Reference documentation and code samples for the Policy Simulator V1 API class Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client.
Client for the OrgPolicyViolationsPreviewService service.
Violations Preview API service for OrgPolicy.
An OrgPolicyViolationsPreview is a preview of the violations that will exist as soon as a proposed OrgPolicy change is submitted. To create an OrgPolicyViolationsPreview, the API user specifies the changes they wish to make and requests the generation of a preview via [GenerateViolationsPreview][]. the OrgPolicy Simulator service then scans the API user's currently existing resources to determine these resources violate the newly set OrgPolicy.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the OrgPolicyViolationsPreviewService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all OrgPolicyViolationsPreviewService clients ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the OrgPolicyViolationsPreviewService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_org_policy_violations_preview
def create_org_policy_violations_preview(request, options = nil) -> ::Gapic::Operation
def create_org_policy_violations_preview(parent: nil, org_policy_violations_preview: nil, org_policy_violations_preview_id: nil) -> ::Gapic::Operation
CreateOrgPolicyViolationsPreview creates an
OrgPolicyViolationsPreview
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay
. The resources to scan are
inferred from these specified changes.
def create_org_policy_violations_preview(request, options = nil) -> ::Gapic::Operation
create_org_policy_violations_preview
via a request object, either of type
CreateOrgPolicyViolationsPreviewRequest or an equivalent Hash.
- request (::Google::Cloud::PolicySimulator::V1::CreateOrgPolicyViolationsPreviewRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_org_policy_violations_preview(parent: nil, org_policy_violations_preview: nil, org_policy_violations_preview_id: nil) -> ::Gapic::Operation
create_org_policy_violations_preview
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The organization under which this
OrgPolicyViolationsPreview
will be created.
Example:
organizations/my-example-org/locations/global
- org_policy_violations_preview (::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview, ::Hash) — Required. The OrgPolicyViolationsPreview to generate.
- org_policy_violations_preview_id (::String) — Optional. An optional user-specified ID for the OrgPolicyViolationsPreview. If not provided, a random ID will be generated.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/policy_simulator/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PolicySimulator::V1::CreateOrgPolicyViolationsPreviewRequest.new # Call the create_org_policy_violations_preview method. result = client.create_org_policy_violations_preview request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#get_org_policy_violations_preview
def get_org_policy_violations_preview(request, options = nil) -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview
def get_org_policy_violations_preview(name: nil) -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview
GetOrgPolicyViolationsPreview gets the specified OrgPolicyViolationsPreview. Each OrgPolicyViolationsPreview is available for at least 7 days.
def get_org_policy_violations_preview(request, options = nil) -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview
get_org_policy_violations_preview
via a request object, either of type
GetOrgPolicyViolationsPreviewRequest or an equivalent Hash.
- request (::Google::Cloud::PolicySimulator::V1::GetOrgPolicyViolationsPreviewRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_org_policy_violations_preview(name: nil) -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview
get_org_policy_violations_preview
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The name of the OrgPolicyViolationsPreview to get.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/policy_simulator/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PolicySimulator::V1::GetOrgPolicyViolationsPreviewRequest.new # Call the get_org_policy_violations_preview method. result = client.get_org_policy_violations_preview request # The returned object is of type Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new OrgPolicyViolationsPreviewService client object.
- (config) — Configure the OrgPolicyViolationsPreviewService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client.new do |config| config.timeout = 10.0 end
#list_org_policy_violations
def list_org_policy_violations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>
def list_org_policy_violations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>
ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an OrgPolicyViolationsPreview.
def list_org_policy_violations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>
list_org_policy_violations
via a request object, either of type
ListOrgPolicyViolationsRequest or an equivalent Hash.
- request (::Google::Cloud::PolicySimulator::V1::ListOrgPolicyViolationsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_org_policy_violations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>
list_org_policy_violations
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}
- page_size (::Integer) — Optional. The maximum number of items to return. The service may return fewer than this value. If unspecified, at most 1000 items will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
-
page_token (::String) — Optional. A page token, received from a previous call. Provide this to
retrieve the subsequent page.
When paginating, all other parameters must match the call that provided the page token.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/policy_simulator/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PolicySimulator::V1::ListOrgPolicyViolationsRequest.new # Call the list_org_policy_violations method. result = client.list_org_policy_violations request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation. p item end
#list_org_policy_violations_previews
def list_org_policy_violations_previews(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>
def list_org_policy_violations_previews(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>
ListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each OrgPolicyViolationsPreview is available for at least 7 days.
def list_org_policy_violations_previews(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>
list_org_policy_violations_previews
via a request object, either of type
ListOrgPolicyViolationsPreviewsRequest or an equivalent Hash.
- request (::Google::Cloud::PolicySimulator::V1::ListOrgPolicyViolationsPreviewsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_org_policy_violations_previews(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>
list_org_policy_violations_previews
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The parent the violations are scoped to.
Format:
organizations/{organization}/locations/{location}
Example:
organizations/my-example-org/locations/global
- page_size (::Integer) — Optional. The maximum number of items to return. The service may return fewer than this value. If unspecified, at most 5 items will be returned. The maximum value is 10; values above 10 will be coerced to 10.
-
page_token (::String) — Optional. A page token, received from a previous call. Provide this to
retrieve the subsequent page.
When paginating, all other parameters must match the call that provided the page token.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/policy_simulator/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PolicySimulator::V1::ListOrgPolicyViolationsPreviewsRequest.new # Call the list_org_policy_violations_previews method. result = client.list_org_policy_violations_previews request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview. p item end
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#operations_client
def operations_client() -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Operations
Get the associated client for long-running operations.
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)