google-cloud-config_service-v1 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -160,15 +160,27 @@ module Google
160
160
  endpoint: @config.endpoint,
161
161
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
162
162
  universe_domain: @config.universe_domain,
163
- credentials: credentials
163
+ credentials: credentials,
164
+ logger: @config.logger
164
165
  )
165
166
 
167
+ @config_stub.logger(stub: true)&.info do |entry|
168
+ entry.set_system_name
169
+ entry.set_service
170
+ entry.message = "Created client for #{entry.service}"
171
+ entry.set_credentials_fields credentials
172
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
173
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
174
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
175
+ end
176
+
166
177
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
167
178
  config.credentials = credentials
168
179
  config.quota_project = @quota_project_id
169
180
  config.endpoint = @config_stub.endpoint
170
181
  config.universe_domain = @config_stub.universe_domain
171
182
  config.bindings_override = @config.bindings_override
183
+ config.logger = @config_stub.logger if config.respond_to? :logger=
172
184
  end
173
185
 
174
186
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -177,6 +189,7 @@ module Google
177
189
  config.endpoint = @config_stub.endpoint
178
190
  config.universe_domain = @config_stub.universe_domain
179
191
  config.bindings_override = @config.bindings_override
192
+ config.logger = @config_stub.logger if config.respond_to? :logger=
180
193
  end
181
194
  end
182
195
 
@@ -201,6 +214,15 @@ module Google
201
214
  #
202
215
  attr_reader :iam_policy_client
203
216
 
217
+ ##
218
+ # The logger used for request/response debug logging.
219
+ #
220
+ # @return [Logger]
221
+ #
222
+ def logger
223
+ @config_stub.logger
224
+ end
225
+
204
226
  # Service calls
205
227
 
206
228
  ##
@@ -314,7 +336,6 @@ module Google
314
336
 
315
337
  @config_stub.list_deployments request, options do |result, operation|
316
338
  yield result, operation if block_given?
317
- return result
318
339
  end
319
340
  rescue ::Gapic::Rest::Error => e
320
341
  raise ::Google::Cloud::Error.from_error(e)
@@ -394,7 +415,6 @@ module Google
394
415
 
395
416
  @config_stub.get_deployment request, options do |result, operation|
396
417
  yield result, operation if block_given?
397
- return result
398
418
  end
399
419
  rescue ::Gapic::Rest::Error => e
400
420
  raise ::Google::Cloud::Error.from_error(e)
@@ -501,7 +521,7 @@ module Google
501
521
  @config_stub.create_deployment request, options do |result, operation|
502
522
  result = ::Gapic::Operation.new result, @operations_client, options: options
503
523
  yield result, operation if block_given?
504
- return result
524
+ throw :response, result
505
525
  end
506
526
  rescue ::Gapic::Rest::Error => e
507
527
  raise ::Google::Cloud::Error.from_error(e)
@@ -613,7 +633,7 @@ module Google
613
633
  @config_stub.update_deployment request, options do |result, operation|
614
634
  result = ::Gapic::Operation.new result, @operations_client, options: options
615
635
  yield result, operation if block_given?
616
- return result
636
+ throw :response, result
617
637
  end
618
638
  rescue ::Gapic::Rest::Error => e
619
639
  raise ::Google::Cloud::Error.from_error(e)
@@ -723,7 +743,7 @@ module Google
723
743
  @config_stub.delete_deployment request, options do |result, operation|
724
744
  result = ::Gapic::Operation.new result, @operations_client, options: options
725
745
  yield result, operation if block_given?
726
- return result
746
+ throw :response, result
727
747
  end
728
748
  rescue ::Gapic::Rest::Error => e
729
749
  raise ::Google::Cloud::Error.from_error(e)
@@ -839,7 +859,6 @@ module Google
839
859
 
840
860
  @config_stub.list_revisions request, options do |result, operation|
841
861
  yield result, operation if block_given?
842
- return result
843
862
  end
844
863
  rescue ::Gapic::Rest::Error => e
