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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa4fd7a2d83a483d357298e1fa2d56d3baa893229e4aad391a7228a35d20c487
4
- data.tar.gz: 17db5d6dca2acfc1a69c2dcdf7842f8cba017b2d375d004789158d2b10cb5409
3
+ metadata.gz: af543db2190662f50f58242e8bd79cd39a700dbca42bf70243ddab22901c419d
4
+ data.tar.gz: 6b0ccc176104dda5b8369aa62f06eacbd6c6587c43fb9bdc2e10052e18f4d430
5
5
  SHA512:
6
- metadata.gz: 4850d2c243be4884c36312272373e036c5dfbd7d7592fbc1381e34fc6800a3a8990909ec38a0a80d61f5755dc9a152af953ee37bb9926a15b41d8f02877957a4
7
- data.tar.gz: 305df44fe37835c31b85a76e4d3ffdebac087a41bf26b470e3636a32b2b92b2b890740e9e7a5c8410373c801c8f4c9755ddbd8b23f8fc09faecc2ea5fc1c1eba
6
+ metadata.gz: 18af8d292ac966a743402f166a906804ea8ba754a0010fce8e6e07ac816c701522e45df0e76e59ca365ae04ec32763fe1ec3fbed6181a579a61037f4daf78df7
7
+ data.tar.gz: 7320db7fed980800e9b2a45afd5c6ba8d8ffab405fb818cf2d79caf42899f350701478195feb2cbdd06038d5c0661ebfd07ff88fe821647250280d2f14534591
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/artifact-registry/)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/artifact_registry/v1beta2"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::ArtifactRegistry::V1beta2::ArtifactRegistry::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -262,14 +262,26 @@ module Google
262
262
  universe_domain: @config.universe_domain,
263
263
  channel_args: @config.channel_args,
264
264
  interceptors: @config.interceptors,
265
- channel_pool_config: @config.channel_pool
265
+ channel_pool_config: @config.channel_pool,
266
+ logger: @config.logger
266
267
  )
267
268
 
269
+ @artifact_registry_stub.stub_logger&.info do |entry|
270
+ entry.set_system_name
271
+ entry.set_service
272
+ entry.message = "Created client for #{entry.service}"
273
+ entry.set_credentials_fields credentials
274
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
275
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
276
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
277
+ end
278
+
268
279
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
269
280
  config.credentials = credentials
270
281
  config.quota_project = @quota_project_id
271
282
  config.endpoint = @artifact_registry_stub.endpoint
272
283
  config.universe_domain = @artifact_registry_stub.universe_domain
284
+ config.logger = @artifact_registry_stub.logger if config.respond_to? :logger=
273
285
  end
274
286
  end
275
287
 
@@ -287,6 +299,15 @@ module Google
287
299
  #
288
300
  attr_reader :location_client
289
301
 
302
+ ##
303
+ # The logger used for request/response debug logging.
304
+ #
305
+ # @return [Logger]
306
+ #
307
+ def logger
308
+ @artifact_registry_stub.logger
309
+ end
310
+
290
311
  # Service calls
291
312
 
292
313
  ##
@@ -382,7 +403,7 @@ module Google
382
403
  @artifact_registry_stub.call_rpc :import_apt_artifacts, request, options: options do |response, operation|
383
404
  response = ::Gapic::Operation.new response, @operations_client, options: options
384
405
  yield response, operation if block_given?
385
- return response
406
+ throw :response, response
386
407
  end
387
408
  rescue ::GRPC::BadStatus => e
388
409
  raise ::Google::Cloud::Error.from_error(e)
@@ -481,7 +502,7 @@ module Google
481
502
  @artifact_registry_stub.call_rpc :import_yum_artifacts, request, options: options do |response, operation|
482
503
  response = ::Gapic::Operation.new response, @operations_client, options: options
483
504
  yield response, operation if block_given?
484
- return response
505
+ throw :response, response
485
506
  end
