Identity and Access Management (IAM) v1 API - Class IAMClientImpl (2.3.0)

public sealed class IAMClientImpl : IAMClient

Reference documentation and code samples for the Identity and Access Management (IAM) v1 API class IAMClientImpl.

IAM client wrapper implementation, for convenient use.

Inheritance

object > IAMClient > IAMClientImpl

Namespace

Google.Cloud.Iam.Admin.V1

Assembly

Google.Cloud.Iam.Admin.V1.dll

Remarks

Creates and manages Identity and Access Management (IAM) resources.

You can use this service to work with all of the following resources:

  • Service accounts, which identify an application or a virtual machine (VM) instance rather than a person
  • Service account keys, which service accounts use to authenticate with Google APIs
  • IAM policies for service accounts, which specify the roles that a principal has for the service account
  • IAM custom roles, which help you limit the number of permissions that you grant to principals

In addition, you can use this service to complete the following tasks, among others:

  • Test whether a service account can use specific permissions
  • Check which roles you can grant for a specific resource
  • Lint, or validate, condition expressions in an IAM policy

When you read data from the IAM API, each read is eventually consistent. In other words, if you write data with the IAM API, then immediately read that data, the read operation might return an older version of the data. To deal with this behavior, your application can retry the request with truncated exponential backoff.

In contrast, writing data to the IAM API is sequentially consistent. In other words, write operations are always processed in the order in which they were received.

Constructors

IAMClientImpl(IAMClient, IAMSettings, ILogger)

public IAMClientImpl(IAM.IAMClient grpcClient, IAMSettings settings, ILogger logger)

Constructs a client wrapper for the IAM service, with the specified gRPC client and settings.

Parameters
Name Description
grpcClient IAMIAMClient

The underlying gRPC client.

settings IAMSettings

The base IAMSettings used within this client.

logger ILogger

Optional ILogger to use within this client.

Properties

GrpcClient

public override IAM.IAMClient GrpcClient { get; }

The underlying gRPC IAM client

Property Value
Type Description
IAMIAMClient
Overrides

Methods

CreateRole(CreateRoleRequest, CallSettings)

public override Role CreateRole(CreateRoleRequest request, CallSettings callSettings = null)

Creates a new custom [Role][google.iam.admin.v1.Role].

Parameters
Name Description
request CreateRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Role

The RPC response.

Overrides

CreateRoleAsync(CreateRoleRequest, CallSettings)

public override Task<Role> CreateRoleAsync(CreateRoleRequest request, CallSettings callSettings = null)

Creates a new custom [Role][google.iam.admin.v1.Role].

Parameters
Name Description
request CreateRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRole

A Task containing the RPC response.

Overrides

CreateServiceAccount(CreateServiceAccountRequest, CallSettings)

public override ServiceAccount CreateServiceAccount(CreateServiceAccountRequest request, CallSettings callSettings = null)

Creates a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request CreateServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ServiceAccount

The RPC response.

Overrides

CreateServiceAccountAsync(CreateServiceAccountRequest, CallSettings)

public override Task<ServiceAccount> CreateServiceAccountAsync(CreateServiceAccountRequest request, CallSettings callSettings = null)

Creates a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request CreateServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskServiceAccount

A Task containing the RPC response.

Overrides

CreateServiceAccountKey(CreateServiceAccountKeyRequest, CallSettings)

public override ServiceAccountKey CreateServiceAccountKey(CreateServiceAccountKeyRequest request, CallSettings callSettings = null)

Creates a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].

Parameters
Name Description
request CreateServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ServiceAccountKey

The RPC response.

Overrides

CreateServiceAccountKeyAsync(CreateServiceAccountKeyRequest, CallSettings)

public override Task<ServiceAccountKey> CreateServiceAccountKeyAsync(CreateServiceAccountKeyRequest request, CallSettings callSettings = null)

Creates a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].

Parameters
Name Description
request CreateServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskServiceAccountKey

A Task containing the RPC response.

Overrides

DeleteRole(DeleteRoleRequest, CallSettings)

public override Role DeleteRole(DeleteRoleRequest request, CallSettings callSettings = null)

Deletes a custom [Role][google.iam.admin.v1.Role].

