google-cloud-maintenance-api-v1beta 0.a → 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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/maintenance/api/v1beta/bindings_override.rb +104 -0
  6. data/lib/google/cloud/maintenance/api/v1beta/maintenance/client.rb +707 -0
  7. data/lib/google/cloud/maintenance/api/v1beta/maintenance/credentials.rb +49 -0
  8. data/lib/google/cloud/maintenance/api/v1beta/maintenance/paths.rb +71 -0
  9. data/lib/google/cloud/maintenance/api/v1beta/maintenance/rest/client.rb +668 -0
  10. data/lib/google/cloud/maintenance/api/v1beta/maintenance/rest/service_stub.rb +266 -0
  11. data/lib/google/cloud/maintenance/api/v1beta/maintenance/rest.rb +55 -0
  12. data/lib/google/cloud/maintenance/api/v1beta/maintenance.rb +57 -0
  13. data/lib/google/cloud/maintenance/api/v1beta/maintenance_service_pb.rb +66 -0
  14. data/lib/google/cloud/maintenance/api/v1beta/maintenance_service_services_pb.rb +51 -0
  15. data/lib/google/cloud/maintenance/api/v1beta/rest.rb +40 -0
  16. data/lib/google/cloud/maintenance/api/v1beta/version.rb +7 -2
  17. data/lib/google/cloud/maintenance/api/v1beta.rb +47 -0
  18. data/lib/google-cloud-maintenance-api-v1beta.rb +21 -0
  19. data/proto_docs/README.md +4 -0
  20. data/proto_docs/google/api/client.rb +473 -0
  21. data/proto_docs/google/api/field_behavior.rb +85 -0
  22. data/proto_docs/google/api/field_info.rb +88 -0
  23. data/proto_docs/google/api/launch_stage.rb +71 -0
  24. data/proto_docs/google/api/resource.rb +227 -0
  25. data/proto_docs/google/cloud/maintenance/api/v1beta/maintenance_service.rb +423 -0
  26. data/proto_docs/google/protobuf/any.rb +145 -0
  27. data/proto_docs/google/protobuf/duration.rb +98 -0
  28. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  29. metadata +81 -9
