google-cloud-api_gateway-v1 0.1.1 → 0.1.5

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.
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client::Configuration}
42
42
  # for a description of the configuration fields.
43
43
  #
44
- # ## Example
44
+ # @example
45
45
  #
46
- # To modify the configuration for all ApiGatewayService clients:
47
- #
48
- # ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all ApiGatewayService clients
47
+ # ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
51
50
  #
52
51
  # @yield [config] Configure the Client client.
53
52
  # @yieldparam config [Client::Configuration]
@@ -67,74 +66,47 @@ module Google
67
66
 
68
67
  default_config.rpcs.create_gateway.timeout = 60.0
69
68
  default_config.rpcs.create_gateway.retry_policy = {
70
- initial_delay: 1.0,
71
- max_delay: 60.0,
72
- multiplier: 2,
73
- retry_codes: [2, 14]
69
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
74
70
  }
75
71
 
76
72
  default_config.rpcs.update_gateway.timeout = 60.0
77
73
  default_config.rpcs.update_gateway.retry_policy = {
78
- initial_delay: 1.0,
79
- max_delay: 60.0,
80
- multiplier: 2,
81
- retry_codes: [2, 14]
74
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
82
75
  }
83
76
 
84
77
  default_config.rpcs.delete_gateway.timeout = 60.0
85
78
  default_config.rpcs.delete_gateway.retry_policy = {
86
- initial_delay: 1.0,
87
- max_delay: 60.0,
88
- multiplier: 2,
89
- retry_codes: [2, 14]
79
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
90
80
  }
91
81
 
92
82
  default_config.rpcs.create_api.timeout = 60.0
93
83
  default_config.rpcs.create_api.retry_policy = {
94
- initial_delay: 1.0,
95
- max_delay: 60.0,
96
- multiplier: 2,
97
- retry_codes: [2, 14]
84
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
98
85
  }
99
86
 
100
87
  default_config.rpcs.update_api.timeout = 60.0
101
88
  default_config.rpcs.update_api.retry_policy = {
102
- initial_delay: 1.0,
103
- max_delay: 60.0,
104
- multiplier: 2,
105
- retry_codes: [2, 14]
89
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
106
90
  }
107
91
 
108
92
  default_config.rpcs.delete_api.timeout = 60.0
109
93
  default_config.rpcs.delete_api.retry_policy = {
110
- initial_delay: 1.0,
111
- max_delay: 60.0,
112
- multiplier: 2,
113
- retry_codes: [2, 14]
94
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
114
95
  }
115
96
 
116
97
  default_config.rpcs.create_api_config.timeout = 60.0
117
98
  default_config.rpcs.create_api_config.retry_policy = {
118
- initial_delay: 1.0,
119
- max_delay: 60.0,
120
- multiplier: 2,
121
- retry_codes: [2, 14]
99
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
122
100
  }
123
101
 
124
102
  default_config.rpcs.update_api_config.timeout = 60.0
125
103
  default_config.rpcs.update_api_config.retry_policy = {
126
- initial_delay: 1.0,
127
- max_delay: 60.0,
128
- multiplier: 2,
129
- retry_codes: [2, 14]
104
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
130
105
  }
131
106
 
132
107
  default_config.rpcs.delete_api_config.timeout = 60.0
133
108
  default_config.rpcs.delete_api_config.retry_policy = {
134
- initial_delay: 1.0,
135
- max_delay: 60.0,
136
- multiplier: 2,
137
- retry_codes: [2, 14]
109
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [2, 14]
138
110
  }
139
111
 
140
112
  default_config
@@ -166,19 +138,15 @@ module Google
166
138
  ##
167
139
  # Create a new ApiGatewayService client object.
168
140
  #
169
- # ## Examples
170
- #
171
- # To create a new ApiGatewayService client with the default
172
- # configuration:
141
+ # @example
173
142
  #
174
- # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
143
+ # # Create a client using the default configuration
144
+ # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
175
145
  #
176
- # To create a new ApiGatewayService client with a custom
177
- # configuration:
178
- #
179
- # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new do |config|
180
- # config.timeout = 10.0
181
- # end
146
+ # # Create a client using a custom configuration
147
+ # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new do |config|
148
+ # config.timeout = 10.0
149
+ # end
182
150
  #
183
151
  # @yield [config] Configure the ApiGatewayService client.
184
152
  # @yieldparam config [Client::Configuration]
@@ -198,14 +166,13 @@ module Google
198
166
 
199
167
  # Create credentials
200
168
  credentials = @config.credentials
201
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
169
+ # Use self-signed JWT if the endpoint is unchanged from default,
202
170
  # but only if the default endpoint does not have a region prefix.