When you delete a custom role, the following changes occur immediately:

  • You cannot bind a principal to the custom role in an IAM [Policy][google.iam.v1.Policy].
  • Existing bindings to the custom role are not changed, but they have no effect.
  • By default, the response from [ListRoles][google.iam.admin.v1.IAM.ListRoles] does not include the custom role.

You have 7 days to undelete the custom role. After 7 days, the following changes occur:

  • The custom role is permanently deleted and cannot be recovered.
  • If an IAM policy contains a binding to the custom role, the binding is permanently removed.
Parameters
Name Description
request DeleteRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Role

The RPC response.

Overrides

DeleteRoleAsync(DeleteRoleRequest, CallSettings)

public override Task<Role> DeleteRoleAsync(DeleteRoleRequest request, CallSettings callSettings = null)

Deletes a custom [Role][google.iam.admin.v1.Role].

When you delete a custom role, the following changes occur immediately:

  • You cannot bind a principal to the custom role in an IAM [Policy][google.iam.v1.Policy].
  • Existing bindings to the custom role are not changed, but they have no effect.
  • By default, the response from [ListRoles][google.iam.admin.v1.IAM.ListRoles] does not include the custom role.

You have 7 days to undelete the custom role. After 7 days, the following changes occur:

  • The custom role is permanently deleted and cannot be recovered.
  • If an IAM policy contains a binding to the custom role, the binding is permanently removed.
Parameters
Name Description
request DeleteRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRole

A Task containing the RPC response.

Overrides

DeleteServiceAccount(DeleteServiceAccountRequest, CallSettings)

public override void DeleteServiceAccount(DeleteServiceAccountRequest request, CallSettings callSettings = null)

Deletes a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Warning: After you delete a service account, you might not be able to undelete it. If you know that you need to re-enable the service account in the future, use [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount] instead.

If you delete a service account, IAM permanently removes the service account 30 days later. Google Cloud cannot recover the service account after it is permanently removed, even if you file a support request.

To help avoid unplanned outages, we recommend that you disable the service account before you delete it. Use [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount] to disable the service account, then wait at least 24 hours and watch for unintended consequences. If there are no unintended consequences, you can delete the service account.

Parameters
Name Description
request DeleteServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

DeleteServiceAccountAsync(DeleteServiceAccountRequest, CallSettings)

public override Task DeleteServiceAccountAsync(DeleteServiceAccountRequest request, CallSettings callSettings = null)

Deletes a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Warning: After you delete a service account, you might not be able to undelete it. If you know that you need to re-enable the service account in the future, use [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount] instead.

If you delete a service account, IAM permanently removes the service account 30 days later. Google Cloud cannot recover the service account after it is permanently removed, even if you file a support request.

To help avoid unplanned outages, we recommend that you disable the service account before you delete it. Use [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount] to disable the service account, then wait at least 24 hours and watch for unintended consequences. If there are no unintended consequences, you can delete the service account.

Parameters
Name Description
request DeleteServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

DeleteServiceAccountKey(DeleteServiceAccountKeyRequest, CallSettings)

public override void DeleteServiceAccountKey(DeleteServiceAccountKeyRequest request, CallSettings callSettings = null)

Deletes a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey]. Deleting a service account key does not revoke short-lived credentials that have been issued based on the service account key.

Parameters
Name Description
request DeleteServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

DeleteServiceAccountKeyAsync(DeleteServiceAccountKeyRequest, CallSettings)

public override Task DeleteServiceAccountKeyAsync(DeleteServiceAccountKeyRequest request, CallSettings callSettings = null)

Deletes a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey]. Deleting a service account key does not revoke short-lived credentials that have been issued based on the service account key.

Parameters
Name Description
request DeleteServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

DisableServiceAccount(DisableServiceAccountRequest, CallSettings)

public override void DisableServiceAccount(DisableServiceAccountRequest request, CallSettings callSettings = null)

Disables a [ServiceAccount][google.iam.admin.v1.ServiceAccount] immediately.

If an application uses the service account to authenticate, that application can no longer call Google APIs or access Google Cloud resources. Existing access tokens for the service account are rejected, and requests for new access tokens will fail.

To re-enable the service account, use [EnableServiceAccount][google.iam.admin.v1.IAM.EnableServiceAccount]. After you re-enable the service account, its existing access tokens will be accepted, and you can request new access tokens.

