google-cloud-certificate_manager-v1 0.10.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -303,15 +303,27 @@ module Google
303
303
  endpoint: @config.endpoint,
304
304
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
305
305
  universe_domain: @config.universe_domain,
306
- credentials: credentials
306
+ credentials: credentials,
307
+ logger: @config.logger
307
308
  )
308
309
 
310
+ @certificate_manager_stub.logger(stub: true)&.info do |entry|
311
+ entry.set_system_name
312
+ entry.set_service
313
+ entry.message = "Created client for #{entry.service}"
314
+ entry.set_credentials_fields credentials
315
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
316
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
317
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
318
+ end
319
+
309
320
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
310
321
  config.credentials = credentials
311
322
  config.quota_project = @quota_project_id
312
323
  config.endpoint = @certificate_manager_stub.endpoint
313
324
  config.universe_domain = @certificate_manager_stub.universe_domain
314
325
  config.bindings_override = @config.bindings_override
326
+ config.logger = @certificate_manager_stub.logger if config.respond_to? :logger=
315
327
  end
316
328
  end
317
329
 
@@ -329,6 +341,15 @@ module Google
329
341
  #
330
342
  attr_reader :location_client
331
343
 
344
+ ##
345
+ # The logger used for request/response debug logging.
346
+ #
347
+ # @return [Logger]
348
+ #
349
+ def logger
350
+ @certificate_manager_stub.logger
351
+ end
352
+
332
353
  # Service calls
333
354
 
334
355
  ##
@@ -421,7 +442,6 @@ module Google
421
442
 
422
443
  @certificate_manager_stub.list_certificates request, options do |result, operation|
423
444
  yield result, operation if block_given?
424
- return result
425
445
  end
426
446
  rescue ::Gapic::Rest::Error => e
427
447
  raise ::Google::Cloud::Error.from_error(e)
@@ -501,7 +521,6 @@ module Google
501
521
 
502
522
  @certificate_manager_stub.get_certificate request, options do |result, operation|
503
523
  yield result, operation if block_given?
504
- return result
505
524
  end
506
525
  rescue ::Gapic::Rest::Error => e
507
526
  raise ::Google::Cloud::Error.from_error(e)
@@ -593,7 +612,7 @@ module Google
593
612
  @certificate_manager_stub.create_certificate request, options do |result, operation|
594
613
  result = ::Gapic::Operation.new result, @operations_client, options: options
595
614
  yield result, operation if block_given?
596
- return result
615
+ throw :response, result
597
616
  end
598
617
  rescue ::Gapic::Rest::Error => e
599
618
  raise ::Google::Cloud::Error.from_error(e)
@@ -684,7 +703,7 @@ module Google
684
703
  @certificate_manager_stub.update_certificate request, options do |result, operation|
685
704
  result = ::Gapic::Operation.new result, @operations_client, options: options
686
705
  yield result, operation if block_given?
687
- return result
706
+ throw :response, result
688
707
  end
689
708
  rescue ::Gapic::Rest::Error => e
690
709
  raise ::Google::Cloud::Error.from_error(e)
@@ -772,7 +791,7 @@ module Google
772
791
  @certificate_manager_stub.delete_certificate request, options do |result, operation|
773
792
  result = ::Gapic::Operation.new result, @operations_client, options: options
774
793
  yield result, operation if block_given?
775
- return result
794
+ throw :response, result
776
795
  end
777
796
  rescue ::Gapic::Rest::Error => e
778
797
  raise ::Google::Cloud::Error.from_error(e)
@@ -868,7 +887,6 @@ module Google
868
887
 
869
888
  @certificate_manager_stub.list_certificate_maps request, options do |result, operation|
870
889
  yield result, operation if block_given?
871
- return result
872
890
  end
873
891
  rescue ::Gapic::Rest::Error => e
874
892
  raise ::Google::Cloud::Error.from_error(e)
@@ -948,7 +966,6 @@ module Google
948
966
 
949
967
  @certificate_manager_stub.get_certificate_map request, options do |result, operation|
950
968
  yield result, operation if block_given?
951
- return result
952
969
  end
953
970
  rescue ::Gapic::Rest::Error => e
954
971
  raise ::Google::Cloud::Error.from_error(e)
@@ -1040,7 +1057,7 @@ module Google
1040
1057
  @certificate_manager_stub.create_certificate_map request, options do |result, operation|
1041
1058
  result = ::Gapic::Operation.new result, @operations_client, options: options
1042
1059
  yield result, operation if block_given?
1043
- return result
1060
+ throw :response, result
1044
1061
  end
1045
1062
  rescue ::Gapic::Rest::Error => e
1046
1063
  raise ::Google::Cloud::Error.from_error(e)
@@ -1131,7 +1148,7 @@ module Google
1131
1148
  @certificate_manager_stub.update_certificate_map request, options do |result, operation|
1132
1149
  result = ::Gapic::Operation.new result, @operations_client, options: options
1133
1150
  yield result, operation if block_given?
1134
- return result
1151
+ throw :response, result
1135
1152
  end
