google-cloud-artifact_registry-v1beta2 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -255,15 +255,27 @@ module Google
255
255
  endpoint: @config.endpoint,
256
256
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
257
257
  universe_domain: @config.universe_domain,
258
- credentials: credentials
258
+ credentials: credentials,
259
+ logger: @config.logger
259
260
  )
260
261
 
262
+ @artifact_registry_stub.logger(stub: true)&.info do |entry|
263
+ entry.set_system_name
264
+ entry.set_service
265
+ entry.message = "Created client for #{entry.service}"
266
+ entry.set_credentials_fields credentials
267
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
268
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
269
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
270
+ end
271
+
261
272
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
262
273
  config.credentials = credentials
263
274
  config.quota_project = @quota_project_id
264
275
  config.endpoint = @artifact_registry_stub.endpoint
265
276
  config.universe_domain = @artifact_registry_stub.universe_domain
266
277
  config.bindings_override = @config.bindings_override
278
+ config.logger = @artifact_registry_stub.logger if config.respond_to? :logger=
267
279
  end
268
280
  end
269
281
 
@@ -281,6 +293,15 @@ module Google
281
293
  #
282
294
  attr_reader :location_client
283
295
 
296
+ ##
297
+ # The logger used for request/response debug logging.
298
+ #
299
+ # @return [Logger]
300
+ #
301
+ def logger
302
+ @artifact_registry_stub.logger
303
+ end
304
+
284
305
  # Service calls
285
306
 
286
307
  ##
@@ -369,7 +390,7 @@ module Google
369
390
  @artifact_registry_stub.import_apt_artifacts request, options do |result, operation|
370
391
  result = ::Gapic::Operation.new result, @operations_client, options: options
371
392
  yield result, operation if block_given?
372
- return result
393
+ throw :response, result
373
394
  end
374
395
  rescue ::Gapic::Rest::Error => e
375
396
  raise ::Google::Cloud::Error.from_error(e)
@@ -461,7 +482,7 @@ module Google
461
482
  @artifact_registry_stub.import_yum_artifacts request, options do |result, operation|
462
483
  result = ::Gapic::Operation.new result, @operations_client, options: options
463
484
  yield result, operation if block_given?
464
- return result
485
+ throw :response, result
465
486
  end
466
487
  rescue ::Gapic::Rest::Error => e
467
488
  raise ::Google::Cloud::Error.from_error(e)
@@ -549,7 +570,7 @@ module Google
549
570
  @artifact_registry_stub.list_repositories request, options do |result, operation|
550
571
  result = ::Gapic::Rest::PagedEnumerable.new @artifact_registry_stub, :list_repositories, "repositories", request, result, options
551
572
  yield result, operation if block_given?
552
- return result
573
+ throw :response, result
553
574
  end
554
575
  rescue ::Gapic::Rest::Error => e
555
576
  raise ::Google::Cloud::Error.from_error(e)
@@ -628,7 +649,6 @@ module Google
628
649
 
629
650
  @artifact_registry_stub.get_repository request, options do |result, operation|
630
651
  yield result, operation if block_given?
631
- return result
632
652
  end
633
653
  rescue ::Gapic::Rest::Error => e
634
654
  raise ::Google::Cloud::Error.from_error(e)
@@ -720,7 +740,7 @@ module Google
720
740
  @artifact_registry_stub.create_repository request, options do |result, operation|
721
741
  result = ::Gapic::Operation.new result, @operations_client, options: options
722
742
  yield result, operation if block_given?
723
- return result
743
+ throw :response, result
724
744
  end
725
745
  rescue ::Gapic::Rest::Error => e
726
746
  raise ::Google::Cloud::Error.from_error(e)
@@ -803,7 +823,6 @@ module Google
803
823
 
804
824
  @artifact_registry_stub.update_repository request, options do |result, operation|
805
825
  yield result, operation if block_given?
806
- return result
807
826
  end
808
827
  rescue ::Gapic::Rest::Error => e
809
828
  raise ::Google::Cloud::Error.from_error(e)
@@ -892,7 +911,7 @@ module Google
892
911
  @artifact_registry_stub.delete_repository request, options do |result, operation|
893
912
  result = ::Gapic::Operation.new result, @operations_client, options: options
894
913
  yield result, operation if block_given?
895
- return result
914
+ throw :response, result
896
915
  end
897
916
  rescue ::Gapic::Rest::Error => e
