google-cloud-api_gateway-v1 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1449 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/apigateway/v1/apigateway_service_pb"
21
+ require "google/cloud/api_gateway/v1/api_gateway_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ApiGateway
26
+ module V1
27
+ module ApiGatewayService
28
+ module Rest
29
+ ##
30
+ # REST client for the ApiGatewayService service.
31
+ #
32
+ # The API Gateway Service is the interface for managing API Gateways.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :api_gateway_service_stub
39
+
40
+ ##
41
+ # Configure the ApiGatewayService Client class.
42
+ #
43
+ # See {::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all ApiGatewayService clients
49
+ # ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "ApiGateway", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.rpcs.create_gateway.timeout = 60.0
70
+ default_config.rpcs.create_gateway.retry_policy = {
71
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
72
+ }
73
+
74
+ default_config.rpcs.update_gateway.timeout = 60.0
75
+ default_config.rpcs.update_gateway.retry_policy = {
76
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
77
+ }
78
+
79
+ default_config.rpcs.delete_gateway.timeout = 60.0
80
+ default_config.rpcs.delete_gateway.retry_policy = {
81
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
82
+ }
83
+
84
+ default_config.rpcs.create_api.timeout = 60.0
85
+ default_config.rpcs.create_api.retry_policy = {
86
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
87
+ }
88
+
89
+ default_config.rpcs.update_api.timeout = 60.0
90
+ default_config.rpcs.update_api.retry_policy = {
91
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
92
+ }
93
+
94
+ default_config.rpcs.delete_api.timeout = 60.0
95
+ default_config.rpcs.delete_api.retry_policy = {
96
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
97
+ }
98
+
99
+ default_config.rpcs.create_api_config.timeout = 60.0
100
+ default_config.rpcs.create_api_config.retry_policy = {
101
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
102
+ }
103
+
104
+ default_config.rpcs.update_api_config.timeout = 60.0
105
+ default_config.rpcs.update_api_config.retry_policy = {
106
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
107
+ }
108
+
109
+ default_config.rpcs.delete_api_config.timeout = 60.0
110
+ default_config.rpcs.delete_api_config.retry_policy = {
111
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
112
+ }
113
+
114
+ default_config
115
+ end
116
+ yield @configure if block_given?
117
+ @configure
118
+ end
119
+
120
+ ##
121
+ # Configure the ApiGatewayService Client instance.
122
+ #
123
+ # The configuration is set to the derived mode, meaning that values can be changed,
124
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
125
+ # should be made on {Client.configure}.
126
+ #
127
+ # See {::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Client::Configuration}
128
+ # for a description of the configuration fields.
129
+ #
130
+ # @yield [config] Configure the Client client.
131
+ # @yieldparam config [Client::Configuration]
132
+ #
133
+ # @return [Client::Configuration]
134
+ #
135
+ def configure
136
+ yield @config if block_given?
137
+ @config
138
+ end
139
+
140
+ ##
141
+ # Create a new ApiGatewayService REST client object.
142
+ #
143
+ # @example
144
+ #
145
+ # # Create a client using the default configuration
146
+ # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Client.new
147
+ #
148
+ # # Create a client using a custom configuration
149
+ # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Client.new do |config|
150
+ # config.timeout = 10.0
151
+ # end
152
+ #
153
+ # @yield [config] Configure the ApiGatewayService client.
154
+ # @yieldparam config [Client::Configuration]
155
+ #
156
+ def initialize
157
+ # Create the configuration object
158
+ @config = Configuration.new Client.configure
159
+
160
+ # Yield the configuration if needed
161
+ yield @config if block_given?
162
+
163
+ # Create credentials
164
+ credentials = @config.credentials
165
+ # Use self-signed JWT if the endpoint is unchanged from default,
166
+ # but only if the default endpoint does not have a region prefix.
167
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
168
+ !@config.endpoint.split(".").first.include?("-")
169
+ credentials ||= Credentials.default scope: @config.scope,
170
+ enable_self_signed_jwt: enable_self_signed_jwt
171
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
172
+ credentials = Credentials.new credentials, scope: @config.scope
173
+ end
174
+
175
+ @quota_project_id = @config.quota_project
176
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
177
+
178
+ @operations_client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Operations.new do |config|
179
+ config.credentials = credentials
180
+ config.quota_project = @quota_project_id
181
+ config.endpoint = @config.endpoint
182
+ end
183
+
184
+ @api_gateway_service_stub = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
185
+ end
186
+
187
+ ##
188
+ # Get the associated client for long-running operations.
189
+ #
190
+ # @return [::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Operations]
191
+ #
192
+ attr_reader :operations_client
193
+
194
+ # Service calls
195
+
196
+ ##
197
+ # Lists Gateways in a given project and location.
198
+ #
199
+ # @overload list_gateways(request, options = nil)
200
+ # Pass arguments to `list_gateways` via a request object, either of type
201
+ # {::Google::Cloud::ApiGateway::V1::ListGatewaysRequest} or an equivalent Hash.
202
+ #
203
+ # @param request [::Google::Cloud::ApiGateway::V1::ListGatewaysRequest, ::Hash]
204
+ # A request object representing the call parameters. Required. To specify no
205
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
206
+ # @param options [::Gapic::CallOptions, ::Hash]
207
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
208
+ #
209
+ # @overload list_gateways(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
210
+ # Pass arguments to `list_gateways` via keyword arguments. Note that at
211
+ # least one keyword argument is required. To specify no parameters, or to keep all
212
+ # the default parameter values, pass an empty Hash as a request object (see above).
213
+ #
214
+ # @param parent [::String]
215
+ # Required. Parent resource of the Gateway, of the form:
216
+ # `projects/*/locations/*`
217
+ # @param page_size [::Integer]
218
+ # Page size.
219
+ # @param page_token [::String]
220
+ # Page token.
221
+ # @param filter [::String]
222
+ # Filter.
223
+ # @param order_by [::String]
224
+ # Order by parameters.
225
+ # @yield [result, operation] Access the result along with the TransportOperation object
226
+ # @yieldparam result [::Google::Cloud::ApiGateway::V1::ListGatewaysResponse]
227
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
228
+ #
229
+ # @return [::Google::Cloud::ApiGateway::V1::ListGatewaysResponse]
230
+ #
231
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
232
+ def list_gateways request, options = nil
233
+ raise ::ArgumentError, "request must be provided" if request.nil?
234
+
235
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::ListGatewaysRequest
236
+
237
+ # Converts hash and nil to an options object
238
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
239
+
240
+ # Customize the options with defaults
241
+ call_metadata = @config.rpcs.list_gateways.metadata.to_h
242
+
243
+ # Set x-goog-api-client and x-goog-user-project headers
244
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
245
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
246
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
247
+ transports_version_send: [:rest]
248
+
249
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
250
+
251
+ options.apply_defaults timeout: @config.rpcs.list_gateways.timeout,
252
+ metadata: call_metadata,
253
+ retry_policy: @config.rpcs.list_gateways.retry_policy
254
+
255
+ options.apply_defaults timeout: @config.timeout,
256
+ metadata: @config.metadata,
257
+ retry_policy: @config.retry_policy
258
+
259
+ @api_gateway_service_stub.list_gateways request, options do |result, operation|
260
+ yield result, operation if block_given?
261
+ return result
262
+ end
263
+ rescue ::Gapic::Rest::Error => e
264
+ raise ::Google::Cloud::Error.from_error(e)
265
+ end
266
+
267
+ ##
268
+ # Gets details of a single Gateway.
269
+ #
270
+ # @overload get_gateway(request, options = nil)
271
+ # Pass arguments to `get_gateway` via a request object, either of type
272
+ # {::Google::Cloud::ApiGateway::V1::GetGatewayRequest} or an equivalent Hash.
273
+ #
274
+ # @param request [::Google::Cloud::ApiGateway::V1::GetGatewayRequest, ::Hash]
275
+ # A request object representing the call parameters. Required. To specify no
276
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
277
+ # @param options [::Gapic::CallOptions, ::Hash]
278
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
279
+ #
280
+ # @overload get_gateway(name: nil)
281
+ # Pass arguments to `get_gateway` via keyword arguments. Note that at
282
+ # least one keyword argument is required. To specify no parameters, or to keep all
283
+ # the default parameter values, pass an empty Hash as a request object (see above).
284
+ #
285
+ # @param name [::String]
286
+ # Required. Resource name of the form:
287
+ # `projects/*/locations/*/gateways/*`
288
+ # @yield [result, operation] Access the result along with the TransportOperation object
289
+ # @yieldparam result [::Google::Cloud::ApiGateway::V1::Gateway]
290
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
291
+ #
292
+ # @return [::Google::Cloud::ApiGateway::V1::Gateway]
293
+ #
294
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
295
+ def get_gateway request, options = nil
296
+ raise ::ArgumentError, "request must be provided" if request.nil?
297
+
298
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::GetGatewayRequest
299
+
300
+ # Converts hash and nil to an options object
301
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
302
+
303
+ # Customize the options with defaults
304
+ call_metadata = @config.rpcs.get_gateway.metadata.to_h
305
+
306
+ # Set x-goog-api-client and x-goog-user-project headers
307
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
308
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
309
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
310
+ transports_version_send: [:rest]
311
+
312
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
313
+
314
+ options.apply_defaults timeout: @config.rpcs.get_gateway.timeout,
315
+ metadata: call_metadata,
316
+ retry_policy: @config.rpcs.get_gateway.retry_policy
317
+
318
+ options.apply_defaults timeout: @config.timeout,
319
+ metadata: @config.metadata,
320
+ retry_policy: @config.retry_policy
321
+
322
+ @api_gateway_service_stub.get_gateway request, options do |result, operation|
323
+ yield result, operation if block_given?
324
+ return result
325
+ end
326
+ rescue ::Gapic::Rest::Error => e
327
+ raise ::Google::Cloud::Error.from_error(e)
328
+ end
329
+
330
+ ##
331
+ # Creates a new Gateway in a given project and location.
332
+ #
333
+ # @overload create_gateway(request, options = nil)
334
+ # Pass arguments to `create_gateway` via a request object, either of type
335
+ # {::Google::Cloud::ApiGateway::V1::CreateGatewayRequest} or an equivalent Hash.
336
+ #
337
+ # @param request [::Google::Cloud::ApiGateway::V1::CreateGatewayRequest, ::Hash]
338
+ # A request object representing the call parameters. Required. To specify no
339
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
340
+ # @param options [::Gapic::CallOptions, ::Hash]
341
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
342
+ #
343
+ # @overload create_gateway(parent: nil, gateway_id: nil, gateway: nil)
344
+ # Pass arguments to `create_gateway` via keyword arguments. Note that at
345
+ # least one keyword argument is required. To specify no parameters, or to keep all
346
+ # the default parameter values, pass an empty Hash as a request object (see above).
347
+ #
348
+ # @param parent [::String]
349
+ # Required. Parent resource of the Gateway, of the form:
350
+ # `projects/*/locations/*`
351
+ # @param gateway_id [::String]
352
+ # Required. Identifier to assign to the Gateway. Must be unique within scope of
353
+ # the parent resource.
354
+ # @param gateway [::Google::Cloud::ApiGateway::V1::Gateway, ::Hash]
355
+ # Required. Gateway resource.
356
+ # @yield [result, operation] Access the result along with the TransportOperation object
357
+ # @yieldparam result [::Gapic::Operation]
358
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
359
+ #
360
+ # @return [::Gapic::Operation]
361
+ #
362
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
363
+ def create_gateway request, options = nil
364
+ raise ::ArgumentError, "request must be provided" if request.nil?
365
+
366
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::CreateGatewayRequest
367
+
368
+ # Converts hash and nil to an options object
369
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
370
+
371
+ # Customize the options with defaults
372
+ call_metadata = @config.rpcs.create_gateway.metadata.to_h
373
+
374
+ # Set x-goog-api-client and x-goog-user-project headers
375
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
376
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
377
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
378
+ transports_version_send: [:rest]
379
+
380
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
381
+
382
+ options.apply_defaults timeout: @config.rpcs.create_gateway.timeout,
383
+ metadata: call_metadata,
384
+ retry_policy: @config.rpcs.create_gateway.retry_policy
385
+
386
+ options.apply_defaults timeout: @config.timeout,
387
+ metadata: @config.metadata,
388
+ retry_policy: @config.retry_policy
389
+
390
+ @api_gateway_service_stub.create_gateway request, options do |result, operation|
391
+ result = ::Gapic::Operation.new result, @operations_client, options: options
392
+ yield result, operation if block_given?
393
+ return result
394
+ end
395
+ rescue ::Gapic::Rest::Error => e
396
+ raise ::Google::Cloud::Error.from_error(e)
397
+ end
398
+
399
+ ##
400
+ # Updates the parameters of a single Gateway.
401
+ #
402
+ # @overload update_gateway(request, options = nil)
403
+ # Pass arguments to `update_gateway` via a request object, either of type
404
+ # {::Google::Cloud::ApiGateway::V1::UpdateGatewayRequest} or an equivalent Hash.
405
+ #
406
+ # @param request [::Google::Cloud::ApiGateway::V1::UpdateGatewayRequest, ::Hash]
407
+ # A request object representing the call parameters. Required. To specify no
408
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
409
+ # @param options [::Gapic::CallOptions, ::Hash]
410
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
411
+ #
412
+ # @overload update_gateway(update_mask: nil, gateway: nil)
413
+ # Pass arguments to `update_gateway` via keyword arguments. Note that at
414
+ # least one keyword argument is required. To specify no parameters, or to keep all
415
+ # the default parameter values, pass an empty Hash as a request object (see above).
416
+ #
417
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
418
+ # Field mask is used to specify the fields to be overwritten in the
419
+ # Gateway resource by the update.
420
+ # The fields specified in the update_mask are relative to the resource, not
421
+ # the full request. A field will be overwritten if it is in the mask. If the
422
+ # user does not provide a mask then all fields will be overwritten.
423
+ # @param gateway [::Google::Cloud::ApiGateway::V1::Gateway, ::Hash]
424
+ # Required. Gateway resource.
425
+ # @yield [result, operation] Access the result along with the TransportOperation object
426
+ # @yieldparam result [::Gapic::Operation]
427
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
428
+ #
429
+ # @return [::Gapic::Operation]
430
+ #
431
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
432
+ def update_gateway request, options = nil
433
+ raise ::ArgumentError, "request must be provided" if request.nil?
434
+
435
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::UpdateGatewayRequest
436
+
437
+ # Converts hash and nil to an options object
438
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
439
+
440
+ # Customize the options with defaults
441
+ call_metadata = @config.rpcs.update_gateway.metadata.to_h
442
+
443
+ # Set x-goog-api-client and x-goog-user-project headers
444
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
445
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
446
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
447
+ transports_version_send: [:rest]
448
+
449
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
450
+
451
+ options.apply_defaults timeout: @config.rpcs.update_gateway.timeout,
452
+ metadata: call_metadata,
453
+ retry_policy: @config.rpcs.update_gateway.retry_policy
454
+
455
+ options.apply_defaults timeout: @config.timeout,
456
+ metadata: @config.metadata,
457
+ retry_policy: @config.retry_policy
458
+
459
+ @api_gateway_service_stub.update_gateway request, options do |result, operation|
460
+ result = ::Gapic::Operation.new result, @operations_client, options: options
461
+ yield result, operation if block_given?
462
+ return result
463
+ end
464
+ rescue ::Gapic::Rest::Error => e
465
+ raise ::Google::Cloud::Error.from_error(e)
466
+ end
467
+
468
+ ##
469
+ # Deletes a single Gateway.
470
+ #
471
+ # @overload delete_gateway(request, options = nil)
472
+ # Pass arguments to `delete_gateway` via a request object, either of type
473
+ # {::Google::Cloud::ApiGateway::V1::DeleteGatewayRequest} or an equivalent Hash.
474
+ #
475
+ # @param request [::Google::Cloud::ApiGateway::V1::DeleteGatewayRequest, ::Hash]
476
+ # A request object representing the call parameters. Required. To specify no
477
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
478
+ # @param options [::Gapic::CallOptions, ::Hash]
479
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
480
+ #
481
+ # @overload delete_gateway(name: nil)
482
+ # Pass arguments to `delete_gateway` via keyword arguments. Note that at
483
+ # least one keyword argument is required. To specify no parameters, or to keep all
484
+ # the default parameter values, pass an empty Hash as a request object (see above).
485
+ #
486
+ # @param name [::String]
487
+ # Required. Resource name of the form:
488
+ # `projects/*/locations/*/gateways/*`
489
+ # @yield [result, operation] Access the result along with the TransportOperation object
490
+ # @yieldparam result [::Gapic::Operation]
491
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
492
+ #
493
+ # @return [::Gapic::Operation]
494
+ #
495
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
496
+ def delete_gateway request, options = nil
497
+ raise ::ArgumentError, "request must be provided" if request.nil?
498
+
499
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::DeleteGatewayRequest
500
+
501
+ # Converts hash and nil to an options object
502
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
503
+
504
+ # Customize the options with defaults
505
+ call_metadata = @config.rpcs.delete_gateway.metadata.to_h
506
+
507
+ # Set x-goog-api-client and x-goog-user-project headers
508
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
509
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
510
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
511
+ transports_version_send: [:rest]
512
+
513
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
514
+
515
+ options.apply_defaults timeout: @config.rpcs.delete_gateway.timeout,
516
+ metadata: call_metadata,
517
+ retry_policy: @config.rpcs.delete_gateway.retry_policy
518
+
519
+ options.apply_defaults timeout: @config.timeout,
520
+ metadata: @config.metadata,
521
+ retry_policy: @config.retry_policy
522
+
523
+ @api_gateway_service_stub.delete_gateway request, options do |result, operation|
524
+ result = ::Gapic::Operation.new result, @operations_client, options: options
525
+ yield result, operation if block_given?
526
+ return result
527
+ end
528
+ rescue ::Gapic::Rest::Error => e
529
+ raise ::Google::Cloud::Error.from_error(e)
530
+ end
531
+
532
+ ##
533
+ # Lists Apis in a given project and location.
534
+ #
535
+ # @overload list_apis(request, options = nil)
536
+ # Pass arguments to `list_apis` via a request object, either of type
537
+ # {::Google::Cloud::ApiGateway::V1::ListApisRequest} or an equivalent Hash.
538
+ #
539
+ # @param request [::Google::Cloud::ApiGateway::V1::ListApisRequest, ::Hash]
540
+ # A request object representing the call parameters. Required. To specify no
541
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
542
+ # @param options [::Gapic::CallOptions, ::Hash]
543
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
544
+ #
545
+ # @overload list_apis(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
546
+ # Pass arguments to `list_apis` via keyword arguments. Note that at
547
+ # least one keyword argument is required. To specify no parameters, or to keep all
548
+ # the default parameter values, pass an empty Hash as a request object (see above).
549
+ #
550
+ # @param parent [::String]
551
+ # Required. Parent resource of the API, of the form:
552
+ # `projects/*/locations/global`
553
+ # @param page_size [::Integer]
554
+ # Page size.
555
+ # @param page_token [::String]
556
+ # Page token.
557
+ # @param filter [::String]
558
+ # Filter.
559
+ # @param order_by [::String]
560
+ # Order by parameters.
561
+ # @yield [result, operation] Access the result along with the TransportOperation object
562
+ # @yieldparam result [::Google::Cloud::ApiGateway::V1::ListApisResponse]
563
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
564
+ #
565
+ # @return [::Google::Cloud::ApiGateway::V1::ListApisResponse]
566
+ #
567
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
568
+ def list_apis request, options = nil
569
+ raise ::ArgumentError, "request must be provided" if request.nil?
570
+
571
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::ListApisRequest
572
+
573
+ # Converts hash and nil to an options object
574
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
575
+
576
+ # Customize the options with defaults
577
+ call_metadata = @config.rpcs.list_apis.metadata.to_h
578
+
579
+ # Set x-goog-api-client and x-goog-user-project headers
580
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
581
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
582
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
583
+ transports_version_send: [:rest]
584
+
585
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
586
+
587
+ options.apply_defaults timeout: @config.rpcs.list_apis.timeout,
588
+ metadata: call_metadata,
589
+ retry_policy: @config.rpcs.list_apis.retry_policy
590
+
591
+ options.apply_defaults timeout: @config.timeout,
592
+ metadata: @config.metadata,
593
+ retry_policy: @config.retry_policy
594
+
595
+ @api_gateway_service_stub.list_apis request, options do |result, operation|
596
+ yield result, operation if block_given?
597
+ return result
598
+ end
599
+ rescue ::Gapic::Rest::Error => e
600
+ raise ::Google::Cloud::Error.from_error(e)
601
+ end
602
+
603
+ ##
604
+ # Gets details of a single Api.
605
+ #
606
+ # @overload get_api(request, options = nil)
607
+ # Pass arguments to `get_api` via a request object, either of type
608
+ # {::Google::Cloud::ApiGateway::V1::GetApiRequest} or an equivalent Hash.
609
+ #
610
+ # @param request [::Google::Cloud::ApiGateway::V1::GetApiRequest, ::Hash]
611
+ # A request object representing the call parameters. Required. To specify no
612
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
613
+ # @param options [::Gapic::CallOptions, ::Hash]
614
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
615
+ #
616
+ # @overload get_api(name: nil)
617
+ # Pass arguments to `get_api` via keyword arguments. Note that at
618
+ # least one keyword argument is required. To specify no parameters, or to keep all
619
+ # the default parameter values, pass an empty Hash as a request object (see above).
620
+ #
621
+ # @param name [::String]
622
+ # Required. Resource name of the form:
623
+ # `projects/*/locations/global/apis/*`
624
+ # @yield [result, operation] Access the result along with the TransportOperation object
625
+ # @yieldparam result [::Google::Cloud::ApiGateway::V1::Api]
626
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
627
+ #
628
+ # @return [::Google::Cloud::ApiGateway::V1::Api]
629
+ #
630
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
631
+ def get_api request, options = nil
632
+ raise ::ArgumentError, "request must be provided" if request.nil?
633
+
634
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::GetApiRequest
635
+
636
+ # Converts hash and nil to an options object
637
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
638
+
639
+ # Customize the options with defaults
640
+ call_metadata = @config.rpcs.get_api.metadata.to_h
641
+
642
+ # Set x-goog-api-client and x-goog-user-project headers
643
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
644
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
645
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
646
+ transports_version_send: [:rest]
647
+
648
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
649
+
650
+ options.apply_defaults timeout: @config.rpcs.get_api.timeout,
651
+ metadata: call_metadata,
652
+ retry_policy: @config.rpcs.get_api.retry_policy
653
+
654
+ options.apply_defaults timeout: @config.timeout,
655
+ metadata: @config.metadata,
656
+ retry_policy: @config.retry_policy
657
+
658
+ @api_gateway_service_stub.get_api request, options do |result, operation|
659
+ yield result, operation if block_given?
660
+ return result
661
+ end
662
+ rescue ::Gapic::Rest::Error => e
663
+ raise ::Google::Cloud::Error.from_error(e)
664
+ end
665
+
666
+ ##
667
+ # Creates a new Api in a given project and location.
668
+ #
669
+ # @overload create_api(request, options = nil)
670
+ # Pass arguments to `create_api` via a request object, either of type
671
+ # {::Google::Cloud::ApiGateway::V1::CreateApiRequest} or an equivalent Hash.
672
+ #
673
+ # @param request [::Google::Cloud::ApiGateway::V1::CreateApiRequest, ::Hash]
674
+ # A request object representing the call parameters. Required. To specify no
675
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
676
+ # @param options [::Gapic::CallOptions, ::Hash]
677
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
678
+ #
679
+ # @overload create_api(parent: nil, api_id: nil, api: nil)
680
+ # Pass arguments to `create_api` via keyword arguments. Note that at
681
+ # least one keyword argument is required. To specify no parameters, or to keep all
682
+ # the default parameter values, pass an empty Hash as a request object (see above).
683
+ #
684
+ # @param parent [::String]
685
+ # Required. Parent resource of the API, of the form:
686
+ # `projects/*/locations/global`
687
+ # @param api_id [::String]
688
+ # Required. Identifier to assign to the API. Must be unique within scope of
689
+ # the parent resource.
690
+ # @param api [::Google::Cloud::ApiGateway::V1::Api, ::Hash]
691
+ # Required. API resource.
692
+ # @yield [result, operation] Access the result along with the TransportOperation object
693
+ # @yieldparam result [::Gapic::Operation]
694
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
695
+ #
696
+ # @return [::Gapic::Operation]
697
+ #
698
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
699
+ def create_api request, options = nil
700
+ raise ::ArgumentError, "request must be provided" if request.nil?
701
+
702
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::CreateApiRequest
703
+
704
+ # Converts hash and nil to an options object
705
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
706
+
707
+ # Customize the options with defaults
708
+ call_metadata = @config.rpcs.create_api.metadata.to_h
709
+
710
+ # Set x-goog-api-client and x-goog-user-project headers
711
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
712
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
713
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
714
+ transports_version_send: [:rest]
715
+
716
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
717
+
718
+ options.apply_defaults timeout: @config.rpcs.create_api.timeout,
719
+ metadata: call_metadata,
720
+ retry_policy: @config.rpcs.create_api.retry_policy
721
+
722
+ options.apply_defaults timeout: @config.timeout,
723
+ metadata: @config.metadata,
724
+ retry_policy: @config.retry_policy
725
+
726
+ @api_gateway_service_stub.create_api request, options do |result, operation|
727
+ result = ::Gapic::Operation.new result, @operations_client, options: options
728
+ yield result, operation if block_given?
729
+ return result
730
+ end
731
+ rescue ::Gapic::Rest::Error => e
732
+ raise ::Google::Cloud::Error.from_error(e)
733
+ end
734
+
735
+ ##
736
+ # Updates the parameters of a single Api.
737
+ #
738
+ # @overload update_api(request, options = nil)
739
+ # Pass arguments to `update_api` via a request object, either of type
740
+ # {::Google::Cloud::ApiGateway::V1::UpdateApiRequest} or an equivalent Hash.
741
+ #
742
+ # @param request [::Google::Cloud::ApiGateway::V1::UpdateApiRequest, ::Hash]
743
+ # A request object representing the call parameters. Required. To specify no
744
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
745
+ # @param options [::Gapic::CallOptions, ::Hash]
746
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
747
+ #
748
+ # @overload update_api(update_mask: nil, api: nil)
749
+ # Pass arguments to `update_api` via keyword arguments. Note that at
750
+ # least one keyword argument is required. To specify no parameters, or to keep all
751
+ # the default parameter values, pass an empty Hash as a request object (see above).
752
+ #
753
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
754
+ # Field mask is used to specify the fields to be overwritten in the
755
+ # Api resource by the update.
756
+ # The fields specified in the update_mask are relative to the resource, not
757
+ # the full request. A field will be overwritten if it is in the mask. If the
758
+ # user does not provide a mask then all fields will be overwritten.
759
+ # @param api [::Google::Cloud::ApiGateway::V1::Api, ::Hash]
760
+ # Required. API resource.
761
+ # @yield [result, operation] Access the result along with the TransportOperation object
762
+ # @yieldparam result [::Gapic::Operation]
763
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
764
+ #
765
+ # @return [::Gapic::Operation]
766
+ #
767
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
768
+ def update_api request, options = nil
769
+ raise ::ArgumentError, "request must be provided" if request.nil?
770
+
771
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::UpdateApiRequest
772
+
773
+ # Converts hash and nil to an options object
774
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
775
+
776
+ # Customize the options with defaults
777
+ call_metadata = @config.rpcs.update_api.metadata.to_h
778
+
779
+ # Set x-goog-api-client and x-goog-user-project headers
780
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
781
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
782
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
783
+ transports_version_send: [:rest]
784
+
785
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
786
+
787
+ options.apply_defaults timeout: @config.rpcs.update_api.timeout,
788
+ metadata: call_metadata,
789
+ retry_policy: @config.rpcs.update_api.retry_policy
790
+
791
+ options.apply_defaults timeout: @config.timeout,
792
+ metadata: @config.metadata,
793
+ retry_policy: @config.retry_policy
794
+
795
+ @api_gateway_service_stub.update_api request, options do |result, operation|
796
+ result = ::Gapic::Operation.new result, @operations_client, options: options
797
+ yield result, operation if block_given?
798
+ return result
799
+ end
800
+ rescue ::Gapic::Rest::Error => e
801
+ raise ::Google::Cloud::Error.from_error(e)
802
+ end
803
+
804
+ ##
805
+ # Deletes a single Api.
806
+ #
807
+ # @overload delete_api(request, options = nil)
808
+ # Pass arguments to `delete_api` via a request object, either of type
809
+ # {::Google::Cloud::ApiGateway::V1::DeleteApiRequest} or an equivalent Hash.
810
+ #
811
+ # @param request [::Google::Cloud::ApiGateway::V1::DeleteApiRequest, ::Hash]
812
+ # A request object representing the call parameters. Required. To specify no
813
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
814
+ # @param options [::Gapic::CallOptions, ::Hash]
815
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
816
+ #
817
+ # @overload delete_api(name: nil)
818
+ # Pass arguments to `delete_api` via keyword arguments. Note that at
819
+ # least one keyword argument is required. To specify no parameters, or to keep all
820
+ # the default parameter values, pass an empty Hash as a request object (see above).
821
+ #
822
+ # @param name [::String]
823
+ # Required. Resource name of the form:
824
+ # `projects/*/locations/global/apis/*`
825
+ # @yield [result, operation] Access the result along with the TransportOperation object
826
+ # @yieldparam result [::Gapic::Operation]
827
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
828
+ #
829
+ # @return [::Gapic::Operation]
830
+ #
831
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
832
+ def delete_api request, options = nil
833
+ raise ::ArgumentError, "request must be provided" if request.nil?
834
+
835
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::DeleteApiRequest
836
+
837
+ # Converts hash and nil to an options object
838
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
839
+
840
+ # Customize the options with defaults
841
+ call_metadata = @config.rpcs.delete_api.metadata.to_h
842
+
843
+ # Set x-goog-api-client and x-goog-user-project headers
844
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
845
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
846
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
847
+ transports_version_send: [:rest]
848
+
849
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
850
+
851
+ options.apply_defaults timeout: @config.rpcs.delete_api.timeout,
852
+ metadata: call_metadata,
853
+ retry_policy: @config.rpcs.delete_api.retry_policy
854
+
855
+ options.apply_defaults timeout: @config.timeout,
856
+ metadata: @config.metadata,
857
+ retry_policy: @config.retry_policy
858
+
859
+ @api_gateway_service_stub.delete_api request, options do |result, operation|
860
+ result = ::Gapic::Operation.new result, @operations_client, options: options
861
+ yield result, operation if block_given?
862
+ return result
863
+ end
864
+ rescue ::Gapic::Rest::Error => e
865
+ raise ::Google::Cloud::Error.from_error(e)
866
+ end
867
+
868
+ ##
869
+ # Lists ApiConfigs in a given project and location.
870
+ #
871
+ # @overload list_api_configs(request, options = nil)
872
+ # Pass arguments to `list_api_configs` via a request object, either of type
873
+ # {::Google::Cloud::ApiGateway::V1::ListApiConfigsRequest} or an equivalent Hash.
874
+ #
875
+ # @param request [::Google::Cloud::ApiGateway::V1::ListApiConfigsRequest, ::Hash]
876
+ # A request object representing the call parameters. Required. To specify no
877
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
878
+ # @param options [::Gapic::CallOptions, ::Hash]
879
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
880
+ #
881
+ # @overload list_api_configs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
882
+ # Pass arguments to `list_api_configs` via keyword arguments. Note that at
883
+ # least one keyword argument is required. To specify no parameters, or to keep all
884
+ # the default parameter values, pass an empty Hash as a request object (see above).
885
+ #
886
+ # @param parent [::String]
887
+ # Required. Parent resource of the API Config, of the form:
888
+ # `projects/*/locations/global/apis/*`
889
+ # @param page_size [::Integer]
890
+ # Page size.
891
+ # @param page_token [::String]
892
+ # Page token.
893
+ # @param filter [::String]
894
+ # Filter.
895
+ # @param order_by [::String]
896
+ # Order by parameters.
897
+ # @yield [result, operation] Access the result along with the TransportOperation object
898
+ # @yieldparam result [::Google::Cloud::ApiGateway::V1::ListApiConfigsResponse]
899
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
900
+ #
901
+ # @return [::Google::Cloud::ApiGateway::V1::ListApiConfigsResponse]
902
+ #
903
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
904
+ def list_api_configs request, options = nil
905
+ raise ::ArgumentError, "request must be provided" if request.nil?
906
+
907
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::ListApiConfigsRequest
908
+
909
+ # Converts hash and nil to an options object
910
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
911
+
912
+ # Customize the options with defaults
913
+ call_metadata = @config.rpcs.list_api_configs.metadata.to_h
914
+
915
+ # Set x-goog-api-client and x-goog-user-project headers
916
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
917
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
918
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
919
+ transports_version_send: [:rest]
920
+
921
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
922
+
923
+ options.apply_defaults timeout: @config.rpcs.list_api_configs.timeout,
924
+ metadata: call_metadata,
925
+ retry_policy: @config.rpcs.list_api_configs.retry_policy
926
+
927
+ options.apply_defaults timeout: @config.timeout,
928
+ metadata: @config.metadata,
929
+ retry_policy: @config.retry_policy
930
+
931
+ @api_gateway_service_stub.list_api_configs request, options do |result, operation|
932
+ yield result, operation if block_given?
933
+ return result
934
+ end
935
+ rescue ::Gapic::Rest::Error => e
936
+ raise ::Google::Cloud::Error.from_error(e)
937
+ end
938
+
939
+ ##
940
+ # Gets details of a single ApiConfig.
941
+ #
942
+ # @overload get_api_config(request, options = nil)
943
+ # Pass arguments to `get_api_config` via a request object, either of type
944
+ # {::Google::Cloud::ApiGateway::V1::GetApiConfigRequest} or an equivalent Hash.
945
+ #
946
+ # @param request [::Google::Cloud::ApiGateway::V1::GetApiConfigRequest, ::Hash]
947
+ # A request object representing the call parameters. Required. To specify no
948
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
949
+ # @param options [::Gapic::CallOptions, ::Hash]
950
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
951
+ #
952
+ # @overload get_api_config(name: nil, view: nil)
953
+ # Pass arguments to `get_api_config` via keyword arguments. Note that at
954
+ # least one keyword argument is required. To specify no parameters, or to keep all
955
+ # the default parameter values, pass an empty Hash as a request object (see above).
956
+ #
957
+ # @param name [::String]
958
+ # Required. Resource name of the form:
959
+ # `projects/*/locations/global/apis/*/configs/*`
960
+ # @param view [::Google::Cloud::ApiGateway::V1::GetApiConfigRequest::ConfigView]
961
+ # Specifies which fields of the API Config are returned in the response.
962
+ # Defaults to `BASIC` view.
963
+ # @yield [result, operation] Access the result along with the TransportOperation object
964
+ # @yieldparam result [::Google::Cloud::ApiGateway::V1::ApiConfig]
965
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
966
+ #
967
+ # @return [::Google::Cloud::ApiGateway::V1::ApiConfig]
968
+ #
969
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
970
+ def get_api_config request, options = nil
971
+ raise ::ArgumentError, "request must be provided" if request.nil?
972
+
973
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::GetApiConfigRequest
974
+
975
+ # Converts hash and nil to an options object
976
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
977
+
978
+ # Customize the options with defaults
979
+ call_metadata = @config.rpcs.get_api_config.metadata.to_h
980
+
981
+ # Set x-goog-api-client and x-goog-user-project headers
982
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
983
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
984
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
985
+ transports_version_send: [:rest]
986
+
987
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
988
+
989
+ options.apply_defaults timeout: @config.rpcs.get_api_config.timeout,
990
+ metadata: call_metadata,
991
+ retry_policy: @config.rpcs.get_api_config.retry_policy
992
+
993
+ options.apply_defaults timeout: @config.timeout,
994
+ metadata: @config.metadata,
995
+ retry_policy: @config.retry_policy
996
+
997
+ @api_gateway_service_stub.get_api_config request, options do |result, operation|
998
+ yield result, operation if block_given?
999
+ return result
1000
+ end
1001
+ rescue ::Gapic::Rest::Error => e
1002
+ raise ::Google::Cloud::Error.from_error(e)
1003
+ end
1004
+
1005
+ ##
1006
+ # Creates a new ApiConfig in a given project and location.
1007
+ #
1008
+ # @overload create_api_config(request, options = nil)
1009
+ # Pass arguments to `create_api_config` via a request object, either of type
1010
+ # {::Google::Cloud::ApiGateway::V1::CreateApiConfigRequest} or an equivalent Hash.
1011
+ #
1012
+ # @param request [::Google::Cloud::ApiGateway::V1::CreateApiConfigRequest, ::Hash]
1013
+ # A request object representing the call parameters. Required. To specify no
1014
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1015
+ # @param options [::Gapic::CallOptions, ::Hash]
1016
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1017
+ #
1018
+ # @overload create_api_config(parent: nil, api_config_id: nil, api_config: nil)
1019
+ # Pass arguments to `create_api_config` via keyword arguments. Note that at
1020
+ # least one keyword argument is required. To specify no parameters, or to keep all
1021
+ # the default parameter values, pass an empty Hash as a request object (see above).
1022
+ #
1023
+ # @param parent [::String]
1024
+ # Required. Parent resource of the API Config, of the form:
1025
+ # `projects/*/locations/global/apis/*`
1026
+ # @param api_config_id [::String]
1027
+ # Required. Identifier to assign to the API Config. Must be unique within scope of
1028
+ # the parent resource.
1029
+ # @param api_config [::Google::Cloud::ApiGateway::V1::ApiConfig, ::Hash]
1030
+ # Required. API resource.
1031
+ # @yield [result, operation] Access the result along with the TransportOperation object
1032
+ # @yieldparam result [::Gapic::Operation]
1033
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1034
+ #
1035
+ # @return [::Gapic::Operation]
1036
+ #
1037
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1038
+ def create_api_config request, options = nil
1039
+ raise ::ArgumentError, "request must be provided" if request.nil?
1040
+
1041
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::CreateApiConfigRequest
1042
+
1043
+ # Converts hash and nil to an options object
1044
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1045
+
1046
+ # Customize the options with defaults
1047
+ call_metadata = @config.rpcs.create_api_config.metadata.to_h
1048
+
1049
+ # Set x-goog-api-client and x-goog-user-project headers
1050
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1051
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1052
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
1053
+ transports_version_send: [:rest]
1054
+
1055
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1056
+
1057
+ options.apply_defaults timeout: @config.rpcs.create_api_config.timeout,
1058
+ metadata: call_metadata,
1059
+ retry_policy: @config.rpcs.create_api_config.retry_policy
1060
+
1061
+ options.apply_defaults timeout: @config.timeout,
1062
+ metadata: @config.metadata,
1063
+ retry_policy: @config.retry_policy
1064
+
1065
+ @api_gateway_service_stub.create_api_config request, options do |result, operation|
1066
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1067
+ yield result, operation if block_given?
1068
+ return result
1069
+ end
1070
+ rescue ::Gapic::Rest::Error => e
1071
+ raise ::Google::Cloud::Error.from_error(e)
1072
+ end
1073
+
1074
+ ##
1075
+ # Updates the parameters of a single ApiConfig.
1076
+ #
1077
+ # @overload update_api_config(request, options = nil)
1078
+ # Pass arguments to `update_api_config` via a request object, either of type
1079
+ # {::Google::Cloud::ApiGateway::V1::UpdateApiConfigRequest} or an equivalent Hash.
1080
+ #
1081
+ # @param request [::Google::Cloud::ApiGateway::V1::UpdateApiConfigRequest, ::Hash]
1082
+ # A request object representing the call parameters. Required. To specify no
1083
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1084
+ # @param options [::Gapic::CallOptions, ::Hash]
1085
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1086
+ #
1087
+ # @overload update_api_config(update_mask: nil, api_config: nil)
1088
+ # Pass arguments to `update_api_config` via keyword arguments. Note that at
1089
+ # least one keyword argument is required. To specify no parameters, or to keep all
1090
+ # the default parameter values, pass an empty Hash as a request object (see above).
1091
+ #
1092
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1093
+ # Field mask is used to specify the fields to be overwritten in the
1094
+ # ApiConfig resource by the update.
1095
+ # The fields specified in the update_mask are relative to the resource, not
1096
+ # the full request. A field will be overwritten if it is in the mask. If the
1097
+ # user does not provide a mask then all fields will be overwritten.
1098
+ # @param api_config [::Google::Cloud::ApiGateway::V1::ApiConfig, ::Hash]
1099
+ # Required. API Config resource.
1100
+ # @yield [result, operation] Access the result along with the TransportOperation object
1101
+ # @yieldparam result [::Gapic::Operation]
1102
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1103
+ #
1104
+ # @return [::Gapic::Operation]
1105
+ #
1106
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1107
+ def update_api_config request, options = nil
1108
+ raise ::ArgumentError, "request must be provided" if request.nil?
1109
+
1110
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::UpdateApiConfigRequest
1111
+
1112
+ # Converts hash and nil to an options object
1113
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1114
+
1115
+ # Customize the options with defaults
1116
+ call_metadata = @config.rpcs.update_api_config.metadata.to_h
1117
+
1118
+ # Set x-goog-api-client and x-goog-user-project headers
1119
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1120
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1121
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
1122
+ transports_version_send: [:rest]
1123
+
1124
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1125
+
1126
+ options.apply_defaults timeout: @config.rpcs.update_api_config.timeout,
1127
+ metadata: call_metadata,
1128
+ retry_policy: @config.rpcs.update_api_config.retry_policy
1129
+
1130
+ options.apply_defaults timeout: @config.timeout,
1131
+ metadata: @config.metadata,
1132
+ retry_policy: @config.retry_policy
1133
+
1134
+ @api_gateway_service_stub.update_api_config request, options do |result, operation|
1135
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1136
+ yield result, operation if block_given?
1137
+ return result
1138
+ end
1139
+ rescue ::Gapic::Rest::Error => e
1140
+ raise ::Google::Cloud::Error.from_error(e)
1141
+ end
1142
+
1143
+ ##
1144
+ # Deletes a single ApiConfig.
1145
+ #
1146
+ # @overload delete_api_config(request, options = nil)
1147
+ # Pass arguments to `delete_api_config` via a request object, either of type
1148
+ # {::Google::Cloud::ApiGateway::V1::DeleteApiConfigRequest} or an equivalent Hash.
1149
+ #
1150
+ # @param request [::Google::Cloud::ApiGateway::V1::DeleteApiConfigRequest, ::Hash]
1151
+ # A request object representing the call parameters. Required. To specify no
1152
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1153
+ # @param options [::Gapic::CallOptions, ::Hash]
1154
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1155
+ #
1156
+ # @overload delete_api_config(name: nil)
1157
+ # Pass arguments to `delete_api_config` via keyword arguments. Note that at
1158
+ # least one keyword argument is required. To specify no parameters, or to keep all
1159
+ # the default parameter values, pass an empty Hash as a request object (see above).
1160
+ #
1161
+ # @param name [::String]
1162
+ # Required. Resource name of the form:
1163
+ # `projects/*/locations/global/apis/*/configs/*`
1164
+ # @yield [result, operation] Access the result along with the TransportOperation object
1165
+ # @yieldparam result [::Gapic::Operation]
1166
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1167
+ #
1168
+ # @return [::Gapic::Operation]
1169
+ #
1170
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1171
+ def delete_api_config request, options = nil
1172
+ raise ::ArgumentError, "request must be provided" if request.nil?
1173
+
1174
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiGateway::V1::DeleteApiConfigRequest
1175
+
1176
+ # Converts hash and nil to an options object
1177
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1178
+
1179
+ # Customize the options with defaults
1180
+ call_metadata = @config.rpcs.delete_api_config.metadata.to_h
1181
+
1182
+ # Set x-goog-api-client and x-goog-user-project headers
1183
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1184
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1185
+ gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION,
1186
+ transports_version_send: [:rest]
1187
+
1188
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1189
+
1190
+ options.apply_defaults timeout: @config.rpcs.delete_api_config.timeout,
1191
+ metadata: call_metadata,
1192
+ retry_policy: @config.rpcs.delete_api_config.retry_policy
1193
+
1194
+ options.apply_defaults timeout: @config.timeout,
1195
+ metadata: @config.metadata,
1196
+ retry_policy: @config.retry_policy
1197
+
1198
+ @api_gateway_service_stub.delete_api_config request, options do |result, operation|
1199
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1200
+ yield result, operation if block_given?
1201
+ return result
1202
+ end
1203
+ rescue ::Gapic::Rest::Error => e
1204
+ raise ::Google::Cloud::Error.from_error(e)
1205
+ end
1206
+
1207
+ ##
1208
+ # Configuration class for the ApiGatewayService REST API.
1209
+ #
1210
+ # This class represents the configuration for ApiGatewayService REST,
1211
+ # providing control over timeouts, retry behavior, logging, transport
1212
+ # parameters, and other low-level controls. Certain parameters can also be
1213
+ # applied individually to specific RPCs. See
1214
+ # {::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Client::Configuration::Rpcs}
1215
+ # for a list of RPCs that can be configured independently.
1216
+ #
1217
+ # Configuration can be applied globally to all clients, or to a single client
1218
+ # on construction.
1219
+ #
1220
+ # @example
1221
+ #
1222
+ # # Modify the global config, setting the timeout for
1223
+ # # list_gateways to 20 seconds,
1224
+ # # and all remaining timeouts to 10 seconds.
1225
+ # ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Client.configure do |config|
1226
+ # config.timeout = 10.0
1227
+ # config.rpcs.list_gateways.timeout = 20.0
1228
+ # end
1229
+ #
1230
+ # # Apply the above configuration only to a new client.
1231
+ # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Rest::Client.new do |config|
1232
+ # config.timeout = 10.0
1233
+ # config.rpcs.list_gateways.timeout = 20.0
1234
+ # end
1235
+ #
1236
+ # @!attribute [rw] endpoint
1237
+ # The hostname or hostname:port of the service endpoint.
1238
+ # Defaults to `"apigateway.googleapis.com"`.
1239
+ # @return [::String]
1240
+ # @!attribute [rw] credentials
1241
+ # Credentials to send with calls. You may provide any of the following types:
1242
+ # * (`String`) The path to a service account key file in JSON format
1243
+ # * (`Hash`) A service account key as a Hash
1244
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1245
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1246
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1247
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1248
+ # * (`nil`) indicating no credentials
1249
+ # @return [::Object]
1250
+ # @!attribute [rw] scope
1251
+ # The OAuth scopes
1252
+ # @return [::Array<::String>]
1253
+ # @!attribute [rw] lib_name
1254
+ # The library name as recorded in instrumentation and logging
1255
+ # @return [::String]
1256
+ # @!attribute [rw] lib_version
1257
+ # The library version as recorded in instrumentation and logging
1258
+ # @return [::String]
1259
+ # @!attribute [rw] timeout
1260
+ # The call timeout in seconds.
1261
+ # @return [::Numeric]
1262
+ # @!attribute [rw] metadata
1263
+ # Additional headers to be sent with the call.
1264
+ # @return [::Hash{::Symbol=>::String}]
1265
+ # @!attribute [rw] retry_policy
1266
+ # The retry policy. The value is a hash with the following keys:
1267
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1268
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1269
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1270
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1271
+ # trigger a retry.
1272
+ # @return [::Hash]
1273
+ # @!attribute [rw] quota_project
1274
+ # A separate project against which to charge quota.
1275
+ # @return [::String]
1276
+ #
1277
+ class Configuration
1278
+ extend ::Gapic::Config
1279
+
1280
+ config_attr :endpoint, "apigateway.googleapis.com", ::String
1281
+ config_attr :credentials, nil do |value|
1282
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1283
+ allowed.any? { |klass| klass === value }
1284
+ end
1285
+ config_attr :scope, nil, ::String, ::Array, nil
1286
+ config_attr :lib_name, nil, ::String, nil
1287
+ config_attr :lib_version, nil, ::String, nil
1288
+ config_attr :timeout, nil, ::Numeric, nil
1289
+ config_attr :metadata, nil, ::Hash, nil
1290
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1291
+ config_attr :quota_project, nil, ::String, nil
1292
+
1293
+ # @private
1294
+ def initialize parent_config = nil
1295
+ @parent_config = parent_config unless parent_config.nil?
1296
+
1297
+ yield self if block_given?
1298
+ end
1299
+
1300
+ ##
1301
+ # Configurations for individual RPCs
1302
+ # @return [Rpcs]
1303
+ #
1304
+ def rpcs
1305
+ @rpcs ||= begin
1306
+ parent_rpcs = nil
1307
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1308
+ Rpcs.new parent_rpcs
1309
+ end
1310
+ end
1311
+
1312
+ ##
1313
+ # Configuration RPC class for the ApiGatewayService API.
1314
+ #
1315
+ # Includes fields providing the configuration for each RPC in this service.
1316
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1317
+ # the following configuration fields:
1318
+ #
1319
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1320
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1321
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1322
+ # include the following keys:
1323
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1324
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1325
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1326
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1327
+ # trigger a retry.
1328
+ #
1329
+ class Rpcs
1330
+ ##
1331
+ # RPC-specific configuration for `list_gateways`
1332
+ # @return [::Gapic::Config::Method]
1333
+ #
1334
+ attr_reader :list_gateways
1335
+ ##
1336
+ # RPC-specific configuration for `get_gateway`
1337
+ # @return [::Gapic::Config::Method]
1338
+ #
1339
+ attr_reader :get_gateway
1340
+ ##
1341
+ # RPC-specific configuration for `create_gateway`
1342
+ # @return [::Gapic::Config::Method]
1343
+ #
1344
+ attr_reader :create_gateway
1345
+ ##
1346
+ # RPC-specific configuration for `update_gateway`
1347
+ # @return [::Gapic::Config::Method]
1348
+ #
1349
+ attr_reader :update_gateway
1350
+ ##
1351
+ # RPC-specific configuration for `delete_gateway`
1352
+ # @return [::Gapic::Config::Method]
1353
+ #
1354
+ attr_reader :delete_gateway
1355
+ ##
1356
+ # RPC-specific configuration for `list_apis`
1357
+ # @return [::Gapic::Config::Method]
1358
+ #
1359
+ attr_reader :list_apis
1360
+ ##
1361
+ # RPC-specific configuration for `get_api`
1362
+ # @return [::Gapic::Config::Method]
1363
+ #
1364
+ attr_reader :get_api
1365
+ ##
1366
+ # RPC-specific configuration for `create_api`
1367
+ # @return [::Gapic::Config::Method]
1368
+ #
1369
+ attr_reader :create_api
1370
+ ##
1371
+ # RPC-specific configuration for `update_api`
1372
+ # @return [::Gapic::Config::Method]
1373
+ #
1374
+ attr_reader :update_api
1375
+ ##
1376
+ # RPC-specific configuration for `delete_api`
1377
+ # @return [::Gapic::Config::Method]
1378
+ #
1379
+ attr_reader :delete_api
1380
+ ##
1381
+ # RPC-specific configuration for `list_api_configs`
1382
+ # @return [::Gapic::Config::Method]
1383
+ #
1384
+ attr_reader :list_api_configs
1385
+ ##
1386
+ # RPC-specific configuration for `get_api_config`
1387
+ # @return [::Gapic::Config::Method]
1388
+ #
1389
+ attr_reader :get_api_config
1390
+ ##
1391
+ # RPC-specific configuration for `create_api_config`
1392
+ # @return [::Gapic::Config::Method]
1393
+ #
1394
+ attr_reader :create_api_config
1395
+ ##
1396
+ # RPC-specific configuration for `update_api_config`
1397
+ # @return [::Gapic::Config::Method]
1398
+ #
1399
+ attr_reader :update_api_config
1400
+ ##
1401
+ # RPC-specific configuration for `delete_api_config`
1402
+ # @return [::Gapic::Config::Method]
1403
+ #
1404
+ attr_reader :delete_api_config
1405
+
1406
+ # @private
1407
+ def initialize parent_rpcs = nil
1408
+ list_gateways_config = parent_rpcs.list_gateways if parent_rpcs.respond_to? :list_gateways
1409
+ @list_gateways = ::Gapic::Config::Method.new list_gateways_config
1410
+ get_gateway_config = parent_rpcs.get_gateway if parent_rpcs.respond_to? :get_gateway
1411
+ @get_gateway = ::Gapic::Config::Method.new get_gateway_config
1412
+ create_gateway_config = parent_rpcs.create_gateway if parent_rpcs.respond_to? :create_gateway
1413
+ @create_gateway = ::Gapic::Config::Method.new create_gateway_config
1414
+ update_gateway_config = parent_rpcs.update_gateway if parent_rpcs.respond_to? :update_gateway
1415
+ @update_gateway = ::Gapic::Config::Method.new update_gateway_config
1416
+ delete_gateway_config = parent_rpcs.delete_gateway if parent_rpcs.respond_to? :delete_gateway
1417
+ @delete_gateway = ::Gapic::Config::Method.new delete_gateway_config
1418
+ list_apis_config = parent_rpcs.list_apis if parent_rpcs.respond_to? :list_apis
1419
+ @list_apis = ::Gapic::Config::Method.new list_apis_config
1420
+ get_api_config = parent_rpcs.get_api if parent_rpcs.respond_to? :get_api
1421
+ @get_api = ::Gapic::Config::Method.new get_api_config
1422
+ create_api_config = parent_rpcs.create_api if parent_rpcs.respond_to? :create_api
1423
+ @create_api = ::Gapic::Config::Method.new create_api_config
1424
+ update_api_config = parent_rpcs.update_api if parent_rpcs.respond_to? :update_api
1425
+ @update_api = ::Gapic::Config::Method.new update_api_config
1426
+ delete_api_config = parent_rpcs.delete_api if parent_rpcs.respond_to? :delete_api
1427
+ @delete_api = ::Gapic::Config::Method.new delete_api_config
1428
+ list_api_configs_config = parent_rpcs.list_api_configs if parent_rpcs.respond_to? :list_api_configs
1429
+ @list_api_configs = ::Gapic::Config::Method.new list_api_configs_config
1430
+ get_api_config_config = parent_rpcs.get_api_config if parent_rpcs.respond_to? :get_api_config
1431
+ @get_api_config = ::Gapic::Config::Method.new get_api_config_config
1432
+ create_api_config_config = parent_rpcs.create_api_config if parent_rpcs.respond_to? :create_api_config
1433
+ @create_api_config = ::Gapic::Config::Method.new create_api_config_config
1434
+ update_api_config_config = parent_rpcs.update_api_config if parent_rpcs.respond_to? :update_api_config
1435
+ @update_api_config = ::Gapic::Config::Method.new update_api_config_config
1436
+ delete_api_config_config = parent_rpcs.delete_api_config if parent_rpcs.respond_to? :delete_api_config
1437
+ @delete_api_config = ::Gapic::Config::Method.new delete_api_config_config
1438
+
1439
+ yield self if block_given?
1440
+ end
1441
+ end
1442
+ end
1443
+ end
1444
+ end
1445
+ end
1446
+ end
1447
+ end
1448
+ end
1449
+ end