google-cloud-certificate_manager-v1 0.10.1 → 0.12.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.
@@ -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)
@@ -2977,6 +2986,13 @@ module Google
2977
2986
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2978
2987
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2979
2988
  # * (`nil`) indicating no credentials
2989
+ #
2990
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2991
+ # external source for authentication to Google Cloud, you must validate it before
2992
+ # providing it to a Google API client library. Providing an unvalidated credential
2993
+ # configuration to Google APIs can compromise the security of your systems and data.
2994
+ # For more information, refer to [Validate credential configurations from external
2995
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2980
2996
  # @return [::Object]
2981
2997
  # @!attribute [rw] scope
2982
2998
  # The OAuth scopes
@@ -3009,6 +3025,11 @@ module Google
3009
3025
  # default endpoint URL. The default value of nil uses the environment
3010
3026
  # universe (usually the default "googleapis.com" universe).
3011
3027
  # @return [::String,nil]
3028
+ # @!attribute [rw] logger
3029
+ # A custom logger to use for request/response debug logging, or the value
3030
+ # `:default` (the default) to construct a default logger, or `nil` to
3031
+ # explicitly disable logging.
3032
+ # @return [::Logger,:default,nil]
3012
3033
  #
3013
3034
  class Configuration
3014
3035
  extend ::Gapic::Config
@@ -3037,6 +3058,7 @@ module Google
3037
3058
  # by the host service.
3038
3059
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3039
3060
  config_attr :bindings_override, {}, ::Hash, nil
3061
+ config_attr :logger, :default, ::Logger, nil, :default
3040
3062
 
3041
3063
  # @private
3042
3064
  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)
@@ -511,6 +502,13 @@ module Google
511
502
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
512
503
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
513
504
  # * (`nil`) indicating no credentials
505
+ #
506
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
507
+ # external source for authentication to Google Cloud, you must validate it before
508
+ # providing it to a Google API client library. Providing an unvalidated credential
509
+ # configuration to Google APIs can compromise the security of your systems and data.
510
+ # For more information, refer to [Validate credential configurations from external
511
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
514
512
  # @return [::Object]
515
513
  # @!attribute [rw] scope
516
514
  # The OAuth scopes
@@ -543,6 +541,11 @@ module Google
543
541
  # default endpoint URL. The default value of nil uses the environment
544
542
  # universe (usually the default "googleapis.com" universe).
545
543
  # @return [::String,nil]
544
+ # @!attribute [rw] logger
545
+ # A custom logger to use for request/response debug logging, or the value
546
+ # `:default` (the default) to construct a default logger, or `nil` to
547
+ # explicitly disable logging.
548
+ # @return [::Logger,:default,nil]
546
549
  #
547
550
  class Configuration
548
551
  extend ::Gapic::Config
@@ -564,6 +567,7 @@ module Google
564
567
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
568
  config_attr :quota_project, nil, ::String, nil
566
569
  config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
567
571
 
568
572
  # @private
569
573
  def initialize parent_config = nil
@@ -683,16 +687,18 @@ module Google
683
687
 
684
688
  response = @client_stub.make_http_request(
685
689
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
689
694
  options: options
690
695
  )
691
696
  operation = ::Gapic::Rest::TransportOperation.new response
692
697
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
696
702
  end
697
703
 
698
704
  ##
@@ -721,16 +727,18 @@ module Google
721
727
 
722
728
  response = @client_stub.make_http_request(
723
729
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
727
734
  options: options
728
735
  )
729
736
  operation = ::Gapic::Rest::TransportOperation.new response
730
737
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
734
742
  end
735
743
 
736
744
  ##
@@ -759,16 +767,18 @@ module Google
759
767
 
760
768
  response = @client_stub.make_http_request(
761
769
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
765
774
  options: options
766
775
  )
767
776
  operation = ::Gapic::Rest::TransportOperation.new response
768
777
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
772
782
  end
773
783
 
774
784
  ##
@@ -797,16 +807,18 @@ module Google
797
807
 
798
808
  response = @client_stub.make_http_request(
799
809
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
803
814
  options: options
804
815
  )
805
816
  operation = ::Gapic::Rest::TransportOperation.new response
806
817
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
810
822
  end
811
823
 
812
824
  ##