1136
1153
  rescue ::Gapic::Rest::Error => e
1137
1154
  raise ::Google::Cloud::Error.from_error(e)
@@ -1221,7 +1238,7 @@ module Google
1221
1238
  @certificate_manager_stub.delete_certificate_map request, options do |result, operation|
1222
1239
  result = ::Gapic::Operation.new result, @operations_client, options: options
1223
1240
  yield result, operation if block_given?
1224
- return result
1241
+ throw :response, result
1225
1242
  end
1226
1243
  rescue ::Gapic::Rest::Error => e
1227
1244
  raise ::Google::Cloud::Error.from_error(e)
@@ -1322,7 +1339,6 @@ module Google
1322
1339
 
1323
1340
  @certificate_manager_stub.list_certificate_map_entries request, options do |result, operation|
1324
1341
  yield result, operation if block_given?
1325
- return result
1326
1342
  end
1327
1343
  rescue ::Gapic::Rest::Error => e
1328
1344
  raise ::Google::Cloud::Error.from_error(e)
@@ -1402,7 +1418,6 @@ module Google
1402
1418
 
1403
1419
  @certificate_manager_stub.get_certificate_map_entry request, options do |result, operation|
1404
1420
  yield result, operation if block_given?
1405
- return result
1406
1421
  end
1407
1422
  rescue ::Gapic::Rest::Error => e
1408
1423
  raise ::Google::Cloud::Error.from_error(e)
@@ -1494,7 +1509,7 @@ module Google
1494
1509
  @certificate_manager_stub.create_certificate_map_entry request, options do |result, operation|
1495
1510
  result = ::Gapic::Operation.new result, @operations_client, options: options
1496
1511
  yield result, operation if block_given?
1497
- return result
1512
+ throw :response, result
1498
1513
  end
1499
1514
  rescue ::Gapic::Rest::Error => e
1500
1515
  raise ::Google::Cloud::Error.from_error(e)
@@ -1585,7 +1600,7 @@ module Google
1585
1600
  @certificate_manager_stub.update_certificate_map_entry request, options do |result, operation|
1586
1601
  result = ::Gapic::Operation.new result, @operations_client, options: options
1587
1602
  yield result, operation if block_given?
1588
- return result
1603
+ throw :response, result
1589
1604
  end
1590
1605
  rescue ::Gapic::Rest::Error => e
1591
1606
  raise ::Google::Cloud::Error.from_error(e)
@@ -1673,7 +1688,7 @@ module Google
1673
1688
  @certificate_manager_stub.delete_certificate_map_entry request, options do |result, operation|
1674
1689
  result = ::Gapic::Operation.new result, @operations_client, options: options
1675
1690
  yield result, operation if block_given?
1676
- return result
1691
+ throw :response, result
1677
1692
  end
1678
1693
  rescue ::Gapic::Rest::Error => e
1679
1694
  raise ::Google::Cloud::Error.from_error(e)
@@ -1769,7 +1784,6 @@ module Google
1769
1784
 
1770
1785
  @certificate_manager_stub.list_dns_authorizations request, options do |result, operation|
1771
1786
  yield result, operation if block_given?
1772
- return result
1773
1787
  end
1774
1788
  rescue ::Gapic::Rest::Error => e
1775
1789
  raise ::Google::Cloud::Error.from_error(e)
@@ -1849,7 +1863,6 @@ module Google
1849
1863
 
1850
1864
  @certificate_manager_stub.get_dns_authorization request, options do |result, operation|
1851
1865
  yield result, operation if block_given?
1852
- return result
1853
1866
  end
1854
1867
  rescue ::Gapic::Rest::Error => e
1855
1868
  raise ::Google::Cloud::Error.from_error(e)
@@ -1941,7 +1954,7 @@ module Google
1941
1954
  @certificate_manager_stub.create_dns_authorization request, options do |result, operation|
1942
1955
  result = ::Gapic::Operation.new result, @operations_client, options: options
1943
1956
  yield result, operation if block_given?
1944
- return result
1957
+ throw :response, result
1945
1958
  end
1946
1959
  rescue ::Gapic::Rest::Error => e
1947
1960
  raise ::Google::Cloud::Error.from_error(e)
@@ -2032,7 +2045,7 @@ module Google
2032
2045
  @certificate_manager_stub.update_dns_authorization request, options do |result, operation|
2033
2046
  result = ::Gapic::Operation.new result, @operations_client, options: options
2034
2047
  yield result, operation if block_given?
2035
- return result
2048
+ throw :response, result
2036
2049
  end
2037
2050
  rescue ::Gapic::Rest::Error => e
2038
2051
  raise ::Google::Cloud::Error.from_error(e)
@@ -2120,7 +2133,7 @@ module Google
2120
2133
  @certificate_manager_stub.delete_dns_authorization request, options do |result, operation|
2121
2134
  result = ::Gapic::Operation.new result, @operations_client, options: options
2122
2135
  yield result, operation if block_given?
2123
- return result
2136
+ throw :response, result
2124
2137
  end
2125
2138
  rescue ::Gapic::Rest::Error => e
