google-cloud-security-private_ca-v1 1.0.0 → 1.1.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.
@@ -167,15 +167,27 @@ module Google
167
167
  endpoint: @config.endpoint,
168
168
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
169
169
  universe_domain: @config.universe_domain,
170
- credentials: credentials
170
+ credentials: credentials,
171
+ logger: @config.logger
171
172
  )
172
173
 
174
+ @certificate_authority_service_stub.logger(stub: true)&.info do |entry|
175
+ entry.set_system_name
176
+ entry.set_service
177
+ entry.message = "Created client for #{entry.service}"
178
+ entry.set_credentials_fields credentials
179
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
180
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
181
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
182
+ end
183
+
173
184
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
174
185
  config.credentials = credentials
175
186
  config.quota_project = @quota_project_id
176
187
  config.endpoint = @certificate_authority_service_stub.endpoint
177
188
  config.universe_domain = @certificate_authority_service_stub.universe_domain
178
189
  config.bindings_override = @config.bindings_override
190
+ config.logger = @certificate_authority_service_stub.logger if config.respond_to? :logger=
179
191
  end
180
192
 
181
193
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -184,6 +196,7 @@ module Google
184
196
  config.endpoint = @certificate_authority_service_stub.endpoint
185
197
  config.universe_domain = @certificate_authority_service_stub.universe_domain
186
198
  config.bindings_override = @config.bindings_override
199
+ config.logger = @certificate_authority_service_stub.logger if config.respond_to? :logger=
187
200
  end
188
201
  end
189
202
 
@@ -208,6 +221,15 @@ module Google
208
221
  #
209
222
  attr_reader :iam_policy_client
210
223
 
224
+ ##
225
+ # The logger used for request/response debug logging.
226
+ #
227
+ # @return [Logger]
228
+ #
229
+ def logger
230
+ @certificate_authority_service_stub.logger
231
+ end
232
+
211
233
  # Service calls
212
234
 
213
235
  ##
@@ -340,7 +362,6 @@ module Google
340
362
 
341
363
  @certificate_authority_service_stub.create_certificate request, options do |result, operation|
342
364
  yield result, operation if block_given?
343
- return result
344
365
  end
345
366
  rescue ::Gapic::Rest::Error => e
346
367
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,7 +442,6 @@ module Google
421
442
 
422
443
  @certificate_authority_service_stub.get_certificate 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)
@@ -526,7 +546,6 @@ module Google
526
546
 
527
547
  @certificate_authority_service_stub.list_certificates request, options do |result, operation|
528
548
  yield result, operation if block_given?
529
- return result
530
549
  end
531
550
  rescue ::Gapic::Rest::Error => e
532
551
  raise ::Google::Cloud::Error.from_error(e)
@@ -625,7 +644,6 @@ module Google
625
644
 
626
645
  @certificate_authority_service_stub.revoke_certificate request, options do |result, operation|
627
646
  yield result, operation if block_given?
628
- return result
629
647
  end
630
648
  rescue ::Gapic::Rest::Error => e
631
649
  raise ::Google::Cloud::Error.from_error(e)
@@ -723,7 +741,6 @@ module Google
723
741
 
724
742
  @certificate_authority_service_stub.update_certificate request, options do |result, operation|
725
743
  yield result, operation if block_given?
726
- return result
727
744
  end
728
745
  rescue ::Gapic::Rest::Error => e
729
746
  raise ::Google::Cloud::Error.from_error(e)
@@ -841,7 +858,7 @@ module Google
841
858
  @certificate_authority_service_stub.activate_certificate_authority request, options do |result, operation|
842
859
  result = ::Gapic::Operation.new result, @operations_client, options: options
843
860
  yield result, operation if block_given?
844
- return result
861
+ throw :response, result
845
862
  end
846
863
  rescue ::Gapic::Rest::Error => e
847
864
  raise ::Google::Cloud::Error.from_error(e)
@@ -954,7 +971,7 @@ module Google
954
971
  @certificate_authority_service_stub.create_certificate_authority request, options do |result, operation|
955
972
  result = ::Gapic::Operation.new result, @operations_client, options: options
956
973
  yield result, operation if block_given?
957
- return result
974
+ throw :response, result
958
975
  end
959
976
  rescue ::Gapic::Rest::Error => e
