pub struct ServiceAccountClient { /* private fields */ }Expand description
Calls ServiceAccountService.
Service accounts: an organization’s credentials for software, which
authenticate with the OAuth 2.0 client credentials grant and never log
in interactively. A new service account holds no role: grant it one with
a role binding on its member. An service_account::Type::External service account’s client
secret expires (secret_expire_time): rotate it before then with
RotateServiceAccountSecret.
Implementations§
Source§impl ServiceAccountClient
impl ServiceAccountClient
Sourcepub fn new(client: &Client) -> Self
pub fn new(client: &Client) -> Self
Returns a client of ServiceAccountService 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 async fn get_service_account(
&self,
request: GetServiceAccountRequest,
) -> Result<ServiceAccount, Error>
pub async fn get_service_account( &self, request: GetServiceAccountRequest, ) -> Result<ServiceAccount, Error>
Returns a service account, deleted or not. Needs
iam.service_account.list on the organization.
Sourcepub async fn list_service_accounts(
&self,
request: ListServiceAccountsRequest,
) -> Result<ListServiceAccountsResponse, Error>
pub async fn list_service_accounts( &self, request: ListServiceAccountsRequest, ) -> Result<ListServiceAccountsResponse, Error>
Lists an organization’s service accounts, oldest first. Deleted ones
are listed only when show_deleted is set. Needs
iam.service_account.list on the organization.
Sourcepub fn all_service_accounts(
&self,
request: ListServiceAccountsRequest,
) -> Pages<ServiceAccount>
pub fn all_service_accounts( &self, request: ListServiceAccountsRequest, ) -> Pages<ServiceAccount>
Returns everything list_service_accounts 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_service_account(
&self,
request: CreateServiceAccountRequest,
) -> Result<ServiceAccount, Error>
pub async fn create_service_account( &self, request: CreateServiceAccountRequest, ) -> Result<ServiceAccount, Error>
Creates a service account and, for an service_account::Type::External one, its client
secret, which expires after secret_lifetime. The response is the
only place the secret is ever shown: store it now. Needs
iam.service_account.create on the organization.
Sourcepub async fn rotate_service_account_secret(
&self,
request: RotateServiceAccountSecretRequest,
) -> Result<ServiceAccount, Error>
pub async fn rotate_service_account_secret( &self, request: RotateServiceAccountSecretRequest, ) -> Result<ServiceAccount, Error>
Issues a new client secret for an service_account::Type::External service account and
returns the service account with it in client_secret, the only place
it is ever shown. The previous secret is refused from then on, and the
new one is accepted at once, also when the previous one had expired.
It expires after secret_lifetime. An access token issued before
stays valid until it expires, within minutes. Needs
iam.service_account.create on the organization.
Sourcepub async fn delete_service_account(
&self,
request: DeleteServiceAccountRequest,
) -> Result<Empty, Error>
pub async fn delete_service_account( &self, request: DeleteServiceAccountRequest, ) -> Result<Empty, Error>
Deletes a service account for good: its credential is refused from
then on, an access token it already holds is refused on its next
request, and every role binding it holds, in any organization, is
removed. It stays readable as service_account::State::Deleted. Deleting a deleted service
account succeeds. Needs iam.service_account.revoke on the
organization.