pub struct GrantClient { /* private fields */ }Expand description
Calls GrantService.
A key’s grants.
Making, renewing and deleting a grant needs kms.grant.create,
kms.grant.update and kms.grant.delete on the key’s project, which the
platform’s own services hold where you let them use your keys; none of
them lets the holder use the key itself. Reading and listing need
kms.grant.get and kms.grant.list.
Implementations§
Source§impl GrantClient
impl GrantClient
Sourcepub fn new(client: &Client) -> Self
pub fn new(client: &Client) -> Self
Returns a client of GrantService that sends its calls through client.
Sourcepub fn service(&self) -> &Service
pub fn service(&self) -> &Service
The endpoint the client sends its calls to, which also serves the operations its methods answer with.
Sourcepub fn with_options(&self, options: CallOptions) -> Self
pub fn with_options(&self, options: CallOptions) -> Self
The same client, whose calls are sent as options says instead of as the Client’s settings do, such as a mutation that must not be sent twice: .with_options(CallOptions::new().max_attempts(1)). See CallOptions.
Sourcepub async fn get_grant(&self, request: GetGrantRequest) -> Result<Grant, Error>
pub async fn get_grant(&self, request: GetGrantRequest) -> Result<Grant, Error>
Returns a grant that hasn’t expired; an expired one is NOT_FOUND. A
grant made moments ago may be refused with SERVICE_UNAVAILABLE,
retryable, until its zone’s change arrives. Needs kms.grant.get on
the project.
Sourcepub async fn list_grants(
&self,
request: ListGrantsRequest,
) -> Result<ListGrantsResponse, Error>
pub async fn list_grants( &self, request: ListGrantsRequest, ) -> Result<ListGrantsResponse, Error>
Lists a key’s grants that haven’t expired, in every zone, ordered by
name. A grant made moments ago may be missing from the list until its
zone’s change arrives. Needs kms.grant.list on the project.
Sourcepub fn all_grants(&self, request: ListGrantsRequest) -> Pages<Grant>
pub fn all_grants(&self, request: ListGrantsRequest) -> Pages<Grant>
Returns everything list_grants lists from request’s page on, fetching the next page as the stream reaches it. A page that fails ends the stream with its error.
Sourcepub async fn create_grant(
&self,
request: CreateGrantRequest,
) -> Result<Grant, Error>
pub async fn create_grant( &self, request: CreateGrantRequest, ) -> Result<Grant, Error>
Makes a grant on an key::Purpose::EncryptDecrypt key for one host, refused with
BAD_REQUEST for a key of another purpose, a host that isn’t one of
the region’s, an empty encryption context, or a ttl outside 1 to 60
minutes, with CONFLICT for a key that isn’t enabled, and with
FORBIDDEN for an encryption context retired on the key. Needs
kms.grant.create on the project.
Sourcepub async fn renew_grant(
&self,
request: RenewGrantRequest,
) -> Result<Grant, Error>
pub async fn renew_grant( &self, request: RenewGrantRequest, ) -> Result<Grant, Error>
Extends a grant that hasn’t expired to ttl from now. An expired
grant isn’t renewed: CONFLICT, and a new one is made instead. A grant
whose encryption context was retired on the key since isn’t renewed
either: FORBIDDEN. Needs kms.grant.update on the project.
Sourcepub async fn delete_grant(
&self,
request: DeleteGrantRequest,
) -> Result<Empty, Error>
pub async fn delete_grant( &self, request: DeleteGrantRequest, ) -> Result<Empty, Error>
Ends a grant before it expires: from then on it opens nothing. Needs
kms.grant.delete on the project.