Identity and Access Management (IAM) V3BETA API - Class Google::Iam::V3beta::AccessPolicies::Rest::Client (v0.6.0)

Reference documentation and code samples for the Identity and Access Management (IAM) V3BETA API class Google::Iam::V3beta::AccessPolicies::Rest::Client.

REST client for the AccessPolicies service.

Manages Identity and Access Management (IAM) access policies.

Inherits

  • Object

Methods

.configure

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

Configure the AccessPolicies 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 AccessPolicies clients
::Google::Iam::V3beta::AccessPolicies::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the AccessPolicies 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_access_policy

def create_access_policy(request, options = nil) -> ::Gapic::Operation
def create_access_policy(parent: nil, access_policy_id: nil, access_policy: nil, validate_only: nil) -> ::Gapic::Operation

Creates an access policy, and returns a long running operation.

Overloads
def create_access_policy(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_access_policy via a request object, either of type CreateAccessPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V3beta::CreateAccessPolicyRequest, ::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_access_policy(parent: nil, access_policy_id: nil, access_policy: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to create_access_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 parent resource where this access policy will be created.

    Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

  • access_policy_id (::String) — Required. The ID to use for the access policy, which will become the final component of the access policy's resource name.

    This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, hyphens, or dots. Pattern, /[a-z][a-z0-9-.]{2,62}/.

    This value must be unique among all access policies with the same parent.

  • access_policy (::Google::Iam::V3beta::AccessPolicy, ::Hash) — Required. The access policy to create.
  • validate_only (::Boolean) — Optional. If set, validate the request and preview the creation, but do not actually post it.
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/iam/v3beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V3beta::AccessPolicies::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V3beta::CreateAccessPolicyRequest.new

# Call the create_access_policy method.
result = client.create_access_policy 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

#delete_access_policy

def delete_access_policy(request, options = nil) -> ::Gapic::Operation
def delete_access_policy(name: nil, etag: nil, validate_only: nil, force: nil) -> ::Gapic::Operation

Deletes an access policy.

Overloads
def delete_access_policy(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_access_policy via a request object, either of type DeleteAccessPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V3beta::DeleteAccessPolicyRequest, ::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_access_policy(name: nil, etag: nil, validate_only: nil, force: nil) -> ::Gapic::Operation
Pass arguments to delete_access_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. The name of the access policy to delete.

    Format: projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}

  • etag (::String) — Optional. The etag of the access policy. If this is provided, it must match the server's etag.
  • validate_only (::Boolean) — Optional. If set, validate the request and preview the deletion, but do not actually post it.
  • force (::Boolean) — Optional. If set to true, the request will force the deletion of the Policy even if the Policy references PolicyBindings.
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/iam/v3beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V3beta::AccessPolicies::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V3beta::DeleteAccessPolicyRequest.new

# Call the delete_access_policy method.
result = client.delete_access_policy 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_access_policy

def get_access_policy(request, options = nil) -> ::Google::Iam::V3beta::AccessPolicy
def get_access_policy(name: nil) -> ::Google::Iam::V3beta::AccessPolicy

Gets an access policy.

Overloads
def get_access_policy(request, options = nil) -> ::Google::Iam::V3beta::AccessPolicy
Pass arguments to get_access_policy via a request object, either of type GetAccessPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V3beta::GetAccessPolicyRequest, ::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_access_policy(name: nil) -> ::Google::Iam::V3beta::AccessPolicy
Pass arguments to get_access_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 name of the access policy to retrieve.

    Format: projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}

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/iam/v3beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V3beta::AccessPolicies::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V3beta::GetAccessPolicyRequest.new

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

# The returned object is of type Google::Iam::V3beta::AccessPolicy.
p result

#initialize

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

Create a new AccessPolicies REST client object.

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

# Create a client using a custom configuration
client = ::Google::Iam::V3beta::AccessPolicies::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_access_policies

def list_access_policies(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Iam::V3beta::AccessPolicy>
def list_access_policies(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Iam::V3beta::AccessPolicy>

Lists access policies.

Overloads
def list_access_policies(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Iam::V3beta::AccessPolicy>
Pass arguments to list_access_policies via a request object, either of type ListAccessPoliciesRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V3beta::ListAccessPoliciesRequest, ::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_access_policies(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Iam::V3beta::AccessPolicy>
Pass arguments to list_access_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 parent resource, which owns the collection of access policy resources.

    Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

  • page_size (::Integer) — Optional. The maximum number of access policies to return. The service may return fewer than this value.

    If unspecified, at most 50 access policies will be returned. Valid value ranges from 1 to 1000; values above 1000 will be coerced to 1000.

  • page_token (::String) — Optional. A page token, received from a previous ListAccessPolicies call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListAccessPolicies 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/iam/v3beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V3beta::AccessPolicies::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V3beta::ListAccessPoliciesRequest.new

# Call the list_access_policies method.
result = client.list_access_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::Iam::V3beta::AccessPolicy.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#operations_client

def operations_client() -> ::Google::Iam::V3beta::AccessPolicies::Rest::Operations

Get the associated client for long-running operations.

#search_access_policy_bindings

def search_access_policy_bindings(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Iam::V3beta::PolicyBinding>
def search_access_policy_bindings(name: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Iam::V3beta::PolicyBinding>

Returns all policy bindings that bind a specific policy if a user has searchPolicyBindings permission on that policy.

Overloads
def search_access_policy_bindings(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Iam::V3beta::PolicyBinding>
Pass arguments to search_access_policy_bindings via a request object, either of type SearchAccessPolicyBindingsRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V3beta::SearchAccessPolicyBindingsRequest, ::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 search_access_policy_bindings(name: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Iam::V3beta::PolicyBinding>
Pass arguments to search_access_policy_bindings 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. The name of the access policy. Format: organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id}
  • page_size (::Integer) — Optional. The maximum number of policy bindings to return. The service may return fewer than this value.

    If unspecified, at most 50 policy bindings 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 SearchAccessPolicyBindingsRequest call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to SearchAccessPolicyBindingsRequest 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/iam/v3beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V3beta::AccessPolicies::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V3beta::SearchAccessPolicyBindingsRequest.new

# Call the search_access_policy_bindings method.
result = client.search_access_policy_bindings 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::Iam::V3beta::PolicyBinding.
  p item
end

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_access_policy

def update_access_policy(request, options = nil) -> ::Gapic::Operation
def update_access_policy(access_policy: nil, validate_only: nil) -> ::Gapic::Operation

Updates an access policy.

Overloads
def update_access_policy(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_access_policy via a request object, either of type UpdateAccessPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V3beta::UpdateAccessPolicyRequest, ::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_access_policy(access_policy: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to update_access_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
  • access_policy (::Google::Iam::V3beta::AccessPolicy, ::Hash) — Required. The access policy to update.

    The access policy's name field is used to identify the policy to update.

  • validate_only (::Boolean) — Optional. If set, validate the request and preview the update, but do not actually post it.
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/iam/v3beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V3beta::AccessPolicies::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V3beta::UpdateAccessPolicyRequest.new

# Call the update_access_policy method.
result = client.update_access_policy 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