486
507
  rescue ::GRPC::BadStatus => e
487
508
  raise ::Google::Cloud::Error.from_error(e)
@@ -576,7 +597,7 @@ module Google
576
597
  @artifact_registry_stub.call_rpc :list_repositories, request, options: options do |response, operation|
577
598
  response = ::Gapic::PagedEnumerable.new @artifact_registry_stub, :list_repositories, request, response, operation, options
578
599
  yield response, operation if block_given?
579
- return response
600
+ throw :response, response
580
601
  end
581
602
  rescue ::GRPC::BadStatus => e
582
603
  raise ::Google::Cloud::Error.from_error(e)
@@ -662,7 +683,6 @@ module Google
662
683
 
663
684
  @artifact_registry_stub.call_rpc :get_repository, request, options: options do |response, operation|
664
685
  yield response, operation if block_given?
665
- return response
666
686
  end
667
687
  rescue ::GRPC::BadStatus => e
668
688
  raise ::Google::Cloud::Error.from_error(e)
@@ -761,7 +781,7 @@ module Google
761
781
  @artifact_registry_stub.call_rpc :create_repository, request, options: options do |response, operation|
762
782
  response = ::Gapic::Operation.new response, @operations_client, options: options
763
783
  yield response, operation if block_given?
764
- return response
784
+ throw :response, response
765
785
  end
766
786
  rescue ::GRPC::BadStatus => e
767
787
  raise ::Google::Cloud::Error.from_error(e)
@@ -851,7 +871,6 @@ module Google
851
871
 
852
872
  @artifact_registry_stub.call_rpc :update_repository, request, options: options do |response, operation|
853
873
  yield response, operation if block_given?
854
- return response
855
874
  end
856
875
  rescue ::GRPC::BadStatus => e
857
876
  raise ::Google::Cloud::Error.from_error(e)
@@ -947,7 +966,7 @@ module Google
947
966
  @artifact_registry_stub.call_rpc :delete_repository, request, options: options do |response, operation|
948
967
  response = ::Gapic::Operation.new response, @operations_client, options: options
949
968
  yield response, operation if block_given?
950
- return response
969
+ throw :response, response
951
970
  end
952
971
  rescue ::GRPC::BadStatus => e
953
972
  raise ::Google::Cloud::Error.from_error(e)
@@ -1043,7 +1062,7 @@ module Google
1043
1062
  @artifact_registry_stub.call_rpc :list_packages, request, options: options do |response, operation|
1044
1063
  response = ::Gapic::PagedEnumerable.new @artifact_registry_stub, :list_packages, request, response, operation, options
1045
1064
  yield response, operation if block_given?
1046
- return response
1065
+ throw :response, response
1047
1066
  end
1048
1067
  rescue ::GRPC::BadStatus => e
1049
1068
  raise ::Google::Cloud::Error.from_error(e)
@@ -1129,7 +1148,6 @@ module Google
1129
1148
 
1130
1149
  @artifact_registry_stub.call_rpc :get_package, request, options: options do |response, operation|
1131
1150
  yield response, operation if block_given?
1132
- return response
1133
1151
  end
1134
1152
  rescue ::GRPC::BadStatus => e
1135
1153
  raise ::Google::Cloud::Error.from_error(e)
@@ -1224,7 +1242,7 @@ module Google
1224
1242
  @artifact_registry_stub.call_rpc :delete_package, request, options: options do |response, operation|
1225
1243
  response = ::Gapic::Operation.new response, @operations_client, options: options
1226
1244
  yield response, operation if block_given?
1227
- return response
1245
+ throw :response, response
1228
1246
  end
1229
1247
  rescue ::GRPC::BadStatus => e
1230
1248
  raise ::Google::Cloud::Error.from_error(e)
@@ -1323,7 +1341,7 @@ module Google
1323
1341
  @artifact_registry_stub.call_rpc :list_versions, request, options: options do |response, operation|