To help avoid unplanned outages, we recommend that you disable the service account before you delete it. Use this method to disable the service account, then wait at least 24 hours and watch for unintended consequences. If there are no unintended consequences, you can delete the service account with [DeleteServiceAccount][google.iam.admin.v1.IAM.DeleteServiceAccount].

Parameters
Name Description
request DisableServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

DisableServiceAccountAsync(DisableServiceAccountRequest, CallSettings)

public override Task DisableServiceAccountAsync(DisableServiceAccountRequest request, CallSettings callSettings = null)

Disables a [ServiceAccount][google.iam.admin.v1.ServiceAccount] immediately.

If an application uses the service account to authenticate, that application can no longer call Google APIs or access Google Cloud resources. Existing access tokens for the service account are rejected, and requests for new access tokens will fail.

To re-enable the service account, use [EnableServiceAccount][google.iam.admin.v1.IAM.EnableServiceAccount]. After you re-enable the service account, its existing access tokens will be accepted, and you can request new access tokens.

To help avoid unplanned outages, we recommend that you disable the service account before you delete it. Use this method to disable the service account, then wait at least 24 hours and watch for unintended consequences. If there are no unintended consequences, you can delete the service account with [DeleteServiceAccount][google.iam.admin.v1.IAM.DeleteServiceAccount].

Parameters
Name Description
request DisableServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

DisableServiceAccountKey(DisableServiceAccountKeyRequest, CallSettings)

public override void DisableServiceAccountKey(DisableServiceAccountKeyRequest request, CallSettings callSettings = null)

Disable a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey]. A disabled service account key can be re-enabled with [EnableServiceAccountKey][google.iam.admin.v1.IAM.EnableServiceAccountKey].

Parameters
Name Description
request DisableServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

DisableServiceAccountKeyAsync(DisableServiceAccountKeyRequest, CallSettings)

public override Task DisableServiceAccountKeyAsync(DisableServiceAccountKeyRequest request, CallSettings callSettings = null)

Disable a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey]. A disabled service account key can be re-enabled with [EnableServiceAccountKey][google.iam.admin.v1.IAM.EnableServiceAccountKey].

Parameters
Name Description
request DisableServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

EnableServiceAccount(EnableServiceAccountRequest, CallSettings)

public override void EnableServiceAccount(EnableServiceAccountRequest request, CallSettings callSettings = null)

Enables a [ServiceAccount][google.iam.admin.v1.ServiceAccount] that was disabled by [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount].

If the service account is already enabled, then this method has no effect.

If the service account was disabled by other means—for example, if Google disabled the service account because it was compromised—you cannot use this method to enable the service account.

Parameters
Name Description
request EnableServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

EnableServiceAccountAsync(EnableServiceAccountRequest, CallSettings)

public override Task EnableServiceAccountAsync(EnableServiceAccountRequest request, CallSettings callSettings = null)

Enables a [ServiceAccount][google.iam.admin.v1.ServiceAccount] that was disabled by [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount].

If the service account is already enabled, then this method has no effect.

If the service account was disabled by other means—for example, if Google disabled the service account because it was compromised—you cannot use this method to enable the service account.

Parameters
Name Description
request EnableServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

EnableServiceAccountKey(EnableServiceAccountKeyRequest, CallSettings)

public override void EnableServiceAccountKey(EnableServiceAccountKeyRequest request, CallSettings callSettings = null)

Enable a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].

Parameters
Name Description
request EnableServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

EnableServiceAccountKeyAsync(EnableServiceAccountKeyRequest, CallSettings)

public override Task EnableServiceAccountKeyAsync(EnableServiceAccountKeyRequest request, CallSettings callSettings = null)

Enable a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].

Parameters
Name Description
request EnableServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public override Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the IAM policy that is attached to a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. This IAM policy specifies which principals have access to the service account.

This method does not tell you whether the service account has been granted any roles on other resources. To check whether a service account has role grants on a resource, use the getIamPolicy method for that resource. For example, to view the role grants for a project, call the Resource Manager API's projects.getIamPolicy method.

Parameters
Name Description
request GetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Overrides

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public override Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the IAM policy that is attached to a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. This IAM policy specifies which principals have access to the service account.

This method does not tell you whether the service account has been granted any roles on other resources. To check whether a service account has role grants on a resource, use the getIamPolicy method for that resource. For example, to view the role grants for a project, call the Resource Manager API's projects.getIamPolicy method.

