google-cloud-service_usage 1.3.1 → 1.4.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: c7c4ac1494a07470d5e7ba3fe6555374f5283a5045f6a2d84ab5b100b09dd9d0
4
- data.tar.gz: 53463789883706524b7ad6b9cd1c138798f9b3bfa2e5bac8d084b06adc061ffd
3
+ metadata.gz: 5f583fe3818623a4a377c81fcfb89aa5fa0ee6fb9bf0155e50ae27c54944c66e
4
+ data.tar.gz: 64ed8ac60a5c2768a02fbfd76d691fbb448405a3cda8ab327a31e825a8418713
5
5
  SHA512:
6
- metadata.gz: 6c0918781ed35333e7f725e554b1babf8a3d148756056348a54d852a01fa4ed0888b74388cca253e36906badd21e0e76653b6858a7cc5cb332769b07aa07734e
7
- data.tar.gz: 043cfb6034d0c3852631b57a73ca0a1ecf6d5525865c9278a8f31b1fa8e9438847bdd07e10697d5b91a5b9b0a4dde2ea92be0b86c3e15f1e88868ae45cd86988
6
+ metadata.gz: c0d58a7e521c85bff478a6160f824aa1ffc502c602aa456bba7d9dae3bf6d4d00efc7e9b0962f648dacd5ea892b989389de4cc37c859ec7f23668fe38a79a0d4
7
+ data.tar.gz: 685d0e3ed71426b5e201a09153d109979fe55c511acae863be43d7682aeb5e049fd748bc01e2afeeeebe3b755f995c6615960c5bba0575f77d2790e84fc8d292
data/README.md CHANGED
@@ -34,35 +34,39 @@ In order to use this library, you first need to go through the following steps:
34
34
  1. [Enable the API.](https://console.cloud.google.com/apis/library/serviceusage.googleapis.com)
35
35
  1. {file:AUTHENTICATION.md Set up authentication.}
36
36
 
37
- ## Enabling Logging
38
-
39
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
40
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
41
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
42
- 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)
43
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
44
-
45
- Configuring a Ruby stdlib logger:
46
-
47
- ```ruby
48
- require "logger"
49
-
50
- module MyLogger
51
- LOGGER = Logger.new $stderr, level: Logger::WARN
52
- def logger
53
- LOGGER
54
- end
55
- end
56
-
57
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
58
- module GRPC
59
- extend MyLogger
60
- end
61
- ```
37
+ ## Debug Logging
38
+
39
+ This library comes with opt-in Debug Logging that can help you troubleshoot
40
+ your application's integration with the API. When logging is activated, key
41
+ events such as requests and responses, along with data payloads and metadata
42
+ such as headers and client configuration, are logged to the standard error
43
+ stream.
44
+
45
+ **WARNING:** Client Library Debug Logging includes your data payloads in
46
+ plaintext, which could include sensitive data such as PII for yourself or your
47
+ customers, private keys, or other security data that could be compromising if
48
+ leaked. Always practice good data hygiene with your application logs, and follow
49
+ the principle of least access. Google also recommends that Client Library Debug
50
+ Logging be enabled only temporarily during active debugging, and not used
51
+ permanently in production.
52
+
53
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
54
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
55
+ list of client library gem names. This will select the default logging behavior,
56
+ which writes logs to the standard error stream. On a local workstation, this may
57
+ result in logs appearing on the console. When running on a Google Cloud hosting
58
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
59
+ results in logs appearing alongside your application logs in the
60
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
61
+
62
+ Debug logging also requires that the versioned clients for this service be
63
+ sufficiently recent, released after about Dec 10, 2024. If logging is not
64
+ working, try updating the versioned clients in your bundle or installed gems:
65
+ [google-cloud-service_usage-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-service_usage-v1/latest).
62
66
 
63
67
  ## Supported Ruby Versions
64
68
 
65
- This library is supported on Ruby 2.7+.
69
+ This library is supported on Ruby 3.0+.
66
70
 
67
71
  Google provides official support for Ruby versions that are actively supported
68
72
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Cloud
22
22
  module ServiceUsage
23
- VERSION = "1.3.1"
23
+ VERSION = "1.4.0"
24
24
  end
25
25
  end
26
26
  end
@@ -56,6 +56,11 @@ module Google
56
56
  # supported by that API version, and the corresponding gem is available, the
57
57
  # appropriate versioned client will be returned.
58
58
  #
59
+ # Raises an exception if the currently installed versioned client gem for the
60
+ # given API version does not support the ServiceUsage service.
61
+ # You can determine whether the method will succeed by calling
62
+ # {Google::Cloud::ServiceUsage.service_usage_available?}.
63
+ #
59
64
  # ## About ServiceUsage
60
65
  #
61
66
  # Enables services that service consumers want to use on Google Cloud Platform,
@@ -79,6 +84,32 @@ module Google
79
84
  service_module.const_get(:Client).new(&block)
80
85
  end
81
86
 
87
+ ##
88
+ # Determines whether the ServiceUsage service is supported by the current client.
89
+ # If true, you can retrieve a client object by calling {Google::Cloud::ServiceUsage.service_usage}.
90
+ # If false, that method will raise an exception. This could happen if the given
91
+ # API version does not exist or does not support the ServiceUsage service,
92
+ # or if the versioned client gem needs an update to support the ServiceUsage service.
93
+ #
94
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
95
+ # Defaults to `:v1`.
96
+ # @return [boolean] Whether the service is available.
97
+ #
98
+ def self.service_usage_available? version: :v1
99
+ require "google/cloud/service_usage/#{version.to_s.downcase}"
100
+ package_name = Google::Cloud::ServiceUsage
101
+ .constants
102
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
103
+ .first
104
+ return false unless package_name
105
+ service_module = Google::Cloud::ServiceUsage.const_get package_name
106
+ return false unless service_module.const_defined? :ServiceUsage
107
+ service_module = service_module.const_get :ServiceUsage
108
+ service_module.const_defined? :Client
109
+ rescue ::LoadError
110
+ false
111
+ end
112
+
82
113
  ##
83
114
  # Configure the google-cloud-service_usage library.
84
115
  #
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-service_usage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-08 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: google-cloud-core
@@ -64,7 +63,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
64
63
  licenses:
65
64
  - Apache-2.0
66
65
  metadata: {}
67
- post_install_message:
68
66
  rdoc_options: []
69
67
  require_paths:
70
68
  - lib
@@ -72,15 +70,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
70
  requirements:
73
71
  - - ">="
74
72
  - !ruby/object:Gem::Version
75
- version: '2.7'
73
+ version: '3.0'
76
74
  required_rubygems_version: !ruby/object:Gem::Requirement
77
75
  requirements:
78
76
  - - ">="
79
77
  - !ruby/object:Gem::Version
80
78
  version: '0'
81
79
  requirements: []
82
- rubygems_version: 3.5.6
83
- signing_key:
80
+ rubygems_version: 3.6.2
84
81
  specification_version: 4
85
82
  summary: API Client library for the Service Usage API
86
83
  test_files: []