Organization Policy V2 API - Class Google::Cloud::OrgPolicy::V2::OrgPolicy::Client (v1.0.1)

Reference documentation and code samples for the Organization Policy V2 API class Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.

Client for the OrgPolicy service.

An interface for managing organization policies.

The Organization Policy Service provides a simple mechanism for organizations to restrict the allowed configurations across their entire resource hierarchy.

You can use a policy to configure restrictions on resources. For example, you can enforce a policy that restricts which Google Cloud APIs can be activated in a certain part of your resource hierarchy, or prevents serial port access to VM instances in a particular folder.

Policies are inherited down through the resource hierarchy. A policy applied to a parent resource automatically applies to all its child resources unless overridden with a policy lower in the hierarchy.

A constraint defines an aspect of a resource's configuration that can be controlled by an organization's policy administrator. Policies are a collection of constraints that defines their allowable configuration on a particular resource and its child resources.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the OrgPolicy 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 OrgPolicy clients
::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the OrgPolicy 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_custom_constraint

def create_custom_constraint(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
def create_custom_constraint(parent: nil, custom_constraint: nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint

Creates a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the organization does not exist. Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the constraint already exists on the given organization.

Overloads
def create_custom_constraint(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
Pass arguments to create_custom_constraint via a request object, either of type CreateCustomConstraintRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::CreateCustomConstraintRequest, ::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_custom_constraint(parent: nil, custom_constraint: nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
Pass arguments to create_custom_constraint 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
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::CreateCustomConstraintRequest.new

# Call the create_custom_constraint method.
result = client.create_custom_constraint request

# The returned object is of type Google::Cloud::OrgPolicy::V2::CustomConstraint.
p result

#create_policy

def create_policy(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
def create_policy(parent: nil, policy: nil) -> ::Google::Cloud::OrgPolicy::V2::Policy

Creates a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist. Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the policy already exists on the given Google Cloud resource.

Overloads
def create_policy(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
Pass arguments to create_policy via a request object, either of type CreatePolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::CreatePolicyRequest, ::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_policy(parent: nil, policy: nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
Pass arguments to create_policy 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 Google Cloud resource that will parent the new policy. Must be in one of the following forms:

    • projects/{project_number}
    • projects/{project_id}
    • folders/{folder_id}
    • organizations/{organization_id}
  • policy (::Google::Cloud::OrgPolicy::V2::Policy, ::Hash) — Required. Policy to create.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::CreatePolicyRequest.new

# Call the create_policy method.
result = client.create_policy request

# The returned object is of type Google::Cloud::OrgPolicy::V2::Policy.
p result

#delete_custom_constraint

def delete_custom_constraint(request, options = nil) -> ::Google::Protobuf::Empty
def delete_custom_constraint(name: nil) -> ::Google::Protobuf::Empty

Deletes a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist.

Overloads
def delete_custom_constraint(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_custom_constraint via a request object, either of type DeleteCustomConstraintRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::DeleteCustomConstraintRequest, ::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 delete_custom_constraint(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_custom_constraint 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. Name of the custom constraint to delete. See the custom constraint entry for naming rules.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::DeleteCustomConstraintRequest.new

# Call the delete_custom_constraint method.
result = client.delete_custom_constraint request

# The returned object is of type Google::Protobuf::Empty.
p result

#delete_policy

def delete_policy(request, options = nil) -> ::Google::Protobuf::Empty
def delete_policy(name: nil, etag: nil) -> ::Google::Protobuf::Empty

Deletes a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint or organization policy does not exist.

Overloads
def delete_policy(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_policy via a request object, either of type DeletePolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::DeletePolicyRequest, ::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 delete_policy(name: nil, etag: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_policy 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
  • name (::String) — Required. Name of the policy to delete. See the policy entry for naming rules.
  • etag (::String) — Optional. The current etag of policy. If an etag is provided and does not match the current etag of the policy, deletion will be blocked and an ABORTED error will be returned.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::DeletePolicyRequest.new

# Call the delete_policy method.
result = client.delete_policy request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_custom_constraint

def get_custom_constraint(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
def get_custom_constraint(name: nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint

Gets a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the custom constraint does not exist.

Overloads
def get_custom_constraint(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
Pass arguments to get_custom_constraint via a request object, either of type GetCustomConstraintRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::GetCustomConstraintRequest, ::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_custom_constraint(name: nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
Pass arguments to get_custom_constraint 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. Resource name of the custom constraint. See the custom constraint entry for naming requirements.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::GetCustomConstraintRequest.new

# Call the get_custom_constraint method.
result = client.get_custom_constraint request

# The returned object is of type Google::Cloud::OrgPolicy::V2::CustomConstraint.
p result

#get_effective_policy

def get_effective_policy(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
def get_effective_policy(name: nil) -> ::Google::Cloud::OrgPolicy::V2::Policy

Gets the effective policy on a resource. This is the result of merging policies in the resource hierarchy and evaluating conditions. The returned policy will not have an etag or condition set because it is an evaluated policy across multiple resources. Subtrees of Resource Manager resource hierarchy with 'under:' prefix will not be expanded.

Overloads
def get_effective_policy(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
Pass arguments to get_effective_policy via a request object, either of type GetEffectivePolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::GetEffectivePolicyRequest, ::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_effective_policy(name: nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
Pass arguments to get_effective_policy 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 effective policy to compute. See Policy for naming requirements.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::GetEffectivePolicyRequest.new

# Call the get_effective_policy method.
result = client.get_effective_policy request

# The returned object is of type Google::Cloud::OrgPolicy::V2::Policy.
p result

#get_policy

def get_policy(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
def get_policy(name: nil) -> ::Google::Cloud::OrgPolicy::V2::Policy

Gets a policy on a resource.

If no policy is set on the resource, NOT_FOUND is returned. The etag value can be used with UpdatePolicy() to update a policy during read-modify-write.

Overloads
def get_policy(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
Pass arguments to get_policy via a request object, either of type GetPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::GetPolicyRequest, ::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_policy(name: nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
Pass arguments to get_policy 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. Resource name of the policy. See Policy for naming requirements.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::GetPolicyRequest.new

# Call the get_policy method.
result = client.get_policy request

# The returned object is of type Google::Cloud::OrgPolicy::V2::Policy.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new OrgPolicy client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new do |config|
  config.timeout = 10.0
end

#list_constraints

def list_constraints(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::Constraint>
def list_constraints(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::Constraint>

Lists constraints that could be applied on the specified resource.

Overloads
def list_constraints(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::Constraint>
Pass arguments to list_constraints via a request object, either of type ListConstraintsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::ListConstraintsRequest, ::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_constraints(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::Constraint>
Pass arguments to list_constraints 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 Google Cloud resource that parents the constraint. Must be in one of the following forms:

    • projects/{project_number}
    • projects/{project_id}
    • folders/{folder_id}
    • organizations/{organization_id}
  • page_size (::Integer) — Size of the pages to be returned. This is currently unsupported and will be ignored. The server may at any point start using this field to limit page size.
  • page_token (::String) — Page token used to retrieve the next page. This is currently unsupported and will be ignored. The server may at any point start using this field.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::ListConstraintsRequest.new

# Call the list_constraints method.
result = client.list_constraints 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::OrgPolicy::V2::Constraint.
  p item
end

#list_custom_constraints

def list_custom_constraints(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::CustomConstraint>
def list_custom_constraints(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::CustomConstraint>

Retrieves all of the custom constraints that exist on a particular organization resource.

Overloads
def list_custom_constraints(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::CustomConstraint>
Pass arguments to list_custom_constraints via a request object, either of type ListCustomConstraintsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::ListCustomConstraintsRequest, ::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_custom_constraints(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::CustomConstraint>
Pass arguments to list_custom_constraints 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 target Google Cloud resource that parents the set of custom constraints that will be returned from this call. Must be in one of the following forms:

    • organizations/{organization_id}
  • page_size (::Integer) — Size of the pages to be returned. This is currently unsupported and will be ignored. The server may at any point start using this field to limit page size.
  • page_token (::String) — Page token used to retrieve the next page. This is currently unsupported and will be ignored. The server may at any point start using this field.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::ListCustomConstraintsRequest.new

# Call the list_custom_constraints method.
result = client.list_custom_constraints 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::OrgPolicy::V2::CustomConstraint.
  p item
end

#list_policies

def list_policies(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::Policy>
def list_policies(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::Policy>

Retrieves all of the policies that exist on a particular resource.

Overloads
def list_policies(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::Policy>
Pass arguments to list_policies via a request object, either of type ListPoliciesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::ListPoliciesRequest, ::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_policies(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::Policy>
Pass arguments to list_policies 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 target Google Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:

    • projects/{project_number}
    • projects/{project_id}
    • folders/{folder_id}
    • organizations/{organization_id}
  • page_size (::Integer) — Size of the pages to be returned. This is currently unsupported and will be ignored. The server may at any point start using this field to limit page size.
  • page_token (::String) — Page token used to retrieve the next page. This is currently unsupported and will be ignored. The server may at any point start using this field.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::ListPoliciesRequest.new

# Call the list_policies method.
result = client.list_policies 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::OrgPolicy::V2::Policy.
  p item
end

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_custom_constraint

def update_custom_constraint(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
def update_custom_constraint(custom_constraint: nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint

Updates a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist.

Note: the supplied policy will perform a full overwrite of all fields.

Overloads
def update_custom_constraint(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
Pass arguments to update_custom_constraint via a request object, either of type UpdateCustomConstraintRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::UpdateCustomConstraintRequest, ::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 update_custom_constraint(custom_constraint: nil) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint
Pass arguments to update_custom_constraint 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
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::UpdateCustomConstraintRequest.new

# Call the update_custom_constraint method.
result = client.update_custom_constraint request

# The returned object is of type Google::Cloud::OrgPolicy::V2::CustomConstraint.
p result

#update_policy

def update_policy(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
def update_policy(policy: nil, update_mask: nil) -> ::Google::Cloud::OrgPolicy::V2::Policy

Updates a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint or the policy do not exist. Returns a google.rpc.Status with google.rpc.Code.ABORTED if the etag supplied in the request does not match the persisted etag of the policy

Note: the supplied policy will perform a full overwrite of all fields.

Overloads
def update_policy(request, options = nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
Pass arguments to update_policy via a request object, either of type UpdatePolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OrgPolicy::V2::UpdatePolicyRequest, ::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 update_policy(policy: nil, update_mask: nil) -> ::Google::Cloud::OrgPolicy::V2::Policy
Pass arguments to update_policy 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
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/org_policy/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OrgPolicy::V2::UpdatePolicyRequest.new

# Call the update_policy method.
result = client.update_policy request

# The returned object is of type Google::Cloud::OrgPolicy::V2::Policy.
p result