1324
1342
  response = ::Gapic::PagedEnumerable.new @artifact_registry_stub, :list_versions, request, response, operation, options
1325
1343
  yield response, operation if block_given?
1326
- return response
1344
+ throw :response, response
1327
1345
  end
1328
1346
  rescue ::GRPC::BadStatus => e
1329
1347
  raise ::Google::Cloud::Error.from_error(e)
@@ -1411,7 +1429,6 @@ module Google
1411
1429
 
1412
1430
  @artifact_registry_stub.call_rpc :get_version, request, options: options do |response, operation|
1413
1431
  yield response, operation if block_given?
1414
- return response
1415
1432
  end
1416
1433
  rescue ::GRPC::BadStatus => e
1417
1434
  raise ::Google::Cloud::Error.from_error(e)
@@ -1509,7 +1526,7 @@ module Google
1509
1526
  @artifact_registry_stub.call_rpc :delete_version, request, options: options do |response, operation|
1510
1527
  response = ::Gapic::Operation.new response, @operations_client, options: options
1511
1528
  yield response, operation if block_given?
1512
- return response
1529
+ throw :response, response
1513
1530
  end
1514
1531
  rescue ::GRPC::BadStatus => e
1515
1532
  raise ::Google::Cloud::Error.from_error(e)
@@ -1618,7 +1635,7 @@ module Google
1618
1635
  @artifact_registry_stub.call_rpc :list_files, request, options: options do |response, operation|
1619
1636
  response = ::Gapic::PagedEnumerable.new @artifact_registry_stub, :list_files, request, response, operation, options
1620
1637
  yield response, operation if block_given?
1621
- return response
1638
+ throw :response, response
1622
1639
  end
1623
1640
  rescue ::GRPC::BadStatus => e
1624
1641
  raise ::Google::Cloud::Error.from_error(e)
@@ -1704,7 +1721,6 @@ module Google
1704
1721
 
1705
1722
  @artifact_registry_stub.call_rpc :get_file, request, options: options do |response, operation|
1706
1723
  yield response, operation if block_given?
1707
- return response
1708
1724
  end
1709
1725
  rescue ::GRPC::BadStatus => e
1710
1726
  raise ::Google::Cloud::Error.from_error(e)
@@ -1809,7 +1825,7 @@ module Google
1809
1825
  @artifact_registry_stub.call_rpc :list_tags, request, options: options do |response, operation|
1810
1826
  response = ::Gapic::PagedEnumerable.new @artifact_registry_stub, :list_tags, request, response, operation, options
1811
1827
  yield response, operation if block_given?
1812
- return response
1828
+ throw :response, response
1813
1829
  end
1814
1830
  rescue ::GRPC::BadStatus => e
1815
1831
  raise ::Google::Cloud::Error.from_error(e)
@@ -1895,7 +1911,6 @@ module Google
1895
1911
 
1896
1912
  @artifact_registry_stub.call_rpc :get_tag, request, options: options do |response, operation|
1897
1913
  yield response, operation if block_given?
1898
- return response
1899
1914
  end
1900
1915
  rescue ::GRPC::BadStatus => e
1901
1916
  raise ::Google::Cloud::Error.from_error(e)
@@ -1985,7 +2000,6 @@ module Google
1985
2000
 
1986
2001
  @artifact_registry_stub.call_rpc :create_tag, request, options: options do |response, operation|
1987
2002
  yield response, operation if block_given?
1988
- return response
1989
2003
  end
1990
2004
  rescue ::GRPC::BadStatus => e
1991
2005
  raise ::Google::Cloud::Error.from_error(e)
@@ -2075,7 +2089,6 @@ module Google
2075
2089
 
2076
2090
  @artifact_registry_stub.call_rpc :update_tag, request, options: options do |response, operation|
2077
2091
  yield response, operation if block_given?
2078
- return response
2079
2092
  end