203
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
204
- @config.endpoint == Client.configure.endpoint &&
171
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
205
172
  !@config.endpoint.split(".").first.include?("-")
206
173
  credentials ||= Credentials.default scope: @config.scope,
207
174
  enable_self_signed_jwt: enable_self_signed_jwt
208
- if credentials.is_a?(String) || credentials.is_a?(Hash)
175
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
209
176
  credentials = Credentials.new credentials, scope: @config.scope
210
177
  end
211
178
  @quota_project_id = @config.quota_project
@@ -213,6 +180,7 @@ module Google
213
180
 
214
181
  @operations_client = Operations.new do |config|
215
182
  config.credentials = credentials
183
+ config.quota_project = @quota_project_id
216
184
  config.endpoint = @config.endpoint
217
185
  end
218
186
 
@@ -272,6 +240,27 @@ module Google
272
240
  #
273
241
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
274
242
  #
243
+ # @example Basic example
244
+ # require "google/cloud/api_gateway/v1"
245
+ #
246
+ # # Create a client object. The client can be reused for multiple calls.
247
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
248
+ #
249
+ # # Create a request. To set request fields, pass in keyword arguments.
250
+ # request = Google::Cloud::ApiGateway::V1::ListGatewaysRequest.new
251
+ #
252
+ # # Call the list_gateways method.
253
+ # result = client.list_gateways request
254
+ #
255
+ # # The returned object is of type Gapic::PagedEnumerable. You can
256
+ # # iterate over all elements by calling #each, and the enumerable
257
+ # # will lazily make API calls to fetch subsequent pages. Other
258
+ # # methods are also available for managing paging directly.
259
+ # result.each do |response|
260
+ # # Each element is of type ::Google::Cloud::ApiGateway::V1::Gateway.
261
+ # p response
262
+ # end
263
+ #
275
264
  def list_gateways request, options = nil
276
265
  raise ::ArgumentError, "request must be provided" if request.nil?
277
266
 
@@ -289,16 +278,20 @@ module Google
289
278
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
290
279
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
291
280
 
292
- header_params = {
293
- "parent" => request.parent
294
- }
281
+ header_params = {}
282
+ if request.parent
283
+ header_params["parent"] = request.parent
284
+ end
285
+
295
286
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
296
287
  metadata[:"x-goog-request-params"] ||= request_params_header
297
288
 
298
289
  options.apply_defaults timeout: @config.rpcs.list_gateways.timeout,
299
290
  metadata: metadata,
300
291
  retry_policy: @config.rpcs.list_gateways.retry_policy
301
- options.apply_defaults metadata: @config.metadata,
292
+
293
+ options.apply_defaults timeout: @config.timeout,
294
+ metadata: @config.metadata,
302
295
  retry_policy: @config.retry_policy
303
296
 
304
297
  @api_gateway_service_stub.call_rpc :list_gateways, request, options: options do |response, operation|
@@ -340,6 +333,21 @@ module Google
340
333
  #
341
334
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
342
335
  #
336
+ # @example Basic example
337
+ # require "google/cloud/api_gateway/v1"
338
+ #
339
+ # # Create a client object. The client can be reused for multiple calls.
340
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
341
+ #
342
+ # # Create a request. To set request fields, pass in keyword arguments.
343
+ # request = Google::Cloud::ApiGateway::V1::GetGatewayRequest.new
344
+ #
345
+ # # Call the get_gateway method.
346
+ # result = client.get_gateway request
347
+ #
348
+ # # The returned object is of type Google::Cloud::ApiGateway::V1::Gateway.
349
+ # p result
350
+ #
343
351
  def get_gateway request, options = nil
344
352
  raise ::ArgumentError, "request must be provided" if request.nil?
345
353
 
@@ -357,16 +365,20 @@ module Google
357
365
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
358
366
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
359
367
 
360
- header_params = {
361
- "name" => request.name
362
- }
368
+ header_params = {}
369
+ if request.name
370
+ header_params["name"] = request.name
371
+ end
372
+
363
373
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
364
374
  metadata[:"x-goog-request-params"] ||= request_params_header
365
375
 
366
376
  options.apply_defaults timeout: @config.rpcs.get_gateway.timeout,
367
377
  metadata: metadata,
368
378
  retry_policy: @config.rpcs.get_gateway.retry_policy
369
- options.apply_defaults metadata: @config.metadata,
379
+
380
+ options.apply_defaults timeout: @config.timeout,
381
+ metadata: @config.metadata,
370
382
  retry_policy: @config.retry_policy
371
383
 
372
384
  @api_gateway_service_stub.call_rpc :get_gateway, request, options: options do |response, operation|
@@ -412,6 +424,28 @@ module Google
412
424
  #
413
425
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
414
426
  #