Parameters
Name Description
request GetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Overrides

GetRole(GetRoleRequest, CallSettings)

public override Role GetRole(GetRoleRequest request, CallSettings callSettings = null)

Gets the definition of a [Role][google.iam.admin.v1.Role].

Parameters
Name Description
request GetRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Role

The RPC response.

Overrides

GetRoleAsync(GetRoleRequest, CallSettings)

public override Task<Role> GetRoleAsync(GetRoleRequest request, CallSettings callSettings = null)

Gets the definition of a [Role][google.iam.admin.v1.Role].

Parameters
Name Description
request GetRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRole

A Task containing the RPC response.

Overrides

GetServiceAccount(GetServiceAccountRequest, CallSettings)

public override ServiceAccount GetServiceAccount(GetServiceAccountRequest request, CallSettings callSettings = null)

Gets a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request GetServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ServiceAccount

The RPC response.

Overrides

GetServiceAccountAsync(GetServiceAccountRequest, CallSettings)

public override Task<ServiceAccount> GetServiceAccountAsync(GetServiceAccountRequest request, CallSettings callSettings = null)

Gets a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request GetServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskServiceAccount

A Task containing the RPC response.

Overrides

GetServiceAccountKey(GetServiceAccountKeyRequest, CallSettings)

public override ServiceAccountKey GetServiceAccountKey(GetServiceAccountKeyRequest request, CallSettings callSettings = null)

Gets a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].

Parameters
Name Description
request GetServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ServiceAccountKey

The RPC response.

Overrides

GetServiceAccountKeyAsync(GetServiceAccountKeyRequest, CallSettings)

public override Task<ServiceAccountKey> GetServiceAccountKeyAsync(GetServiceAccountKeyRequest request, CallSettings callSettings = null)

Gets a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].

Parameters
Name Description
request GetServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskServiceAccountKey

A Task containing the RPC response.

Overrides

LintPolicy(LintPolicyRequest, CallSettings)

public override LintPolicyResponse LintPolicy(LintPolicyRequest request, CallSettings callSettings = null)

Lints, or validates, an IAM policy. Currently checks the [google.iam.v1.Binding.condition][google.iam.v1.Binding.condition] field, which contains a condition expression for a role binding.

Successful calls to this method always return an HTTP 200 OK status code, even if the linter detects an issue in the IAM policy.

Parameters
Name Description
request LintPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
LintPolicyResponse

The RPC response.

Overrides

LintPolicyAsync(LintPolicyRequest, CallSettings)

public override Task<LintPolicyResponse> LintPolicyAsync(LintPolicyRequest request, CallSettings callSettings = null)

Lints, or validates, an IAM policy. Currently checks the [google.iam.v1.Binding.condition][google.iam.v1.Binding.condition] field, which contains a condition expression for a role binding.

Successful calls to this method always return an HTTP 200 OK status code, even if the linter detects an issue in the IAM policy.

Parameters
Name Description
request LintPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskLintPolicyResponse

A Task containing the RPC response.

Overrides

ListRoles(ListRolesRequest, CallSettings)

public override PagedEnumerable<ListRolesResponse, Role> ListRoles(ListRolesRequest request, CallSettings callSettings = null)

Lists every predefined [Role][google.iam.admin.v1.Role] that IAM supports, or every custom role that is defined for an organization or project.

Parameters
Name Description
request ListRolesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListRolesResponseRole

A pageable sequence of Role resources.

Overrides

ListRolesAsync(ListRolesRequest, CallSettings)

public override PagedAsyncEnumerable<ListRolesResponse, Role> ListRolesAsync(ListRolesRequest request, CallSettings callSettings = null)

Lists every predefined [Role][google.iam.admin.v1.Role] that IAM supports, or every custom role that is defined for an organization or project.

Parameters
Name Description
request ListRolesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListRolesResponseRole

A pageable asynchronous sequence of Role resources.

Overrides

ListServiceAccountKeys(ListServiceAccountKeysRequest, CallSettings)

public override ListServiceAccountKeysResponse ListServiceAccountKeys(ListServiceAccountKeysRequest request, CallSettings callSettings = null)

Lists every [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] for a service account.

Parameters
Name Description
request ListServiceAccountKeysRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ListServiceAccountKeysResponse

The RPC response.

Overrides

