Policy Simulator V1 API - Class Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Rest::Client (v1.4.0)

Reference documentation and code samples for the Policy Simulator V1 API class Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Rest::Client.

REST 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all OrgPolicyViolationsPreviewService clients
::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Rest::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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#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.

Overloads
def create_org_policy_violations_preview(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_org_policy_violations_preview via a request object, either of type CreateOrgPolicyViolationsPreviewRequest or an equivalent Hash.
Parameters
def create_org_policy_violations_preview(parent: nil, org_policy_violations_preview: nil, org_policy_violations_preview_id: nil) -> ::Gapic::Operation
Pass arguments to 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

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::Rest::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.

Overloads
def get_org_policy_violations_preview(request, options = nil) -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview
Pass arguments to get_org_policy_violations_preview via a request object, either of type GetOrgPolicyViolationsPreviewRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameter
  • name (::String) — Required. The name of the OrgPolicyViolationsPreview to get.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

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::Rest::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 REST client object.

Yields
  • (config) — Configure the OrgPolicyViolationsPreviewService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_org_policy_violations

def list_org_policy_violations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>
def list_org_policy_violations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>

ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an OrgPolicyViolationsPreview.

Overloads
def list_org_policy_violations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>
Pass arguments to list_org_policy_violations via a request object, either of type ListOrgPolicyViolationsRequest or an equivalent Hash.
Parameters
  • 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::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>
Pass arguments to 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).
Parameters
  • 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.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

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::Rest::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::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>
def list_org_policy_violations_previews(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>

ListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each OrgPolicyViolationsPreview is available for at least 7 days.

Overloads
def list_org_policy_violations_previews(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>
Pass arguments to list_org_policy_violations_previews via a request object, either of type ListOrgPolicyViolationsPreviewsRequest or an equivalent Hash.
Parameters
def list_org_policy_violations_previews(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>
Pass arguments to 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).
Parameters
  • 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.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

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::Rest::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.

Returns
  • (Logger)

#operations_client

def operations_client() -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Rest::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)