Class AccessApprovalClient (2.11.0)

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}
  • 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 Pub/Sub topic owned by the customer (contact support if you would like to enable Pub/Sub notifications).

ApprovalRequests can be approved or dismissed. Google personnel 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.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

AccessApprovalClient(AccessApprovalClient const &)

Copy and move support

Parameter
Name Description
AccessApprovalClient const &

AccessApprovalClient(AccessApprovalClient &&)

Copy and move support

Parameter
Name Description
AccessApprovalClient &&

AccessApprovalClient(std::shared_ptr< AccessApprovalConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< AccessApprovalConnection >
opts Options

Operators

operator=(AccessApprovalClient const &)

Copy and move support

Parameter
Name Description
AccessApprovalClient const &
Returns
Type Description
AccessApprovalClient &

operator=(AccessApprovalClient &&)

Copy and move support

Parameter
Name Description
AccessApprovalClient &&
Returns
Type Description
AccessApprovalClient &

Functions

ListApprovalRequests(std::string const &, Options)

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.

Parameters
Name Description
parent std::string const &

The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::accessapproval::v1::ApprovalRequest >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.accessapproval.v1.ApprovalRequest, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListApprovalRequests(google::cloud::accessapproval::v1::ListApprovalRequestsMessage, Options)

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.

Parameters
Name Description
request google::cloud::accessapproval::v1::ListApprovalRequestsMessage

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.ListApprovalRequestsMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::accessapproval::v1::ApprovalRequest >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.accessapproval.v1.ApprovalRequest, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetApprovalRequest(std::string const &, Options)

Gets an approval request.

Returns NOT_FOUND if the request does not exist.

Parameters
Name Description
name std::string const &

The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::ApprovalRequest >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.ApprovalRequest) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetApprovalRequest(google::cloud::accessapproval::v1::GetApprovalRequestMessage const &, Options)

Gets an approval request.

Returns NOT_FOUND if the request does not exist.

Parameters
Name Description
request google::cloud::accessapproval::v1::GetApprovalRequestMessage const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.GetApprovalRequestMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::ApprovalRequest >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.ApprovalRequest) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ApproveApprovalRequest(google::cloud::accessapproval::v1::ApproveApprovalRequestMessage const &, Options)

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.

Parameters
Name Description
request google::cloud::accessapproval::v1::ApproveApprovalRequestMessage const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.ApproveApprovalRequestMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::ApprovalRequest >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.ApprovalRequest) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DismissApprovalRequest(google::cloud::accessapproval::v1::DismissApprovalRequestMessage const &, Options)

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.

Parameters
Name Description
request google::cloud::accessapproval::v1::DismissApprovalRequestMessage const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.DismissApprovalRequestMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::ApprovalRequest >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.ApprovalRequest) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

InvalidateApprovalRequest(google::cloud::accessapproval::v1::InvalidateApprovalRequestMessage const &, Options)

Invalidates an existing ApprovalRequest.

Returns the updated ApprovalRequest.

NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval.

Returns FAILED_PRECONDITION if the request exists but is not in an approved state.

Parameters
Name Description
request google::cloud::accessapproval::v1::InvalidateApprovalRequestMessage const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.InvalidateApprovalRequestMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::ApprovalRequest >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.ApprovalRequest) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetAccessApprovalSettings(std::string const &, Options)

Gets the settings associated with a project, folder, or organization.

Parameters
Name Description
name std::string const &

The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::AccessApprovalSettings >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.AccessApprovalSettings) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetAccessApprovalSettings(google::cloud::accessapproval::v1::GetAccessApprovalSettingsMessage const &, Options)

Gets the settings associated with a project, folder, or organization.

Parameters
Name Description
request google::cloud::accessapproval::v1::GetAccessApprovalSettingsMessage const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.GetAccessApprovalSettingsMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::AccessApprovalSettings >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.AccessApprovalSettings) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateAccessApprovalSettings(google::cloud::accessapproval::v1::AccessApprovalSettings const &, google::protobuf::FieldMask const &, Options)

Updates the settings associated with a project, folder, or organization.

Settings to update are determined by the value of field_mask.

Parameters
Name Description
settings google::cloud::accessapproval::v1::AccessApprovalSettings const &

The new AccessApprovalSettings.

update_mask google::protobuf::FieldMask const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::AccessApprovalSettings >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.AccessApprovalSettings) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateAccessApprovalSettings(google::cloud::accessapproval::v1::UpdateAccessApprovalSettingsMessage const &, Options)

Updates the settings associated with a project, folder, or organization.

Settings to update are determined by the value of field_mask.

Parameters
Name Description
request google::cloud::accessapproval::v1::UpdateAccessApprovalSettingsMessage const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.UpdateAccessApprovalSettingsMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::AccessApprovalSettings >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.AccessApprovalSettings) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteAccessApprovalSettings(std::string const &, Options)

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.

Parameters
Name Description
name std::string const &

Name of the AccessApprovalSettings to delete.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteAccessApprovalSettings(google::cloud::accessapproval::v1::DeleteAccessApprovalSettingsMessage const &, Options)

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.

Parameters
Name Description
request google::cloud::accessapproval::v1::DeleteAccessApprovalSettingsMessage const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.DeleteAccessApprovalSettingsMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

GetAccessApprovalServiceAccount(std::string const &, Options)

Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.

Parameters
Name Description
name std::string const &

Name of the AccessApprovalServiceAccount to retrieve.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::AccessApprovalServiceAccount >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.AccessApprovalServiceAccount) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetAccessApprovalServiceAccount(google::cloud::accessapproval::v1::GetAccessApprovalServiceAccountMessage const &, Options)

Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.

Parameters
Name Description
request google::cloud::accessapproval::v1::GetAccessApprovalServiceAccountMessage const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.accessapproval.v1.GetAccessApprovalServiceAccountMessage. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::accessapproval::v1::AccessApprovalServiceAccount >

the result of the RPC. The response message type (google.cloud.accessapproval.v1.AccessApprovalServiceAccount) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.