427
+ # @example Basic example
428
+ # require "google/cloud/api_gateway/v1"
429
+ #
430
+ # # Create a client object. The client can be reused for multiple calls.
431
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
432
+ #
433
+ # # Create a request. To set request fields, pass in keyword arguments.
434
+ # request = Google::Cloud::ApiGateway::V1::CreateGatewayRequest.new
435
+ #
436
+ # # Call the create_gateway method.
437
+ # result = client.create_gateway request
438
+ #
439
+ # # The returned object is of type Gapic::Operation. You can use this
440
+ # # object to check the status of an operation, cancel it, or wait
441
+ # # for results. Here is how to block until completion:
442
+ # result.wait_until_done! timeout: 60
443
+ # if result.response?
444
+ # p result.response
445
+ # else
446
+ # puts "Error!"
447
+ # end
448
+ #
415
449
  def create_gateway request, options = nil
416
450
  raise ::ArgumentError, "request must be provided" if request.nil?
417
451
 
@@ -429,16 +463,20 @@ module Google
429
463
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
430
464
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
465
 
432
- header_params = {
433
- "parent" => request.parent
434
- }
466
+ header_params = {}
467
+ if request.parent
468
+ header_params["parent"] = request.parent
469
+ end
470
+
435
471
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
436
472
  metadata[:"x-goog-request-params"] ||= request_params_header
437
473
 
438
474
  options.apply_defaults timeout: @config.rpcs.create_gateway.timeout,
439
475
  metadata: metadata,
440
476
  retry_policy: @config.rpcs.create_gateway.retry_policy
441
- options.apply_defaults metadata: @config.metadata,
477
+
478
+ options.apply_defaults timeout: @config.timeout,
479
+ metadata: @config.metadata,
442
480
  retry_policy: @config.retry_policy
443
481
 
444
482
  @api_gateway_service_stub.call_rpc :create_gateway, request, options: options do |response, operation|
@@ -485,6 +523,28 @@ module Google
485
523
  #
486
524
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
487
525
  #
526
+ # @example Basic example
527
+ # require "google/cloud/api_gateway/v1"
528
+ #
529
+ # # Create a client object. The client can be reused for multiple calls.
530
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
531
+ #
532
+ # # Create a request. To set request fields, pass in keyword arguments.
533
+ # request = Google::Cloud::ApiGateway::V1::UpdateGatewayRequest.new
534
+ #
535
+ # # Call the update_gateway method.
536
+ # result = client.update_gateway request
537
+ #
538
+ # # The returned object is of type Gapic::Operation. You can use this
539
+ # # object to check the status of an operation, cancel it, or wait
540
+ # # for results. Here is how to block until completion:
541
+ # result.wait_until_done! timeout: 60
542
+ # if result.response?
543
+ # p result.response
544
+ # else
545
+ # puts "Error!"
546
+ # end
547
+ #
488
548
  def update_gateway request, options = nil
489
549
  raise ::ArgumentError, "request must be provided" if request.nil?
490
550
 
@@ -502,16 +562,20 @@ module Google
502
562
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
503
563
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
504
564
 
505
- header_params = {
506
- "gateway.name" => request.gateway.name
507
- }
565
+ header_params = {}
566
+ if request.gateway&.name
567
+ header_params["gateway.name"] = request.gateway.name
568
+ end
569
+
508
570
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
509
571
  metadata[:"x-goog-request-params"] ||= request_params_header
510
572
 
511
573
  options.apply_defaults timeout: @config.rpcs.update_gateway.timeout,
512
574
  metadata: metadata,
513
575
  retry_policy: @config.rpcs.update_gateway.retry_policy
514
- options.apply_defaults metadata: @config.metadata,
576
+
577
+ options.apply_defaults timeout: @config.timeout,
578
+ metadata: @config.metadata,
515
579
  retry_policy: @config.retry_policy
516
580
 
517
581
  @api_gateway_service_stub.call_rpc :update_gateway, request, options: options do |response, operation|
@@ -553,6 +617,28 @@ module Google
553
617
  #
554
618
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
555
619
  #
620
+ # @example Basic example
621
+ # require "google/cloud/api_gateway/v1"
622
+ #
623
+ # # Create a client object. The client can be reused for multiple calls.
624
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
625
+ #
626
+ # # Create a request. To set request fields, pass in keyword arguments.
627
+ # request = Google::Cloud::ApiGateway::V1::DeleteGatewayRequest.new
628
+ #
629
+ # # Call the delete_gateway method.
630
+ # result = client.delete_gateway request
631
+ #
632
+ # # The returned object is of type Gapic::Operation. You can use this
633
+ # # object to check the status of an operation, cancel it, or wait
634
+ # # for results. Here is how to block until completion:
635
+ # result.wait_until_done! timeout: 60
636
+ # if result.response?
637
+ # p result.response
638
+ # else
639
+ # puts "Error!"
640
+ # end
641
+ #
556
642
  def delete_gateway request, options = nil
