Client for the AccessApproval service.
This API allows a customer to manage accesses to cloud resources by Google personnel. It defines the following resource model:
- The API has a collection of
ApprovalRequest
resources, named
approvalRequests/{approval_request_id}
- The API has top-level settings per Project/Folder/Organization, named
accessApprovalSettings
The service also periodically emails a list of recipients, defined at the Project/Folder/Organization level in the accessApprovalSettings, when there is a pending ApprovalRequest for them to act on. The ApprovalRequests can also optionally be published to a Cloud Pub/Sub topic owned by the customer (for Beta, the Pub/Sub setup is managed manually).
ApprovalRequests can be approved or dismissed. Google personel can only access the indicated resource or resources if the request is approved (subject to some exclusions: https://cloud.google.com/access-approval/docs/overview#exclusions).
Note: Using Access Approval functionality will mean that Google may not be able to meet the SLAs for your chosen products, as any support response times may be dramatically increased. As such the SLAs do not apply to any service disruption to the extent impacted by Customer's use of Access Approval. Do not enable Access Approval for projects where you may require high service availability and rapid response by Google Cloud Support.
After a request is approved or dismissed, no further action may be taken on it. Requests with the requested_expiration in the past or with no activity for 14 days are considered dismissed. When an approval expires, the request is considered dismissed.
If a request is not approved or dismissed, we call it pending.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the AccessApproval Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all AccessApproval clients ::Google::Cloud::AccessApproval::V1::AccessApproval::Client.configure do |config| config.timeout = 10.0 end
#approve_approval_request
def approve_approval_request(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
def approve_approval_request(name: nil, expire_time: nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
Approves a request and returns the updated ApprovalRequest.
Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
def approve_approval_request(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
approve_approval_request
via a request object, either of type
Google::Cloud::AccessApproval::V1::ApproveApprovalRequestMessage or an equivalent Hash.
- request (::Google::Cloud::AccessApproval::V1::ApproveApprovalRequestMessage, ::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 approve_approval_request(name: nil, expire_time: nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
approve_approval_request
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) — Name of the approval request to approve.
- expire_time (::Google::Protobuf::Timestamp, ::Hash) — The expiration time of this approval.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::AccessApproval::V1::ApprovalRequest)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/access_approval/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::AccessApproval::V1::AccessApproval::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::AccessApproval::V1::ApproveApprovalRequestMessage.new # Call the approve_approval_request method. result = client.approve_approval_request request # The returned object is of type Google::Cloud::AccessApproval::V1::ApprovalRequest. p result
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the AccessApproval 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)
#delete_access_approval_settings
def delete_access_approval_settings(request, options = nil) -> ::Google::Protobuf::Empty
def delete_access_approval_settings(name: nil) -> ::Google::Protobuf::Empty
Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.
def delete_access_approval_settings(request, options = nil) -> ::Google::Protobuf::Empty
delete_access_approval_settings
via a request object, either of type
DeleteAccessApprovalSettingsMessage or an equivalent Hash.
- request (::Google::Cloud::AccessApproval::V1::DeleteAccessApprovalSettingsMessage, ::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_approval_settings(name: nil) -> ::Google::Protobuf::Empty
delete_access_approval_settings
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) — Name of the AccessApprovalSettings to delete.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/access_approval/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::AccessApproval::V1::AccessApproval::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::AccessApproval::V1::DeleteAccessApprovalSettingsMessage.new # Call the delete_access_approval_settings method. result = client.delete_access_approval_settings request # The returned object is of type Google::Protobuf::Empty. p result
#dismiss_approval_request
def dismiss_approval_request(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
def dismiss_approval_request(name: nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
Dismisses a request. Returns the updated ApprovalRequest.
NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether.
Returns NOT_FOUND if the request does not exist.
Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
def dismiss_approval_request(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
dismiss_approval_request
via a request object, either of type
DismissApprovalRequestMessage or an equivalent Hash.
- request (::Google::Cloud::AccessApproval::V1::DismissApprovalRequestMessage, ::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 dismiss_approval_request(name: nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
dismiss_approval_request
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) — Name of the ApprovalRequest to dismiss.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::AccessApproval::V1::ApprovalRequest)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/access_approval/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::AccessApproval::V1::AccessApproval::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::AccessApproval::V1::DismissApprovalRequestMessage.new # Call the dismiss_approval_request method. result = client.dismiss_approval_request request # The returned object is of type Google::Cloud::AccessApproval::V1::ApprovalRequest. p result
#get_access_approval_settings
def get_access_approval_settings(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::AccessApprovalSettings
def get_access_approval_settings(name: nil) -> ::Google::Cloud::AccessApproval::V1::AccessApprovalSettings
Gets the settings associated with a project, folder, or organization.
def get_access_approval_settings(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::AccessApprovalSettings
get_access_approval_settings
via a request object, either of type
GetAccessApprovalSettingsMessage or an equivalent Hash.
- request (::Google::Cloud::AccessApproval::V1::GetAccessApprovalSettingsMessage, ::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_approval_settings(name: nil) -> ::Google::Cloud::AccessApproval::V1::AccessApprovalSettings
get_access_approval_settings
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) — Name of the AccessApprovalSettings to retrieve.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::AccessApproval::V1::AccessApprovalSettings)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/access_approval/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::AccessApproval::V1::AccessApproval::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::AccessApproval::V1::GetAccessApprovalSettingsMessage.new # Call the get_access_approval_settings method. result = client.get_access_approval_settings request # The returned object is of type Google::Cloud::AccessApproval::V1::AccessApprovalSettings. p result
#get_approval_request
def get_approval_request(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
def get_approval_request(name: nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
Gets an approval request. Returns NOT_FOUND if the request does not exist.
def get_approval_request(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
get_approval_request
via a request object, either of type
GetApprovalRequestMessage or an equivalent Hash.
- request (::Google::Cloud::AccessApproval::V1::GetApprovalRequestMessage, ::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_approval_request(name: nil) -> ::Google::Cloud::AccessApproval::V1::ApprovalRequest
get_approval_request
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) — Name of the approval request to retrieve.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::AccessApproval::V1::ApprovalRequest)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/access_approval/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::AccessApproval::V1::AccessApproval::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::AccessApproval::V1::GetApprovalRequestMessage.new # Call the get_approval_request method. result = client.get_approval_request request # The returned object is of type Google::Cloud::AccessApproval::V1::ApprovalRequest. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new AccessApproval client object.
- (config) — Configure the AccessApproval client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::AccessApproval::V1::AccessApproval::Client.new # Create a client using a custom configuration client = ::Google::Cloud::AccessApproval::V1::AccessApproval::Client.new do |config| config.timeout = 10.0 end
#list_approval_requests
def list_approval_requests(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AccessApproval::V1::ApprovalRequest>
def list_approval_requests(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AccessApproval::V1::ApprovalRequest>
Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.
def list_approval_requests(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AccessApproval::V1::ApprovalRequest>
list_approval_requests
via a request object, either of type
ListApprovalRequestsMessage or an equivalent Hash.
- request (::Google::Cloud::AccessApproval::V1::ListApprovalRequestsMessage, ::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_approval_requests(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AccessApproval::V1::ApprovalRequest>
list_approval_requests
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) — The parent resource. This may be "projects/{project_id}", "folders/{folder_id}", or "organizations/{organization_id}".
-
filter (::String) —
A filter on the type of approval requests to retrieve. Must be one of the following values:
- [not set]: Requests that are pending or have active approvals.
- ALL: All requests.
- PENDING: Only pending requests.
- ACTIVE: Only active (i.e. currently approved) requests.
- DISMISSED: Only dismissed (including expired) requests.
- page_size (::Integer) — Requested page size.
- page_token (::String) — A token identifying the page of results to return.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::AccessApproval::V1::ApprovalRequest>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::AccessApproval::V1::ApprovalRequest>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/access_approval/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::AccessApproval::V1::AccessApproval::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::AccessApproval::V1::ListApprovalRequestsMessage.new # Call the list_approval_requests method. result = client.list_approval_requests request # The returned object is of type Gapic::PagedEnumerable. You can # iterate over all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::AccessApproval::V1::ApprovalRequest. p response end
#update_access_approval_settings
def update_access_approval_settings(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::AccessApprovalSettings
def update_access_approval_settings(settings: nil, update_mask: nil) -> ::Google::Cloud::AccessApproval::V1::AccessApprovalSettings
Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.
def update_access_approval_settings(request, options = nil) -> ::Google::Cloud::AccessApproval::V1::AccessApprovalSettings
update_access_approval_settings
via a request object, either of type
UpdateAccessApprovalSettingsMessage or an equivalent Hash.
- request (::Google::Cloud::AccessApproval::V1::UpdateAccessApprovalSettingsMessage, ::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_approval_settings(settings: nil, update_mask: nil) -> ::Google::Cloud::AccessApproval::V1::AccessApprovalSettings
update_access_approval_settings
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).
- settings (::Google::Cloud::AccessApproval::V1::AccessApprovalSettings, ::Hash) — The new AccessApprovalSettings.
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — The update mask applies to the settings. Only the top level fields of
AccessApprovalSettings (notification_emails & enrolled_services) are
supported. For each field, if it is included, the currently stored value
will be entirely overwritten with the value of the field passed in this
request.
For the
FieldMask
definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask If this field is left unset, only the notification_emails field will be updated.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::AccessApproval::V1::AccessApprovalSettings)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/access_approval/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::AccessApproval::V1::AccessApproval::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::AccessApproval::V1::UpdateAccessApprovalSettingsMessage.new # Call the update_access_approval_settings method. result = client.update_access_approval_settings request # The returned object is of type Google::Cloud::AccessApproval::V1::AccessApprovalSettings. p result