ListServiceAccountKeysAsync(ListServiceAccountKeysRequest, CallSettings)

public override Task<ListServiceAccountKeysResponse> ListServiceAccountKeysAsync(ListServiceAccountKeysRequest request, CallSettings callSettings = null)

Lists every [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] for a service account.

Parameters
Name Description
request ListServiceAccountKeysRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskListServiceAccountKeysResponse

A Task containing the RPC response.

Overrides

ListServiceAccounts(ListServiceAccountsRequest, CallSettings)

public override PagedEnumerable<ListServiceAccountsResponse, ServiceAccount> ListServiceAccounts(ListServiceAccountsRequest request, CallSettings callSettings = null)

Lists every [ServiceAccount][google.iam.admin.v1.ServiceAccount] that belongs to a specific project.

Parameters
Name Description
request ListServiceAccountsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListServiceAccountsResponseServiceAccount

A pageable sequence of ServiceAccount resources.

Overrides

ListServiceAccountsAsync(ListServiceAccountsRequest, CallSettings)

public override PagedAsyncEnumerable<ListServiceAccountsResponse, ServiceAccount> ListServiceAccountsAsync(ListServiceAccountsRequest request, CallSettings callSettings = null)

Lists every [ServiceAccount][google.iam.admin.v1.ServiceAccount] that belongs to a specific project.

Parameters
Name Description
request ListServiceAccountsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListServiceAccountsResponseServiceAccount

A pageable asynchronous sequence of ServiceAccount resources.

Overrides

PatchServiceAccount(PatchServiceAccountRequest, CallSettings)

public override ServiceAccount PatchServiceAccount(PatchServiceAccountRequest request, CallSettings callSettings = null)

Patches a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request PatchServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ServiceAccount

The RPC response.

Overrides

PatchServiceAccountAsync(PatchServiceAccountRequest, CallSettings)

public override Task<ServiceAccount> PatchServiceAccountAsync(PatchServiceAccountRequest request, CallSettings callSettings = null)

Patches a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request PatchServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskServiceAccount

A Task containing the RPC response.

Overrides

QueryAuditableServices(QueryAuditableServicesRequest, CallSettings)

public override QueryAuditableServicesResponse QueryAuditableServices(QueryAuditableServicesRequest request, CallSettings callSettings = null)

Returns a list of services that allow you to opt into audit logs that are not generated by default.

To learn more about audit logs, see the Logging documentation.

Parameters
Name Description
request QueryAuditableServicesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
QueryAuditableServicesResponse

The RPC response.

Overrides

QueryAuditableServicesAsync(QueryAuditableServicesRequest, CallSettings)

public override Task<QueryAuditableServicesResponse> QueryAuditableServicesAsync(QueryAuditableServicesRequest request, CallSettings callSettings = null)

Returns a list of services that allow you to opt into audit logs that are not generated by default.

To learn more about audit logs, see the Logging documentation.

Parameters
Name Description
request QueryAuditableServicesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueryAuditableServicesResponse

A Task containing the RPC response.

Overrides

QueryGrantableRoles(QueryGrantableRolesRequest, CallSettings)

public override PagedEnumerable<QueryGrantableRolesResponse, Role> QueryGrantableRoles(QueryGrantableRolesRequest request, CallSettings callSettings = null)

Lists roles that can be granted on a Google Cloud resource. A role is grantable if the IAM policy for the resource can contain bindings to the role.

Parameters
Name Description
request QueryGrantableRolesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableQueryGrantableRolesResponseRole

A pageable sequence of Role resources.

Overrides

QueryGrantableRolesAsync(QueryGrantableRolesRequest, CallSettings)

public override PagedAsyncEnumerable<QueryGrantableRolesResponse, Role> QueryGrantableRolesAsync(QueryGrantableRolesRequest request, CallSettings callSettings = null)

Lists roles that can be granted on a Google Cloud resource. A role is grantable if the IAM policy for the resource can contain bindings to the role.

Parameters
Name Description
request QueryGrantableRolesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableQueryGrantableRolesResponseRole

A pageable asynchronous sequence of Role resources.

Overrides

QueryTestablePermissions(QueryTestablePermissionsRequest, CallSettings)

public override PagedEnumerable<QueryTestablePermissionsResponse, Permission> QueryTestablePermissions(QueryTestablePermissionsRequest request, CallSettings callSettings = null)