557
643
  raise ::ArgumentError, "request must be provided" if request.nil?
558
644
 
@@ -570,16 +656,20 @@ module Google
570
656
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
571
657
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
572
658
 
573
- header_params = {
574
- "name" => request.name
575
- }
659
+ header_params = {}
660
+ if request.name
661
+ header_params["name"] = request.name
662
+ end
663
+
576
664
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
577
665
  metadata[:"x-goog-request-params"] ||= request_params_header
578
666
 
579
667
  options.apply_defaults timeout: @config.rpcs.delete_gateway.timeout,
580
668
  metadata: metadata,
581
669
  retry_policy: @config.rpcs.delete_gateway.retry_policy
582
- options.apply_defaults metadata: @config.metadata,
670
+
671
+ options.apply_defaults timeout: @config.timeout,
672
+ metadata: @config.metadata,
583
673
  retry_policy: @config.retry_policy
584
674
 
585
675
  @api_gateway_service_stub.call_rpc :delete_gateway, request, options: options do |response, operation|
@@ -629,6 +719,27 @@ module Google
629
719
  #
630
720
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
631
721
  #
722
+ # @example Basic example
723
+ # require "google/cloud/api_gateway/v1"
724
+ #
725
+ # # Create a client object. The client can be reused for multiple calls.
726
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
727
+ #
728
+ # # Create a request. To set request fields, pass in keyword arguments.
729
+ # request = Google::Cloud::ApiGateway::V1::ListApisRequest.new
730
+ #
731
+ # # Call the list_apis method.
732
+ # result = client.list_apis request
733
+ #
734
+ # # The returned object is of type Gapic::PagedEnumerable. You can
735
+ # # iterate over all elements by calling #each, and the enumerable
736
+ # # will lazily make API calls to fetch subsequent pages. Other
737
+ # # methods are also available for managing paging directly.
738
+ # result.each do |response|
739
+ # # Each element is of type ::Google::Cloud::ApiGateway::V1::Api.
740
+ # p response
741
+ # end
742
+ #
632
743
  def list_apis request, options = nil
633
744
  raise ::ArgumentError, "request must be provided" if request.nil?
634
745
 
@@ -646,16 +757,20 @@ module Google
646
757
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
647
758
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
648
759
 
649
- header_params = {
650
- "parent" => request.parent
651
- }
760
+ header_params = {}
761
+ if request.parent
762
+ header_params["parent"] = request.parent
763
+ end
764
+
652
765
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
653
766
  metadata[:"x-goog-request-params"] ||= request_params_header
654
767
 
655
768
  options.apply_defaults timeout: @config.rpcs.list_apis.timeout,
656
769
  metadata: metadata,
657
770
  retry_policy: @config.rpcs.list_apis.retry_policy
658
- options.apply_defaults metadata: @config.metadata,
771
+
772
+ options.apply_defaults timeout: @config.timeout,
773
+ metadata: @config.metadata,
659
774
  retry_policy: @config.retry_policy
660
775
 
661
776
  @api_gateway_service_stub.call_rpc :list_apis, request, options: options do |response, operation|
@@ -697,6 +812,21 @@ module Google
697
812
  #
698
813
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
699
814
  #
815
+ # @example Basic example
816
+ # require "google/cloud/api_gateway/v1"
817
+ #
818
+ # # Create a client object. The client can be reused for multiple calls.
819
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
820
+ #
821
+ # # Create a request. To set request fields, pass in keyword arguments.
822
+ # request = Google::Cloud::ApiGateway::V1::GetApiRequest.new
823
+ #
824
+ # # Call the get_api method.
825
+ # result = client.get_api request
826
+ #
827
+ # # The returned object is of type Google::Cloud::ApiGateway::V1::Api.
828
+ # p result
829
+ #
700
830
  def get_api request, options = nil
701
831
  raise ::ArgumentError, "request must be provided" if request.nil?
702
832
 
@@ -714,16 +844,20 @@ module Google
714
844
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
715
845
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
716
846
 
717
- header_params = {
718
- "name" => request.name
719
- }
847
+ header_params = {}
848
+ if request.name
849
+ header_params["name"] = request.name
850
+ end
851
+
720
852
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
721
853
  metadata[:"x-goog-request-params"] ||= request_params_header
722
854
 
723
855
  options.apply_defaults timeout: @config.rpcs.get_api.timeout,
724
856
  metadata: metadata,
725
857
  retry_policy: @config.rpcs.get_api.retry_policy