898
917
  raise ::Google::Cloud::Error.from_error(e)
@@ -981,7 +1000,7 @@ module Google
981
1000
  @artifact_registry_stub.list_packages request, options do |result, operation|
982
1001
  result = ::Gapic::Rest::PagedEnumerable.new @artifact_registry_stub, :list_packages, "packages", request, result, options
983
1002
  yield result, operation if block_given?
984
- return result
1003
+ throw :response, result
985
1004
  end
986
1005
  rescue ::Gapic::Rest::Error => e
987
1006
  raise ::Google::Cloud::Error.from_error(e)
@@ -1060,7 +1079,6 @@ module Google
1060
1079
 
1061
1080
  @artifact_registry_stub.get_package request, options do |result, operation|
1062
1081
  yield result, operation if block_given?
1063
- return result
1064
1082
  end
1065
1083
  rescue ::Gapic::Rest::Error => e
1066
1084
  raise ::Google::Cloud::Error.from_error(e)
@@ -1148,7 +1166,7 @@ module Google
1148
1166
  @artifact_registry_stub.delete_package request, options do |result, operation|
1149
1167
  result = ::Gapic::Operation.new result, @operations_client, options: options
1150
1168
  yield result, operation if block_given?
1151
- return result
1169
+ throw :response, result
1152
1170
  end
1153
1171
  rescue ::Gapic::Rest::Error => e
1154
1172
  raise ::Google::Cloud::Error.from_error(e)
@@ -1240,7 +1258,7 @@ module Google
1240
1258
  @artifact_registry_stub.list_versions request, options do |result, operation|
1241
1259
  result = ::Gapic::Rest::PagedEnumerable.new @artifact_registry_stub, :list_versions, "versions", request, result, options
1242
1260
  yield result, operation if block_given?
1243
- return result
1261
+ throw :response, result
1244
1262
  end
1245
1263
  rescue ::Gapic::Rest::Error => e
1246
1264
  raise ::Google::Cloud::Error.from_error(e)
@@ -1321,7 +1339,6 @@ module Google
1321
1339
 
1322
1340
  @artifact_registry_stub.get_version request, options do |result, operation|
1323
1341
  yield result, operation if block_given?
1324
- return result
1325
1342
  end
1326
1343
  rescue ::Gapic::Rest::Error => e
1327
1344
  raise ::Google::Cloud::Error.from_error(e)
@@ -1412,7 +1429,7 @@ module Google
1412
1429
  @artifact_registry_stub.delete_version request, options do |result, operation|
1413
1430
  result = ::Gapic::Operation.new result, @operations_client, options: options
1414
1431
  yield result, operation if block_given?
1415
- return result
1432
+ throw :response, result
1416
1433
  end
1417
1434
  rescue ::Gapic::Rest::Error => e
1418
1435
  raise ::Google::Cloud::Error.from_error(e)
@@ -1514,7 +1531,7 @@ module Google
1514
1531
  @artifact_registry_stub.list_files request, options do |result, operation|
1515
1532
  result = ::Gapic::Rest::PagedEnumerable.new @artifact_registry_stub, :list_files, "files", request, result, options
1516
1533
  yield result, operation if block_given?
1517
- return result
1534
+ throw :response, result
1518
1535
  end
1519
1536
  rescue ::Gapic::Rest::Error => e
1520
1537
  raise ::Google::Cloud::Error.from_error(e)
@@ -1593,7 +1610,6 @@ module Google
1593
1610
 
1594
1611
  @artifact_registry_stub.get_file request, options do |result, operation|
1595
1612
  yield result, operation if block_given?
1596
- return result
1597
1613
  end
1598
1614
  rescue ::Gapic::Rest::Error => e
1599
1615
  raise ::Google::Cloud::Error.from_error(e)
@@ -1691,7 +1707,7 @@ module Google
1691
1707
  @artifact_registry_stub.list_tags request, options do |result, operation|
1692
1708
  result = ::Gapic::Rest::PagedEnumerable.new @artifact_registry_stub, :list_tags, "tags", request, result, options
1693
1709
  yield result, operation if block_given?
1694
- return result
1710
+ throw :response, result
1695
1711
  end
1696
1712
  rescue ::Gapic::Rest::Error => e
1697
1713
  raise ::Google::Cloud::Error.from_error(e)
@@ -1770,7 +1786,6 @@ module Google
1770
1786
 