960
977
  raise ::Google::Cloud::Error.from_error(e)
@@ -1063,7 +1080,7 @@ module Google
1063
1080
  @certificate_authority_service_stub.disable_certificate_authority request, options do |result, operation|
1064
1081
  result = ::Gapic::Operation.new result, @operations_client, options: options
1065
1082
  yield result, operation if block_given?
1066
- return result
1083
+ throw :response, result
1067
1084
  end
1068
1085
  rescue ::Gapic::Rest::Error => e
1069
1086
  raise ::Google::Cloud::Error.from_error(e)
@@ -1167,7 +1184,7 @@ module Google
1167
1184
  @certificate_authority_service_stub.enable_certificate_authority request, options do |result, operation|
1168
1185
  result = ::Gapic::Operation.new result, @operations_client, options: options
1169
1186
  yield result, operation if block_given?
1170
- return result
1187
+ throw :response, result
1171
1188
  end
1172
1189
  rescue ::Gapic::Rest::Error => e
1173
1190
  raise ::Google::Cloud::Error.from_error(e)
@@ -1258,7 +1275,6 @@ module Google
1258
1275
 
1259
1276
  @certificate_authority_service_stub.fetch_certificate_authority_csr request, options do |result, operation|
1260
1277
  yield result, operation if block_given?
1261
- return result
1262
1278
  end
1263
1279
  rescue ::Gapic::Rest::Error => e
1264
1280
  raise ::Google::Cloud::Error.from_error(e)
@@ -1341,7 +1357,6 @@ module Google
1341
1357
 
1342
1358
  @certificate_authority_service_stub.get_certificate_authority request, options do |result, operation|
1343
1359
  yield result, operation if block_given?
1344
- return result
1345
1360
  end
1346
1361
  rescue ::Gapic::Rest::Error => e
1347
1362
  raise ::Google::Cloud::Error.from_error(e)
@@ -1444,7 +1459,6 @@ module Google
1444
1459
 
1445
1460
  @certificate_authority_service_stub.list_certificate_authorities request, options do |result, operation|
1446
1461
  yield result, operation if block_given?
1447
- return result
1448
1462
  end
1449
1463
  rescue ::Gapic::Rest::Error => e
1450
1464
  raise ::Google::Cloud::Error.from_error(e)
@@ -1549,7 +1563,7 @@ module Google
1549
1563
  @certificate_authority_service_stub.undelete_certificate_authority request, options do |result, operation|
1550
1564
  result = ::Gapic::Operation.new result, @operations_client, options: options
1551
1565
  yield result, operation if block_given?
1552
- return result
1566
+ throw :response, result
1553
1567
  end
1554
1568
  rescue ::Gapic::Rest::Error => e
1555
1569
  raise ::Google::Cloud::Error.from_error(e)
@@ -1665,7 +1679,7 @@ module Google
1665
1679
  @certificate_authority_service_stub.delete_certificate_authority request, options do |result, operation|
1666
1680
  result = ::Gapic::Operation.new result, @operations_client, options: options
1667
1681
  yield result, operation if block_given?
1668
- return result
1682
+ throw :response, result
1669
1683
  end
1670
1684
  rescue ::Gapic::Rest::Error => e
1671
1685
  raise ::Google::Cloud::Error.from_error(e)
@@ -1771,7 +1785,7 @@ module Google
1771
1785
  @certificate_authority_service_stub.update_certificate_authority request, options do |result, operation|
1772
1786
  result = ::Gapic::Operation.new result, @operations_client, options: options
1773
1787
  yield result, operation if block_given?
1774
- return result
1788
+ throw :response, result
1775
1789
  end
1776
1790
  rescue ::Gapic::Rest::Error => e
1777
1791
  raise ::Google::Cloud::Error.from_error(e)
@@ -1880,7 +1894,7 @@ module Google
1880
1894
  @certificate_authority_service_stub.create_ca_pool request, options do |result, operation|
1881
1895
  result = ::Gapic::Operation.new result, @operations_client, options: options
1882
1896
  yield result, operation if block_given?
1883
- return result
1897
+ throw :response, result
1884
1898
  end
1885
1899
  rescue ::Gapic::Rest::Error => e
1886
1900
  raise ::Google::Cloud::Error.from_error(e)