726
- options.apply_defaults metadata: @config.metadata,
858
+
859
+ options.apply_defaults timeout: @config.timeout,
860
+ metadata: @config.metadata,
727
861
  retry_policy: @config.retry_policy
728
862
 
729
863
  @api_gateway_service_stub.call_rpc :get_api, request, options: options do |response, operation|
@@ -769,6 +903,28 @@ module Google
769
903
  #
770
904
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
771
905
  #
906
+ # @example Basic example
907
+ # require "google/cloud/api_gateway/v1"
908
+ #
909
+ # # Create a client object. The client can be reused for multiple calls.
910
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
911
+ #
912
+ # # Create a request. To set request fields, pass in keyword arguments.
913
+ # request = Google::Cloud::ApiGateway::V1::CreateApiRequest.new
914
+ #
915
+ # # Call the create_api method.
916
+ # result = client.create_api request
917
+ #
918
+ # # The returned object is of type Gapic::Operation. You can use this
919
+ # # object to check the status of an operation, cancel it, or wait
920
+ # # for results. Here is how to block until completion:
921
+ # result.wait_until_done! timeout: 60
922
+ # if result.response?
923
+ # p result.response
924
+ # else
925
+ # puts "Error!"
926
+ # end
927
+ #
772
928
  def create_api request, options = nil
773
929
  raise ::ArgumentError, "request must be provided" if request.nil?
774
930
 
@@ -786,16 +942,20 @@ module Google
786
942
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
787
943
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
788
944
 
789
- header_params = {
790
- "parent" => request.parent
791
- }
945
+ header_params = {}
946
+ if request.parent
947
+ header_params["parent"] = request.parent
948
+ end
949
+
792
950
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
793
951
  metadata[:"x-goog-request-params"] ||= request_params_header
794
952
 
795
953
  options.apply_defaults timeout: @config.rpcs.create_api.timeout,
796
954
  metadata: metadata,
797
955
  retry_policy: @config.rpcs.create_api.retry_policy
798
- options.apply_defaults metadata: @config.metadata,
956
+
957
+ options.apply_defaults timeout: @config.timeout,
958
+ metadata: @config.metadata,
799
959
  retry_policy: @config.retry_policy
800
960
 
801
961
  @api_gateway_service_stub.call_rpc :create_api, request, options: options do |response, operation|
@@ -842,6 +1002,28 @@ module Google
842
1002
  #
843
1003
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
844
1004
  #
1005
+ # @example Basic example
1006
+ # require "google/cloud/api_gateway/v1"
1007
+ #
1008
+ # # Create a client object. The client can be reused for multiple calls.
1009
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
1010
+ #
1011
+ # # Create a request. To set request fields, pass in keyword arguments.
1012
+ # request = Google::Cloud::ApiGateway::V1::UpdateApiRequest.new
1013
+ #
1014
+ # # Call the update_api method.
1015
+ # result = client.update_api request
1016
+ #
1017
+ # # The returned object is of type Gapic::Operation. You can use this
1018
+ # # object to check the status of an operation, cancel it, or wait
1019
+ # # for results. Here is how to block until completion:
1020
+ # result.wait_until_done! timeout: 60
1021
+ # if result.response?
1022
+ # p result.response
1023
+ # else
1024
+ # puts "Error!"
1025
+ # end
1026
+ #
845
1027
  def update_api request, options = nil
846
1028
  raise ::ArgumentError, "request must be provided" if request.nil?
847
1029
 
@@ -859,16 +1041,20 @@ module Google
859
1041
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
860
1042
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
861
1043
 
862
- header_params = {
863
- "api.name" => request.api.name
864
- }
1044
+ header_params = {}
1045
+ if request.api&.name
1046
+ header_params["api.name"] = request.api.name
1047
+ end
1048
+
865
1049
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
866
1050
  metadata[:"x-goog-request-params"] ||= request_params_header
867
1051
 
868
1052
  options.apply_defaults timeout: @config.rpcs.update_api.timeout,
869
1053
  metadata: metadata,
870
1054
  retry_policy: @config.rpcs.update_api.retry_policy
871
- options.apply_defaults metadata: @config.metadata,
1055
+
1056
+ options.apply_defaults timeout: @config.timeout,
1057
+ metadata: @config.metadata,
872
1058
  retry_policy: @config.retry_policy
873
1059
 
874
1060
  @api_gateway_service_stub.call_rpc :update_api, request, options: options do |response, operation|
@@ -910,6 +1096,28 @@ module Google
910
1096
  #
911
1097
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
912
1098
  #
