Binary Authorization V1 API - Class Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client (v1.1.0)

Reference documentation and code samples for the Binary Authorization V1 API class Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.

REST client for the BinauthzManagementService service.

Google Cloud Management Service for Binary Authorization admission policies and attestation authorities.

This API implements a REST model with the following objects:

Inherits

  • Object

Methods

.configure

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

Configure the BinauthzManagementService 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 BinauthzManagementService clients
::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the BinauthzManagementService 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_attestor

def create_attestor(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
def create_attestor(parent: nil, attestor_id: nil, attestor: nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor

Creates an attestor, and returns a copy of the new attestor. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the attestor already exists.

Overloads
def create_attestor(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
Pass arguments to create_attestor via a request object, either of type CreateAttestorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::BinaryAuthorization::V1::CreateAttestorRequest, ::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_attestor(parent: nil, attestor_id: nil, attestor: nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
Pass arguments to create_attestor 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
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/binary_authorization/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::BinaryAuthorization::V1::CreateAttestorRequest.new

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

# The returned object is of type Google::Cloud::BinaryAuthorization::V1::Attestor.
p result

#delete_attestor

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

Deletes an attestor. Returns NOT_FOUND if the attestor does not exist.

Overloads
def delete_attestor(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_attestor via a request object, either of type DeleteAttestorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::BinaryAuthorization::V1::DeleteAttestorRequest, ::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_attestor(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_attestor 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 attestors to delete, in the format projects/*/attestors/*.
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/binary_authorization/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::BinaryAuthorization::V1::DeleteAttestorRequest.new

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

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

#get_attestor

def get_attestor(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
def get_attestor(name: nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor

Gets an attestor. Returns NOT_FOUND if the attestor does not exist.

Overloads
def get_attestor(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
Pass arguments to get_attestor via a request object, either of type GetAttestorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::BinaryAuthorization::V1::GetAttestorRequest, ::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_attestor(name: nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
Pass arguments to get_attestor 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 attestor to retrieve, in the format projects/*/attestors/*.
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/binary_authorization/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::BinaryAuthorization::V1::GetAttestorRequest.new

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

# The returned object is of type Google::Cloud::BinaryAuthorization::V1::Attestor.
p result

#get_policy

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

A policy specifies the attestors that must attest to a container image, before the project is allowed to deploy that image. There is at most one policy per project. All image admission requests are permitted if a project has no policy.

Gets the policy for this project. Returns a default policy if the project does not have one.

Overloads
def get_policy(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Policy
Pass arguments to get_policy via a request object, either of type GetPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::BinaryAuthorization::V1::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::BinaryAuthorization::V1::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. The resource name of the policy to retrieve, in the format projects/*/policy.
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/binary_authorization/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::BinaryAuthorization::V1::Policy.
p result

#initialize

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

Create a new BinauthzManagementService REST client object.

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

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

#list_attestors

def list_attestors(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::BinaryAuthorization::V1::Attestor>
def list_attestors(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::BinaryAuthorization::V1::Attestor>

Lists attestors. Returns INVALID_ARGUMENT if the project does not exist.

Overloads
def list_attestors(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::BinaryAuthorization::V1::Attestor>
Pass arguments to list_attestors via a request object, either of type ListAttestorsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::BinaryAuthorization::V1::ListAttestorsRequest, ::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_attestors(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::BinaryAuthorization::V1::Attestor>
Pass arguments to list_attestors 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 resource name of the project associated with the attestors, in the format projects/*.
  • page_size (::Integer) — Requested page size. The server may return fewer results than requested. If unspecified, the server will pick an appropriate default.
  • page_token (::String) — A token identifying a page of results the server should return. Typically, this is the value of ListAttestorsResponse.next_page_token returned from the previous call to the ListAttestors method.
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/binary_authorization/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::BinaryAuthorization::V1::ListAttestorsRequest.new

# Call the list_attestors method.
result = client.list_attestors 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::BinaryAuthorization::V1::Attestor.
  p item
end

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_attestor

def update_attestor(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
def update_attestor(attestor: nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor

Updates an attestor. Returns NOT_FOUND if the attestor does not exist.

Overloads
def update_attestor(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
Pass arguments to update_attestor via a request object, either of type UpdateAttestorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::BinaryAuthorization::V1::UpdateAttestorRequest, ::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_attestor(attestor: nil) -> ::Google::Cloud::BinaryAuthorization::V1::Attestor
Pass arguments to update_attestor 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
  • (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/binary_authorization/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::BinaryAuthorization::V1::UpdateAttestorRequest.new

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

# The returned object is of type Google::Cloud::BinaryAuthorization::V1::Attestor.
p result

#update_policy

def update_policy(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Policy
def update_policy(policy: nil) -> ::Google::Cloud::BinaryAuthorization::V1::Policy

Creates or updates a project's policy, and returns a copy of the new policy. A policy is always updated as a whole, to avoid race conditions with concurrent policy enforcement (or management!) requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed.

Overloads
def update_policy(request, options = nil) -> ::Google::Cloud::BinaryAuthorization::V1::Policy
Pass arguments to update_policy via a request object, either of type UpdatePolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::BinaryAuthorization::V1::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) -> ::Google::Cloud::BinaryAuthorization::V1::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).
Parameter
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/binary_authorization/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::BinaryAuthorization::V1::Policy.
p result