845
864
  raise ::Google::Cloud::Error.from_error(e)
@@ -919,7 +938,6 @@ module Google
919
938
 
920
939
  @config_stub.get_revision request, options do |result, operation|
921
940
  yield result, operation if block_given?
922
- return result
923
941
  end
924
942
  rescue ::Gapic::Rest::Error => e
925
943
  raise ::Google::Cloud::Error.from_error(e)
@@ -1000,14 +1018,13 @@ module Google
1000
1018
 
1001
1019
  @config_stub.get_resource request, options do |result, operation|
1002
1020
  yield result, operation if block_given?
1003
- return result
1004
1021
  end
1005
1022
  rescue ::Gapic::Rest::Error => e
1006
1023
  raise ::Google::Cloud::Error.from_error(e)
1007
1024
  end
1008
1025
 
1009
1026
  ##
1010
- # Lists {::Google::Cloud::ConfigService::V1::Resource Resource}s in a given revision.
1027
+ # Lists {::Google::Cloud::ConfigService::V1::Resource Resources} in a given revision.
1011
1028
  #
1012
1029
  # @overload list_resources(request, options = nil)
1013
1030
  # Pass arguments to `list_resources` via a request object, either of type
@@ -1108,7 +1125,6 @@ module Google
1108
1125
 
1109
1126
  @config_stub.list_resources request, options do |result, operation|
1110
1127
  yield result, operation if block_given?
1111
- return result
1112
1128
  end
1113
1129
  rescue ::Gapic::Rest::Error => e
1114
1130
  raise ::Google::Cloud::Error.from_error(e)
@@ -1193,7 +1209,6 @@ module Google
1193
1209
 
1194
1210
  @config_stub.export_deployment_statefile request, options do |result, operation|
1195
1211
  yield result, operation if block_given?
1196
- return result
1197
1212
  end
1198
1213
  rescue ::Gapic::Rest::Error => e
1199
1214
  raise ::Google::Cloud::Error.from_error(e)
@@ -1274,7 +1289,6 @@ module Google
1274
1289
 
1275
1290
  @config_stub.export_revision_statefile request, options do |result, operation|
1276
1291
  yield result, operation if block_given?
1277
- return result
1278
1292
  end
1279
1293
  rescue ::Gapic::Rest::Error => e
1280
1294
  raise ::Google::Cloud::Error.from_error(e)
@@ -1361,7 +1375,6 @@ module Google
1361
1375
 
1362
1376
  @config_stub.import_statefile request, options do |result, operation|
1363
1377
  yield result, operation if block_given?
1364
- return result
1365
1378
  end
1366
1379
  rescue ::Gapic::Rest::Error => e
1367
1380
  raise ::Google::Cloud::Error.from_error(e)
@@ -1444,7 +1457,6 @@ module Google
1444
1457
 
1445
1458
  @config_stub.delete_statefile request, options do |result, operation|
1446
1459
  yield result, operation if block_given?
1447
- return result
1448
1460
  end
1449
1461
  rescue ::Gapic::Rest::Error => e
1450
1462
  raise ::Google::Cloud::Error.from_error(e)
@@ -1532,7 +1544,7 @@ module Google
1532
1544
  @config_stub.lock_deployment request, options do |result, operation|
1533
1545
  result = ::Gapic::Operation.new result, @operations_client, options: options
1534
1546
  yield result, operation if block_given?
1535
- return result
1547
+ throw :response, result
1536
1548
  end
1537
1549
  rescue ::Gapic::Rest::Error => e
1538
1550
  raise ::Google::Cloud::Error.from_error(e)
@@ -1622,7 +1634,7 @@ module Google
1622
1634
  @config_stub.unlock_deployment request, options do |result, operation|
1623
1635
  result = ::Gapic::Operation.new result, @operations_client, options: options
1624
1636
  yield result, operation if block_given?
1625
- return result
1637
+ throw :response, result
1626
1638
  end
1627
1639
  rescue ::Gapic::Rest::Error => e
1628
1640
  raise ::Google::Cloud::Error.from_error(e)
