Access Context Manager V1 Client - Class AccessContextManagerClient (1.0.2)

Reference documentation and code samples for the Access Context Manager V1 Client class AccessContextManagerClient.

Service Description: API for setting access levels and service perimeters for Google Cloud projects. Each organization has one access policy that contains the access levels and service perimeters. This access policy is applicable to all resources in the organization.

AccessPolicies

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Identity \ AccessContextManager \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

↳ logger false|LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

commitServicePerimeters

Commits the dry-run specification for all the service perimeters in an access policy.

A commit operation on a service perimeter involves copying its spec field to the status field of the service perimeter. Only service perimeters with use_explicit_dry_run_spec field set to true are affected by a commit operation. The long-running operation from this RPC has a successful status after the dry-run specifications for all the service perimeters have been committed. If a commit fails, it causes the long-running operation to return an error response and the entire commit operation is cancelled. When successful, the Operation.response field contains CommitServicePerimetersResponse. The dry_run and the spec fields are cleared after a successful commit operation.

The async variant is AccessContextManagerClient::commitServicePerimetersAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\CommitServicePerimetersRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\CommitServicePerimetersRequest;
use Google\Identity\AccessContextManager\V1\CommitServicePerimetersResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Resource name for the parent [Access Policy]
 *                                [google.identity.accesscontextmanager.v1.AccessPolicy] which owns all
 *                                [Service Perimeters]
 *                                [google.identity.accesscontextmanager.v1.ServicePerimeter] in scope for
 *                                the commit operation.
 *
 *                                Format: `accessPolicies/{policy_id}`
 *                                Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function commit_service_perimeters_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new CommitServicePerimetersRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->commitServicePerimeters($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var CommitServicePerimetersResponse $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    commit_service_perimeters_sample($formattedParent);
}

createAccessLevel

Creates an access level. The long-running operation from this RPC has a successful status after the access level propagates to long-lasting storage. If access levels contain errors, an error response is returned for the first error encountered.

The async variant is AccessContextManagerClient::createAccessLevelAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\CreateAccessLevelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\AccessLevel;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\CreateAccessLevelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Resource name for the access policy which owns this [Access
 *                                Level] [google.identity.accesscontextmanager.v1.AccessLevel].
 *
 *                                Format: `accessPolicies/{policy_id}`
 *                                Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function create_access_level_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $accessLevel = new AccessLevel();
    $request = (new CreateAccessLevelRequest())
        ->setParent($formattedParent)
        ->setAccessLevel($accessLevel);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->createAccessLevel($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AccessLevel $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    create_access_level_sample($formattedParent);
}

createAccessPolicy

Creates an access policy. This method fails if the organization already has an access policy. The long-running operation has a successful status after the access policy propagates to long-lasting storage.

Syntactic and basic semantic errors are returned in metadata as a BadRequest proto.

