Show / Hide Table of Contents

Class ProjectsResource.ServiceAccountsResource

The "serviceAccounts" collection of methods.

Inheritance
object
ProjectsResource.ServiceAccountsResource
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Google.Apis.Iam.v1
Assembly: Google.Apis.Iam.v1.dll
Syntax
public class ProjectsResource.ServiceAccountsResource

Constructors

ServiceAccountsResource(IClientService)

Constructs a new resource.

Declaration
public ServiceAccountsResource(IClientService service)
Parameters
Type Name Description
IClientService service

Properties

Keys

Gets the Keys resource.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.KeysResource Keys { get; }
Property Value
Type Description
ProjectsResource.ServiceAccountsResource.KeysResource

Methods

Create(CreateServiceAccountRequest, string)

Creates a ServiceAccount.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.CreateRequest Create(CreateServiceAccountRequest body, string name)
Parameters
Type Name Description
CreateServiceAccountRequest body

The body of the request.

string name

Required. The resource name of the project associated with the service accounts, such as projects/my-project-123.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.CreateRequest

Delete(string)

Deletes a 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 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 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.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.DeleteRequest Delete(string name)
Parameters
Type Name Description
string name

Required. The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.DeleteRequest

Disable(DisableServiceAccountRequest, string)

Disables a 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. 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.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.DisableRequest Disable(DisableServiceAccountRequest body, string name)
Parameters
Type Name Description
DisableServiceAccountRequest body

The body of the request.

string name

The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.DisableRequest

Enable(EnableServiceAccountRequest, string)

Enables a ServiceAccount that was disabled by 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.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.EnableRequest Enable(EnableServiceAccountRequest body, string name)
Parameters
Type Name Description
EnableServiceAccountRequest body

The body of the request.

string name

The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.EnableRequest

Get(string)

Gets a ServiceAccount.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.GetRequest Get(string name)
Parameters
Type Name Description
string name

Required. The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.GetRequest

GetIamPolicy(string)

Gets the IAM policy that is attached to a 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.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.GetIamPolicyRequest GetIamPolicy(string resource)
Parameters
Type Name Description
string resource

REQUIRED: The resource for which the policy is being requested. See Resource names for the appropriate value for this field.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.GetIamPolicyRequest

List(string)

Lists every ServiceAccount that belongs to a specific project.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.ListRequest List(string name)
Parameters
Type Name Description
string name

Required. The resource name of the project associated with the service accounts, such as projects/my-project-123.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.ListRequest

Patch(PatchServiceAccountRequest, string)

Patches a ServiceAccount.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.PatchRequest Patch(PatchServiceAccountRequest body, string name)
Parameters
Type Name Description
PatchServiceAccountRequest body

The body of the request.

string name

The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.PatchRequest

SetIamPolicy(SetIamPolicyRequest, string)

Sets the IAM policy that is attached to a 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.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.SetIamPolicyRequest SetIamPolicy(SetIamPolicyRequest body, string resource)
Parameters
Type Name Description
SetIamPolicyRequest body

The body of the request.

string resource

REQUIRED: The resource for which the policy is being specified. See Resource names for the appropriate value for this field.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.SetIamPolicyRequest

SignBlob(SignBlobRequest, string)

Signs a blob using the system-managed private key for a ServiceAccount.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.SignBlobRequest SignBlob(SignBlobRequest body, string name)
Parameters
Type Name Description
SignBlobRequest body

The body of the request.

string name

Required. Deprecated. Migrate to Service Account Credentials API. The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.SignBlobRequest

SignJwt(SignJwtRequest, string)

Signs a JSON Web Token (JWT) using the system-managed private key for a ServiceAccount.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.SignJwtRequest SignJwt(SignJwtRequest body, string name)
Parameters
Type Name Description
SignJwtRequest body

The body of the request.

string name

Required. Deprecated. Migrate to Service Account Credentials API. The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.SignJwtRequest

TestIamPermissions(TestIamPermissionsRequest, string)

Tests whether the caller has the specified permissions on a ServiceAccount.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.TestIamPermissionsRequest TestIamPermissions(TestIamPermissionsRequest body, string resource)
Parameters
Type Name Description
TestIamPermissionsRequest body

The body of the request.

string resource

REQUIRED: The resource for which the policy detail is being requested. See Resource names for the appropriate value for this field.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.TestIamPermissionsRequest

Undelete(UndeleteServiceAccountRequest, string)

Restores a deleted 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.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.UndeleteRequest Undelete(UndeleteServiceAccountRequest body, string name)
Parameters
Type Name Description
UndeleteServiceAccountRequest body

The body of the request.

string name

The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.UndeleteRequest

Update(ServiceAccount, string)

Note: We are in the process of deprecating this method. Use PatchServiceAccount instead. Updates a ServiceAccount. You can update only the display_name field.

Declaration
public virtual ProjectsResource.ServiceAccountsResource.UpdateRequest Update(ServiceAccount body, string name)
Parameters
Type Name Description
ServiceAccount body

The body of the request.

string name

The resource name of the service account. Use one of the following formats: * projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS} * projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID} As an alternative, you can use the - wildcard character instead of the project ID: * projects/-/serviceAccounts/{EMAIL_ADDRESS} * projects/-/serviceAccounts/{UNIQUE_ID} When possible, avoid using the - wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account projects/-/serviceAccounts/fake@example.com, which does not exist, the response contains an HTTP 403 Forbidden error instead of a 404 Not Found error.

Returns
Type Description
ProjectsResource.ServiceAccountsResource.UpdateRequest
In this article
Back to top Generated by DocFX