1771
1787
  @artifact_registry_stub.get_tag request, options do |result, operation|
1772
1788
  yield result, operation if block_given?
1773
- return result
1774
1789
  end
1775
1790
  rescue ::Gapic::Rest::Error => e
1776
1791
  raise ::Google::Cloud::Error.from_error(e)
@@ -1853,7 +1868,6 @@ module Google
1853
1868
 
1854
1869
  @artifact_registry_stub.create_tag request, options do |result, operation|
1855
1870
  yield result, operation if block_given?
1856
- return result
1857
1871
  end
1858
1872
  rescue ::Gapic::Rest::Error => e
1859
1873
  raise ::Google::Cloud::Error.from_error(e)
@@ -1936,7 +1950,6 @@ module Google
1936
1950
 
1937
1951
  @artifact_registry_stub.update_tag request, options do |result, operation|
1938
1952
  yield result, operation if block_given?
1939
- return result
1940
1953
  end
1941
1954
  rescue ::Gapic::Rest::Error => e
1942
1955
  raise ::Google::Cloud::Error.from_error(e)
@@ -2015,7 +2028,6 @@ module Google
2015
2028
 
2016
2029
  @artifact_registry_stub.delete_tag request, options do |result, operation|
2017
2030
  yield result, operation if block_given?
2018
- return result
2019
2031
  end
2020
2032
  rescue ::Gapic::Rest::Error => e
2021
2033
  raise ::Google::Cloud::Error.from_error(e)
@@ -2106,7 +2118,6 @@ module Google
2106
2118
 
2107
2119
  @artifact_registry_stub.set_iam_policy request, options do |result, operation|
2108
2120
  yield result, operation if block_given?
2109
- return result
2110
2121
  end
2111
2122
  rescue ::Gapic::Rest::Error => e
2112
2123
  raise ::Google::Cloud::Error.from_error(e)
@@ -2189,7 +2200,6 @@ module Google
2189
2200
 
2190
2201
  @artifact_registry_stub.get_iam_policy request, options do |result, operation|
2191
2202
  yield result, operation if block_given?
2192
- return result
2193
2203
  end
2194
2204
  rescue ::Gapic::Rest::Error => e
2195
2205
  raise ::Google::Cloud::Error.from_error(e)
@@ -2274,7 +2284,6 @@ module Google
2274
2284
 
2275
2285
  @artifact_registry_stub.test_iam_permissions request, options do |result, operation|
2276
2286
  yield result, operation if block_given?
2277
- return result
2278
2287
  end
2279
2288
  rescue ::Gapic::Rest::Error => e
2280
2289
  raise ::Google::Cloud::Error.from_error(e)
@@ -2353,7 +2362,6 @@ module Google
2353
2362
 
2354
2363
  @artifact_registry_stub.get_project_settings request, options do |result, operation|
2355
2364
  yield result, operation if block_given?
2356
- return result
2357
2365
  end
2358
2366
  rescue ::Gapic::Rest::Error => e
2359
2367
  raise ::Google::Cloud::Error.from_error(e)
@@ -2434,7 +2442,6 @@ module Google
2434
2442
 
2435
2443
  @artifact_registry_stub.update_project_settings request, options do |result, operation|
2436
2444
  yield result, operation if block_given?
2437
- return result
2438
2445
  end
2439
2446
  rescue ::Gapic::Rest::Error => e
2440
2447
  raise ::Google::Cloud::Error.from_error(e)
@@ -2514,6 +2521,11 @@ module Google
2514
2521
  # default endpoint URL. The default value of nil uses the environment
2515
2522
  # universe (usually the default "googleapis.com" universe).
2516
2523
  # @return [::String,nil]
2524
+ # @!attribute [rw] logger
2525
+ # A custom logger to use for request/response debug logging, or the value
2526
+ # `:default` (the default) to construct a default logger, or `nil` to
2527
+ # explicitly disable logging.
2528
+ # @return [::Logger,:default,nil]
2517
2529
  #
2518
2530
  class Configuration
2519
2531
  extend ::Gapic::Config
@@ -2542,6 +2554,7 @@ module Google
2542
2554
  # by the host service.
2543
2555
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2544
2556
  config_attr :bindings_override, {}, ::Hash, nil
2557
+ config_attr :logger, :default, ::Logger, nil, :default
2545
2558
 
2546
2559
  # @private
2547
2560
  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
  ##