@@ -1702,7 +1714,6 @@ module Google
1702
1714
 
1703
1715
  @config_stub.export_lock_info request, options do |result, operation|
1704
1716
  yield result, operation if block_given?
1705
- return result
1706
1717
  end
1707
1718
  rescue ::Gapic::Rest::Error => e
1708
1719
  raise ::Google::Cloud::Error.from_error(e)
@@ -1808,7 +1819,7 @@ module Google
1808
1819
  @config_stub.create_preview request, options do |result, operation|
1809
1820
  result = ::Gapic::Operation.new result, @operations_client, options: options
1810
1821
  yield result, operation if block_given?
1811
- return result
1822
+ throw :response, result
1812
1823
  end
1813
1824
  rescue ::Gapic::Rest::Error => e
1814
1825
  raise ::Google::Cloud::Error.from_error(e)
@@ -1888,7 +1899,6 @@ module Google
1888
1899
 
1889
1900
  @config_stub.get_preview request, options do |result, operation|
1890
1901
  yield result, operation if block_given?
1891
- return result
1892
1902
  end
1893
1903
  rescue ::Gapic::Rest::Error => e
1894
1904
  raise ::Google::Cloud::Error.from_error(e)
@@ -2005,7 +2015,6 @@ module Google
2005
2015
 
2006
2016
  @config_stub.list_previews request, options do |result, operation|
2007
2017
  yield result, operation if block_given?
2008
- return result
2009
2018
  end
2010
2019
  rescue ::Gapic::Rest::Error => e
2011
2020
  raise ::Google::Cloud::Error.from_error(e)
@@ -2107,7 +2116,7 @@ module Google
2107
2116
  @config_stub.delete_preview request, options do |result, operation|
2108
2117
  result = ::Gapic::Operation.new result, @operations_client, options: options
2109
2118
  yield result, operation if block_given?
2110
- return result
2119
+ throw :response, result
2111
2120
  end
2112
2121
  rescue ::Gapic::Rest::Error => e
2113
2122
  raise ::Google::Cloud::Error.from_error(e)
@@ -2188,7 +2197,6 @@ module Google
2188
2197
 
2189
2198
  @config_stub.export_preview_result request, options do |result, operation|
2190
2199
  yield result, operation if block_given?
2191
- return result
2192
2200
  end
2193
2201
  rescue ::Gapic::Rest::Error => e
2194
2202
  raise ::Google::Cloud::Error.from_error(e)
@@ -2293,7 +2301,6 @@ module Google
2293
2301
 
2294
2302
  @config_stub.list_terraform_versions request, options do |result, operation|
2295
2303
  yield result, operation if block_given?
2296
- return result
2297
2304
  end
2298
2305
  rescue ::Gapic::Rest::Error => e
2299
2306
  raise ::Google::Cloud::Error.from_error(e)
@@ -2374,7 +2381,6 @@ module Google
2374
2381
 
2375
2382
  @config_stub.get_terraform_version request, options do |result, operation|
2376
2383
  yield result, operation if block_given?
2377
- return result
2378
2384
  end
2379
2385
  rescue ::Gapic::Rest::Error => e
2380
2386
  raise ::Google::Cloud::Error.from_error(e)
@@ -2454,6 +2460,11 @@ module Google
2454
2460
  # default endpoint URL. The default value of nil uses the environment
2455
2461
  # universe (usually the default "googleapis.com" universe).
2456
2462
  # @return [::String,nil]
2463
+ # @!attribute [rw] logger
2464
+ # A custom logger to use for request/response debug logging, or the value
2465
+ # `:default` (the default) to construct a default logger, or `nil` to
2466
+ # explicitly disable logging.
2467
+ # @return [::Logger,:default,nil]
2457
2468
  #
2458
2469
  class Configuration
2459
2470
  extend ::Gapic::Config
@@ -2482,6 +2493,7 @@ module Google
2482
2493
  # by the host service.
2483
2494
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2484
2495
  config_attr :bindings_override, {}, ::Hash, nil
