google-cloud-monitoring-metrics_scope-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +167 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google/cloud/monitoring/metrics_scope/v1/metrics_scopes/client.rb +627 -0
  7. data/lib/google/cloud/monitoring/metrics_scope/v1/metrics_scopes/credentials.rb +52 -0
  8. data/lib/google/cloud/monitoring/metrics_scope/v1/metrics_scopes/operations.rb +666 -0
  9. data/lib/google/cloud/monitoring/metrics_scope/v1/metrics_scopes/paths.rb +66 -0
  10. data/lib/google/cloud/monitoring/metrics_scope/v1/metrics_scopes.rb +53 -0
  11. data/lib/google/cloud/monitoring/metrics_scope/v1/version.rb +30 -0
  12. data/lib/google/cloud/monitoring/metrics_scope/v1.rb +40 -0
  13. data/lib/google/monitoring/metricsscope/v1/metrics_scope_pb.rb +35 -0
  14. data/lib/google/monitoring/metricsscope/v1/metrics_scopes_pb.rb +62 -0
  15. data/lib/google/monitoring/metricsscope/v1/metrics_scopes_services_pb.rb +57 -0
  16. data/lib/google-cloud-monitoring-metrics_scope-v1.rb +21 -0
  17. data/proto_docs/README.md +4 -0
  18. data/proto_docs/google/api/field_behavior.rb +71 -0
  19. data/proto_docs/google/api/resource.rb +283 -0
  20. data/proto_docs/google/longrunning/operations.rb +164 -0
  21. data/proto_docs/google/monitoring/metricsscope/v1/metrics_scope.rb +72 -0
  22. data/proto_docs/google/monitoring/metricsscope/v1/metrics_scopes.rb +127 -0
  23. data/proto_docs/google/protobuf/any.rb +141 -0
  24. data/proto_docs/google/protobuf/duration.rb +98 -0
  25. data/proto_docs/google/protobuf/empty.rb +36 -0
  26. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  27. data/proto_docs/google/rpc/status.rb +46 -0
  28. metadata +219 -0
