ProjectsServiceAccounts
class ProjectsServiceAccounts extends Resource (View source)
The "serviceAccounts" collection of methods.
Typical usage is:
$iamService = new Google\Service\Iam(...);
$serviceAccounts = $iamService->projects_serviceAccounts;
Methods
Creates a ServiceAccount. (serviceAccounts.create)
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.
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. (serviceAccounts.disable)
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. (serviceAccounts.enable)
Gets a ServiceAccount. (serviceAccounts.get)
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.
Lists every ServiceAccount that belongs to a specific project.
Patches a ServiceAccount. (serviceAccounts.patch)
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.
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. (serviceAccounts.signBlob)
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. (serviceAccounts.signJwt)
Tests whether the caller has the specified permissions on a ServiceAccount.
Restores a deleted ServiceAccount. Important: It is not always possible to restore a deleted service account. Use this method only as a last resort.
Note: We are in the process of deprecating this method. Use
PatchServiceAccount instead. Updates a ServiceAccount. You can update only
the display_name
field. (serviceAccounts.update)
Details
ServiceAccount
create(string $name, CreateServiceAccountRequest $postBody, array $optParams = [])
Creates a ServiceAccount. (serviceAccounts.create)
IamEmpty
delete(string $name, array $optParams = [])
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.
(serviceAccounts.delete)
IamEmpty
disable(string $name, DisableServiceAccountRequest $postBody, array $optParams = [])
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. (serviceAccounts.disable)
IamEmpty
enable(string $name, EnableServiceAccountRequest $postBody, array $optParams = [])
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. (serviceAccounts.enable)
ServiceAccount
get(string $name, array $optParams = [])
Gets a ServiceAccount. (serviceAccounts.get)
Policy
getIamPolicy(string $resource, array $optParams = [])
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.
(serviceAccounts.getIamPolicy)
ListServiceAccountsResponse
listProjectsServiceAccounts(string $name, array $optParams = [])
Lists every ServiceAccount that belongs to a specific project.
(serviceAccounts.listProjectsServiceAccounts)
ServiceAccount
patch(string $name, PatchServiceAccountRequest $postBody, array $optParams = [])
Patches a ServiceAccount. (serviceAccounts.patch)
Policy
setIamPolicy(string $resource, SetIamPolicyRequest $postBody, array $optParams = [])
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.
(serviceAccounts.setIamPolicy)
SignBlobResponse
signBlob(string $name, SignBlobRequest $postBody, array $optParams = [])
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. (serviceAccounts.signBlob)
SignJwtResponse
signJwt(string $name, SignJwtRequest $postBody, array $optParams = [])
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. (serviceAccounts.signJwt)
TestIamPermissionsResponse
testIamPermissions(string $resource, TestIamPermissionsRequest $postBody, array $optParams = [])
Tests whether the caller has the specified permissions on a ServiceAccount.
(serviceAccounts.testIamPermissions)
UndeleteServiceAccountResponse
undelete(string $name, UndeleteServiceAccountRequest $postBody, array $optParams = [])
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. (serviceAccounts.undelete)
ServiceAccount
update(string $name, ServiceAccount $postBody, array $optParams = [])
Note: We are in the process of deprecating this method. Use
PatchServiceAccount instead. Updates a ServiceAccount. You can update only
the display_name
field. (serviceAccounts.update)