google-cloud-profiler-v2 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/profiler/v2"
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/profiler/v2/profiler_service"
20
+ require "google/cloud/profiler/v2/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Profiler
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/profiler/v2"
29
+ # client = ::Google::Cloud::Profiler::V2::ProfilerService::Client.new
30
+ #
31
+ module V2
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ helper_path = ::File.join __dir__, "v2", "_helpers.rb"
38
+ require "google/cloud/profiler/v2/_helpers" if ::File.file? helper_path
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/profiler/v2/version"
24
+
25
+ require "google/cloud/profiler/v2/profiler_service/credentials"
26
+ require "google/cloud/profiler/v2/profiler_service/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module Profiler
31
+ module V2
32
+ ##
33
+ # Manage the collection of continuous profiling data provided by profiling
34
+ # agents running in the cloud or by an offline provider of profiling data.
35
+ #
36
+ # General guidelines:
37
+ # * Profiles for a single deployment must be created in ascending time order.
38
+ # * Profiles can be created in either online or offline mode, see below.
39
+ #
40
+ # To load this service and instantiate a client:
41
+ #
42
+ # require "google/cloud/profiler/v2/profiler_service"
43
+ # client = ::Google::Cloud::Profiler::V2::ProfilerService::Client.new
44
+ #
45
+ module ProfilerService
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "profiler_service", "helpers.rb"
53
+ require "google/cloud/profiler/v2/profiler_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,566 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/devtools/cloudprofiler/v2/profiler_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Profiler
25
+ module V2
26
+ module ProfilerService
27
+ ##
28
+ # Client for the ProfilerService service.
29
+ #
30
+ # Manage the collection of continuous profiling data provided by profiling
31
+ # agents running in the cloud or by an offline provider of profiling data.
32
+ #
33
+ # General guidelines:
34
+ # * Profiles for a single deployment must be created in ascending time order.
35
+ # * Profiles can be created in either online or offline mode, see below.
36
+ #
37
+ class Client
38
+ # @private
39
+ attr_reader :profiler_service_stub
40
+
41
+ ##
42
+ # Configure the ProfilerService Client class.
43
+ #
44
+ # See {::Google::Cloud::Profiler::V2::ProfilerService::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # ## Example
48
+ #
49
+ # To modify the configuration for all ProfilerService clients:
50
+ #
51
+ # ::Google::Cloud::Profiler::V2::ProfilerService::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Profiler", "V2"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const&.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 30.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 1.0,
74
+ max_delay: 10.0,
75
+ multiplier: 1.3,
76
+ retry_codes: [14]
77
+ }
78
+
79
+ default_config.rpcs.create_profile.timeout = 3600.0
80
+
81
+ default_config.rpcs.create_offline_profile.timeout = 30.0
82
+
83
+ default_config.rpcs.update_profile.timeout = 30.0
84
+
85
+ default_config
86
+ end
87
+ yield @configure if block_given?
88
+ @configure
89
+ end
90
+
91
+ ##
92
+ # Configure the ProfilerService Client instance.
93
+ #
94
+ # The configuration is set to the derived mode, meaning that values can be changed,
95
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
96
+ # should be made on {Client.configure}.
97
+ #
98
+ # See {::Google::Cloud::Profiler::V2::ProfilerService::Client::Configuration}
99
+ # for a description of the configuration fields.
100
+ #
101
+ # @yield [config] Configure the Client client.
102
+ # @yieldparam config [Client::Configuration]
103
+ #
104
+ # @return [Client::Configuration]
105
+ #
106
+ def configure
107
+ yield @config if block_given?
108
+ @config
109
+ end
110
+
111
+ ##
112
+ # Create a new ProfilerService client object.
113
+ #
114
+ # ## Examples
115
+ #
116
+ # To create a new ProfilerService client with the default
117
+ # configuration:
118
+ #
119
+ # client = ::Google::Cloud::Profiler::V2::ProfilerService::Client.new
120
+ #
121
+ # To create a new ProfilerService client with a custom
122
+ # configuration:
123
+ #
124
+ # client = ::Google::Cloud::Profiler::V2::ProfilerService::Client.new do |config|
125
+ # config.timeout = 10.0
126
+ # end
127
+ #
128
+ # @yield [config] Configure the ProfilerService client.
129
+ # @yieldparam config [Client::Configuration]
130
+ #
131
+ def initialize
132
+ # These require statements are intentionally placed here to initialize
133
+ # the gRPC module only when it's required.
134
+ # See https://github.com/googleapis/toolkit/issues/446
135
+ require "gapic/grpc"
136
+ require "google/devtools/cloudprofiler/v2/profiler_services_pb"
137
+
138
+ # Create the configuration object
139
+ @config = Configuration.new Client.configure
140
+
141
+ # Yield the configuration if needed
142
+ yield @config if block_given?
143
+
144
+ # Create credentials
145
+ credentials = @config.credentials
146
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
147
+ # but only if the default endpoint does not have a region prefix.
148
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
149
+ @config.endpoint == Client.configure.endpoint &&
150
+ !@config.endpoint.split(".").first.include?("-")
151
+ credentials ||= Credentials.default scope: @config.scope,
152
+ enable_self_signed_jwt: enable_self_signed_jwt
153
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
154
+ credentials = Credentials.new credentials, scope: @config.scope
155
+ end
156
+ @quota_project_id = @config.quota_project
157
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
158
+
159
+ @profiler_service_stub = ::Gapic::ServiceStub.new(
160
+ ::Google::Cloud::Profiler::V2::ProfilerService::Stub,
161
+ credentials: credentials,
162
+ endpoint: @config.endpoint,
163
+ channel_args: @config.channel_args,
164
+ interceptors: @config.interceptors
165
+ )
166
+ end
167
+
168
+ # Service calls
169
+
170
+ ##
171
+ # CreateProfile creates a new profile resource in the online mode.
172
+ #
173
+ # The server ensures that the new profiles are created at a constant rate per
174
+ # deployment, so the creation request may hang for some time until the next
175
+ # profile session is available.
176
+ #
177
+ # The request may fail with ABORTED error if the creation is not available
178
+ # within ~1m, the response will indicate the duration of the backoff the
179
+ # client should take before attempting creating a profile again. The backoff
180
+ # duration is returned in google.rpc.RetryInfo extension on the response
181
+ # status. To a gRPC client, the extension will be return as a
182
+ # binary-serialized proto in the trailing metadata item named
183
+ # "google.rpc.retryinfo-bin".
184
+ #
185
+ # @overload create_profile(request, options = nil)
186
+ # Pass arguments to `create_profile` via a request object, either of type
187
+ # {::Google::Cloud::Profiler::V2::CreateProfileRequest} or an equivalent Hash.
188
+ #
189
+ # @param request [::Google::Cloud::Profiler::V2::CreateProfileRequest, ::Hash]
190
+ # A request object representing the call parameters. Required. To specify no
191
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
192
+ # @param options [::Gapic::CallOptions, ::Hash]
193
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
194
+ #
195
+ # @overload create_profile(parent: nil, deployment: nil, profile_type: nil)
196
+ # Pass arguments to `create_profile` via keyword arguments. Note that at
197
+ # least one keyword argument is required. To specify no parameters, or to keep all
198
+ # the default parameter values, pass an empty Hash as a request object (see above).
199
+ #
200
+ # @param parent [::String]
201
+ # Parent project to create the profile in.
202
+ # @param deployment [::Google::Cloud::Profiler::V2::Deployment, ::Hash]
203
+ # Deployment details.
204
+ # @param profile_type [::Array<::Google::Cloud::Profiler::V2::ProfileType>]
205
+ # One or more profile types that the agent is capable of providing.
206
+ #
207
+ # @yield [response, operation] Access the result along with the RPC operation
208
+ # @yieldparam response [::Google::Cloud::Profiler::V2::Profile]
209
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
210
+ #
211
+ # @return [::Google::Cloud::Profiler::V2::Profile]
212
+ #
213
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
214
+ #
215
+ def create_profile request, options = nil
216
+ raise ::ArgumentError, "request must be provided" if request.nil?
217
+
218
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Profiler::V2::CreateProfileRequest
219
+
220
+ # Converts hash and nil to an options object
221
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
222
+
223
+ # Customize the options with defaults
224
+ metadata = @config.rpcs.create_profile.metadata.to_h
225
+
226
+ # Set x-goog-api-client and x-goog-user-project headers
227
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
228
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
229
+ gapic_version: ::Google::Cloud::Profiler::V2::VERSION
230
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
231
+
232
+ header_params = {
233
+ "parent" => request.parent
234
+ }
235
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
236
+ metadata[:"x-goog-request-params"] ||= request_params_header
237
+
238
+ options.apply_defaults timeout: @config.rpcs.create_profile.timeout,
239
+ metadata: metadata,
240
+ retry_policy: @config.rpcs.create_profile.retry_policy
241
+ options.apply_defaults metadata: @config.metadata,
242
+ retry_policy: @config.retry_policy
243
+
244
+ @profiler_service_stub.call_rpc :create_profile, request, options: options do |response, operation|
245
+ yield response, operation if block_given?
246
+ return response
247
+ end
248
+ rescue ::GRPC::BadStatus => e
249
+ raise ::Google::Cloud::Error.from_error(e)
250
+ end
251
+
252
+ ##
253
+ # CreateOfflineProfile creates a new profile resource in the offline mode.
254
+ # The client provides the profile to create along with the profile bytes, the
255
+ # server records it.
256
+ #
257
+ # @overload create_offline_profile(request, options = nil)
258
+ # Pass arguments to `create_offline_profile` via a request object, either of type
259
+ # {::Google::Cloud::Profiler::V2::CreateOfflineProfileRequest} or an equivalent Hash.
260
+ #
261
+ # @param request [::Google::Cloud::Profiler::V2::CreateOfflineProfileRequest, ::Hash]
262
+ # A request object representing the call parameters. Required. To specify no
263
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
264
+ # @param options [::Gapic::CallOptions, ::Hash]
265
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
266
+ #
267
+ # @overload create_offline_profile(parent: nil, profile: nil)
268
+ # Pass arguments to `create_offline_profile` via keyword arguments. Note that at
269
+ # least one keyword argument is required. To specify no parameters, or to keep all
270
+ # the default parameter values, pass an empty Hash as a request object (see above).
271
+ #
272
+ # @param parent [::String]
273
+ # Parent project to create the profile in.
274
+ # @param profile [::Google::Cloud::Profiler::V2::Profile, ::Hash]
275
+ # Contents of the profile to create.
276
+ #
277
+ # @yield [response, operation] Access the result along with the RPC operation
278
+ # @yieldparam response [::Google::Cloud::Profiler::V2::Profile]
279
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
280
+ #
281
+ # @return [::Google::Cloud::Profiler::V2::Profile]
282
+ #
283
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
284
+ #
285
+ def create_offline_profile request, options = nil
286
+ raise ::ArgumentError, "request must be provided" if request.nil?
287
+
288
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Profiler::V2::CreateOfflineProfileRequest
289
+
290
+ # Converts hash and nil to an options object
291
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
292
+
293
+ # Customize the options with defaults
294
+ metadata = @config.rpcs.create_offline_profile.metadata.to_h
295
+
296
+ # Set x-goog-api-client and x-goog-user-project headers
297
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
298
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
299
+ gapic_version: ::Google::Cloud::Profiler::V2::VERSION
300
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ header_params = {
303
+ "parent" => request.parent
304
+ }
305
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
306
+ metadata[:"x-goog-request-params"] ||= request_params_header
307
+
308
+ options.apply_defaults timeout: @config.rpcs.create_offline_profile.timeout,
309
+ metadata: metadata,
310
+ retry_policy: @config.rpcs.create_offline_profile.retry_policy
311
+ options.apply_defaults metadata: @config.metadata,
312
+ retry_policy: @config.retry_policy
313
+
314
+ @profiler_service_stub.call_rpc :create_offline_profile, request, options: options do |response, operation|
315
+ yield response, operation if block_given?
316
+ return response
317
+ end
318
+ rescue ::GRPC::BadStatus => e
319
+ raise ::Google::Cloud::Error.from_error(e)
320
+ end
321
+
322
+ ##
323
+ # UpdateProfile updates the profile bytes and labels on the profile resource
324
+ # created in the online mode. Updating the bytes for profiles created in the
325
+ # offline mode is currently not supported: the profile content must be
326
+ # provided at the time of the profile creation.
327
+ #
328
+ # @overload update_profile(request, options = nil)
329
+ # Pass arguments to `update_profile` via a request object, either of type
330
+ # {::Google::Cloud::Profiler::V2::UpdateProfileRequest} or an equivalent Hash.
331
+ #
332
+ # @param request [::Google::Cloud::Profiler::V2::UpdateProfileRequest, ::Hash]
333
+ # A request object representing the call parameters. Required. To specify no
334
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
335
+ # @param options [::Gapic::CallOptions, ::Hash]
336
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
337
+ #
338
+ # @overload update_profile(profile: nil, update_mask: nil)
339
+ # Pass arguments to `update_profile` via keyword arguments. Note that at
340
+ # least one keyword argument is required. To specify no parameters, or to keep all
341
+ # the default parameter values, pass an empty Hash as a request object (see above).
342
+ #
343
+ # @param profile [::Google::Cloud::Profiler::V2::Profile, ::Hash]
344
+ # Profile to update
345
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
346
+ # Field mask used to specify the fields to be overwritten. Currently only
347
+ # profile_bytes and labels fields are supported by UpdateProfile, so only
348
+ # those fields can be specified in the mask. When no mask is provided, all
349
+ # fields are overwritten.
350
+ #
351
+ # @yield [response, operation] Access the result along with the RPC operation
352
+ # @yieldparam response [::Google::Cloud::Profiler::V2::Profile]
353
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
354
+ #
355
+ # @return [::Google::Cloud::Profiler::V2::Profile]
356
+ #
357
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
358
+ #
359
+ def update_profile request, options = nil
360
+ raise ::ArgumentError, "request must be provided" if request.nil?
361
+
362
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Profiler::V2::UpdateProfileRequest
363
+
364
+ # Converts hash and nil to an options object
365
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
366
+
367
+ # Customize the options with defaults
368
+ metadata = @config.rpcs.update_profile.metadata.to_h
369
+
370
+ # Set x-goog-api-client and x-goog-user-project headers
371
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
372
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
373
+ gapic_version: ::Google::Cloud::Profiler::V2::VERSION
374
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
375
+
376
+ header_params = {
377
+ "profile.name" => request.profile.name
378
+ }
379
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
380
+ metadata[:"x-goog-request-params"] ||= request_params_header
381
+
382
+ options.apply_defaults timeout: @config.rpcs.update_profile.timeout,
383
+ metadata: metadata,
384
+ retry_policy: @config.rpcs.update_profile.retry_policy
385
+ options.apply_defaults metadata: @config.metadata,
386
+ retry_policy: @config.retry_policy
387
+
388
+ @profiler_service_stub.call_rpc :update_profile, request, options: options do |response, operation|
389
+ yield response, operation if block_given?
390
+ return response
391
+ end
392
+ rescue ::GRPC::BadStatus => e
393
+ raise ::Google::Cloud::Error.from_error(e)
394
+ end
395
+
396
+ ##
397
+ # Configuration class for the ProfilerService API.
398
+ #
399
+ # This class represents the configuration for ProfilerService,
400
+ # providing control over timeouts, retry behavior, logging, transport
401
+ # parameters, and other low-level controls. Certain parameters can also be
402
+ # applied individually to specific RPCs. See
403
+ # {::Google::Cloud::Profiler::V2::ProfilerService::Client::Configuration::Rpcs}
404
+ # for a list of RPCs that can be configured independently.
405
+ #
406
+ # Configuration can be applied globally to all clients, or to a single client
407
+ # on construction.
408
+ #
409
+ # # Examples
410
+ #
411
+ # To modify the global config, setting the timeout for create_profile
412
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
413
+ #
414
+ # ::Google::Cloud::Profiler::V2::ProfilerService::Client.configure do |config|
415
+ # config.timeout = 10.0
416
+ # config.rpcs.create_profile.timeout = 20.0
417
+ # end
418
+ #
419
+ # To apply the above configuration only to a new client:
420
+ #
421
+ # client = ::Google::Cloud::Profiler::V2::ProfilerService::Client.new do |config|
422
+ # config.timeout = 10.0
423
+ # config.rpcs.create_profile.timeout = 20.0
424
+ # end
425
+ #
426
+ # @!attribute [rw] endpoint
427
+ # The hostname or hostname:port of the service endpoint.
428
+ # Defaults to `"cloudprofiler.googleapis.com"`.
429
+ # @return [::String]
430
+ # @!attribute [rw] credentials
431
+ # Credentials to send with calls. You may provide any of the following types:
432
+ # * (`String`) The path to a service account key file in JSON format
433
+ # * (`Hash`) A service account key as a Hash
434
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
435
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
436
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
437
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
438
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
439
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
440
+ # * (`nil`) indicating no credentials
441
+ # @return [::Object]
442
+ # @!attribute [rw] scope
443
+ # The OAuth scopes
444
+ # @return [::Array<::String>]
445
+ # @!attribute [rw] lib_name
446
+ # The library name as recorded in instrumentation and logging
447
+ # @return [::String]
448
+ # @!attribute [rw] lib_version
449
+ # The library version as recorded in instrumentation and logging
450
+ # @return [::String]
451
+ # @!attribute [rw] channel_args
452
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
453
+ # `GRPC::Core::Channel` object is provided as the credential.
454
+ # @return [::Hash]
455
+ # @!attribute [rw] interceptors
456
+ # An array of interceptors that are run before calls are executed.
457
+ # @return [::Array<::GRPC::ClientInterceptor>]
458
+ # @!attribute [rw] timeout
459
+ # The call timeout in seconds.
460
+ # @return [::Numeric]
461
+ # @!attribute [rw] metadata
462
+ # Additional gRPC headers to be sent with the call.
463
+ # @return [::Hash{::Symbol=>::String}]
464
+ # @!attribute [rw] retry_policy
465
+ # The retry policy. The value is a hash with the following keys:
466
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
467
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
468
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
469
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
470
+ # trigger a retry.
471
+ # @return [::Hash]
472
+ # @!attribute [rw] quota_project
473
+ # A separate project against which to charge quota.
474
+ # @return [::String]
475
+ #
476
+ class Configuration
477
+ extend ::Gapic::Config
478
+
479
+ config_attr :endpoint, "cloudprofiler.googleapis.com", ::String
480
+ config_attr :credentials, nil do |value|
481
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
482
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
483
+ allowed.any? { |klass| klass === value }
484
+ end
485
+ config_attr :scope, nil, ::String, ::Array, nil
486
+ config_attr :lib_name, nil, ::String, nil
487
+ config_attr :lib_version, nil, ::String, nil
488
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
489
+ config_attr :interceptors, nil, ::Array, nil
490
+ config_attr :timeout, nil, ::Numeric, nil
491
+ config_attr :metadata, nil, ::Hash, nil
492
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
493
+ config_attr :quota_project, nil, ::String, nil
494
+
495
+ # @private
496
+ def initialize parent_config = nil
497
+ @parent_config = parent_config unless parent_config.nil?
498
+
499
+ yield self if block_given?
500
+ end
501
+
502
+ ##
503
+ # Configurations for individual RPCs
504
+ # @return [Rpcs]
505
+ #
506
+ def rpcs
507
+ @rpcs ||= begin
508
+ parent_rpcs = nil
509
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
510
+ Rpcs.new parent_rpcs
511
+ end
512
+ end
513
+
514
+ ##
515
+ # Configuration RPC class for the ProfilerService API.
516
+ #
517
+ # Includes fields providing the configuration for each RPC in this service.
518
+ # Each configuration object is of type `Gapic::Config::Method` and includes
519
+ # the following configuration fields:
520
+ #
521
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
522
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
523
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
524
+ # include the following keys:
525
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
526
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
527
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
528
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
529
+ # trigger a retry.
530
+ #
531
+ class Rpcs
532
+ ##
533
+ # RPC-specific configuration for `create_profile`
534
+ # @return [::Gapic::Config::Method]
535
+ #
536
+ attr_reader :create_profile
537
+ ##
538
+ # RPC-specific configuration for `create_offline_profile`
539
+ # @return [::Gapic::Config::Method]
540
+ #
541
+ attr_reader :create_offline_profile
542
+ ##
543
+ # RPC-specific configuration for `update_profile`
544
+ # @return [::Gapic::Config::Method]
545
+ #
546
+ attr_reader :update_profile
547
+
548
+ # @private
549
+ def initialize parent_rpcs = nil
550
+ create_profile_config = parent_rpcs&.create_profile if parent_rpcs&.respond_to? :create_profile
551
+ @create_profile = ::Gapic::Config::Method.new create_profile_config
552
+ create_offline_profile_config = parent_rpcs&.create_offline_profile if parent_rpcs&.respond_to? :create_offline_profile
553
+ @create_offline_profile = ::Gapic::Config::Method.new create_offline_profile_config
554
+ update_profile_config = parent_rpcs&.update_profile if parent_rpcs&.respond_to? :update_profile
555
+ @update_profile = ::Gapic::Config::Method.new update_profile_config
556
+
557
+ yield self if block_given?
558
+ end
559
+ end
560
+ end
561
+ end
562
+ end
563
+ end
564
+ end
565
+ end
566
+ end