Lists every permission that you can test on a resource. A permission is testable if you can check whether a principal has that permission on the resource.

Parameters
Name Description
request QueryTestablePermissionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableQueryTestablePermissionsResponsePermission

A pageable sequence of Permission resources.

Overrides

QueryTestablePermissionsAsync(QueryTestablePermissionsRequest, CallSettings)

public override PagedAsyncEnumerable<QueryTestablePermissionsResponse, Permission> QueryTestablePermissionsAsync(QueryTestablePermissionsRequest request, CallSettings callSettings = null)

Lists every permission that you can test on a resource. A permission is testable if you can check whether a principal has that permission on the resource.

Parameters
Name Description
request QueryTestablePermissionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableQueryTestablePermissionsResponsePermission

A pageable asynchronous sequence of Permission resources.

Overrides

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public override Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the IAM policy that is attached to a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Use this method to grant or revoke access to the service account. For example, you could grant a principal the ability to impersonate the service account.

This method does not enable the service account to access other resources. To grant roles to a service account on a resource, follow these steps:

  1. Call the resource's getIamPolicy method to get its current IAM policy.
  2. Edit the policy so that it binds the service account to an IAM role for the resource.
  3. Call the resource's setIamPolicy method to update its IAM policy.

For detailed instructions, see Manage access to project, folders, and organizations or Manage access to other resources.

Parameters
Name Description
request SetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Overrides

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public override Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the IAM policy that is attached to a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Use this method to grant or revoke access to the service account. For example, you could grant a principal the ability to impersonate the service account.

This method does not enable the service account to access other resources. To grant roles to a service account on a resource, follow these steps:

  1. Call the resource's getIamPolicy method to get its current IAM policy.
  2. Edit the policy so that it binds the service account to an IAM role for the resource.
  3. Call the resource's setIamPolicy method to update its IAM policy.

For detailed instructions, see Manage access to project, folders, and organizations or Manage access to other resources.

Parameters
Name Description
request SetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Overrides

SignBlob(SignBlobRequest, CallSettings)

[Obsolete]
public override SignBlobResponse SignBlob(SignBlobRequest request, CallSettings callSettings = null)

Note: This method is deprecated. Use the signBlob method in the IAM Service Account Credentials API instead. If you currently use this method, see the migration guide for instructions.

Signs a blob using the system-managed private key for a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request SignBlobRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SignBlobResponse

The RPC response.

Overrides

SignBlobAsync(SignBlobRequest, CallSettings)

[Obsolete]
public override Task<SignBlobResponse> SignBlobAsync(SignBlobRequest request, CallSettings callSettings = null)

Note: This method is deprecated. Use the signBlob method in the IAM Service Account Credentials API instead. If you currently use this method, see the migration guide for instructions.

Signs a blob using the system-managed private key for a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request SignBlobRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSignBlobResponse

A Task containing the RPC response.

Overrides

SignJwt(SignJwtRequest, CallSettings)

[Obsolete]
public override SignJwtResponse SignJwt(SignJwtRequest request, CallSettings callSettings = null)

Note: This method is deprecated. Use the signJwt method in the IAM Service Account Credentials API instead. If you currently use this method, see the migration guide for instructions.

Signs a JSON Web Token (JWT) using the system-managed private key for a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request SignJwtRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SignJwtResponse

The RPC response.

Overrides

SignJwtAsync(SignJwtRequest, CallSettings)

[Obsolete]
public override Task<SignJwtResponse> SignJwtAsync(SignJwtRequest request, CallSettings callSettings = null)

Note: This method is deprecated. Use the signJwt method in the IAM Service Account Credentials API instead. If you currently use this method, see the migration guide for instructions.

Signs a JSON Web Token (JWT) using the system-managed private key for a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request SignJwtRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSignJwtResponse

A Task containing the RPC response.

Overrides

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public override TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)

Tests whether the caller has the specified permissions on a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TestIamPermissionsResponse

The RPC response.

Overrides

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public override Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)

Tests whether the caller has the specified permissions on a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Parameters
Name Description
request TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Overrides

UndeleteRole(UndeleteRoleRequest, CallSettings)

public override Role UndeleteRole(UndeleteRoleRequest request, CallSettings callSettings = null)

Undeletes a custom [Role][google.iam.admin.v1.Role].