@@ -1984,7 +1998,7 @@ module Google
1984
1998
  @certificate_authority_service_stub.update_ca_pool request, options do |result, operation|
1985
1999
  result = ::Gapic::Operation.new result, @operations_client, options: options
1986
2000
  yield result, operation if block_given?
1987
- return result
2001
+ throw :response, result
1988
2002
  end
1989
2003
  rescue ::Gapic::Rest::Error => e
1990
2004
  raise ::Google::Cloud::Error.from_error(e)
@@ -2064,7 +2078,6 @@ module Google
2064
2078
 
2065
2079
  @certificate_authority_service_stub.get_ca_pool request, options do |result, operation|
2066
2080
  yield result, operation if block_given?
2067
- return result
2068
2081
  end
2069
2082
  rescue ::Gapic::Rest::Error => e
2070
2083
  raise ::Google::Cloud::Error.from_error(e)
@@ -2164,7 +2177,6 @@ module Google
2164
2177
 
2165
2178
  @certificate_authority_service_stub.list_ca_pools request, options do |result, operation|
2166
2179
  yield result, operation if block_given?
2167
- return result
2168
2180
  end
2169
2181
  rescue ::Gapic::Rest::Error => e
2170
2182
  raise ::Google::Cloud::Error.from_error(e)
@@ -2272,7 +2284,7 @@ module Google
2272
2284
  @certificate_authority_service_stub.delete_ca_pool request, options do |result, operation|
2273
2285
  result = ::Gapic::Operation.new result, @operations_client, options: options
2274
2286
  yield result, operation if block_given?
2275
- return result
2287
+ throw :response, result
2276
2288
  end
2277
2289
  rescue ::Gapic::Rest::Error => e
2278
2290
  raise ::Google::Cloud::Error.from_error(e)
@@ -2370,7 +2382,6 @@ module Google
2370
2382
 
2371
2383
  @certificate_authority_service_stub.fetch_ca_certs request, options do |result, operation|
2372
2384
  yield result, operation if block_given?
2373
- return result
2374
2385
  end
2375
2386
  rescue ::Gapic::Rest::Error => e
2376
2387
  raise ::Google::Cloud::Error.from_error(e)
@@ -2454,7 +2465,6 @@ module Google
2454
2465
 
2455
2466
  @certificate_authority_service_stub.get_certificate_revocation_list request, options do |result, operation|
2456
2467
  yield result, operation if block_given?
2457
- return result
2458
2468
  end
2459
2469
  rescue ::Gapic::Rest::Error => e
2460
2470
  raise ::Google::Cloud::Error.from_error(e)
@@ -2556,7 +2566,6 @@ module Google
2556
2566
 
2557
2567
  @certificate_authority_service_stub.list_certificate_revocation_lists request, options do |result, operation|
2558
2568
  yield result, operation if block_given?
2559
- return result
2560
2569
  end
2561
2570
  rescue ::Gapic::Rest::Error => e
2562
2571
  raise ::Google::Cloud::Error.from_error(e)
@@ -2662,7 +2671,7 @@ module Google
2662
2671
  @certificate_authority_service_stub.update_certificate_revocation_list request, options do |result, operation|
2663
2672
  result = ::Gapic::Operation.new result, @operations_client, options: options
2664
2673
  yield result, operation if block_given?
2665
- return result
2674
+ throw :response, result
2666
2675
  end
2667
2676
  rescue ::Gapic::Rest::Error => e
2668
2677
  raise ::Google::Cloud::Error.from_error(e)
@@ -2774,7 +2783,7 @@ module Google
2774
2783
  @certificate_authority_service_stub.create_certificate_template request, options do |result, operation|
2775
2784
  result = ::Gapic::Operation.new result, @operations_client, options: options
2776
2785
  yield result, operation if block_given?
2777
- return result
2786
+ throw :response, result
2778
2787
  end
2779
2788
  rescue ::Gapic::Rest::Error => e
2780
2789
  raise ::Google::Cloud::Error.from_error(e)
@@ -2878,7 +2887,7 @@ module Google
2878
2887
  @certificate_authority_service_stub.delete_certificate_template request, options do |result, operation|
2879
2888
  result = ::Gapic::Operation.new result, @operations_client, options: options
2880
2889
  yield result, operation if block_given?
2881
- return result
2890
+ throw :response, result
2882
2891
  end
