google-cloud-policy_simulator 1.2.1 → 1.3.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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +3 -3
- data/lib/google/cloud/policy_simulator/version.rb +1 -1
- data/lib/google/cloud/policy_simulator.rb +80 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '048c7412a9c19eb2c378af1a453c47817fcfdcad7200becd7fbfcbd336f60728'
|
4
|
+
data.tar.gz: cf5f5f73fa1ea1a6005ac8c22f3bd096c5d0ab6050da03651ea9f16f2b1380c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 518f563a3ca4f19c2fa2815b807b81d02807f4a37a4c672761e57b8351ee6805c609bb7491aa968df458d716f67125bdc899931b585226b7dff3ec80580529ea
|
7
|
+
data.tar.gz: 2b8b280707f5caad3f686a57577f52e29b6dd716423a048574857837d407e79ba87e524a4664164873fd45cb6ffade54c060915f7ea8061fff9bffe23e1ac4a0
|
data/AUTHENTICATION.md
CHANGED
@@ -56,7 +56,7 @@ To configure a credentials file for an individual client initialization:
|
|
56
56
|
```ruby
|
57
57
|
require "google/cloud/policy_simulator"
|
58
58
|
|
59
|
-
client = Google::Cloud::PolicySimulator.
|
59
|
+
client = Google::Cloud::PolicySimulator.org_policy_violations_preview_service do |config|
|
60
60
|
config.credentials = "path/to/credentialfile.json"
|
61
61
|
end
|
62
62
|
```
|
@@ -70,7 +70,7 @@ Google::Cloud::PolicySimulator.configure do |config|
|
|
70
70
|
config.credentials = "path/to/credentialfile.json"
|
71
71
|
end
|
72
72
|
|
73
|
-
client = Google::Cloud::PolicySimulator.
|
73
|
+
client = Google::Cloud::PolicySimulator.org_policy_violations_preview_service
|
74
74
|
```
|
75
75
|
|
76
76
|
### Environment Variables
|
@@ -100,7 +100,7 @@ require "google/cloud/policy_simulator"
|
|
100
100
|
|
101
101
|
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
|
102
102
|
|
103
|
-
client = Google::Cloud::PolicySimulator.
|
103
|
+
client = Google::Cloud::PolicySimulator.org_policy_violations_preview_service
|
104
104
|
```
|
105
105
|
|
106
106
|
### Local ADC file
|
@@ -45,6 +45,86 @@ end
|
|
45
45
|
module Google
|
46
46
|
module Cloud
|
47
47
|
module PolicySimulator
|
48
|
+
##
|
49
|
+
# Create a new client object for OrgPolicyViolationsPreviewService.
|
50
|
+
#
|
51
|
+
# By default, this returns an instance of
|
52
|
+
# [Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-OrgPolicyViolationsPreviewService-Client)
|
53
|
+
# for a gRPC client for version V1 of the API.
|
54
|
+
# However, you can specify a different API version by passing it in the
|
55
|
+
# `version` parameter. If the OrgPolicyViolationsPreviewService service is
|
56
|
+
# supported by that API version, and the corresponding gem is available, the
|
57
|
+
# appropriate versioned client will be returned.
|
58
|
+
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
59
|
+
# the `transport` parameter.
|
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 OrgPolicyViolationsPreviewService service.
|
63
|
+
# You can determine whether the method will succeed by calling
|
64
|
+
# {Google::Cloud::PolicySimulator.org_policy_violations_preview_service_available?}.
|
65
|
+
#
|
66
|
+
# ## About OrgPolicyViolationsPreviewService
|
67
|
+
#
|
68
|
+
# Violations Preview API service for OrgPolicy.
|
69
|
+
#
|
70
|
+
# An
|
71
|
+
# OrgPolicyViolationsPreview
|
72
|
+
# is a preview of the violations that will exist as soon as a proposed
|
73
|
+
# OrgPolicy change is submitted. To create an
|
74
|
+
# OrgPolicyViolationsPreview,
|
75
|
+
# the API user specifies the changes they wish to make and requests the
|
76
|
+
# generation of a preview via [GenerateViolationsPreview][]. the OrgPolicy
|
77
|
+
# Simulator service then scans the API user's currently existing resources to
|
78
|
+
# determine these resources violate the newly set OrgPolicy.
|
79
|
+
#
|
80
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
81
|
+
# Defaults to `:v1`.
|
82
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
83
|
+
# @return [::Object] A client object for the specified version.
|
84
|
+
#
|
85
|
+
def self.org_policy_violations_preview_service version: :v1, transport: :grpc, &block
|
86
|
+
require "google/cloud/policy_simulator/#{version.to_s.downcase}"
|
87
|
+
|
88
|
+
package_name = Google::Cloud::PolicySimulator
|
89
|
+
.constants
|
90
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
91
|
+
.first
|
92
|
+
service_module = Google::Cloud::PolicySimulator.const_get(package_name).const_get(:OrgPolicyViolationsPreviewService)
|
93
|
+
service_module = service_module.const_get(:Rest) if transport == :rest
|
94
|
+
service_module.const_get(:Client).new(&block)
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Determines whether the OrgPolicyViolationsPreviewService service is supported by the current client.
|
99
|
+
# If true, you can retrieve a client object by calling {Google::Cloud::PolicySimulator.org_policy_violations_preview_service}.
|
100
|
+
# If false, that method will raise an exception. This could happen if the given
|
101
|
+
# API version does not exist or does not support the OrgPolicyViolationsPreviewService service,
|
102
|
+
# or if the versioned client gem needs an update to support the OrgPolicyViolationsPreviewService service.
|
103
|
+
#
|
104
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
105
|
+
# Defaults to `:v1`.
|
106
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
107
|
+
# @return [boolean] Whether the service is available.
|
108
|
+
#
|
109
|
+
def self.org_policy_violations_preview_service_available? version: :v1, transport: :grpc
|
110
|
+
require "google/cloud/policy_simulator/#{version.to_s.downcase}"
|
111
|
+
package_name = Google::Cloud::PolicySimulator
|
112
|
+
.constants
|
113
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
114
|
+
.first
|
115
|
+
return false unless package_name
|
116
|
+
service_module = Google::Cloud::PolicySimulator.const_get package_name
|
117
|
+
return false unless service_module.const_defined? :OrgPolicyViolationsPreviewService
|
118
|
+
service_module = service_module.const_get :OrgPolicyViolationsPreviewService
|
119
|
+
if transport == :rest
|
120
|
+
return false unless service_module.const_defined? :Rest
|
121
|
+
service_module = service_module.const_get :Rest
|
122
|
+
end
|
123
|
+
service_module.const_defined? :Client
|
124
|
+
rescue ::LoadError
|
125
|
+
false
|
126
|
+
end
|
127
|
+
|
48
128
|
##
|
49
129
|
# Create a new client object for Simulator.
|
50
130
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-policy_simulator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.6.
|
83
|
+
rubygems_version: 3.6.9
|
84
84
|
specification_version: 4
|
85
85
|
summary: Policy Simulator is a collection of endpoints for creating, running, and
|
86
86
|
viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A `Replay` is a type
|