The async variant is AccessContextManagerClient::createAccessPolicyAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\AccessPolicy

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\AccessPolicy;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Rpc\Status;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function create_access_policy_sample(): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = new AccessPolicy();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->createAccessPolicy($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AccessPolicy $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

createGcpUserAccessBinding

Creates a GcpUserAccessBinding. If the client specifies a name, the server ignores it. Fails if a resource already exists with the same group_key.

Completion of this long-running operation does not necessarily signify that the new binding is deployed onto all affected users, which may take more time.

The async variant is AccessContextManagerClient::createGcpUserAccessBindingAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\CreateGcpUserAccessBindingRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\CreateGcpUserAccessBindingRequest;
use Google\Identity\AccessContextManager\V1\GcpUserAccessBinding;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                                  Example: "organizations/256"
 *                                                                 Please see {@see AccessContextManagerClient::organizationName()} for help formatting this field.
 * @param string $gcpUserAccessBindingGroupKey                     Immutable. Google Group id whose members are subject to this binding's restrictions.
 *                                                                 See "id" in the [G Suite Directory API's Groups resource]
 *                                                                 (https://developers.google.com/admin-sdk/directory/v1/reference/groups#resource).
 *                                                                 If a group's email address/alias is changed, this resource will continue
 *                                                                 to point at the changed group. This field does not accept group email
 *                                                                 addresses or aliases.
 *                                                                 Example: "01d520gv4vjcrht"
 * @param string $formattedGcpUserAccessBindingAccessLevelsElement Access level that a user must have to be granted access. Only one access
 *                                                                 level is supported, not multiple. This repeated field must have exactly
 *                                                                 one element.
 *                                                                 Example: "accessPolicies/9522/accessLevels/device_trusted"
 *                                                                 Please see {@see AccessContextManagerClient::accessLevelName()} for help formatting this field.
 */
function create_gcp_user_access_binding_sample(
    string $formattedParent,
    string $gcpUserAccessBindingGroupKey,
    string $formattedGcpUserAccessBindingAccessLevelsElement
): void {
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $formattedGcpUserAccessBindingAccessLevels = [
        $formattedGcpUserAccessBindingAccessLevelsElement,
    ];
    $gcpUserAccessBinding = (new GcpUserAccessBinding())
        ->setGroupKey($gcpUserAccessBindingGroupKey)
        ->setAccessLevels($formattedGcpUserAccessBindingAccessLevels);
    $request = (new CreateGcpUserAccessBindingRequest())
        ->setParent($formattedParent)
        ->setGcpUserAccessBinding($gcpUserAccessBinding);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->createGcpUserAccessBinding($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var GcpUserAccessBinding $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::organizationName('[ORGANIZATION]');
    $gcpUserAccessBindingGroupKey = '[GROUP_KEY]';
    $formattedGcpUserAccessBindingAccessLevelsElement = AccessContextManagerClient::accessLevelName(
        '[ACCESS_POLICY]',
        '[ACCESS_LEVEL]'
    );

    create_gcp_user_access_binding_sample(
        $formattedParent,
        $gcpUserAccessBindingGroupKey,
        $formattedGcpUserAccessBindingAccessLevelsElement
    );
}

createServicePerimeter

Creates a service perimeter. The long-running operation from this RPC has a successful status after the service perimeter propagates to long-lasting storage. If a service perimeter contains errors, an error response is returned for the first error encountered.

The async variant is AccessContextManagerClient::createServicePerimeterAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\CreateServicePerimeterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\CreateServicePerimeterRequest;
use Google\Identity\AccessContextManager\V1\ServicePerimeter;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Resource name for the access policy which owns this [Service
 *                                Perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter].
 *
 *                                Format: `accessPolicies/{policy_id}`
 *                                Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function create_service_perimeter_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $servicePerimeter = new ServicePerimeter();
    $request = (new CreateServicePerimeterRequest())
        ->setParent($formattedParent)
        ->setServicePerimeter($servicePerimeter);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->createServicePerimeter($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var ServicePerimeter $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    create_service_perimeter_sample($formattedParent);
}

deleteAccessLevel

Deletes an access level based on the resource name. The long-running operation from this RPC has a successful status after the access level has been removed from long-lasting storage.

The async variant is AccessContextManagerClient::deleteAccessLevelAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\DeleteAccessLevelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\DeleteAccessLevelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Resource name for the [Access Level]
 *                              [google.identity.accesscontextmanager.v1.AccessLevel].
 *
 *                              Format:
 *                              `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
 *                              Please see {@see AccessContextManagerClient::accessLevelName()} for help formatting this field.
 */
function delete_access_level_sample(string $formattedName): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new DeleteAccessLevelRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->deleteAccessLevel($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AccessContextManagerClient::accessLevelName('[ACCESS_POLICY]', '[ACCESS_LEVEL]');

    delete_access_level_sample($formattedName);
}

deleteAccessPolicy

Deletes an access policy based on the resource name. The long-running operation has a successful status after the access policy is removed from long-lasting storage.

The async variant is AccessContextManagerClient::deleteAccessPolicyAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\DeleteAccessPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\DeleteAccessPolicyRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Resource name for the access policy to delete.
 *
 *                              Format `accessPolicies/{policy_id}`
 *                              Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function delete_access_policy_sample(string $formattedName): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new DeleteAccessPolicyRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->deleteAccessPolicy($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    delete_access_policy_sample($formattedName);
}

deleteGcpUserAccessBinding

Deletes a GcpUserAccessBinding.

Completion of this long-running operation does not necessarily signify that the binding deletion is deployed onto all affected users, which may take more time.

The async variant is AccessContextManagerClient::deleteGcpUserAccessBindingAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\DeleteGcpUserAccessBindingRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\DeleteGcpUserAccessBindingRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N"
 *                              Please see {@see AccessContextManagerClient::gcpUserAccessBindingName()} for help formatting this field.
 */
function delete_gcp_user_access_binding_sample(string $formattedName): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new DeleteGcpUserAccessBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->deleteGcpUserAccessBinding($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AccessContextManagerClient::gcpUserAccessBindingName(
        '[ORGANIZATION]',
        '[GCP_USER_ACCESS_BINDING]'
    );

    delete_gcp_user_access_binding_sample($formattedName);
}

deleteServicePerimeter

Deletes a service perimeter based on the resource name. The long-running operation from this RPC has a successful status after the service perimeter is removed from long-lasting storage.

The async variant is AccessContextManagerClient::deleteServicePerimeterAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\DeleteServicePerimeterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\DeleteServicePerimeterRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Resource name for the [Service Perimeter]
 *                              [google.identity.accesscontextmanager.v1.ServicePerimeter].
 *
 *                              Format:
 *                              `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`
 *                              Please see {@see AccessContextManagerClient::servicePerimeterName()} for help formatting this field.
 */
function delete_service_perimeter_sample(string $formattedName): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new DeleteServicePerimeterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->deleteServicePerimeter($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AccessContextManagerClient::servicePerimeterName(
        '[ACCESS_POLICY]',
        '[SERVICE_PERIMETER]'
    );

    delete_service_perimeter_sample($formattedName);
}

getAccessLevel

Gets an access level based on the resource name.

The async variant is AccessContextManagerClient::getAccessLevelAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\GetAccessLevelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Identity\AccessContextManager\V1\AccessLevel
Example
use Google\ApiCore\ApiException;
use Google\Identity\AccessContextManager\V1\AccessLevel;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\GetAccessLevelRequest;

/**
 * @param string $formattedName Resource name for the [Access Level]
 *                              [google.identity.accesscontextmanager.v1.AccessLevel].
 *
 *                              Format:
 *                              `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
 *                              Please see {@see AccessContextManagerClient::accessLevelName()} for help formatting this field.
 */
function get_access_level_sample(string $formattedName): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new GetAccessLevelRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AccessLevel $response */
        $response = $accessContextManagerClient->getAccessLevel($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AccessContextManagerClient::accessLevelName('[ACCESS_POLICY]', '[ACCESS_LEVEL]');

    get_access_level_sample($formattedName);
}

getAccessPolicy

Returns an access policy based on the name.

The async variant is AccessContextManagerClient::getAccessPolicyAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\GetAccessPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Identity\AccessContextManager\V1\AccessPolicy
Example
use Google\ApiCore\ApiException;
use Google\Identity\AccessContextManager\V1\AccessPolicy;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\GetAccessPolicyRequest;

/**
 * @param string $formattedName Resource name for the access policy to get.
 *
 *                              Format `accessPolicies/{policy_id}`
 *                              Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function get_access_policy_sample(string $formattedName): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new GetAccessPolicyRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AccessPolicy $response */
        $response = $accessContextManagerClient->getAccessPolicy($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    get_access_policy_sample($formattedName);
}

getGcpUserAccessBinding

Gets the GcpUserAccessBinding with the given name.

The async variant is AccessContextManagerClient::getGcpUserAccessBindingAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\GetGcpUserAccessBindingRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Identity\AccessContextManager\V1\GcpUserAccessBinding
Example
use Google\ApiCore\ApiException;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\GcpUserAccessBinding;
use Google\Identity\AccessContextManager\V1\GetGcpUserAccessBindingRequest;

/**
 * @param string $formattedName Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N"
 *                              Please see {@see AccessContextManagerClient::gcpUserAccessBindingName()} for help formatting this field.
 */
function get_gcp_user_access_binding_sample(string $formattedName): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new GetGcpUserAccessBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var GcpUserAccessBinding $response */
        $response = $accessContextManagerClient->getGcpUserAccessBinding($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AccessContextManagerClient::gcpUserAccessBindingName(
        '[ORGANIZATION]',
        '[GCP_USER_ACCESS_BINDING]'
    );

    get_gcp_user_access_binding_sample($formattedName);
}

getIamPolicy

Gets the IAM policy for the specified Access Context Manager access policy.

The async variant is AccessContextManagerClient::getIamPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\GetIamPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Iam\V1\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;

/**
 * @param string $resource REQUIRED: The resource for which the policy is being requested.
 *                         See the operation documentation for the appropriate value for this field.
 */
function get_iam_policy_sample(string $resource): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new GetIamPolicyRequest())
        ->setResource($resource);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $accessContextManagerClient->getIamPolicy($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';

    get_iam_policy_sample($resource);
}

getServicePerimeter

Gets a service perimeter based on the resource name.

The async variant is AccessContextManagerClient::getServicePerimeterAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\GetServicePerimeterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Identity\AccessContextManager\V1\ServicePerimeter
Example
use Google\ApiCore\ApiException;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\GetServicePerimeterRequest;
use Google\Identity\AccessContextManager\V1\ServicePerimeter;

/**
 * @param string $formattedName Resource name for the [Service Perimeter]
 *                              [google.identity.accesscontextmanager.v1.ServicePerimeter].
 *
 *                              Format:
 *                              `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`
 *                              Please see {@see AccessContextManagerClient::servicePerimeterName()} for help formatting this field.
 */
function get_service_perimeter_sample(string $formattedName): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new GetServicePerimeterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var ServicePerimeter $response */
        $response = $accessContextManagerClient->getServicePerimeter($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AccessContextManagerClient::servicePerimeterName(
        '[ACCESS_POLICY]',
        '[SERVICE_PERIMETER]'
    );

    get_service_perimeter_sample($formattedName);
}

listAccessLevels

Lists all access levels for an access policy.

The async variant is AccessContextManagerClient::listAccessLevelsAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ListAccessLevelsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Identity\AccessContextManager\V1\AccessLevel;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\ListAccessLevelsRequest;

/**
 * @param string $formattedParent Resource name for the access policy to list [Access Levels]
 *                                [google.identity.accesscontextmanager.v1.AccessLevel] from.
 *
 *                                Format:
 *                                `accessPolicies/{policy_id}`
 *                                Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function list_access_levels_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new ListAccessLevelsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $accessContextManagerClient->listAccessLevels($request);

        /** @var AccessLevel $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    list_access_levels_sample($formattedParent);
}

listAccessPolicies

Lists all access policies in an organization.

The async variant is AccessContextManagerClient::listAccessPoliciesAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ListAccessPoliciesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Identity\AccessContextManager\V1\AccessPolicy;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\ListAccessPoliciesRequest;

/**
 * @param string $formattedParent Resource name for the container to list AccessPolicy instances
 *                                from.
 *
 *                                Format:
 *                                `organizations/{org_id}`
 *                                Please see {@see AccessContextManagerClient::organizationName()} for help formatting this field.
 */
function list_access_policies_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new ListAccessPoliciesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $accessContextManagerClient->listAccessPolicies($request);

        /** @var AccessPolicy $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::organizationName('[ORGANIZATION]');

    list_access_policies_sample($formattedParent);
}

listGcpUserAccessBindings

Lists all GcpUserAccessBindings for a Google Cloud organization.

The async variant is AccessContextManagerClient::listGcpUserAccessBindingsAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ListGcpUserAccessBindingsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\GcpUserAccessBinding;
use Google\Identity\AccessContextManager\V1\ListGcpUserAccessBindingsRequest;

/**
 * @param string $formattedParent Example: "organizations/256"
 *                                Please see {@see AccessContextManagerClient::organizationName()} for help formatting this field.
 */
function list_gcp_user_access_bindings_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new ListGcpUserAccessBindingsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $accessContextManagerClient->listGcpUserAccessBindings($request);

        /** @var GcpUserAccessBinding $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::organizationName('[ORGANIZATION]');

    list_gcp_user_access_bindings_sample($formattedParent);
}

listServicePerimeters

Lists all service perimeters for an access policy.

The async variant is AccessContextManagerClient::listServicePerimetersAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ListServicePerimetersRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\ListServicePerimetersRequest;
use Google\Identity\AccessContextManager\V1\ServicePerimeter;

/**
 * @param string $formattedParent Resource name for the access policy to list [Service Perimeters]
 *                                [google.identity.accesscontextmanager.v1.ServicePerimeter] from.
 *
 *                                Format:
 *                                `accessPolicies/{policy_id}`
 *                                Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function list_service_perimeters_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $request = (new ListServicePerimetersRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $accessContextManagerClient->listServicePerimeters($request);

        /** @var ServicePerimeter $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    list_service_perimeters_sample($formattedParent);
}

replaceAccessLevels

Replaces all existing access levels in an access policy with the access levels provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. If the replacement contains errors, an error response is returned for the first error encountered. Upon error, the replacement is cancelled, and existing access levels are not affected. The Operation.response field contains ReplaceAccessLevelsResponse. Removing access levels contained in existing service perimeters result in an error.

The async variant is AccessContextManagerClient::replaceAccessLevelsAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ReplaceAccessLevelsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\AccessLevel;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\ReplaceAccessLevelsRequest;
use Google\Identity\AccessContextManager\V1\ReplaceAccessLevelsResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Resource name for the access policy which owns these
 *                                [Access Levels]
 *                                [google.identity.accesscontextmanager.v1.AccessLevel].
 *
 *                                Format: `accessPolicies/{policy_id}`
 *                                Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function replace_access_levels_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $accessLevels = [new AccessLevel()];
    $request = (new ReplaceAccessLevelsRequest())
        ->setParent($formattedParent)
        ->setAccessLevels($accessLevels);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->replaceAccessLevels($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var ReplaceAccessLevelsResponse $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    replace_access_levels_sample($formattedParent);
}

replaceServicePerimeters

Replace all existing service perimeters in an access policy with the service perimeters provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage.

Replacements containing errors result in an error response for the first error encountered. Upon an error, replacement are cancelled and existing service perimeters are not affected. The Operation.response field contains ReplaceServicePerimetersResponse.

The async variant is AccessContextManagerClient::replaceServicePerimetersAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ReplaceServicePerimetersRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\ReplaceServicePerimetersRequest;
use Google\Identity\AccessContextManager\V1\ReplaceServicePerimetersResponse;
use Google\Identity\AccessContextManager\V1\ServicePerimeter;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Resource name for the access policy which owns these
 *                                [Service Perimeters]
 *                                [google.identity.accesscontextmanager.v1.ServicePerimeter].
 *
 *                                Format: `accessPolicies/{policy_id}`
 *                                Please see {@see AccessContextManagerClient::accessPolicyName()} for help formatting this field.
 */
function replace_service_perimeters_sample(string $formattedParent): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $servicePerimeters = [new ServicePerimeter()];
    $request = (new ReplaceServicePerimetersRequest())
        ->setParent($formattedParent)
        ->setServicePerimeters($servicePerimeters);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->replaceServicePerimeters($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var ReplaceServicePerimetersResponse $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AccessContextManagerClient::accessPolicyName('[ACCESS_POLICY]');

    replace_service_perimeters_sample($formattedParent);
}

setIamPolicy

Sets the IAM policy for the specified Access Context Manager access policy.

This method replaces the existing IAM policy on the access policy. The IAM policy controls the set of users who can perform specific operations on the Access Context Manager access policy.

The async variant is AccessContextManagerClient::setIamPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\SetIamPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Iam\V1\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;

/**
 * @param string $resource REQUIRED: The resource for which the policy is being specified.
 *                         See the operation documentation for the appropriate value for this field.
 */
function set_iam_policy_sample(string $resource): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $policy = new Policy();
    $request = (new SetIamPolicyRequest())
        ->setResource($resource)
        ->setPolicy($policy);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $accessContextManagerClient->setIamPolicy($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';

    set_iam_policy_sample($resource);
}

testIamPermissions

Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an AccessPolicy, AccessLevel, or [ServicePerimeter][google.identity.accesscontextmanager.v1.ServicePerimeter ]. This method does not support other resources.

The async variant is AccessContextManagerClient::testIamPermissionsAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\TestIamPermissionsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Iam\V1\TestIamPermissionsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;

/**
 * @param string $resource           REQUIRED: The resource for which the policy detail is being requested.
 *                                   See the operation documentation for the appropriate value for this field.
 * @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
 *                                   wildcards (such as '*' or 'storage.*') are not allowed. For more
 *                                   information see
 *                                   [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
 */
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $permissions = [$permissionsElement,];
    $request = (new TestIamPermissionsRequest())
        ->setResource($resource)
        ->setPermissions($permissions);

    // Call the API and handle any network failures.
    try {
        /** @var TestIamPermissionsResponse $response */
        $response = $accessContextManagerClient->testIamPermissions($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';
    $permissionsElement = '[PERMISSIONS]';

    test_iam_permissions_sample($resource, $permissionsElement);
}

updateAccessLevel

Updates an access level. The long-running operation from this RPC has a successful status after the changes to the access level propagate to long-lasting storage. If access levels contain errors, an error response is returned for the first error encountered.

The async variant is AccessContextManagerClient::updateAccessLevelAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\UpdateAccessLevelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\AccessLevel;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\UpdateAccessLevelRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_access_level_sample(): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $accessLevel = new AccessLevel();
    $updateMask = new FieldMask();
    $request = (new UpdateAccessLevelRequest())
        ->setAccessLevel($accessLevel)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->updateAccessLevel($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AccessLevel $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateAccessPolicy

Updates an access policy. The long-running operation from this RPC has a successful status after the changes to the access policy propagate to long-lasting storage.

The async variant is AccessContextManagerClient::updateAccessPolicyAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\UpdateAccessPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\AccessPolicy;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\UpdateAccessPolicyRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_access_policy_sample(): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $policy = new AccessPolicy();
    $updateMask = new FieldMask();
    $request = (new UpdateAccessPolicyRequest())
        ->setPolicy($policy)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->updateAccessPolicy($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AccessPolicy $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateGcpUserAccessBinding

Updates a GcpUserAccessBinding.

Completion of this long-running operation does not necessarily signify that the changed binding is deployed onto all affected users, which may take more time.

The async variant is AccessContextManagerClient::updateGcpUserAccessBindingAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\UpdateGcpUserAccessBindingRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\GcpUserAccessBinding;
use Google\Identity\AccessContextManager\V1\UpdateGcpUserAccessBindingRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $gcpUserAccessBindingGroupKey                     Immutable. Google Group id whose members are subject to this binding's restrictions.
 *                                                                 See "id" in the [G Suite Directory API's Groups resource]
 *                                                                 (https://developers.google.com/admin-sdk/directory/v1/reference/groups#resource).
 *                                                                 If a group's email address/alias is changed, this resource will continue
 *                                                                 to point at the changed group. This field does not accept group email
 *                                                                 addresses or aliases.
 *                                                                 Example: "01d520gv4vjcrht"
 * @param string $formattedGcpUserAccessBindingAccessLevelsElement Access level that a user must have to be granted access. Only one access
 *                                                                 level is supported, not multiple. This repeated field must have exactly
 *                                                                 one element.
 *                                                                 Example: "accessPolicies/9522/accessLevels/device_trusted"
 *                                                                 Please see {@see AccessContextManagerClient::accessLevelName()} for help formatting this field.
 */
function update_gcp_user_access_binding_sample(
    string $gcpUserAccessBindingGroupKey,
    string $formattedGcpUserAccessBindingAccessLevelsElement
): void {
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $formattedGcpUserAccessBindingAccessLevels = [
        $formattedGcpUserAccessBindingAccessLevelsElement,
    ];
    $gcpUserAccessBinding = (new GcpUserAccessBinding())
        ->setGroupKey($gcpUserAccessBindingGroupKey)
        ->setAccessLevels($formattedGcpUserAccessBindingAccessLevels);
    $updateMask = new FieldMask();
    $request = (new UpdateGcpUserAccessBindingRequest())
        ->setGcpUserAccessBinding($gcpUserAccessBinding)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->updateGcpUserAccessBinding($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var GcpUserAccessBinding $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $gcpUserAccessBindingGroupKey = '[GROUP_KEY]';
    $formattedGcpUserAccessBindingAccessLevelsElement = AccessContextManagerClient::accessLevelName(
        '[ACCESS_POLICY]',
        '[ACCESS_LEVEL]'
    );

    update_gcp_user_access_binding_sample(
        $gcpUserAccessBindingGroupKey,
        $formattedGcpUserAccessBindingAccessLevelsElement
    );
}

updateServicePerimeter

Updates a service perimeter. The long-running operation from this RPC has a successful status after the service perimeter propagates to long-lasting storage. If a service perimeter contains errors, an error response is returned for the first error encountered.

The async variant is AccessContextManagerClient::updateServicePerimeterAsync() .

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\UpdateServicePerimeterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
use Google\Identity\AccessContextManager\V1\ServicePerimeter;
use Google\Identity\AccessContextManager\V1\UpdateServicePerimeterRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_service_perimeter_sample(): void
{
    // Create a client.
    $accessContextManagerClient = new AccessContextManagerClient();

    // Prepare the request message.
    $servicePerimeter = new ServicePerimeter();
    $updateMask = new FieldMask();
    $request = (new UpdateServicePerimeterRequest())
        ->setServicePerimeter($servicePerimeter)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $accessContextManagerClient->updateServicePerimeter($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var ServicePerimeter $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

commitServicePerimetersAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\CommitServicePerimetersRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createAccessLevelAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\CreateAccessLevelRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createAccessPolicyAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\AccessPolicy
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createGcpUserAccessBindingAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\CreateGcpUserAccessBindingRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createServicePerimeterAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\CreateServicePerimeterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteAccessLevelAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\DeleteAccessLevelRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteAccessPolicyAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\DeleteAccessPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteGcpUserAccessBindingAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\DeleteGcpUserAccessBindingRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteServicePerimeterAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\DeleteServicePerimeterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getAccessLevelAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\GetAccessLevelRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Identity\AccessContextManager\V1\AccessLevel>

getAccessPolicyAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\GetAccessPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Identity\AccessContextManager\V1\AccessPolicy>

getGcpUserAccessBindingAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\GetGcpUserAccessBindingRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Identity\AccessContextManager\V1\GcpUserAccessBinding>

getIamPolicyAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\GetIamPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\Policy>

getServicePerimeterAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\GetServicePerimeterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Identity\AccessContextManager\V1\ServicePerimeter>

listAccessLevelsAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ListAccessLevelsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listAccessPoliciesAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ListAccessPoliciesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listGcpUserAccessBindingsAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ListGcpUserAccessBindingsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listServicePerimetersAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ListServicePerimetersRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

replaceAccessLevelsAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ReplaceAccessLevelsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

replaceServicePerimetersAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\ReplaceServicePerimetersRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setIamPolicyAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\SetIamPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\Policy>

testIamPermissionsAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\TestIamPermissionsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\TestIamPermissionsResponse>

updateAccessLevelAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\UpdateAccessLevelRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateAccessPolicyAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\UpdateAccessPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateGcpUserAccessBindingAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\UpdateGcpUserAccessBindingRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateServicePerimeterAsync

Parameters
Name Description
request Google\Identity\AccessContextManager\V1\UpdateServicePerimeterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
Type Description
Google\LongRunning\Client\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse

static::accessLevelName

Formats a string containing the fully-qualified path to represent a access_level resource.

Parameters
Name Description
accessPolicy string
accessLevel string
Returns
Type Description
string The formatted access_level resource.

static::accessPolicyName

Formats a string containing the fully-qualified path to represent a access_policy resource.

Parameter
Name Description
accessPolicy string
Returns
Type Description
string The formatted access_policy resource.

static::gcpUserAccessBindingName

Formats a string containing the fully-qualified path to represent a gcp_user_access_binding resource.

Parameters
Name Description
organization string
gcpUserAccessBinding string
Returns
Type Description
string The formatted gcp_user_access_binding resource.

static::organizationName

Formats a string containing the fully-qualified path to represent a organization resource.

Parameter
Name Description
organization string
Returns
Type Description
string The formatted organization resource.

static::servicePerimeterName

Formats a string containing the fully-qualified path to represent a service_perimeter resource.

Parameters
Name Description
accessPolicy string
servicePerimeter string
Returns
Type Description
string The formatted service_perimeter resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • accessLevel: accessPolicies/{access_policy}/accessLevels/{access_level}
  • accessPolicy: accessPolicies/{access_policy}
  • gcpUserAccessBinding: organizations/{organization}/gcpUserAccessBindings/{gcp_user_access_binding}
  • organization: organizations/{organization}
  • servicePerimeter: accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
Name Description
formattedName string

The formatted name string

template ?string

Optional name of template to match

Returns
Type Description
array An associative array from name component IDs to component values.