2126
2139
  raise ::Google::Cloud::Error.from_error(e)
@@ -2217,7 +2230,6 @@ module Google
2217
2230
 
2218
2231
  @certificate_manager_stub.list_certificate_issuance_configs request, options do |result, operation|
2219
2232
  yield result, operation if block_given?
2220
- return result
2221
2233
  end
2222
2234
  rescue ::Gapic::Rest::Error => e
2223
2235
  raise ::Google::Cloud::Error.from_error(e)
@@ -2297,7 +2309,6 @@ module Google
2297
2309
 
2298
2310
  @certificate_manager_stub.get_certificate_issuance_config request, options do |result, operation|
2299
2311
  yield result, operation if block_given?
2300
- return result
2301
2312
  end
2302
2313
  rescue ::Gapic::Rest::Error => e
2303
2314
  raise ::Google::Cloud::Error.from_error(e)
@@ -2389,7 +2400,7 @@ module Google
2389
2400
  @certificate_manager_stub.create_certificate_issuance_config request, options do |result, operation|
2390
2401
  result = ::Gapic::Operation.new result, @operations_client, options: options
2391
2402
  yield result, operation if block_given?
2392
- return result
2403
+ throw :response, result
2393
2404
  end
2394
2405
  rescue ::Gapic::Rest::Error => e
2395
2406
  raise ::Google::Cloud::Error.from_error(e)
@@ -2477,7 +2488,7 @@ module Google
2477
2488
  @certificate_manager_stub.delete_certificate_issuance_config request, options do |result, operation|
2478
2489
  result = ::Gapic::Operation.new result, @operations_client, options: options
2479
2490
  yield result, operation if block_given?
2480
- return result
2491
+ throw :response, result
2481
2492
  end
2482
2493
  rescue ::Gapic::Rest::Error => e
2483
2494
  raise ::Google::Cloud::Error.from_error(e)
@@ -2573,7 +2584,6 @@ module Google
2573
2584
 
2574
2585
  @certificate_manager_stub.list_trust_configs request, options do |result, operation|
2575
2586
  yield result, operation if block_given?
2576
- return result
2577
2587
  end
2578
2588
  rescue ::Gapic::Rest::Error => e
2579
2589
  raise ::Google::Cloud::Error.from_error(e)
@@ -2653,7 +2663,6 @@ module Google
2653
2663
 
2654
2664
  @certificate_manager_stub.get_trust_config request, options do |result, operation|
2655
2665
  yield result, operation if block_given?
2656
- return result
2657
2666
  end
2658
2667
  rescue ::Gapic::Rest::Error => e
2659
2668
  raise ::Google::Cloud::Error.from_error(e)
@@ -2746,7 +2755,7 @@ module Google
2746
2755
  @certificate_manager_stub.create_trust_config request, options do |result, operation|
2747
2756
  result = ::Gapic::Operation.new result, @operations_client, options: options
2748
2757
  yield result, operation if block_given?
2749
- return result
2758
+ throw :response, result
2750
2759
  end
2751
2760
  rescue ::Gapic::Rest::Error => e
2752
2761
  raise ::Google::Cloud::Error.from_error(e)
@@ -2837,7 +2846,7 @@ module Google
2837
2846
  @certificate_manager_stub.update_trust_config request, options do |result, operation|
2838
2847
  result = ::Gapic::Operation.new result, @operations_client, options: options
2839
2848
  yield result, operation if block_given?
2840
- return result
2849
+ throw :response, result
2841
2850
  end
2842
2851
  rescue ::Gapic::Rest::Error => e
2843
2852
  raise ::Google::Cloud::Error.from_error(e)
@@ -2929,7 +2938,7 @@ module Google
2929
2938
  @certificate_manager_stub.delete_trust_config request, options do |result, operation|
2930
2939
  result = ::Gapic::Operation.new result, @operations_client, options: options
2931
2940
  yield result, operation if block_given?
2932
- return result
2941
+ throw :response, result
2933
2942
  end
2934
2943
  rescue ::Gapic::Rest::Error => e
2935
2944
  raise ::Google::Cloud::Error.from_error(e)
@@ -3009,6 +3018,11 @@ module Google
3009
3018
  # default endpoint URL. The default value of nil uses the environment
3010
3019
  # universe (usually the default "googleapis.com" universe).
3011
3020
  # @return [::String,nil]
3021
+ # @!attribute [rw] logger
3022
+ # A custom logger to use for request/response debug logging, or the value
3023
+ # `:default` (the default) to construct a default logger, or `nil` to
3024
+ # explicitly disable logging.
3025
+ # @return [::Logger,:default,nil]
3012
3026
  #
3013
3027
  class Configuration
3014
3028
  extend ::Gapic::Config
@@ -3037,6 +3051,7 @@ module Google
3037
3051
  # by the host service.
3038
3052
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3039
3053
  config_attr :bindings_override, {}, ::Hash, nil
3054
+ config_attr :logger, :default, ::Logger, nil, :default
3040
3055
 
3041
3056
  # @private
3042
3057
  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
  ##