1099
+ # @example Basic example
1100
+ # require "google/cloud/api_gateway/v1"
1101
+ #
1102
+ # # Create a client object. The client can be reused for multiple calls.
1103
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
1104
+ #
1105
+ # # Create a request. To set request fields, pass in keyword arguments.
1106
+ # request = Google::Cloud::ApiGateway::V1::DeleteApiRequest.new
1107
+ #
1108
+ # # Call the delete_api method.
1109
+ # result = client.delete_api request
1110
+ #
1111
+ # # The returned object is of type Gapic::Operation. You can use this
1112
+ # # object to check the status of an operation, cancel it, or wait
1113
+ # # for results. Here is how to block until completion:
1114
+ # result.wait_until_done! timeout: 60
1115
+ # if result.response?
1116
+ # p result.response
1117
+ # else
1118
+ # puts "Error!"
1119
+ # end
1120
+ #
913
1121
  def delete_api request, options = nil
914
1122
  raise ::ArgumentError, "request must be provided" if request.nil?
915
1123
 
@@ -927,16 +1135,20 @@ module Google
927
1135
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
928
1136
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
929
1137
 
930
- header_params = {
931
- "name" => request.name
932
- }
1138
+ header_params = {}
1139
+ if request.name
1140
+ header_params["name"] = request.name
1141
+ end
1142
+
933
1143
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
934
1144
  metadata[:"x-goog-request-params"] ||= request_params_header
935
1145
 
936
1146
  options.apply_defaults timeout: @config.rpcs.delete_api.timeout,
937
1147
  metadata: metadata,
938
1148
  retry_policy: @config.rpcs.delete_api.retry_policy
939
- options.apply_defaults metadata: @config.metadata,
1149
+
1150
+ options.apply_defaults timeout: @config.timeout,
1151
+ metadata: @config.metadata,
940
1152
  retry_policy: @config.retry_policy
941
1153
 
942
1154
  @api_gateway_service_stub.call_rpc :delete_api, request, options: options do |response, operation|
@@ -986,6 +1198,27 @@ module Google
986
1198
  #
987
1199
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
988
1200
  #
1201
+ # @example Basic example
1202
+ # require "google/cloud/api_gateway/v1"
1203
+ #
1204
+ # # Create a client object. The client can be reused for multiple calls.
1205
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
1206
+ #
1207
+ # # Create a request. To set request fields, pass in keyword arguments.
1208
+ # request = Google::Cloud::ApiGateway::V1::ListApiConfigsRequest.new
1209
+ #
1210
+ # # Call the list_api_configs method.
1211
+ # result = client.list_api_configs request
1212
+ #
1213
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1214
+ # # iterate over all elements by calling #each, and the enumerable
1215
+ # # will lazily make API calls to fetch subsequent pages. Other
1216
+ # # methods are also available for managing paging directly.
1217
+ # result.each do |response|
1218
+ # # Each element is of type ::Google::Cloud::ApiGateway::V1::ApiConfig.
1219
+ # p response
1220
+ # end
1221
+ #
989
1222
  def list_api_configs request, options = nil
990
1223
  raise ::ArgumentError, "request must be provided" if request.nil?
991
1224
 
@@ -1003,16 +1236,20 @@ module Google
1003
1236
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
1004
1237
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1005
1238
 
1006
- header_params = {
1007
- "parent" => request.parent
1008
- }
1239
+ header_params = {}
1240
+ if request.parent
1241
+ header_params["parent"] = request.parent
1242
+ end
1243
+
1009
1244
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1010
1245
  metadata[:"x-goog-request-params"] ||= request_params_header
1011
1246
 
1012
1247
  options.apply_defaults timeout: @config.rpcs.list_api_configs.timeout,
1013
1248
  metadata: metadata,
1014
1249
  retry_policy: @config.rpcs.list_api_configs.retry_policy
1015
- options.apply_defaults metadata: @config.metadata,
1250
+
1251
+ options.apply_defaults timeout: @config.timeout,
1252
+ metadata: @config.metadata,
1016
1253
  retry_policy: @config.retry_policy
1017
1254
 
1018
1255
  @api_gateway_service_stub.call_rpc :list_api_configs, request, options: options do |response, operation|
@@ -1057,6 +1294,21 @@ module Google
1057
1294
  #
1058
1295
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1059
1296
  #
1297
+ # @example Basic example
1298
+ # require "google/cloud/api_gateway/v1"
1299
+ #
1300
+ # # Create a client object. The client can be reused for multiple calls.
1301
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
1302
+ #
1303
+ # # Create a request. To set request fields, pass in keyword arguments.
1304
+ # request = Google::Cloud::ApiGateway::V1::GetApiConfigRequest.new
1305
+ #
1306
+ # # Call the get_api_config method.
1307
+ # result = client.get_api_config request
1308
+ #
1309
+ # # The returned object is of type Google::Cloud::ApiGateway::V1::ApiConfig.
1310
+ # p result
1311
+ #
1060
1312
  def get_api_config request, options = nil