2496
+ config_attr :logger, :default, ::Logger, nil, :default
2485
2497
 
2486
2498
  # @private
2487
2499
  def initialize parent_config = nil
@@ -115,14 +115,6 @@ module Google
115
115
  # Lists operations that match the specified filter in the request. If the
116
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
117
  #
118
- # NOTE: the `name` binding allows API services to override the binding
119
- # to use different resource name schemes, such as `users/*/operations`. To
120
- # override the binding, API services can add a binding such as
121
- # `"/v1/{name=users/*}/operations"` to their service configuration.
122
- # For backwards compatibility, the default name includes the operations
123
- # collection id, however overriding users must ensure the name binding
124
- # is the parent resource, without the operations collection id.
125
- #
126
118
  # @overload list_operations(request, options = nil)
127
119
  # Pass arguments to `list_operations` via a request object, either of type
128
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -204,7 +196,7 @@ module Google
204
196
  @operations_stub.list_operations request, options do |result, operation|
205
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
206
198
  yield result, operation if block_given?
207
- return result
199
+ throw :response, result
208
200
  end
209
201
  rescue ::Gapic::Rest::Error => e
210
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,7 +285,7 @@ module Google
293
285
  @operations_stub.get_operation request, options do |result, operation|
294
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
295
287
  yield result, operation if block_given?
296
- return result
288
+ throw :response, result
297
289
  end
298
290
  rescue ::Gapic::Rest::Error => e
299
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,7 +367,6 @@ module Google
375
367
 
376
368
  @operations_stub.delete_operation request, options do |result, operation|
377
369
  yield result, operation if block_given?
378
- return result
379
370
  end
380
371
  rescue ::Gapic::Rest::Error => e
381
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -390,8 +381,9 @@ module Google
390
381
  # other methods to check whether the cancellation succeeded or whether the
391
382
  # operation completed despite cancellation. On successful cancellation,
392
383
  # the operation is not deleted; instead, it becomes an operation with
393
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
394
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
395
387
  #
396
388
  # @overload cancel_operation(request, options = nil)
397
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -463,7 +455,6 @@ module Google
463
455
 
464
456
  @operations_stub.cancel_operation request, options do |result, operation|
465
457
  yield result, operation if block_given?
466
- return result
467
458
  end
468
459
  rescue ::Gapic::Rest::Error => e
469
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -543,6 +534,11 @@ module Google
543
534
  # default endpoint URL. The default value of nil uses the environment
544
535
  # universe (usually the default "googleapis.com" universe).
545
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
546
542
  #
547
543
  class Configuration
548
544
  extend ::Gapic::Config
@@ -564,6 +560,7 @@ module Google
564
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
561
  config_attr :quota_project, nil, ::String, nil
566
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
567
564
 
568
565
  # @private
569
566
  def initialize parent_config = nil
@@ -683,16 +680,18 @@ module Google
683
680
 
684
681
  response = @client_stub.make_http_request(
685
682
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
689
687
  options: options
690
688
  )
691
689
  operation = ::Gapic::Rest::TransportOperation.new response
692
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
696
695
  end
697
696
 
698
697
  ##
@@ -721,16 +720,18 @@ module Google
721
720
 
722
721
  response = @client_stub.make_http_request(
723
722
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
727
727
  options: options
728
728
  )
729
729
  operation = ::Gapic::Rest::TransportOperation.new response
730
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
734
735
  end
735
736
 
736
737
  ##
@@ -759,16 +760,18 @@ module Google
759
760
 
760
761
  response = @client_stub.make_http_request(
761
762
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
765
767
  options: options
766
768
  )
767
769
  operation = ::Gapic::Rest::TransportOperation.new response
768
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
772
775
  end
773
776
 
774
777
  ##
@@ -797,16 +800,18 @@ module Google
797
800
 
798
801
  response = @client_stub.make_http_request(
799
802
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
803
807
  options: options
804
808
  )
805
809
  operation = ::Gapic::Rest::TransportOperation.new response
806
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
810
815
  end
811
816
 
812
817
  ##