google-cloud-policy_simulator 1.1.0 → 1.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9ee9d1ee6f66bdcc735d034c46ab189b9b3be89b015874d855c595df429a2d8
4
- data.tar.gz: 281802288748eddab9ea996a95e2d7823c2da937c7706781bfa48d3b687d8981
3
+ metadata.gz: ea5e56e454535fd1e25dfa31a7f345c04399a09e1c7335560c97fbaeb7241203
4
+ data.tar.gz: 75bfca4e9c930de016f372b8f220d9ae8a531635fd11b370dfcf7334e329c993
5
5
  SHA512:
6
- metadata.gz: 1d4e45fe0f3d3366b6ccd487d7a1d06cbff81f5beaeae190c11f131d15bab4929a5587b8efd387ade715fef88e038069b3cfd89c1d3c84122ef07747c123ad9b
7
- data.tar.gz: c92d7219fc9543cd3961ae5a5950e96680f607002de2afd9f50fd9775a8fae71b915efdbb1f35bc0702f4c053dab8fd696af08d361705b9dc3a9db6b279d6272
6
+ metadata.gz: 20e1991e9a6d2926f01b563fec143fd12f5a1088eefc4950294e6456f8f31279dafcd803c1609afb054270bcf9be70e6bf58313dd0cb030bc0d4df3a78c1b74f
7
+ data.tar.gz: d033489fcd8ffc3c5f2d203787d5d166854f55973f7356322af2d28f83f22ce6b3b7be2a0f7d47ee1e437d6ee756cd3e353d3f8187a4991187bda2b156f3be69
data/README.md CHANGED
@@ -7,7 +7,7 @@ Policy Simulator is a collection of endpoints for creating, running, and viewing
7
7
  Actual client classes for the various versions of this API are defined in
8
8
  _versioned_ client gems, with names of the form `google-cloud-policy_simulator-v*`.
9
9
  The gem `google-cloud-policy_simulator` is the main client library that brings the
10
- verisoned gems in as dependencies, and provides high-level methods for
10
+ versioned gems in as dependencies, and provides high-level methods for
11
11
  constructing clients. More information on versioned clients can be found below
12
12
  in the section titled *Which client should I use?*.
13
13
 
@@ -34,9 +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/policysimulator.googleapis.com)
35
35
  1. {file:AUTHENTICATION.md Set up authentication.}
36
36
 
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-policy_simulator-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest).
66
+
37
67
  ## Supported Ruby Versions
38
68
 
39
- This library is supported on Ruby 2.7+.
69
+ This library is supported on Ruby 3.0+.
40
70
 
41
71
  Google provides official support for Ruby versions that are actively supported
42
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 PolicySimulator
23
- VERSION = "1.1.0"
23
+ VERSION = "1.2.1"
24
24
  end
25
25
  end
26
26
  end
@@ -58,6 +58,11 @@ module Google
58
58
  # You can also specify a different transport by passing `:rest` or `:grpc` in
59
59
  # the `transport` parameter.
60
60
  #
61
+ # Raises an exception if the currently installed versioned client gem for the
62
+ # given API version does not support the given transport of the Simulator service.
63
+ # You can determine whether the method will succeed by calling
64
+ # {Google::Cloud::PolicySimulator.simulator_available?}.
65
+ #
61
66
  # ## About Simulator
62
67
  #
63
68
  # Policy Simulator API service.
@@ -90,6 +95,37 @@ module Google
90
95
  service_module.const_get(:Client).new(&block)
91
96
  end
92
97
 
98
+ ##
99
+ # Determines whether the Simulator service is supported by the current client.
100
+ # If true, you can retrieve a client object by calling {Google::Cloud::PolicySimulator.simulator}.
101
+ # If false, that method will raise an exception. This could happen if the given
102
+ # API version does not exist or does not support the Simulator service,
103
+ # or if the versioned client gem needs an update to support the Simulator service.
104
+ #
105
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
106
+ # Defaults to `:v1`.
107
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
108
+ # @return [boolean] Whether the service is available.
109
+ #
110
+ def self.simulator_available? version: :v1, transport: :grpc
111
+ require "google/cloud/policy_simulator/#{version.to_s.downcase}"
112
+ package_name = Google::Cloud::PolicySimulator
113
+ .constants
114
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
115
+ .first
116
+ return false unless package_name
117
+ service_module = Google::Cloud::PolicySimulator.const_get package_name
118
+ return false unless service_module.const_defined? :Simulator
119
+ service_module = service_module.const_get :Simulator
120
+ if transport == :rest
121
+ return false unless service_module.const_defined? :Rest
122
+ service_module = service_module.const_get :Rest
123
+ end
124
+ service_module.const_defined? :Client
125
+ rescue ::LoadError
126
+ false
127
+ end
128
+
93
129
  ##
94
130
  # Configure the google-cloud-policy_simulator library.
95
131
  #
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-policy_simulator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.1
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-20 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: google-cloud-core
@@ -67,7 +66,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
67
66
  licenses:
68
67
  - Apache-2.0
69
68
  metadata: {}
70
- post_install_message:
71
69
  rdoc_options: []
72
70
  require_paths:
73
71
  - lib
@@ -75,15 +73,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
73
  requirements:
76
74
  - - ">="
77
75
  - !ruby/object:Gem::Version
78
- version: '2.7'
76
+ version: '3.0'
79
77
  required_rubygems_version: !ruby/object:Gem::Requirement
80
78
  requirements:
81
79
  - - ">="
82
80
  - !ruby/object:Gem::Version
83
81
  version: '0'
84
82
  requirements: []
85
- rubygems_version: 3.5.6
86
- signing_key:
83
+ rubygems_version: 3.6.8
87
84
  specification_version: 4
88
85
  summary: Policy Simulator is a collection of endpoints for creating, running, and
89
86
  viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A `Replay` is a type