Documentation

Google_Service_Iam_Resource_ProjectsServiceAccounts extends Google_Service_Resource
in package

The "serviceAccounts" collection of methods.

Typical usage is: $iamService = new Google_Service_Iam(...); $serviceAccounts = $iamService->serviceAccounts;

Table of Contents

$client  : Google_Client
$methods  : array<string|int, mixed>
$resourceName  : string
$rootUrl  : string
$serviceName  : string
$servicePath  : string
$stackParameters  : mixed
__construct()  : mixed
call()  : Google_Http_Request|expectedClass
TODO: This function needs simplifying.
create()  : Google_Service_Iam_ServiceAccount
Creates a ServiceAccount. (serviceAccounts.create)
createRequestUri()  : string
Parse/expand request parameters and create a fully qualified request uri.
delete()  : Google_Service_Iam_IamEmpty
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.
disable()  : Google_Service_Iam_IamEmpty
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)
enable()  : Google_Service_Iam_IamEmpty
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)
get()  : Google_Service_Iam_ServiceAccount
Gets a ServiceAccount. (serviceAccounts.get)
getIamPolicy()  : Google_Service_Iam_Policy
Gets the IAM policy that is attached to a ServiceAccount. This IAM policy specifies which members 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`](https://cloud.google.com/resource- manager/reference/rest/v1/projects/getIamPolicy) method.
listProjectsServiceAccounts()  : Google_Service_Iam_ListServiceAccountsResponse
Lists every ServiceAccount that belongs to a specific project.
patch()  : Google_Service_Iam_ServiceAccount
Patches a ServiceAccount. (serviceAccounts.patch)
setIamPolicy()  : Google_Service_Iam_Policy
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 member 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 [Granting roles to a service account for specific resources](https://cloud.google.com/iam/help/service-accounts/granting- access-to-service-accounts). (serviceAccounts.setIamPolicy)
signBlob()  : Google_Service_Iam_SignBlobResponse
**Note:** This method is deprecated and will stop working on July 1, 2021.
signJwt()  : Google_Service_Iam_SignJwtResponse
**Note:** This method is deprecated and will stop working on July 1, 2021.
testIamPermissions()  : Google_Service_Iam_TestIamPermissionsResponse
Tests whether the caller has the specified permissions on a ServiceAccount.
undelete()  : Google_Service_Iam_UndeleteServiceAccountResponse
Restores a deleted ServiceAccount. **Important:** It is not always possible to restore a deleted service account. Use this method only as a last resort.
update()  : Google_Service_Iam_ServiceAccount
**Note:** We are in the process of deprecating this method. Use PatchServiceAccount instead. Updates a ServiceAccount. You can update only the `display_name` and `description` fields. (serviceAccounts.update)
convertToArrayAndStripNulls()  : mixed

Properties

$methods

private array<string|int, mixed> $methods

$resourceName

private string $resourceName

$serviceName

private string $serviceName

$servicePath

private string $servicePath

$stackParameters

private mixed $stackParameters = array('alt' => array('type' => 'string', 'location' => 'query'), 'fields' => array('type' => 'string', 'location' => 'query'), 'trace' => array('type' => 'string', 'location' => 'query'), 'userIp' => array('type' => 'string', 'location' => 'query'), 'quotaUser' => array('type' => 'string', 'location' => 'query'), 'data' => array('type' => 'string', 'location' => 'body'), 'mimeType' => array('type' => 'string', 'location' => 'header'), 'uploadType' => array('type' => 'string', 'location' => 'query'), 'mediaUpload' => array('type' => 'complex', 'location' => 'query'), 'prettyPrint' => array('type' => 'string', 'location' => 'query'))

Methods

__construct()

public __construct(mixed $service, mixed $serviceName, mixed $resourceName, mixed $resource) : mixed
Parameters
$service : mixed
$serviceName : mixed
$resourceName : mixed
$resource : mixed
Return values
mixed

call()

TODO: This function needs simplifying.

public call( $name,  $arguments[,  $expectedClass = null ]) : Google_Http_Request|expectedClass
Parameters
$name :
$arguments :
$expectedClass : = null
  • optional, the expected class name
Tags
throws
Google_Exception
Return values
Google_Http_Request|expectedClass

create()

Creates a ServiceAccount. (serviceAccounts.create)

public create(string $name, Google_Service_Iam_CreateServiceAccountRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_ServiceAccount
Parameters
$name : string

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

$postBody : Google_Service_Iam_CreateServiceAccountRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_ServiceAccount

createRequestUri()

Parse/expand request parameters and create a fully qualified request uri.

public createRequestUri(string $restPath, array<string|int, mixed> $params) : string
Parameters
$restPath : string
$params : array<string|int, mixed>
Tags
static
Return values
string

$requestUrl

delete()

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.

public delete(string $name[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_IamEmpty

(serviceAccounts.delete)

Parameters
$name : string

Required. The resource name of the service account in the following format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. Using - as a wildcard for the PROJECT_ID will infer the project from the account. The ACCOUNT value can be the email address or the unique_id of the service account.

$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_IamEmpty

disable()

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)

public disable(string $name, Google_Service_Iam_DisableServiceAccountRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_IamEmpty
Parameters
$name : string

The resource name of the service account in the following format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. Using - as a wildcard for the PROJECT_ID will infer the project from the account. The ACCOUNT value can be the email address or the unique_id of the service account.

$postBody : Google_Service_Iam_DisableServiceAccountRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_IamEmpty

enable()

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)

public enable(string $name, Google_Service_Iam_EnableServiceAccountRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_IamEmpty
Parameters
$name : string

The resource name of the service account in the following format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. Using - as a wildcard for the PROJECT_ID will infer the project from the account. The ACCOUNT value can be the email address or the unique_id of the service account.

$postBody : Google_Service_Iam_EnableServiceAccountRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_IamEmpty

get()

Gets a ServiceAccount. (serviceAccounts.get)

public get(string $name[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_ServiceAccount
Parameters
$name : string

Required. The resource name of the service account in the following format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. Using - as a wildcard for the PROJECT_ID will infer the project from the account. The ACCOUNT value can be the email address or the unique_id of the service account.

$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_ServiceAccount

getIamPolicy()

Gets the IAM policy that is attached to a ServiceAccount. This IAM policy specifies which members 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`](https://cloud.google.com/resource- manager/reference/rest/v1/projects/getIamPolicy) method.

public getIamPolicy(string $resource[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_Policy

(serviceAccounts.getIamPolicy)

Parameters
$resource : string

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

$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

int options.requestedPolicyVersion Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource- policies).

Return values
Google_Service_Iam_Policy

listProjectsServiceAccounts()

Lists every ServiceAccount that belongs to a specific project.

public listProjectsServiceAccounts(string $name[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_ListServiceAccountsResponse

(serviceAccounts.listProjectsServiceAccounts)

Parameters
$name : string

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

$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

int pageSize Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the ListServiceAccountsResponse.next_page_token in a subsequent request. The default is 20, and the maximum is 100.

opt_param

string pageToken Optional pagination token returned in an earlier ListServiceAccountsResponse.next_page_token.

Return values
Google_Service_Iam_ListServiceAccountsResponse

patch()

Patches a ServiceAccount. (serviceAccounts.patch)

public patch(string $name, Google_Service_Iam_PatchServiceAccountRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_ServiceAccount
Parameters
$name : string

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 get 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.
$postBody : Google_Service_Iam_PatchServiceAccountRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_ServiceAccount

setIamPolicy()

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 member 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 [Granting roles to a service account for specific resources](https://cloud.google.com/iam/help/service-accounts/granting- access-to-service-accounts). (serviceAccounts.setIamPolicy)

public setIamPolicy(string $resource, Google_Service_Iam_SetIamPolicyRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_Policy
Parameters
$resource : string

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

$postBody : Google_Service_Iam_SetIamPolicyRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_Policy

signBlob()

**Note:** This method is deprecated and will stop working on July 1, 2021.

public signBlob(string $name, Google_Service_Iam_SignBlobRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_SignBlobResponse

Use the [signBlob](https://cloud.google.com/iam/help/rest- credentials/v1/projects.serviceAccounts/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)

Parameters
$name : string

Required. Deprecated. Migrate to Service Account Credentials API. The resource name of the service account in the following format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. Using - as a wildcard for the PROJECT_ID will infer the project from the account. The ACCOUNT value can be the email address or the unique_id of the service account.

$postBody : Google_Service_Iam_SignBlobRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_SignBlobResponse

signJwt()

**Note:** This method is deprecated and will stop working on July 1, 2021.

public signJwt(string $name, Google_Service_Iam_SignJwtRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_SignJwtResponse

Use the [signJwt](https://cloud.google.com/iam/help/rest- credentials/v1/projects.serviceAccounts/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)

Parameters
$name : string

Required. Deprecated. Migrate to Service Account Credentials API. The resource name of the service account in the following format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. Using - as a wildcard for the PROJECT_ID will infer the project from the account. The ACCOUNT value can be the email address or the unique_id of the service account.

$postBody : Google_Service_Iam_SignJwtRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_SignJwtResponse

testIamPermissions()

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

public testIamPermissions(string $resource, Google_Service_Iam_TestIamPermissionsRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_TestIamPermissionsResponse

(serviceAccounts.testIamPermissions)

Parameters
$resource : string

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

$postBody : Google_Service_Iam_TestIamPermissionsRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_TestIamPermissionsResponse

undelete()

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

public undelete(string $name, Google_Service_Iam_UndeleteServiceAccountRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_UndeleteServiceAccountResponse

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)

Parameters
$name : string

The resource name of the service account in the following format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}. Using - as a wildcard for the PROJECT_ID will infer the project from the account.

$postBody : Google_Service_Iam_UndeleteServiceAccountRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_UndeleteServiceAccountResponse

update()

**Note:** We are in the process of deprecating this method. Use PatchServiceAccount instead. Updates a ServiceAccount. You can update only the `display_name` and `description` fields. (serviceAccounts.update)

public update(string $name, Google_Service_Iam_ServiceAccount $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Iam_ServiceAccount
Parameters
$name : string

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 get 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.
$postBody : Google_Service_Iam_ServiceAccount
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Iam_ServiceAccount

convertToArrayAndStripNulls()

protected convertToArrayAndStripNulls(mixed $o) : mixed
Parameters
$o : mixed
Return values
mixed

Search results