2080
2093
  rescue ::GRPC::BadStatus => e
2081
2094
  raise ::Google::Cloud::Error.from_error(e)
@@ -2161,7 +2174,6 @@ module Google
2161
2174
 
2162
2175
  @artifact_registry_stub.call_rpc :delete_tag, request, options: options do |response, operation|
2163
2176
  yield response, operation if block_given?
2164
- return response
2165
2177
  end
2166
2178
  rescue ::GRPC::BadStatus => e
2167
2179
  raise ::Google::Cloud::Error.from_error(e)
@@ -2259,7 +2271,6 @@ module Google
2259
2271
 
2260
2272
  @artifact_registry_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
2261
2273
  yield response, operation if block_given?
2262
- return response
2263
2274
  end
2264
2275
  rescue ::GRPC::BadStatus => e
2265
2276
  raise ::Google::Cloud::Error.from_error(e)
@@ -2349,7 +2360,6 @@ module Google
2349
2360
 
2350
2361
  @artifact_registry_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
2351
2362
  yield response, operation if block_given?
2352
- return response
2353
2363
  end
2354
2364
  rescue ::GRPC::BadStatus => e
2355
2365
  raise ::Google::Cloud::Error.from_error(e)
@@ -2441,7 +2451,6 @@ module Google
2441
2451
 
2442
2452
  @artifact_registry_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
2443
2453
  yield response, operation if block_given?
2444
- return response
2445
2454
  end
2446
2455
  rescue ::GRPC::BadStatus => e
2447
2456
  raise ::Google::Cloud::Error.from_error(e)
@@ -2527,7 +2536,6 @@ module Google
2527
2536
 
2528
2537
  @artifact_registry_stub.call_rpc :get_project_settings, request, options: options do |response, operation|
2529
2538
  yield response, operation if block_given?
2530
- return response
2531
2539
  end
2532
2540
  rescue ::GRPC::BadStatus => e
2533
2541
  raise ::Google::Cloud::Error.from_error(e)
@@ -2615,7 +2623,6 @@ module Google
2615
2623
 
2616
2624
  @artifact_registry_stub.call_rpc :update_project_settings, request, options: options do |response, operation|
2617
2625
  yield response, operation if block_given?
2618
- return response
2619
2626
  end
2620
2627
  rescue ::GRPC::BadStatus => e
2621
2628
  raise ::Google::Cloud::Error.from_error(e)
@@ -2704,6 +2711,11 @@ module Google
2704
2711
  # default endpoint URL. The default value of nil uses the environment
2705
2712
  # universe (usually the default "googleapis.com" universe).
2706
2713
  # @return [::String,nil]
2714
+ # @!attribute [rw] logger
2715
+ # A custom logger to use for request/response debug logging, or the value
2716
+ # `:default` (the default) to construct a default logger, or `nil` to
2717
+ # explicitly disable logging.
2718
+ # @return [::Logger,:default,nil]
2707
2719
  #
2708
2720
  class Configuration
2709
2721
  extend ::Gapic::Config
@@ -2728,6 +2740,7 @@ module Google
2728
2740
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2729
2741
  config_attr :quota_project, nil, ::String, nil
2730
2742
  config_attr :universe_domain, nil, ::String, nil
2743
+ config_attr :logger, :default, ::Logger, nil, :default
2731
2744
 
2732
2745
  # @private
2733
2746
  def initialize parent_config = nil
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -688,6 +679,11 @@ module Google
688
679
  # default endpoint URL. The default value of nil uses the environment
689
680
  # universe (usually the default "googleapis.com" universe).
690
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
691
687
  #
692
688
  class Configuration
693
689
  extend ::Gapic::Config
@@ -712,6 +708,7 @@ module Google
712
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
709
  config_attr :quota_project, nil, ::String, nil
714
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
715
712
 
716
713
  # @private
717
714
  def initialize parent_config = nil