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