@@ -0,0 +1,627 @@
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/monitoring/metricsscope/v1/metrics_scopes_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Monitoring
25
+ module MetricsScope
26
+ module V1
27
+ module MetricsScopes
28
+ ##
29
+ # Client for the MetricsScopes service.
30
+ #
31
+ # Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
32
+ # projects and AWS accounts.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :metrics_scopes_stub
39
+
40
+ ##
41
+ # Configure the MetricsScopes Client class.
42
+ #
43
+ # See {::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all MetricsScopes clients
49
+ # ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "Monitoring", "MetricsScope", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config
70
+ end
71
+ yield @configure if block_given?
72
+ @configure
73
+ end
74
+
75
+ ##
76
+ # Configure the MetricsScopes Client instance.
77
+ #
78
+ # The configuration is set to the derived mode, meaning that values can be changed,
79
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
80
+ # should be made on {Client.configure}.
81
+ #
82
+ # See {::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client::Configuration}
83
+ # for a description of the configuration fields.
84
+ #
85
+ # @yield [config] Configure the Client client.
86
+ # @yieldparam config [Client::Configuration]
87
+ #
88
+ # @return [Client::Configuration]
89
+ #
90
+ def configure
91
+ yield @config if block_given?
92
+ @config
93
+ end
94
+
95
+ ##
96
+ # Create a new MetricsScopes client object.
97
+ #
98
+ # @example
99
+ #
100
+ # # Create a client using the default configuration
101
+ # client = ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new
102
+ #
103
+ # # Create a client using a custom configuration
104
+ # client = ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new do |config|
105
+ # config.timeout = 10.0
106
+ # end
107
+ #
108
+ # @yield [config] Configure the MetricsScopes client.
109
+ # @yieldparam config [Client::Configuration]
110
+ #
111
+ def initialize
112
+ # These require statements are intentionally placed here to initialize
113
+ # the gRPC module only when it's required.
114
+ # See https://github.com/googleapis/toolkit/issues/446
115
+ require "gapic/grpc"
116
+ require "google/monitoring/metricsscope/v1/metrics_scopes_services_pb"
117
+
118
+ # Create the configuration object
119
+ @config = Configuration.new Client.configure
120
+
121
+ # Yield the configuration if needed
122
+ yield @config if block_given?
123
+
124
+ # Create credentials
125
+ credentials = @config.credentials
126
+ # Use self-signed JWT if the endpoint is unchanged from default,
127
+ # but only if the default endpoint does not have a region prefix.
128
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ !@config.endpoint.split(".").first.include?("-")
130
+ credentials ||= Credentials.default scope: @config.scope,
131
+ enable_self_signed_jwt: enable_self_signed_jwt
132
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
+ credentials = Credentials.new credentials, scope: @config.scope
134
+ end
135
+ @quota_project_id = @config.quota_project
136
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
137
+
138
+ @operations_client = Operations.new do |config|
139
+ config.credentials = credentials
140
+ config.endpoint = @config.endpoint
141
+ end
142
+
143
+ @metrics_scopes_stub = ::Gapic::ServiceStub.new(
144
+ ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Stub,
145
+ credentials: credentials,
146
+ endpoint: @config.endpoint,
147
+ channel_args: @config.channel_args,
148
+ interceptors: @config.interceptors
149
+ )
150
+ end
151
+
152
+ ##
153
+ # Get the associated client for long-running operations.
154
+ #
155
+ # @return [::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Operations]
156
+ #
157
+ attr_reader :operations_client
158
+
159
+ # Service calls
160
+
161
+ ##
162
+ # Returns a specific `Metrics Scope`.
163
+ #
164
+ # @overload get_metrics_scope(request, options = nil)
165
+ # Pass arguments to `get_metrics_scope` via a request object, either of type
166
+ # {::Google::Cloud::Monitoring::MetricsScope::V1::GetMetricsScopeRequest} or an equivalent Hash.
167
+ #
168
+ # @param request [::Google::Cloud::Monitoring::MetricsScope::V1::GetMetricsScopeRequest, ::Hash]
169
+ # A request object representing the call parameters. Required. To specify no
170
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
171
+ # @param options [::Gapic::CallOptions, ::Hash]
172
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
173
+ #
174
+ # @overload get_metrics_scope(name: nil)
175
+ # Pass arguments to `get_metrics_scope` via keyword arguments. Note that at
176
+ # least one keyword argument is required. To specify no parameters, or to keep all
177
+ # the default parameter values, pass an empty Hash as a request object (see above).
178
+ #
179
+ # @param name [::String]
180
+ # Required. The resource name of the `Metrics Scope`.
181
+ # Example:
182
+ # `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
183
+ #
184
+ # @yield [response, operation] Access the result along with the RPC operation
185
+ # @yieldparam response [::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScope]
186
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
187
+ #
188
+ # @return [::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScope]
189
+ #
190
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
191
+ #
192
+ def get_metrics_scope request, options = nil
193
+ raise ::ArgumentError, "request must be provided" if request.nil?
194
+
195
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::MetricsScope::V1::GetMetricsScopeRequest
196
+
197
+ # Converts hash and nil to an options object
198
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
199
+
200
+ # Customize the options with defaults
201
+ metadata = @config.rpcs.get_metrics_scope.metadata.to_h
202
+
203
+ # Set x-goog-api-client and x-goog-user-project headers
204
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
205
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
206
+ gapic_version: ::Google::Cloud::Monitoring::MetricsScope::V1::VERSION
207
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
208
+
209
+ header_params = {
210
+ "name" => request.name
211
+ }
212
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
213
+ metadata[:"x-goog-request-params"] ||= request_params_header
214
+
215
+ options.apply_defaults timeout: @config.rpcs.get_metrics_scope.timeout,
216
+ metadata: metadata,
217
+ retry_policy: @config.rpcs.get_metrics_scope.retry_policy
218
+
219
+ options.apply_defaults timeout: @config.timeout,
220
+ metadata: @config.metadata,
221
+ retry_policy: @config.retry_policy
222
+
223
+ @metrics_scopes_stub.call_rpc :get_metrics_scope, request, options: options do |response, operation|
224
+ yield response, operation if block_given?
225
+ return response
226
+ end
227
+ rescue ::GRPC::BadStatus => e
228
+ raise ::Google::Cloud::Error.from_error(e)
229
+ end
230
+
231
+ ##
232
+ # Returns a list of every `Metrics Scope` that a specific `MonitoredProject`
233
+ # has been added to. The metrics scope representing the specified monitored
234
+ # project will always be the first entry in the response.
235
+ #
236
+ # @overload list_metrics_scopes_by_monitored_project(request, options = nil)
237
+ # Pass arguments to `list_metrics_scopes_by_monitored_project` via a request object, either of type
238
+ # {::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectRequest} or an equivalent Hash.
239
+ #
240
+ # @param request [::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectRequest, ::Hash]
241
+ # A request object representing the call parameters. Required. To specify no
242
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
243
+ # @param options [::Gapic::CallOptions, ::Hash]
244
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
245
+ #
246
+ # @overload list_metrics_scopes_by_monitored_project(monitored_resource_container: nil)
247
+ # Pass arguments to `list_metrics_scopes_by_monitored_project` via keyword arguments. Note that at
248
+ # least one keyword argument is required. To specify no parameters, or to keep all
249
+ # the default parameter values, pass an empty Hash as a request object (see above).
250
+ #
251
+ # @param monitored_resource_container [::String]
252
+ # Required. The resource name of the `Monitored Project` being requested.
253
+ # Example:
254
+ # `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
255
+ #
256
+ # @yield [response, operation] Access the result along with the RPC operation
257
+ # @yieldparam response [::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponse]
258
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
259
+ #
260
+ # @return [::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponse]
261
+ #
262
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
263
+ #
264
+ def list_metrics_scopes_by_monitored_project request, options = nil
265
+ raise ::ArgumentError, "request must be provided" if request.nil?
266
+
267
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectRequest
268
+
269
+ # Converts hash and nil to an options object
270
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
271
+
272
+ # Customize the options with defaults
273
+ metadata = @config.rpcs.list_metrics_scopes_by_monitored_project.metadata.to_h
274
+
275
+ # Set x-goog-api-client and x-goog-user-project headers
276
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
277
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
278
+ gapic_version: ::Google::Cloud::Monitoring::MetricsScope::V1::VERSION
279
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
280
+
281
+ options.apply_defaults timeout: @config.rpcs.list_metrics_scopes_by_monitored_project.timeout,
282
+ metadata: metadata,
283
+ retry_policy: @config.rpcs.list_metrics_scopes_by_monitored_project.retry_policy
284
+
285
+ options.apply_defaults timeout: @config.timeout,
286
+ metadata: @config.metadata,
287
+ retry_policy: @config.retry_policy
288
+
289
+ @metrics_scopes_stub.call_rpc :list_metrics_scopes_by_monitored_project, request, options: options do |response, operation|
290
+ yield response, operation if block_given?
291
+ return response
292
+ end
293
+ rescue ::GRPC::BadStatus => e
294
+ raise ::Google::Cloud::Error.from_error(e)
295
+ end
296
+
297
+ ##
298
+ # Adds a `MonitoredProject` with the given project ID
299
+ # to the specified `Metrics Scope`.
300
+ #
301
+ # @overload create_monitored_project(request, options = nil)
302
+ # Pass arguments to `create_monitored_project` via a request object, either of type
303
+ # {::Google::Cloud::Monitoring::MetricsScope::V1::CreateMonitoredProjectRequest} or an equivalent Hash.
304
+ #
305
+ # @param request [::Google::Cloud::Monitoring::MetricsScope::V1::CreateMonitoredProjectRequest, ::Hash]
306
+ # A request object representing the call parameters. Required. To specify no
307
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
308
+ # @param options [::Gapic::CallOptions, ::Hash]
309
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
310
+ #
311
+ # @overload create_monitored_project(parent: nil, monitored_project: nil)
312
+ # Pass arguments to `create_monitored_project` via keyword arguments. Note that at
313
+ # least one keyword argument is required. To specify no parameters, or to keep all
314
+ # the default parameter values, pass an empty Hash as a request object (see above).
315
+ #
316
+ # @param parent [::String]
317
+ # Required. The resource name of the existing `Metrics Scope` that will monitor this
318
+ # project.
319
+ # Example:
320
+ # `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
321
+ # @param monitored_project [::Google::Cloud::Monitoring::MetricsScope::V1::MonitoredProject, ::Hash]
322
+ # Required. The initial `MonitoredProject` configuration.
323
+ # Specify only the `monitored_project.name` field. All other fields are
324
+ # ignored. The `monitored_project.name` must be in the format:
325
+ # `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
326
+ #
327
+ # @yield [response, operation] Access the result along with the RPC operation
328
+ # @yieldparam response [::Gapic::Operation]
329
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
330
+ #
331
+ # @return [::Gapic::Operation]
332
+ #
333
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
334
+ #
335
+ def create_monitored_project request, options = nil
336
+ raise ::ArgumentError, "request must be provided" if request.nil?
337
+
338
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::MetricsScope::V1::CreateMonitoredProjectRequest
339
+
340
+ # Converts hash and nil to an options object
341
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
342
+
343
+ # Customize the options with defaults
344
+ metadata = @config.rpcs.create_monitored_project.metadata.to_h
345
+
346
+ # Set x-goog-api-client and x-goog-user-project headers
347
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
348
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
349
+ gapic_version: ::Google::Cloud::Monitoring::MetricsScope::V1::VERSION
350
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
351
+
352
+ header_params = {
353
+ "parent" => request.parent
354
+ }
355
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
356
+ metadata[:"x-goog-request-params"] ||= request_params_header
357
+
358
+ options.apply_defaults timeout: @config.rpcs.create_monitored_project.timeout,
359
+ metadata: metadata,
360
+ retry_policy: @config.rpcs.create_monitored_project.retry_policy
361
+
362
+ options.apply_defaults timeout: @config.timeout,
363
+ metadata: @config.metadata,
364
+ retry_policy: @config.retry_policy
365
+
366
+ @metrics_scopes_stub.call_rpc :create_monitored_project, request, options: options do |response, operation|
367
+ response = ::Gapic::Operation.new response, @operations_client, options: options
368
+ yield response, operation if block_given?
369
+ return response
370
+ end
371
+ rescue ::GRPC::BadStatus => e
372
+ raise ::Google::Cloud::Error.from_error(e)
373
+ end
374
+
375
+ ##
376
+ # Deletes a `MonitoredProject` from the specified `Metrics Scope`.
377
+ #
378
+ # @overload delete_monitored_project(request, options = nil)
379
+ # Pass arguments to `delete_monitored_project` via a request object, either of type
380
+ # {::Google::Cloud::Monitoring::MetricsScope::V1::DeleteMonitoredProjectRequest} or an equivalent Hash.
381
+ #
382
+ # @param request [::Google::Cloud::Monitoring::MetricsScope::V1::DeleteMonitoredProjectRequest, ::Hash]
383
+ # A request object representing the call parameters. Required. To specify no
384
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
385
+ # @param options [::Gapic::CallOptions, ::Hash]
386
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
387
+ #
388
+ # @overload delete_monitored_project(name: nil)
389
+ # Pass arguments to `delete_monitored_project` via keyword arguments. Note that at
390
+ # least one keyword argument is required. To specify no parameters, or to keep all
391
+ # the default parameter values, pass an empty Hash as a request object (see above).
392
+ #
393
+ # @param name [::String]
394
+ # Required. The resource name of the `MonitoredProject`.
395
+ # Example:
396
+ # `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
397
+ #
398
+ # Authorization requires the following [Google
399
+ # IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
400
+ # and on the `MonitoredProject`: `monitoring.metricsScopes.link`
401
+ #
402
+ # @yield [response, operation] Access the result along with the RPC operation
403
+ # @yieldparam response [::Gapic::Operation]
404
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
405
+ #
406
+ # @return [::Gapic::Operation]
407
+ #
408
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
409
+ #
410
+ def delete_monitored_project request, options = nil
411
+ raise ::ArgumentError, "request must be provided" if request.nil?
412
+
413
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::MetricsScope::V1::DeleteMonitoredProjectRequest
414
+
415
+ # Converts hash and nil to an options object
416
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
417
+
418
+ # Customize the options with defaults
419
+ metadata = @config.rpcs.delete_monitored_project.metadata.to_h
420
+
421
+ # Set x-goog-api-client and x-goog-user-project headers
422
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
423
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
424
+ gapic_version: ::Google::Cloud::Monitoring::MetricsScope::V1::VERSION
425
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
426
+
427
+ header_params = {
428
+ "name" => request.name
429
+ }
430
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
431
+ metadata[:"x-goog-request-params"] ||= request_params_header
432
+
433
+ options.apply_defaults timeout: @config.rpcs.delete_monitored_project.timeout,
434
+ metadata: metadata,
435
+ retry_policy: @config.rpcs.delete_monitored_project.retry_policy
436
+
437
+ options.apply_defaults timeout: @config.timeout,
438
+ metadata: @config.metadata,
439
+ retry_policy: @config.retry_policy
440
+
441
+ @metrics_scopes_stub.call_rpc :delete_monitored_project, request, options: options do |response, operation|
442
+ response = ::Gapic::Operation.new response, @operations_client, options: options
443
+ yield response, operation if block_given?
444
+ return response
445
+ end
446
+ rescue ::GRPC::BadStatus => e
447
+ raise ::Google::Cloud::Error.from_error(e)
448
+ end
449
+
450
+ ##
451
+ # Configuration class for the MetricsScopes API.
452
+ #
453
+ # This class represents the configuration for MetricsScopes,
454
+ # providing control over timeouts, retry behavior, logging, transport
455
+ # parameters, and other low-level controls. Certain parameters can also be
456
+ # applied individually to specific RPCs. See
457
+ # {::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client::Configuration::Rpcs}
458
+ # for a list of RPCs that can be configured independently.
459
+ #
460
+ # Configuration can be applied globally to all clients, or to a single client
461
+ # on construction.
462
+ #
463
+ # @example
464
+ #
465
+ # # Modify the global config, setting the timeout for
466
+ # # get_metrics_scope to 20 seconds,
467
+ # # and all remaining timeouts to 10 seconds.
468
+ # ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.configure do |config|
469
+ # config.timeout = 10.0
470
+ # config.rpcs.get_metrics_scope.timeout = 20.0
471
+ # end
472
+ #
473
+ # # Apply the above configuration only to a new client.
474
+ # client = ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new do |config|
475
+ # config.timeout = 10.0
476
+ # config.rpcs.get_metrics_scope.timeout = 20.0
477
+ # end
478
+ #
479
+ # @!attribute [rw] endpoint
480
+ # The hostname or hostname:port of the service endpoint.
481
+ # Defaults to `"monitoring.googleapis.com"`.
482
+ # @return [::String]
483
+ # @!attribute [rw] credentials
484
+ # Credentials to send with calls. You may provide any of the following types:
485
+ # * (`String`) The path to a service account key file in JSON format
486
+ # * (`Hash`) A service account key as a Hash
487
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
488
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
489
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
490
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
491
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
492
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
493
+ # * (`nil`) indicating no credentials
494
+ # @return [::Object]
495
+ # @!attribute [rw] scope
496
+ # The OAuth scopes
497
+ # @return [::Array<::String>]
498
+ # @!attribute [rw] lib_name
499
+ # The library name as recorded in instrumentation and logging
500
+ # @return [::String]
501
+ # @!attribute [rw] lib_version
502
+ # The library version as recorded in instrumentation and logging
503
+ # @return [::String]
504
+ # @!attribute [rw] channel_args
505
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
506
+ # `GRPC::Core::Channel` object is provided as the credential.
507
+ # @return [::Hash]
508
+ # @!attribute [rw] interceptors
509
+ # An array of interceptors that are run before calls are executed.
510
+ # @return [::Array<::GRPC::ClientInterceptor>]
511
+ # @!attribute [rw] timeout
512
+ # The call timeout in seconds.
513
+ # @return [::Numeric]
514
+ # @!attribute [rw] metadata
515
+ # Additional gRPC headers to be sent with the call.
516
+ # @return [::Hash{::Symbol=>::String}]
517
+ # @!attribute [rw] retry_policy
518
+ # The retry policy. The value is a hash with the following keys:
519
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
520
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
521
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
522
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
523
+ # trigger a retry.
524
+ # @return [::Hash]
525
+ # @!attribute [rw] quota_project
526
+ # A separate project against which to charge quota.
527
+ # @return [::String]
528
+ #
529
+ class Configuration
530
+ extend ::Gapic::Config
531
+
532
+ config_attr :endpoint, "monitoring.googleapis.com", ::String
533
+ config_attr :credentials, nil do |value|
534
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
535
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
536
+ allowed.any? { |klass| klass === value }
537
+ end
538
+ config_attr :scope, nil, ::String, ::Array, nil
539
+ config_attr :lib_name, nil, ::String, nil
540
+ config_attr :lib_version, nil, ::String, nil
541
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
542
+ config_attr :interceptors, nil, ::Array, nil
543
+ config_attr :timeout, nil, ::Numeric, nil
544
+ config_attr :metadata, nil, ::Hash, nil
545
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
546
+ config_attr :quota_project, nil, ::String, nil
547
+
548
+ # @private
549
+ def initialize parent_config = nil
550
+ @parent_config = parent_config unless parent_config.nil?
551
+
552
+ yield self if block_given?
553
+ end
554
+
555
+ ##
556
+ # Configurations for individual RPCs
557
+ # @return [Rpcs]
558
+ #
559
+ def rpcs
560
+ @rpcs ||= begin
561
+ parent_rpcs = nil
562
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
563
+ Rpcs.new parent_rpcs
564
+ end
565
+ end
566
+
567
+ ##
568
+ # Configuration RPC class for the MetricsScopes API.
569
+ #
570
+ # Includes fields providing the configuration for each RPC in this service.
571
+ # Each configuration object is of type `Gapic::Config::Method` and includes
572
+ # the following configuration fields:
573
+ #
574
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
575
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
576
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
577
+ # include the following keys:
578
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
579
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
580
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
581
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
582
+ # trigger a retry.
583
+ #
584
+ class Rpcs
585
+ ##
586
+ # RPC-specific configuration for `get_metrics_scope`
587
+ # @return [::Gapic::Config::Method]
588
+ #
589
+ attr_reader :get_metrics_scope
590
+ ##
591
+ # RPC-specific configuration for `list_metrics_scopes_by_monitored_project`
592
+ # @return [::Gapic::Config::Method]
593
+ #
594
+ attr_reader :list_metrics_scopes_by_monitored_project
595
+ ##
596
+ # RPC-specific configuration for `create_monitored_project`
597
+ # @return [::Gapic::Config::Method]
598
+ #
599
+ attr_reader :create_monitored_project
600
+ ##
601
+ # RPC-specific configuration for `delete_monitored_project`
602
+ # @return [::Gapic::Config::Method]
603
+ #
604
+ attr_reader :delete_monitored_project
605
+
606
+ # @private
607
+ def initialize parent_rpcs = nil
608
+ get_metrics_scope_config = parent_rpcs.get_metrics_scope if parent_rpcs.respond_to? :get_metrics_scope
609
+ @get_metrics_scope = ::Gapic::Config::Method.new get_metrics_scope_config
610
+ list_metrics_scopes_by_monitored_project_config = parent_rpcs.list_metrics_scopes_by_monitored_project if parent_rpcs.respond_to? :list_metrics_scopes_by_monitored_project
611
+ @list_metrics_scopes_by_monitored_project = ::Gapic::Config::Method.new list_metrics_scopes_by_monitored_project_config
612
+ create_monitored_project_config = parent_rpcs.create_monitored_project if parent_rpcs.respond_to? :create_monitored_project
613
+ @create_monitored_project = ::Gapic::Config::Method.new create_monitored_project_config
614
+ delete_monitored_project_config = parent_rpcs.delete_monitored_project if parent_rpcs.respond_to? :delete_monitored_project
615
+ @delete_monitored_project = ::Gapic::Config::Method.new delete_monitored_project_config
616
+
617
+ yield self if block_given?
618
+ end
619
+ end
620
+ end
621
+ end
622
+ end
623
+ end
624
+ end
625
+ end
626
+ end
627
+ end
@@ -0,0 +1,52 @@
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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Monitoring
24
+ module MetricsScope
25
+ module V1
26
+ module MetricsScopes
27
+ # Credentials for the MetricsScopes API.
28
+ class Credentials < ::Google::Auth::Credentials
29
+ self.scope = [
30
+ "https://www.googleapis.com/auth/cloud-platform",
31
+ "https://www.googleapis.com/auth/monitoring",
32
+ "https://www.googleapis.com/auth/monitoring.read",
33
+ "https://www.googleapis.com/auth/monitoring.write"
34
+ ]
35
+ self.env_vars = [
36
+ "GOOGLE_CLOUD_CREDENTIALS",
37
+ "GOOGLE_CLOUD_KEYFILE",
38
+ "GCLOUD_KEYFILE",
39
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
40
+ "GOOGLE_CLOUD_KEYFILE_JSON",
41
+ "GCLOUD_KEYFILE_JSON"
42
+ ]
43
+ self.paths = [
44
+ "~/.config/google_cloud/application_default_credentials.json"
45
+ ]
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end