google-cloud-api_gateway-v1 0.1.0 → 0.1.4

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