google-cloud-maintenance-api-v1 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/v1/bindings_override.rb +77 -0
  6. data/lib/google/cloud/maintenance/api/v1/maintenance/client.rb +712 -0
  7. data/lib/google/cloud/maintenance/api/v1/maintenance/credentials.rb +49 -0
  8. data/lib/google/cloud/maintenance/api/v1/maintenance/paths.rb +71 -0
  9. data/lib/google/cloud/maintenance/api/v1/maintenance/rest/client.rb +656 -0
  10. data/lib/google/cloud/maintenance/api/v1/maintenance/rest/service_stub.rb +266 -0
  11. data/lib/google/cloud/maintenance/api/v1/maintenance/rest.rb +55 -0
  12. data/lib/google/cloud/maintenance/api/v1/maintenance.rb +57 -0
  13. data/lib/google/cloud/maintenance/api/v1/maintenance_service_pb.rb +66 -0
  14. data/lib/google/cloud/maintenance/api/v1/maintenance_service_services_pb.rb +51 -0
  15. data/lib/google/cloud/maintenance/api/v1/rest.rb +40 -0
  16. data/lib/google/cloud/maintenance/api/v1/version.rb +7 -2
  17. data/lib/google/cloud/maintenance/api/v1.rb +47 -0
  18. data/lib/google-cloud-maintenance-api-v1.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/v1/maintenance_service.rb +411 -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,712 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/v1/maintenance_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Maintenance