@@ -0,0 +1,668 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/cloud/maintenance/api/v1beta/maintenance_service_pb"
21
+ require "google/cloud/maintenance/api/v1beta/maintenance/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Maintenance
27
+ module Api
28
+ module V1beta
29
+ module Maintenance
30
+ module Rest
31
+ ##
32
+ # REST client for the Maintenance service.
33
+ #
34
+ # Unified Maintenance service
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "maintenance.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :maintenance_stub
47
+
48
+ ##
49
+ # Configure the Maintenance Client class.
50
+ #
51
+ # See {::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all Maintenance clients
57
+ # ::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "Maintenance", "Api", "V1beta"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the Maintenance Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # The effective universe domain
105
+ #
106
+ # @return [String]
107
+ #
108
+ def universe_domain
109
+ @maintenance_stub.universe_domain
110
+ end
111
+
112
+ ##
113
+ # Create a new Maintenance REST client object.
114
+ #
115
+ # @example
116
+ #
117
+ # # Create a client using the default configuration
118
+ # client = ::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client.new
119
+ #
120
+ # # Create a client using a custom configuration
121
+ # client = ::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
124
+ #
125
+ # @yield [config] Configure the Maintenance client.
126
+ # @yieldparam config [Client::Configuration]
127
+ #
128
+ def initialize
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
+ # but only if the default endpoint does not have a region prefix.
139
+ enable_self_signed_jwt = @config.endpoint.nil? ||
140
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
+ !@config.endpoint.split(".").first.include?("-"))
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @maintenance_stub = ::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::ServiceStub.new(
152
+ endpoint: @config.endpoint,
153
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
154
+ universe_domain: @config.universe_domain,
155
+ credentials: credentials,
156
+ logger: @config.logger
157
+ )
158
+
159
+ @maintenance_stub.logger(stub: true)&.info do |entry|
160
+ entry.set_system_name
161
+ entry.set_service
162
+ entry.message = "Created client for #{entry.service}"
163
+ entry.set_credentials_fields credentials
164
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
165
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
166
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
167
+ end
168
+
169
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
170
+ config.credentials = credentials
171
+ config.quota_project = @quota_project_id
172
+ config.endpoint = @maintenance_stub.endpoint
173
+ config.universe_domain = @maintenance_stub.universe_domain
174
+ config.bindings_override = @config.bindings_override
175
+ config.logger = @maintenance_stub.logger if config.respond_to? :logger=
176
+ end
177
+ end
178
+
179
+ ##
180
+ # Get the associated client for mix-in of the Locations.
181
+ #
182
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
183
+ #
184
+ attr_reader :location_client
185
+
186
+ ##
187
+ # The logger used for request/response debug logging.
188
+ #
189
+ # @return [Logger]
190
+ #
191
+ def logger
192
+ @maintenance_stub.logger
193
+ end
194
+
195
+ # Service calls
196
+
197
+ ##
198
+ # Retrieves the statistics of a specific maintenance.
199
+ #
200
+ # @overload summarize_maintenances(request, options = nil)
201
+ # Pass arguments to `summarize_maintenances` via a request object, either of type
202
+ # {::Google::Cloud::Maintenance::Api::V1beta::SummarizeMaintenancesRequest} or an equivalent Hash.
203
+ #
204
+ # @param request [::Google::Cloud::Maintenance::Api::V1beta::SummarizeMaintenancesRequest, ::Hash]
205
+ # A request object representing the call parameters. Required. To specify no
206
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
207
+ # @param options [::Gapic::CallOptions, ::Hash]
208
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
209
+ #
210
+ # @overload summarize_maintenances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
211
+ # Pass arguments to `summarize_maintenances` via keyword arguments. Note that at
212
+ # least one keyword argument is required. To specify no parameters, or to keep all
213
+ # the default parameter values, pass an empty Hash as a request object (see above).
214
+ #
215
+ # @param parent [::String]
216
+ # Required. The parent of the resource maintenance.
217
+ # eg. `projects/123/locations/*`
218
+ # @param page_size [::Integer]
219
+ # The maximum number of resource maintenances to send per page. The default
220
+ # page size is 20 and the maximum is 1000.
221
+ # @param page_token [::String]
222
+ # The page token: If the next_page_token from a previous response
223
+ # is provided, this request will send the subsequent page.
224
+ # @param filter [::String]
225
+ # Filter the list as specified in https://google.aip.dev/160.
226
+ # Supported fields include:
227
+ # - state
228
+ # - resource.location
229
+ # - resource.resourceName
230
+ # - resource.type
231
+ # - maintenance.maintenanceName
232
+ # - maintenanceStartTime
233
+ # - maintenanceCompleteTime
234
+ # Examples:
235
+ # - state="SCHEDULED"
236
+ # - resource.location="us-central1-c"
237
+ # - resource.resourceName=~"*/instance-20241212-211259"
238
+ # - maintenanceStartTime>"2000-10-11T20:44:51Z"
239
+ # - state="SCHEDULED" OR resource.type="compute.googleapis.com/Instance"
240
+ # - maintenance.maitenanceName="eb3b709c-9ca1-5472-9fb6-800a3849eda1" AND
241
+ # maintenanceCompleteTime>"2000-10-11T20:44:51Z"
242
+ # @param order_by [::String]
243
+ # Order results as specified in https://google.aip.dev/132.
244
+ # @yield [result, operation] Access the result along with the TransportOperation object
245
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Maintenance::Api::V1beta::MaintenanceSummary>]
246
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
247
+ #
248
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Maintenance::Api::V1beta::MaintenanceSummary>]
249
+ #
250
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
251
+ #
252
+ # @example Basic example
253
+ # require "google/cloud/maintenance/api/v1beta"
254
+ #
255
+ # # Create a client object. The client can be reused for multiple calls.
256
+ # client = Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client.new
257
+ #
258
+ # # Create a request. To set request fields, pass in keyword arguments.
259
+ # request = Google::Cloud::Maintenance::Api::V1beta::SummarizeMaintenancesRequest.new
260
+ #
261
+ # # Call the summarize_maintenances method.
262
+ # result = client.summarize_maintenances request
263
+ #
264
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
265
+ # # over elements, and API calls will be issued to fetch pages as needed.
266
+ # result.each do |item|
267
+ # # Each element is of type ::Google::Cloud::Maintenance::Api::V1beta::MaintenanceSummary.
268
+ # p item
269
+ # end
270
+ #
271
+ def summarize_maintenances request, options = nil
272
+ raise ::ArgumentError, "request must be provided" if request.nil?
273
+
274
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Maintenance::Api::V1beta::SummarizeMaintenancesRequest
275
+
276
+ # Converts hash and nil to an options object
277
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
278
+
279
+ # Customize the options with defaults
280
+ call_metadata = @config.rpcs.summarize_maintenances.metadata.to_h
281
+
282
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
283
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
284
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
285
+ gapic_version: ::Google::Cloud::Maintenance::Api::V1beta::VERSION,
286
+ transports_version_send: [:rest]
287
+
288
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
289
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
290
+
291
+ options.apply_defaults timeout: @config.rpcs.summarize_maintenances.timeout,
292
+ metadata: call_metadata,
293
+ retry_policy: @config.rpcs.summarize_maintenances.retry_policy
294
+
295
+ options.apply_defaults timeout: @config.timeout,
296
+ metadata: @config.metadata,
297
+ retry_policy: @config.retry_policy
298
+
299
+ @maintenance_stub.summarize_maintenances request, options do |result, operation|
300
+ result = ::Gapic::Rest::PagedEnumerable.new @maintenance_stub, :summarize_maintenances, "maintenances", request, result, options
301
+ yield result, operation if block_given?
302
+ throw :response, result
303
+ end
304
+ rescue ::Gapic::Rest::Error => e
305
+ raise ::Google::Cloud::Error.from_error(e)
306
+ end
307
+
308
+ ##
309
+ # Retrieve a collection of resource maintenances.
310
+ #
311
+ # @overload list_resource_maintenances(request, options = nil)
312
+ # Pass arguments to `list_resource_maintenances` via a request object, either of type
313
+ # {::Google::Cloud::Maintenance::Api::V1beta::ListResourceMaintenancesRequest} or an equivalent Hash.
314
+ #
315
+ # @param request [::Google::Cloud::Maintenance::Api::V1beta::ListResourceMaintenancesRequest, ::Hash]
316
+ # A request object representing the call parameters. Required. To specify no
317
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
318
+ # @param options [::Gapic::CallOptions, ::Hash]
319
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
320
+ #
321
+ # @overload list_resource_maintenances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
322
+ # Pass arguments to `list_resource_maintenances` via keyword arguments. Note that at
323
+ # least one keyword argument is required. To specify no parameters, or to keep all
324
+ # the default parameter values, pass an empty Hash as a request object (see above).
325
+ #
326
+ # @param parent [::String]
327
+ # Required. The parent of the resource maintenance.
328
+ # @param page_size [::Integer]
329
+ # The maximum number of resource maintenances to send per page.
330
+ # @param page_token [::String]
331
+ # The page token: If the next_page_token from a previous response
332
+ # is provided, this request will send the subsequent page.
333
+ # @param filter [::String]
334
+ # Filter the list as specified in https://google.aip.dev/160.
335
+ # @param order_by [::String]
336
+ # Order results as specified in https://google.aip.dev/132.
337
+ # @yield [result, operation] Access the result along with the TransportOperation object
338
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Maintenance::Api::V1beta::ResourceMaintenance>]
339
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
340
+ #
341
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Maintenance::Api::V1beta::ResourceMaintenance>]
342
+ #
343
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
344
+ #
345
+ # @example Basic example
346
+ # require "google/cloud/maintenance/api/v1beta"
347
+ #
348
+ # # Create a client object. The client can be reused for multiple calls.
349
+ # client = Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client.new
350
+ #
351
+ # # Create a request. To set request fields, pass in keyword arguments.
352
+ # request = Google::Cloud::Maintenance::Api::V1beta::ListResourceMaintenancesRequest.new
353
+ #
354
+ # # Call the list_resource_maintenances method.
355
+ # result = client.list_resource_maintenances request
356
+ #
357
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
358
+ # # over elements, and API calls will be issued to fetch pages as needed.
359
+ # result.each do |item|
360
+ # # Each element is of type ::Google::Cloud::Maintenance::Api::V1beta::ResourceMaintenance.
361
+ # p item
362
+ # end
363
+ #
364
+ def list_resource_maintenances request, options = nil
365
+ raise ::ArgumentError, "request must be provided" if request.nil?
366
+
367
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Maintenance::Api::V1beta::ListResourceMaintenancesRequest
368
+
369
+ # Converts hash and nil to an options object
370
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
371
+
372
+ # Customize the options with defaults
373
+ call_metadata = @config.rpcs.list_resource_maintenances.metadata.to_h
374
+
375
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
376
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
377
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
378
+ gapic_version: ::Google::Cloud::Maintenance::Api::V1beta::VERSION,
379
+ transports_version_send: [:rest]
380
+
381
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
382
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
+
384
+ options.apply_defaults timeout: @config.rpcs.list_resource_maintenances.timeout,
385
+ metadata: call_metadata,
386
+ retry_policy: @config.rpcs.list_resource_maintenances.retry_policy
387
+
388
+ options.apply_defaults timeout: @config.timeout,
389
+ metadata: @config.metadata,
390
+ retry_policy: @config.retry_policy
391
+
392
+ @maintenance_stub.list_resource_maintenances request, options do |result, operation|
393
+ result = ::Gapic::Rest::PagedEnumerable.new @maintenance_stub, :list_resource_maintenances, "resource_maintenances", request, result, options
394
+ yield result, operation if block_given?
395
+ throw :response, result
396
+ end
397
+ rescue ::Gapic::Rest::Error => e
398
+ raise ::Google::Cloud::Error.from_error(e)
399
+ end
400
+
401
+ ##
402
+ # Retrieve a single resource maintenance.
403
+ #
404
+ # @overload get_resource_maintenance(request, options = nil)
405
+ # Pass arguments to `get_resource_maintenance` via a request object, either of type
406
+ # {::Google::Cloud::Maintenance::Api::V1beta::GetResourceMaintenanceRequest} or an equivalent Hash.
407
+ #
408
+ # @param request [::Google::Cloud::Maintenance::Api::V1beta::GetResourceMaintenanceRequest, ::Hash]
409
+ # A request object representing the call parameters. Required. To specify no
410
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
411
+ # @param options [::Gapic::CallOptions, ::Hash]
412
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
413
+ #
414
+ # @overload get_resource_maintenance(name: nil)
415
+ # Pass arguments to `get_resource_maintenance` via keyword arguments. Note that at
416
+ # least one keyword argument is required. To specify no parameters, or to keep all
417
+ # the default parameter values, pass an empty Hash as a request object (see above).
418
+ #
419
+ # @param name [::String]
420
+ # Required. The resource name of the resource within a service.
421
+ # @yield [result, operation] Access the result along with the TransportOperation object
422
+ # @yieldparam result [::Google::Cloud::Maintenance::Api::V1beta::ResourceMaintenance]
423
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
424
+ #
425
+ # @return [::Google::Cloud::Maintenance::Api::V1beta::ResourceMaintenance]
426
+ #
427
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
428
+ #
429
+ # @example Basic example
430
+ # require "google/cloud/maintenance/api/v1beta"
431
+ #
432
+ # # Create a client object. The client can be reused for multiple calls.
433
+ # client = Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client.new
434
+ #
435
+ # # Create a request. To set request fields, pass in keyword arguments.
436
+ # request = Google::Cloud::Maintenance::Api::V1beta::GetResourceMaintenanceRequest.new
437
+ #
438
+ # # Call the get_resource_maintenance method.
439
+ # result = client.get_resource_maintenance request
440
+ #
441
+ # # The returned object is of type Google::Cloud::Maintenance::Api::V1beta::ResourceMaintenance.
442
+ # p result
443
+ #
444
+ def get_resource_maintenance request, options = nil
445
+ raise ::ArgumentError, "request must be provided" if request.nil?
446
+
447
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Maintenance::Api::V1beta::GetResourceMaintenanceRequest
448
+
449
+ # Converts hash and nil to an options object
450
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
451
+
452
+ # Customize the options with defaults
453
+ call_metadata = @config.rpcs.get_resource_maintenance.metadata.to_h
454
+
455
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
456
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
457
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
458
+ gapic_version: ::Google::Cloud::Maintenance::Api::V1beta::VERSION,
459
+ transports_version_send: [:rest]
460
+
461
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
462
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
463
+
464
+ options.apply_defaults timeout: @config.rpcs.get_resource_maintenance.timeout,
465
+ metadata: call_metadata,
466
+ retry_policy: @config.rpcs.get_resource_maintenance.retry_policy
467
+
468
+ options.apply_defaults timeout: @config.timeout,
469
+ metadata: @config.metadata,
470
+ retry_policy: @config.retry_policy
471
+
472
+ @maintenance_stub.get_resource_maintenance request, options do |result, operation|
473
+ yield result, operation if block_given?
474
+ end
475
+ rescue ::Gapic::Rest::Error => e
476
+ raise ::Google::Cloud::Error.from_error(e)
477
+ end
478
+
479
+ ##
480
+ # Configuration class for the Maintenance REST API.
481
+ #
482
+ # This class represents the configuration for Maintenance REST,
483
+ # providing control over timeouts, retry behavior, logging, transport
484
+ # parameters, and other low-level controls. Certain parameters can also be
485
+ # applied individually to specific RPCs. See
486
+ # {::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client::Configuration::Rpcs}
487
+ # for a list of RPCs that can be configured independently.
488
+ #
489
+ # Configuration can be applied globally to all clients, or to a single client
490
+ # on construction.
491
+ #
492
+ # @example
493
+ #
494
+ # # Modify the global config, setting the timeout for
495
+ # # summarize_maintenances to 20 seconds,
496
+ # # and all remaining timeouts to 10 seconds.
497
+ # ::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client.configure do |config|
498
+ # config.timeout = 10.0
499
+ # config.rpcs.summarize_maintenances.timeout = 20.0
500
+ # end
501
+ #
502
+ # # Apply the above configuration only to a new client.
503
+ # client = ::Google::Cloud::Maintenance::Api::V1beta::Maintenance::Rest::Client.new do |config|
504
+ # config.timeout = 10.0
505
+ # config.rpcs.summarize_maintenances.timeout = 20.0
506
+ # end
507
+ #
508
+ # @!attribute [rw] endpoint
509
+ # A custom service endpoint, as a hostname or hostname:port. The default is
510
+ # nil, indicating to use the default endpoint in the current universe domain.
511
+ # @return [::String,nil]
512
+ # @!attribute [rw] credentials
513
+ # Credentials to send with calls. You may provide any of the following types:
514
+ # * (`String`) The path to a service account key file in JSON format
515
+ # * (`Hash`) A service account key as a Hash
516
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
517
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
518
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
519
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
520
+ # * (`nil`) indicating no credentials
521
+ #
522
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
523
+ # external source for authentication to Google Cloud, you must validate it before
524
+ # providing it to a Google API client library. Providing an unvalidated credential
525
+ # configuration to Google APIs can compromise the security of your systems and data.
526
+ # For more information, refer to [Validate credential configurations from external
527
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
528
+ # @return [::Object]
529
+ # @!attribute [rw] scope
530
+ # The OAuth scopes
531
+ # @return [::Array<::String>]
532
+ # @!attribute [rw] lib_name
533
+ # The library name as recorded in instrumentation and logging
534
+ # @return [::String]
535
+ # @!attribute [rw] lib_version
536
+ # The library version as recorded in instrumentation and logging
537
+ # @return [::String]
538
+ # @!attribute [rw] timeout
539
+ # The call timeout in seconds.
540
+ # @return [::Numeric]
541
+ # @!attribute [rw] metadata
542
+ # Additional headers to be sent with the call.
543
+ # @return [::Hash{::Symbol=>::String}]
544
+ # @!attribute [rw] retry_policy
545
+ # The retry policy. The value is a hash with the following keys:
546
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
547
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
548
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
549
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
550
+ # trigger a retry.
551
+ # @return [::Hash]
552
+ # @!attribute [rw] quota_project
553
+ # A separate project against which to charge quota.
554
+ # @return [::String]
555
+ # @!attribute [rw] universe_domain
556
+ # The universe domain within which to make requests. This determines the
557
+ # default endpoint URL. The default value of nil uses the environment
558
+ # universe (usually the default "googleapis.com" universe).
559
+ # @return [::String,nil]
560
+ # @!attribute [rw] logger
561
+ # A custom logger to use for request/response debug logging, or the value
562
+ # `:default` (the default) to construct a default logger, or `nil` to
563
+ # explicitly disable logging.
564
+ # @return [::Logger,:default,nil]
565
+ #
566
+ class Configuration
567
+ extend ::Gapic::Config
568
+
569
+ # @private
570
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
571
+ DEFAULT_ENDPOINT = "maintenance.googleapis.com"
572
+
573
+ config_attr :endpoint, nil, ::String, nil
574
+ config_attr :credentials, nil do |value|
575
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
576
+ allowed.any? { |klass| klass === value }
577
+ end
578
+ config_attr :scope, nil, ::String, ::Array, nil
579
+ config_attr :lib_name, nil, ::String, nil
580
+ config_attr :lib_version, nil, ::String, nil
581
+ config_attr :timeout, nil, ::Numeric, nil
582
+ config_attr :metadata, nil, ::Hash, nil
583
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
584
+ config_attr :quota_project, nil, ::String, nil
585
+ config_attr :universe_domain, nil, ::String, nil
586
+
587
+ # @private
588
+ # Overrides for http bindings for the RPCs of this service
589
+ # are only used when this service is used as mixin, and only
590
+ # by the host service.
591
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
592
+ config_attr :bindings_override, {}, ::Hash, nil
593
+ config_attr :logger, :default, ::Logger, nil, :default
594
+
595
+ # @private
596
+ def initialize parent_config = nil
597
+ @parent_config = parent_config unless parent_config.nil?
598
+
599
+ yield self if block_given?
600
+ end
601
+
602
+ ##
603
+ # Configurations for individual RPCs
604
+ # @return [Rpcs]
605
+ #
606
+ def rpcs
607
+ @rpcs ||= begin
608
+ parent_rpcs = nil
609
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
610
+ Rpcs.new parent_rpcs
611
+ end
612
+ end
613
+
614
+ ##
615
+ # Configuration RPC class for the Maintenance API.
616
+ #
617
+ # Includes fields providing the configuration for each RPC in this service.
618
+ # Each configuration object is of type `Gapic::Config::Method` and includes
619
+ # the following configuration fields:
620
+ #
621
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
622
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
623
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
624
+ # include the following keys:
625
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
626
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
627
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
628
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
629
+ # trigger a retry.
630
+ #
631
+ class Rpcs
632
+ ##
633
+ # RPC-specific configuration for `summarize_maintenances`
634
+ # @return [::Gapic::Config::Method]
635
+ #
636
+ attr_reader :summarize_maintenances
637
+ ##
638
+ # RPC-specific configuration for `list_resource_maintenances`
639
+ # @return [::Gapic::Config::Method]
640
+ #
641
+ attr_reader :list_resource_maintenances
642
+ ##
643
+ # RPC-specific configuration for `get_resource_maintenance`
644
+ # @return [::Gapic::Config::Method]
645
+ #
646
+ attr_reader :get_resource_maintenance
647
+
648
+ # @private
649
+ def initialize parent_rpcs = nil
650
+ summarize_maintenances_config = parent_rpcs.summarize_maintenances if parent_rpcs.respond_to? :summarize_maintenances
651
+ @summarize_maintenances = ::Gapic::Config::Method.new summarize_maintenances_config
652
+ list_resource_maintenances_config = parent_rpcs.list_resource_maintenances if parent_rpcs.respond_to? :list_resource_maintenances
653
+ @list_resource_maintenances = ::Gapic::Config::Method.new list_resource_maintenances_config
654
+ get_resource_maintenance_config = parent_rpcs.get_resource_maintenance if parent_rpcs.respond_to? :get_resource_maintenance
655
+ @get_resource_maintenance = ::Gapic::Config::Method.new get_resource_maintenance_config
656
+
657
+ yield self if block_given?
658
+ end
659
+ end
660
+ end
661
+ end
662
+ end
663
+ end
664
+ end
665
+ end
666
+ end
667
+ end
668
+ end