2883
2892
  rescue ::Gapic::Rest::Error => e
2884
2893
  raise ::Google::Cloud::Error.from_error(e)
@@ -2961,7 +2970,6 @@ module Google
2961
2970
 
2962
2971
  @certificate_authority_service_stub.get_certificate_template request, options do |result, operation|
2963
2972
  yield result, operation if block_given?
2964
- return result
2965
2973
  end
2966
2974
  rescue ::Gapic::Rest::Error => e
2967
2975
  raise ::Google::Cloud::Error.from_error(e)
@@ -3063,7 +3071,6 @@ module Google
3063
3071
 
3064
3072
  @certificate_authority_service_stub.list_certificate_templates request, options do |result, operation|
3065
3073
  yield result, operation if block_given?
3066
- return result
3067
3074
  end
3068
3075
  rescue ::Gapic::Rest::Error => e
3069
3076
  raise ::Google::Cloud::Error.from_error(e)
@@ -3169,7 +3176,7 @@ module Google
3169
3176
  @certificate_authority_service_stub.update_certificate_template request, options do |result, operation|
3170
3177
  result = ::Gapic::Operation.new result, @operations_client, options: options
3171
3178
  yield result, operation if block_given?
3172
- return result
3179
+ throw :response, result
3173
3180
  end
3174
3181
  rescue ::Gapic::Rest::Error => e
3175
3182
  raise ::Google::Cloud::Error.from_error(e)
@@ -3249,6 +3256,11 @@ module Google
3249
3256
  # default endpoint URL. The default value of nil uses the environment
3250
3257
  # universe (usually the default "googleapis.com" universe).
3251
3258
  # @return [::String,nil]
3259
+ # @!attribute [rw] logger
3260
+ # A custom logger to use for request/response debug logging, or the value
3261
+ # `:default` (the default) to construct a default logger, or `nil` to
3262
+ # explicitly disable logging.
3263
+ # @return [::Logger,:default,nil]
3252
3264
  #
3253
3265
  class Configuration
3254
3266
  extend ::Gapic::Config
@@ -3277,6 +3289,7 @@ module Google
3277
3289
  # by the host service.
3278
3290
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3279
3291
  config_attr :bindings_override, {}, ::Hash, nil
3292
+ config_attr :logger, :default, ::Logger, nil, :default
3280
3293
 
3281
3294
  # @private
3282
3295
  def initialize parent_config = nil
@@ -116,14 +116,6 @@ module Google
116
116
  # Lists operations that match the specified filter in the request. If the
117
117
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
118
118
  #
119
- # NOTE: the `name` binding allows API services to override the binding
120
- # to use different resource name schemes, such as `users/*/operations`. To
121
- # override the binding, API services can add a binding such as
122
- # `"/v1/{name=users/*}/operations"` to their service configuration.
123
- # For backwards compatibility, the default name includes the operations
124
- # collection id, however overriding users must ensure the name binding
125
- # is the parent resource, without the operations collection id.
126
- #
127
119
  # @overload list_operations(request, options = nil)
128
120
  # Pass arguments to `list_operations` via a request object, either of type
129
121
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -205,7 +197,7 @@ module Google
205
197
  @operations_stub.list_operations request, options do |result, operation|
206
198
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
207
199
  yield result, operation if block_given?
208
- return result
200
+ throw :response, result
209
201
  end
210
202
  rescue ::Gapic::Rest::Error => e
211
203
  raise ::Google::Cloud::Error.from_error(e)
@@ -294,7 +286,7 @@ module Google
294
286
  @operations_stub.get_operation request, options do |result, operation|
295
287
  result = ::Gapic::Operation.new result, @operations_client, options: options
296
288
  yield result, operation if block_given?
297
- return result
289
+ throw :response, result
298
290
  end
299
291
  rescue ::Gapic::Rest::Error => e
300
292
  raise ::Google::Cloud::Error.from_error(e)
@@ -376,7 +368,6 @@ module Google
376
368
 
377
369
  @operations_stub.delete_operation request, options do |result, operation|
378
370
  yield result, operation if block_given?
379
- return result
380
371
  end
381
372
  rescue ::Gapic::Rest::Error => e
382
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -391,8 +382,9 @@ module Google
391
382
  # other methods to check whether the cancellation succeeded or whether the
392
383
  # operation completed despite cancellation. On successful cancellation,