1061
1313
  raise ::ArgumentError, "request must be provided" if request.nil?
1062
1314
 
@@ -1074,16 +1326,20 @@ module Google
1074
1326
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
1075
1327
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1076
1328
 
1077
- header_params = {
1078
- "name" => request.name
1079
- }
1329
+ header_params = {}
1330
+ if request.name
1331
+ header_params["name"] = request.name
1332
+ end
1333
+
1080
1334
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1081
1335
  metadata[:"x-goog-request-params"] ||= request_params_header
1082
1336
 
1083
1337
  options.apply_defaults timeout: @config.rpcs.get_api_config.timeout,
1084
1338
  metadata: metadata,
1085
1339
  retry_policy: @config.rpcs.get_api_config.retry_policy
1086
- options.apply_defaults metadata: @config.metadata,
1340
+
1341
+ options.apply_defaults timeout: @config.timeout,
1342
+ metadata: @config.metadata,
1087
1343
  retry_policy: @config.retry_policy
1088
1344
 
1089
1345
  @api_gateway_service_stub.call_rpc :get_api_config, request, options: options do |response, operation|
@@ -1129,6 +1385,28 @@ module Google
1129
1385
  #
1130
1386
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1131
1387
  #
1388
+ # @example Basic example
1389
+ # require "google/cloud/api_gateway/v1"
1390
+ #
1391
+ # # Create a client object. The client can be reused for multiple calls.
1392
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
1393
+ #
1394
+ # # Create a request. To set request fields, pass in keyword arguments.
1395
+ # request = Google::Cloud::ApiGateway::V1::CreateApiConfigRequest.new
1396
+ #
1397
+ # # Call the create_api_config method.
1398
+ # result = client.create_api_config request
1399
+ #
1400
+ # # The returned object is of type Gapic::Operation. You can use this
1401
+ # # object to check the status of an operation, cancel it, or wait
1402
+ # # for results. Here is how to block until completion:
1403
+ # result.wait_until_done! timeout: 60
1404
+ # if result.response?
1405
+ # p result.response
1406
+ # else
1407
+ # puts "Error!"
1408
+ # end
1409
+ #
1132
1410
  def create_api_config request, options = nil
1133
1411
  raise ::ArgumentError, "request must be provided" if request.nil?
1134
1412
 
@@ -1146,16 +1424,20 @@ module Google
1146
1424
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
1147
1425
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1148
1426
 
1149
- header_params = {
1150
- "parent" => request.parent
1151
- }
1427
+ header_params = {}
1428
+ if request.parent
1429
+ header_params["parent"] = request.parent
1430
+ end
1431
+
1152
1432
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1153
1433
  metadata[:"x-goog-request-params"] ||= request_params_header
1154
1434
 
1155
1435
  options.apply_defaults timeout: @config.rpcs.create_api_config.timeout,
1156
1436
  metadata: metadata,
1157
1437
  retry_policy: @config.rpcs.create_api_config.retry_policy
1158
- options.apply_defaults metadata: @config.metadata,
1438
+
1439
+ options.apply_defaults timeout: @config.timeout,
1440
+ metadata: @config.metadata,
1159
1441
  retry_policy: @config.retry_policy
1160
1442
 
1161
1443
  @api_gateway_service_stub.call_rpc :create_api_config, request, options: options do |response, operation|
@@ -1202,6 +1484,28 @@ module Google
1202
1484
  #
1203
1485
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1204
1486
  #
1487
+ # @example Basic example
1488
+ # require "google/cloud/api_gateway/v1"
1489
+ #
1490
+ # # Create a client object. The client can be reused for multiple calls.
1491
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
1492
+ #
1493
+ # # Create a request. To set request fields, pass in keyword arguments.
1494
+ # request = Google::Cloud::ApiGateway::V1::UpdateApiConfigRequest.new
1495
+ #
1496
+ # # Call the update_api_config method.
1497
+ # result = client.update_api_config request
1498
+ #
1499
+ # # The returned object is of type Gapic::Operation. You can use this
1500
+ # # object to check the status of an operation, cancel it, or wait
1501
+ # # for results. Here is how to block until completion:
1502
+ # result.wait_until_done! timeout: 60
1503
+ # if result.response?
1504
+ # p result.response
1505
+ # else
1506
+ # puts "Error!"
1507
+ # end
1508
+ #
1205
1509
  def update_api_config request, options = nil
1206
1510
  raise ::ArgumentError, "request must be provided" if request.nil?
1207
1511
 
@@ -1219,16 +1523,20 @@ module Google
1219
1523
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
1220
1524
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1221
1525
 