Parameters
Name Description
request UndeleteRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Role

The RPC response.

Overrides

UndeleteRoleAsync(UndeleteRoleRequest, CallSettings)

public override Task<Role> UndeleteRoleAsync(UndeleteRoleRequest request, CallSettings callSettings = null)

Undeletes a custom [Role][google.iam.admin.v1.Role].

Parameters
Name Description
request UndeleteRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRole

A Task containing the RPC response.

Overrides

UndeleteServiceAccount(UndeleteServiceAccountRequest, CallSettings)

public override UndeleteServiceAccountResponse UndeleteServiceAccount(UndeleteServiceAccountRequest request, CallSettings callSettings = null)

Restores a deleted [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Important: It is not always possible to restore a deleted service account. Use this method only as a last resort.

After you delete a service account, IAM permanently removes the service account 30 days later. There is no way to restore a deleted service account that has been permanently removed.

Parameters
Name Description
request UndeleteServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
UndeleteServiceAccountResponse

The RPC response.

Overrides

UndeleteServiceAccountAsync(UndeleteServiceAccountRequest, CallSettings)

public override Task<UndeleteServiceAccountResponse> UndeleteServiceAccountAsync(UndeleteServiceAccountRequest request, CallSettings callSettings = null)

Restores a deleted [ServiceAccount][google.iam.admin.v1.ServiceAccount].

Important: It is not always possible to restore a deleted service account. Use this method only as a last resort.

After you delete a service account, IAM permanently removes the service account 30 days later. There is no way to restore a deleted service account that has been permanently removed.

Parameters
Name Description
request UndeleteServiceAccountRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskUndeleteServiceAccountResponse

A Task containing the RPC response.

Overrides

UpdateRole(UpdateRoleRequest, CallSettings)

public override Role UpdateRole(UpdateRoleRequest request, CallSettings callSettings = null)

Updates the definition of a custom [Role][google.iam.admin.v1.Role].

Parameters
Name Description
request UpdateRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Role

The RPC response.

Overrides

UpdateRoleAsync(UpdateRoleRequest, CallSettings)

public override Task<Role> UpdateRoleAsync(UpdateRoleRequest request, CallSettings callSettings = null)

Updates the definition of a custom [Role][google.iam.admin.v1.Role].

Parameters
Name Description
request UpdateRoleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRole

A Task containing the RPC response.

Overrides

UpdateServiceAccount(ServiceAccount, CallSettings)

public override ServiceAccount UpdateServiceAccount(ServiceAccount request, CallSettings callSettings = null)

Note: We are in the process of deprecating this method. Use [PatchServiceAccount][google.iam.admin.v1.IAM.PatchServiceAccount] instead.

Updates a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

You can update only the display_name field.

Parameters
Name Description
request ServiceAccount

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ServiceAccount

The RPC response.

Overrides

UpdateServiceAccountAsync(ServiceAccount, CallSettings)

public override Task<ServiceAccount> UpdateServiceAccountAsync(ServiceAccount request, CallSettings callSettings = null)

Note: We are in the process of deprecating this method. Use [PatchServiceAccount][google.iam.admin.v1.IAM.PatchServiceAccount] instead.

Updates a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

You can update only the display_name field.

Parameters
Name Description
request ServiceAccount

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskServiceAccount

A Task containing the RPC response.

Overrides

UploadServiceAccountKey(UploadServiceAccountKeyRequest, CallSettings)

public override ServiceAccountKey UploadServiceAccountKey(UploadServiceAccountKeyRequest request, CallSettings callSettings = null)

Uploads the public key portion of a key pair that you manage, and associates the public key with a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

After you upload the public key, you can use the private key from the key pair as a service account key.

Parameters
Name Description
request UploadServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ServiceAccountKey

The RPC response.

Overrides

UploadServiceAccountKeyAsync(UploadServiceAccountKeyRequest, CallSettings)

public override Task<ServiceAccountKey> UploadServiceAccountKeyAsync(UploadServiceAccountKeyRequest request, CallSettings callSettings = null)

Uploads the public key portion of a key pair that you manage, and associates the public key with a [ServiceAccount][google.iam.admin.v1.ServiceAccount].

After you upload the public key, you can use the private key from the key pair as a service account key.

Parameters
Name Description
request UploadServiceAccountKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskServiceAccountKey

A Task containing the RPC response.

Overrides