393
384
  # the operation is not deleted; instead, it becomes an operation with
394
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
395
- # corresponding to `Code.CANCELLED`.
385
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
386
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
387
+ # `Code.CANCELLED`.
396
388
  #
397
389
  # @overload cancel_operation(request, options = nil)
398
390
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -464,7 +456,6 @@ module Google
464
456
 
465
457
  @operations_stub.cancel_operation request, options do |result, operation|
466
458
  yield result, operation if block_given?
467
- return result
468
459
  end
469
460
  rescue ::Gapic::Rest::Error => e
470
461
  raise ::Google::Cloud::Error.from_error(e)
@@ -544,6 +535,11 @@ module Google
544
535
  # default endpoint URL. The default value of nil uses the environment
545
536
  # universe (usually the default "googleapis.com" universe).
546
537
  # @return [::String,nil]
538
+ # @!attribute [rw] logger
539
+ # A custom logger to use for request/response debug logging, or the value
540
+ # `:default` (the default) to construct a default logger, or `nil` to
541
+ # explicitly disable logging.
542
+ # @return [::Logger,:default,nil]
547
543
  #
548
544
  class Configuration
549
545
  extend ::Gapic::Config
@@ -565,6 +561,7 @@ module Google
565
561
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
566
562
  config_attr :quota_project, nil, ::String, nil
567
563
  config_attr :universe_domain, nil, ::String, nil
564
+ config_attr :logger, :default, ::Logger, nil, :default
568
565
 
569
566
  # @private
570
567
  def initialize parent_config = nil
@@ -684,16 +681,18 @@ module Google
684
681
 
685
682
  response = @client_stub.make_http_request(
686
683
  verb,
687
- uri: uri,
688
- body: body || "",
689
- params: query_string_params,
684
+ uri: uri,
685
+ body: body || "",
686
+ params: query_string_params,
687
+ method_name: "list_operations",
690
688
  options: options
691
689
  )
692
690
  operation = ::Gapic::Rest::TransportOperation.new response
693
691
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
694
-
695
- yield result, operation if block_given?
696
- result
692
+ catch :response do
693
+ yield result, operation if block_given?
694
+ result
695
+ end
697
696
  end
698
697
 
699
698
  ##
@@ -722,16 +721,18 @@ module Google
722
721
 
723
722
  response = @client_stub.make_http_request(
724
723
  verb,
725
- uri: uri,
726
- body: body || "",
727
- params: query_string_params,
724
+ uri: uri,
725
+ body: body || "",
726
+ params: query_string_params,
727
+ method_name: "get_operation",
728
728
  options: options
729
729
  )
730
730
  operation = ::Gapic::Rest::TransportOperation.new response
731
731
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
732
-
733
- yield result, operation if block_given?
734
- result
732
+ catch :response do
733
+ yield result, operation if block_given?
734
+ result
735
+ end
735
736
  end
736
737
 
737
738
  ##
@@ -760,16 +761,18 @@ module Google
760
761
 
761
762
  response = @client_stub.make_http_request(
762
763
  verb,
763
- uri: uri,
764
- body: body || "",
765
- params: query_string_params,
764
+ uri: uri,
765
+ body: body || "",
766
+ params: query_string_params,
767
+ method_name: "delete_operation",
766
768
  options: options
767
769
  )
768
770
  operation = ::Gapic::Rest::TransportOperation.new response
769
771
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
770
-
771
- yield result, operation if block_given?
772
- result
772
+ catch :response do
773
+ yield result, operation if block_given?
774
+ result
775
+ end
773
776
  end
774
777
 
775
778
  ##
@@ -798,16 +801,18 @@ module Google
798
801
 
799
802
  response = @client_stub.make_http_request(
800
803
  verb,
801
- uri: uri,
802
- body: body || "",
803
- params: query_string_params,
804
+ uri: uri,
805
+ body: body || "",
806
+ params: query_string_params,
807
+ method_name: "cancel_operation",
804
808
  options: options
805
809
  )
806
810
  operation = ::Gapic::Rest::TransportOperation.new response
807
811
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
808
-
809
- yield result, operation if block_given?
810
- result
812
+ catch :response do
813
+ yield result, operation if block_given?
814
+ result
815
+ end
811
816
  end
812
817
 
813
818
  ##