26
+ module Api
27
+ module V1
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::V1::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::V1::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", "V1"]
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::V1::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::V1::Maintenance::Client.new
117
+ #
118
+ # # Create a client using a custom configuration
119
+ # client = ::Google::Cloud::Maintenance::Api::V1::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/v1/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::V1::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::V1::SummarizeMaintenancesRequest} or an equivalent Hash.
209
+ #
210
+ # @param request [::Google::Cloud::Maintenance::Api::V1::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
+ # - `maintenance.maintenanceName`
234
+ # Examples:
235
+ # - `maintenance.maintenanceName="eb3b709c-9ca1-5472-9fb6-800a3849eda1"`
236
+ # @param order_by [::String]
237
+ # Order results as specified in https://google.aip.dev/132.
238
+ #
239
+ # @yield [response, operation] Access the result along with the RPC operation
240
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Maintenance::Api::V1::MaintenanceSummary>]
241
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
242
+ #
243
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Maintenance::Api::V1::MaintenanceSummary>]
244
+ #
245
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
246
+ #
247
+ # @example Basic example
248
+ # require "google/cloud/maintenance/api/v1"
249
+ #
250
+ # # Create a client object. The client can be reused for multiple calls.
251
+ # client = Google::Cloud::Maintenance::Api::V1::Maintenance::Client.new
252
+ #
253
+ # # Create a request. To set request fields, pass in keyword arguments.
254
+ # request = Google::Cloud::Maintenance::Api::V1::SummarizeMaintenancesRequest.new
255
+ #
256
+ # # Call the summarize_maintenances method.
257
+ # result = client.summarize_maintenances request
258
+ #
259
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
260
+ # # over elements, and API calls will be issued to fetch pages as needed.
261
+ # result.each do |item|
262
+ # # Each element is of type ::Google::Cloud::Maintenance::Api::V1::MaintenanceSummary.
263
+ # p item
264
+ # end
265
+ #
266
+ def summarize_maintenances request, options = nil
267
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
+
269
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Maintenance::Api::V1::SummarizeMaintenancesRequest
270
+
271
+ # Converts hash and nil to an options object
272
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
273
+
274
+ # Customize the options with defaults
275
+ metadata = @config.rpcs.summarize_maintenances.metadata.to_h
276
+
277
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
278
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
280
+ gapic_version: ::Google::Cloud::Maintenance::Api::V1::VERSION
281
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
282
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
283
+
284
+ header_params = {}
285
+ if request.parent
286
+ header_params["parent"] = request.parent
287
+ end
288
+
289
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
290
+ metadata[:"x-goog-request-params"] ||= request_params_header
291
+
292
+ options.apply_defaults timeout: @config.rpcs.summarize_maintenances.timeout,
293
+ metadata: metadata,
294
+ retry_policy: @config.rpcs.summarize_maintenances.retry_policy
295
+
296
+ options.apply_defaults timeout: @config.timeout,
297
+ metadata: @config.metadata,
298
+ retry_policy: @config.retry_policy
299
+
300
+ @maintenance_stub.call_rpc :summarize_maintenances, request, options: options do |response, operation|
301
+ response = ::Gapic::PagedEnumerable.new @maintenance_stub, :summarize_maintenances, request, response, operation, options
302
+ yield response, operation if block_given?
303
+ throw :response, response
304
+ end
305
+ rescue ::GRPC::BadStatus => e
306
+ raise ::Google::Cloud::Error.from_error(e)
307
+ end
308
+
309
+ ##
310
+ # Retrieve a collection of resource maintenances.
311
+ #
312
+ # @overload list_resource_maintenances(request, options = nil)
313
+ # Pass arguments to `list_resource_maintenances` via a request object, either of type
314
+ # {::Google::Cloud::Maintenance::Api::V1::ListResourceMaintenancesRequest} or an equivalent Hash.
315
+ #
316
+ # @param request [::Google::Cloud::Maintenance::Api::V1::ListResourceMaintenancesRequest, ::Hash]
317
+ # A request object representing the call parameters. Required. To specify no
318
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
319
+ # @param options [::Gapic::CallOptions, ::Hash]
320
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
321
+ #
322
+ # @overload list_resource_maintenances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
323
+ # Pass arguments to `list_resource_maintenances` via keyword arguments. Note that at
324
+ # least one keyword argument is required. To specify no parameters, or to keep all
325
+ # the default parameter values, pass an empty Hash as a request object (see above).
326
+ #
327
+ # @param parent [::String]
328
+ # Required. The parent of the resource maintenance.
329
+ # @param page_size [::Integer]
330
+ # The maximum number of resource maintenances to send per page.
331
+ # @param page_token [::String]
332
+ # The page token: If the next_page_token from a previous response
333
+ # is provided, this request will send the subsequent page.
334
+ # @param filter [::String]
335
+ # Filter the list as specified in https://google.aip.dev/160.
336
+ # @param order_by [::String]
337
+ # Order results as specified in https://google.aip.dev/132.
338
+ #
339
+ # @yield [response, operation] Access the result along with the RPC operation
340
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Maintenance::Api::V1::ResourceMaintenance>]
341
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
342
+ #
343
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Maintenance::Api::V1::ResourceMaintenance>]
344
+ #
345
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
346
+ #
347
+ # @example Basic example
348
+ # require "google/cloud/maintenance/api/v1"
349
+ #
350
+ # # Create a client object. The client can be reused for multiple calls.
351
+ # client = Google::Cloud::Maintenance::Api::V1::Maintenance::Client.new
352
+ #
353
+ # # Create a request. To set request fields, pass in keyword arguments.
354
+ # request = Google::Cloud::Maintenance::Api::V1::ListResourceMaintenancesRequest.new
355
+ #
356
+ # # Call the list_resource_maintenances method.
357
+ # result = client.list_resource_maintenances request
358
+ #
359
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
360
+ # # over elements, and API calls will be issued to fetch pages as needed.
361
+ # result.each do |item|
362
+ # # Each element is of type ::Google::Cloud::Maintenance::Api::V1::ResourceMaintenance.
363
+ # p item
364
+ # end
365
+ #
366
+ def list_resource_maintenances request, options = nil
367
+ raise ::ArgumentError, "request must be provided" if request.nil?
368
+
369
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Maintenance::Api::V1::ListResourceMaintenancesRequest
370
+
371
+ # Converts hash and nil to an options object
372
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
373
+
374
+ # Customize the options with defaults
375
+ metadata = @config.rpcs.list_resource_maintenances.metadata.to_h
376
+
377
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
378
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
379
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
380
+ gapic_version: ::Google::Cloud::Maintenance::Api::V1::VERSION
381
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
382
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
+
384
+ header_params = {}
385
+ if request.parent
386
+ header_params["parent"] = request.parent
387
+ end
388
+
389
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
390
+ metadata[:"x-goog-request-params"] ||= request_params_header
391
+
392
+ options.apply_defaults timeout: @config.rpcs.list_resource_maintenances.timeout,
393
+ metadata: metadata,
394
+ retry_policy: @config.rpcs.list_resource_maintenances.retry_policy
395
+
396
+ options.apply_defaults timeout: @config.timeout,
397
+ metadata: @config.metadata,
398
+ retry_policy: @config.retry_policy
399
+
400
+ @maintenance_stub.call_rpc :list_resource_maintenances, request, options: options do |response, operation|
401
+ response = ::Gapic::PagedEnumerable.new @maintenance_stub, :list_resource_maintenances, request, response, operation, options
402
+ yield response, operation if block_given?
403
+ throw :response, response
404
+ end
405
+ rescue ::GRPC::BadStatus => e
406
+ raise ::Google::Cloud::Error.from_error(e)
407
+ end
408
+
409
+ ##
410
+ # Retrieve a single resource maintenance.
411
+ #
412
+ # @overload get_resource_maintenance(request, options = nil)
413
+ # Pass arguments to `get_resource_maintenance` via a request object, either of type
414
+ # {::Google::Cloud::Maintenance::Api::V1::GetResourceMaintenanceRequest} or an equivalent Hash.
415
+ #
416
+ # @param request [::Google::Cloud::Maintenance::Api::V1::GetResourceMaintenanceRequest, ::Hash]
417
+ # A request object representing the call parameters. Required. To specify no
418
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
419
+ # @param options [::Gapic::CallOptions, ::Hash]
420
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
421
+ #
422
+ # @overload get_resource_maintenance(name: nil)
423
+ # Pass arguments to `get_resource_maintenance` via keyword arguments. Note that at
424
+ # least one keyword argument is required. To specify no parameters, or to keep all
425
+ # the default parameter values, pass an empty Hash as a request object (see above).
426
+ #
427
+ # @param name [::String]
428
+ # Required. The resource name of the resource within a service.
429
+ #
430
+ # @yield [response, operation] Access the result along with the RPC operation
431
+ # @yieldparam response [::Google::Cloud::Maintenance::Api::V1::ResourceMaintenance]
432
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
433
+ #
434
+ # @return [::Google::Cloud::Maintenance::Api::V1::ResourceMaintenance]
435
+ #
436
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
437
+ #
438
+ # @example Basic example
439
+ # require "google/cloud/maintenance/api/v1"
440
+ #
441
+ # # Create a client object. The client can be reused for multiple calls.
442
+ # client = Google::Cloud::Maintenance::Api::V1::Maintenance::Client.new
443
+ #
444
+ # # Create a request. To set request fields, pass in keyword arguments.
445
+ # request = Google::Cloud::Maintenance::Api::V1::GetResourceMaintenanceRequest.new
446
+ #
447
+ # # Call the get_resource_maintenance method.
448
+ # result = client.get_resource_maintenance request
449
+ #
450
+ # # The returned object is of type Google::Cloud::Maintenance::Api::V1::ResourceMaintenance.
451
+ # p result
452
+ #
453
+ def get_resource_maintenance request, options = nil
454
+ raise ::ArgumentError, "request must be provided" if request.nil?
455
+
456
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Maintenance::Api::V1::GetResourceMaintenanceRequest
457
+
458
+ # Converts hash and nil to an options object
459
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
460
+
461
+ # Customize the options with defaults
462
+ metadata = @config.rpcs.get_resource_maintenance.metadata.to_h
463
+
464
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
465
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
466
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
467
+ gapic_version: ::Google::Cloud::Maintenance::Api::V1::VERSION
468
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
469
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
470
+
471
+ header_params = {}
472
+ if request.name
473
+ header_params["name"] = request.name
474
+ end
475
+
476
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
477
+ metadata[:"x-goog-request-params"] ||= request_params_header
478
+
479
+ options.apply_defaults timeout: @config.rpcs.get_resource_maintenance.timeout,
480
+ metadata: metadata,
481
+ retry_policy: @config.rpcs.get_resource_maintenance.retry_policy
482
+
483
+ options.apply_defaults timeout: @config.timeout,
484
+ metadata: @config.metadata,
485
+ retry_policy: @config.retry_policy
486
+
487
+ @maintenance_stub.call_rpc :get_resource_maintenance, request, options: options do |response, operation|
488
+ yield response, operation if block_given?
489
+ end
490
+ rescue ::GRPC::BadStatus => e
491
+ raise ::Google::Cloud::Error.from_error(e)
492
+ end
493
+
494
+ ##
495
+ # Configuration class for the Maintenance API.
496
+ #
497
+ # This class represents the configuration for Maintenance,
498
+ # providing control over timeouts, retry behavior, logging, transport
499
+ # parameters, and other low-level controls. Certain parameters can also be
500
+ # applied individually to specific RPCs. See
501
+ # {::Google::Cloud::Maintenance::Api::V1::Maintenance::Client::Configuration::Rpcs}
502
+ # for a list of RPCs that can be configured independently.
503
+ #
504
+ # Configuration can be applied globally to all clients, or to a single client
505
+ # on construction.
506
+ #
507
+ # @example
508
+ #
509
+ # # Modify the global config, setting the timeout for
510
+ # # summarize_maintenances to 20 seconds,
511
+ # # and all remaining timeouts to 10 seconds.
512
+ # ::Google::Cloud::Maintenance::Api::V1::Maintenance::Client.configure do |config|
513
+ # config.timeout = 10.0
514
+ # config.rpcs.summarize_maintenances.timeout = 20.0
515
+ # end
516
+ #
517
+ # # Apply the above configuration only to a new client.
518
+ # client = ::Google::Cloud::Maintenance::Api::V1::Maintenance::Client.new do |config|
519
+ # config.timeout = 10.0
520
+ # config.rpcs.summarize_maintenances.timeout = 20.0
521
+ # end
522
+ #
523
+ # @!attribute [rw] endpoint
524
+ # A custom service endpoint, as a hostname or hostname:port. The default is
525
+ # nil, indicating to use the default endpoint in the current universe domain.
526
+ # @return [::String,nil]
527
+ # @!attribute [rw] credentials
528
+ # Credentials to send with calls. You may provide any of the following types:
529
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
530
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
531
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
532
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
533
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
534
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
535
+ # * (`nil`) indicating no credentials
536
+ #
537
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
538
+ # is deprecated. Providing an unvalidated credential configuration to
539
+ # Google APIs can compromise the security of your systems and data.
540
+ #
541
+ # @example
542
+ #
543
+ # # The recommended way to provide credentials is to use the `make_creds` method
544
+ # # on the appropriate credentials class for your environment.
545
+ #
546
+ # require "googleauth"
547
+ #
548
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
549
+ # json_key_io: ::File.open("/path/to/keyfile.json")
550
+ # )
551
+ #
552
+ # client = ::Google::Cloud::Maintenance::Api::V1::Maintenance::Client.new do |config|
553
+ # config.credentials = credentials
554
+ # end
555
+ #
556
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
557
+ # external source for authentication to Google Cloud, you must validate it before
558
+ # providing it to a Google API client library. Providing an unvalidated credential
559
+ # configuration to Google APIs can compromise the security of your systems and data.
560
+ # For more information, refer to [Validate credential configurations from external
561
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
562
+ # @return [::Object]
563
+ # @!attribute [rw] scope
564
+ # The OAuth scopes
565
+ # @return [::Array<::String>]
566
+ # @!attribute [rw] lib_name
567
+ # The library name as recorded in instrumentation and logging
568
+ # @return [::String]
569
+ # @!attribute [rw] lib_version
570
+ # The library version as recorded in instrumentation and logging
571
+ # @return [::String]
572
+ # @!attribute [rw] channel_args
573
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
574
+ # `GRPC::Core::Channel` object is provided as the credential.
575
+ # @return [::Hash]
576
+ # @!attribute [rw] interceptors
577
+ # An array of interceptors that are run before calls are executed.
578
+ # @return [::Array<::GRPC::ClientInterceptor>]
579
+ # @!attribute [rw] timeout
580
+ # The call timeout in seconds.
581
+ # @return [::Numeric]
582
+ # @!attribute [rw] metadata
583
+ # Additional gRPC headers to be sent with the call.
584
+ # @return [::Hash{::Symbol=>::String}]
585
+ # @!attribute [rw] retry_policy
586
+ # The retry policy. The value is a hash with the following keys:
587
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
588
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
589
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
590
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
591
+ # trigger a retry.
592
+ # @return [::Hash]
593
+ # @!attribute [rw] quota_project
594
+ # A separate project against which to charge quota.
595
+ # @return [::String]
596
+ # @!attribute [rw] universe_domain
597
+ # The universe domain within which to make requests. This determines the
598
+ # default endpoint URL. The default value of nil uses the environment
599
+ # universe (usually the default "googleapis.com" universe).
600
+ # @return [::String,nil]
601
+ # @!attribute [rw] logger
602
+ # A custom logger to use for request/response debug logging, or the value
603
+ # `:default` (the default) to construct a default logger, or `nil` to
604
+ # explicitly disable logging.
605
+ # @return [::Logger,:default,nil]
606
+ #
607
+ class Configuration
608
+ extend ::Gapic::Config
609
+
610
+ # @private
611
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
612
+ DEFAULT_ENDPOINT = "maintenance.googleapis.com"
613
+
614
+ config_attr :endpoint, nil, ::String, nil
615
+ config_attr :credentials, nil do |value|
616
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
617
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
618
+ allowed.any? { |klass| klass === value }
619
+ end
620
+ config_attr :scope, nil, ::String, ::Array, nil
621
+ config_attr :lib_name, nil, ::String, nil
622
+ config_attr :lib_version, nil, ::String, nil
623
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
624
+ config_attr :interceptors, nil, ::Array, nil
625
+ config_attr :timeout, nil, ::Numeric, nil
626
+ config_attr :metadata, nil, ::Hash, nil
627
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
628
+ config_attr :quota_project, nil, ::String, nil
629
+ config_attr :universe_domain, nil, ::String, nil
630
+ config_attr :logger, :default, ::Logger, nil, :default
631
+
632
+ # @private
633
+ def initialize parent_config = nil
634
+ @parent_config = parent_config unless parent_config.nil?
635
+
636
+ yield self if block_given?
637
+ end
638
+
639
+ ##
640
+ # Configurations for individual RPCs
641
+ # @return [Rpcs]
642
+ #
643
+ def rpcs
644
+ @rpcs ||= begin
645
+ parent_rpcs = nil
646
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
647
+ Rpcs.new parent_rpcs
648
+ end
649
+ end
650
+
651
+ ##
652
+ # Configuration for the channel pool
653
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
654
+ #
655
+ def channel_pool
656
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
657
+ end
658
+
659
+ ##
660
+ # Configuration RPC class for the Maintenance API.
661
+ #
662
+ # Includes fields providing the configuration for each RPC in this service.
663
+ # Each configuration object is of type `Gapic::Config::Method` and includes
664
+ # the following configuration fields:
665
+ #
666
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
667
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
668
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
669
+ # include the following keys:
670
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
671
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
672
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
673
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
674
+ # trigger a retry.
675
+ #
676
+ class Rpcs
677
+ ##
678
+ # RPC-specific configuration for `summarize_maintenances`
679
+ # @return [::Gapic::Config::Method]
680
+ #
681
+ attr_reader :summarize_maintenances
682
+ ##
683
+ # RPC-specific configuration for `list_resource_maintenances`
684
+ # @return [::Gapic::Config::Method]
685
+ #
686
+ attr_reader :list_resource_maintenances
687
+ ##
688
+ # RPC-specific configuration for `get_resource_maintenance`
689
+ # @return [::Gapic::Config::Method]
690
+ #
691
+ attr_reader :get_resource_maintenance
692
+
693
+ # @private
694
+ def initialize parent_rpcs = nil
695
+ summarize_maintenances_config = parent_rpcs.summarize_maintenances if parent_rpcs.respond_to? :summarize_maintenances
696
+ @summarize_maintenances = ::Gapic::Config::Method.new summarize_maintenances_config
697
+ list_resource_maintenances_config = parent_rpcs.list_resource_maintenances if parent_rpcs.respond_to? :list_resource_maintenances
698
+ @list_resource_maintenances = ::Gapic::Config::Method.new list_resource_maintenances_config
699
+ get_resource_maintenance_config = parent_rpcs.get_resource_maintenance if parent_rpcs.respond_to? :get_resource_maintenance
700
+ @get_resource_maintenance = ::Gapic::Config::Method.new get_resource_maintenance_config
701
+
702
+ yield self if block_given?
703
+ end
704
+ end
705
+ end
706
+ end
707
+ end
708
+ end
709
+ end
710
+ end
711
+ end
712
+ end