1222
- header_params = {
1223
- "api_config.name" => request.api_config.name
1224
- }
1526
+ header_params = {}
1527
+ if request.api_config&.name
1528
+ header_params["api_config.name"] = request.api_config.name
1529
+ end
1530
+
1225
1531
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1226
1532
  metadata[:"x-goog-request-params"] ||= request_params_header
1227
1533
 
1228
1534
  options.apply_defaults timeout: @config.rpcs.update_api_config.timeout,
1229
1535
  metadata: metadata,
1230
1536
  retry_policy: @config.rpcs.update_api_config.retry_policy
1231
- options.apply_defaults metadata: @config.metadata,
1537
+
1538
+ options.apply_defaults timeout: @config.timeout,
1539
+ metadata: @config.metadata,
1232
1540
  retry_policy: @config.retry_policy
1233
1541
 
1234
1542
  @api_gateway_service_stub.call_rpc :update_api_config, request, options: options do |response, operation|
@@ -1270,6 +1578,28 @@ module Google
1270
1578
  #
1271
1579
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1272
1580
  #
1581
+ # @example Basic example
1582
+ # require "google/cloud/api_gateway/v1"
1583
+ #
1584
+ # # Create a client object. The client can be reused for multiple calls.
1585
+ # client = Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new
1586
+ #
1587
+ # # Create a request. To set request fields, pass in keyword arguments.
1588
+ # request = Google::Cloud::ApiGateway::V1::DeleteApiConfigRequest.new
1589
+ #
1590
+ # # Call the delete_api_config method.
1591
+ # result = client.delete_api_config request
1592
+ #
1593
+ # # The returned object is of type Gapic::Operation. You can use this
1594
+ # # object to check the status of an operation, cancel it, or wait
1595
+ # # for results. Here is how to block until completion:
1596
+ # result.wait_until_done! timeout: 60
1597
+ # if result.response?
1598
+ # p result.response
1599
+ # else
1600
+ # puts "Error!"
1601
+ # end
1602
+ #
1273
1603
  def delete_api_config request, options = nil
1274
1604
  raise ::ArgumentError, "request must be provided" if request.nil?
1275
1605
 
@@ -1287,16 +1617,20 @@ module Google
1287
1617
  gapic_version: ::Google::Cloud::ApiGateway::V1::VERSION
1288
1618
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1289
1619
 
1290
- header_params = {
1291
- "name" => request.name
1292
- }
1620
+ header_params = {}
1621
+ if request.name
1622
+ header_params["name"] = request.name
1623
+ end
1624
+
1293
1625
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1294
1626
  metadata[:"x-goog-request-params"] ||= request_params_header
1295
1627
 
1296
1628
  options.apply_defaults timeout: @config.rpcs.delete_api_config.timeout,
1297
1629
  metadata: metadata,
1298
1630
  retry_policy: @config.rpcs.delete_api_config.retry_policy
1299
- options.apply_defaults metadata: @config.metadata,
1631
+
1632
+ options.apply_defaults timeout: @config.timeout,
1633
+ metadata: @config.metadata,
1300
1634
  retry_policy: @config.retry_policy
1301
1635
 
1302
1636
  @api_gateway_service_stub.call_rpc :delete_api_config, request, options: options do |response, operation|
@@ -1321,22 +1655,21 @@ module Google
1321
1655
  # Configuration can be applied globally to all clients, or to a single client
1322
1656
  # on construction.
1323
1657
  #
1324
- # # Examples
1325
- #
1326
- # To modify the global config, setting the timeout for list_gateways
1327
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1328
- #
1329
- # ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.configure do |config|
1330
- # config.timeout = 10.0
1331
- # config.rpcs.list_gateways.timeout = 20.0
1332
- # end
1333
- #
1334
- # To apply the above configuration only to a new client:
1335
- #
1336
- # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new do |config|
1337
- # config.timeout = 10.0
1338
- # config.rpcs.list_gateways.timeout = 20.0
1339
- # end
1658
+ # @example
1659
+ #
1660
+ # # Modify the global config, setting the timeout for
1661
+ # # list_gateways to 20 seconds,
1662
+ # # and all remaining timeouts to 10 seconds.
1663
+ # ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.configure do |config|
1664
+ # config.timeout = 10.0
1665
+ # config.rpcs.list_gateways.timeout = 20.0
1666
+ # end
1667
+ #
1668
+ # # Apply the above configuration only to a new client.
1669
+ # client = ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Client.new do |config|
1670
+ # config.timeout = 10.0
1671
+ # config.rpcs.list_gateways.timeout = 20.0
1672
+ # end
1340
1673
  #
1341
1674
  # @!attribute [rw] endpoint
1342
1675
  # The hostname or hostname:port of the service endpoint.