Google Cloud Assured Workloads V1beta1 Client - Class AssuredWorkloadsServiceClient (1.0.1)

Reference documentation and code samples for the Google Cloud Assured Workloads V1beta1 Client class AssuredWorkloadsServiceClient.

Service Description: Service to manage AssuredWorkloads.

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 \ Cloud \ AssuredWorkloads \ V1beta1 \ 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.

analyzeWorkloadMove

Analyze if the source Assured Workloads can be moved to the target Assured Workload

The async variant is AssuredWorkloadsServiceClient::analyzeWorkloadMoveAsync() .

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\AnalyzeWorkloadMoveRequest

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\AssuredWorkloads\V1beta1\AnalyzeWorkloadMoveResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AssuredWorkloads\V1beta1\AnalyzeWorkloadMoveRequest;
use Google\Cloud\AssuredWorkloads\V1beta1\AnalyzeWorkloadMoveResponse;
use Google\Cloud\AssuredWorkloads\V1beta1\Client\AssuredWorkloadsServiceClient;

/**
 * @param string $target The resource ID of the folder-based destination workload. This workload is
 *                       where the source project will hypothetically be moved to. Specify the
 *                       workload's relative resource name, formatted as:
 *                       "organizations/{ORGANIZATION_ID}/locations/{LOCATION_ID}/workloads/{WORKLOAD_ID}"
 *                       For example:
 *                       "organizations/123/locations/us-east1/workloads/assured-workload-2"
 */
function analyze_workload_move_sample(string $target): void
{
    // Create a client.
    $assuredWorkloadsServiceClient = new AssuredWorkloadsServiceClient();

    // Prepare the request message.
    $request = (new AnalyzeWorkloadMoveRequest())
        ->setTarget($target);

    // Call the API and handle any network failures.
    try {
        /** @var AnalyzeWorkloadMoveResponse $response */
        $response = $assuredWorkloadsServiceClient->analyzeWorkloadMove($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
{
    $target = '[TARGET]';

    analyze_workload_move_sample($target);
}

createWorkload

Creates Assured Workload.

The async variant is AssuredWorkloadsServiceClient::createWorkloadAsync() .

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\CreateWorkloadRequest

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\Cloud\AssuredWorkloads\V1beta1\Client\AssuredWorkloadsServiceClient;
use Google\Cloud\AssuredWorkloads\V1beta1\CreateWorkloadRequest;
use Google\Cloud\AssuredWorkloads\V1beta1\Workload;
use Google\Cloud\AssuredWorkloads\V1beta1\Workload\ComplianceRegime;
use Google\Rpc\Status;

/**
 * @param string $formattedParent          The resource name of the new Workload's parent.
 *                                         Must be of the form `organizations/{org_id}/locations/{location_id}`. Please see
 *                                         {@see AssuredWorkloadsServiceClient::locationName()} for help formatting this field.
 * @param string $workloadDisplayName      The user-assigned display name of the Workload.
 *                                         When present it must be between 4 to 30 characters.
 *                                         Allowed characters are: lowercase and uppercase letters, numbers,
 *                                         hyphen, and spaces.
 *
 *                                         Example: My Workload
 * @param int    $workloadComplianceRegime Immutable. Compliance Regime associated with this workload.
 */
function create_workload_sample(
    string $formattedParent,
    string $workloadDisplayName,
    int $workloadComplianceRegime
): void {
    // Create a client.
    $assuredWorkloadsServiceClient = new AssuredWorkloadsServiceClient();

    // Prepare the request message.
    $workload = (new Workload())
        ->setDisplayName($workloadDisplayName)
        ->setComplianceRegime($workloadComplianceRegime);
    $request = (new CreateWorkloadRequest())
        ->setParent($formattedParent)
        ->setWorkload($workload);

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

        if ($response->operationSucceeded()) {
            /** @var Workload $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 = AssuredWorkloadsServiceClient::locationName('[ORGANIZATION]', '[LOCATION]');
    $workloadDisplayName = '[DISPLAY_NAME]';
    $workloadComplianceRegime = ComplianceRegime::COMPLIANCE_REGIME_UNSPECIFIED;

    create_workload_sample($formattedParent, $workloadDisplayName, $workloadComplianceRegime);
}

deleteWorkload

Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error.

In addition to assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set permission on the deleted folder to remove Assured Workloads OrgPolicies.

The async variant is AssuredWorkloadsServiceClient::deleteWorkloadAsync() .

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\DeleteWorkloadRequest

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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\AssuredWorkloads\V1beta1\Client\AssuredWorkloadsServiceClient;
use Google\Cloud\AssuredWorkloads\V1beta1\DeleteWorkloadRequest;

/**
 * @param string $formattedName The `name` field is used to identify the workload.
 *                              Format:
 *                              organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
 *                              Please see {@see AssuredWorkloadsServiceClient::workloadName()} for help formatting this field.
 */
function delete_workload_sample(string $formattedName): void
{
    // Create a client.
    $assuredWorkloadsServiceClient = new AssuredWorkloadsServiceClient();

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

    // Call the API and handle any network failures.
    try {
        $assuredWorkloadsServiceClient->deleteWorkload($request);
        printf('Call completed successfully.' . PHP_EOL);
    } 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 = AssuredWorkloadsServiceClient::workloadName(
        '[ORGANIZATION]',
        '[LOCATION]',
        '[WORKLOAD]'
    );

    delete_workload_sample($formattedName);
}

getWorkload

Gets Assured Workload associated with a CRM Node

The async variant is AssuredWorkloadsServiceClient::getWorkloadAsync() .

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\GetWorkloadRequest

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\AssuredWorkloads\V1beta1\Workload
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AssuredWorkloads\V1beta1\Client\AssuredWorkloadsServiceClient;
use Google\Cloud\AssuredWorkloads\V1beta1\GetWorkloadRequest;
use Google\Cloud\AssuredWorkloads\V1beta1\Workload;

/**
 * @param string $formattedName The resource name of the Workload to fetch. This is the workloads's
 *                              relative path in the API, formatted as
 *                              "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}".
 *                              For example,
 *                              "organizations/123/locations/us-east1/workloads/assured-workload-1". Please see
 *                              {@see AssuredWorkloadsServiceClient::workloadName()} for help formatting this field.
 */
function get_workload_sample(string $formattedName): void
{
    // Create a client.
    $assuredWorkloadsServiceClient = new AssuredWorkloadsServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Workload $response */
        $response = $assuredWorkloadsServiceClient->getWorkload($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 = AssuredWorkloadsServiceClient::workloadName(
        '[ORGANIZATION]',
        '[LOCATION]',
        '[WORKLOAD]'
    );

    get_workload_sample($formattedName);
}

listWorkloads

Lists Assured Workloads under a CRM Node.

The async variant is AssuredWorkloadsServiceClient::listWorkloadsAsync() .

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\ListWorkloadsRequest

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\Cloud\AssuredWorkloads\V1beta1\Client\AssuredWorkloadsServiceClient;
use Google\Cloud\AssuredWorkloads\V1beta1\ListWorkloadsRequest;
use Google\Cloud\AssuredWorkloads\V1beta1\Workload;

/**
 * @param string $formattedParent Parent Resource to list workloads from.
 *                                Must be of the form `organizations/{org_id}/locations/{location}`. Please see
 *                                {@see AssuredWorkloadsServiceClient::locationName()} for help formatting this field.
 */
function list_workloads_sample(string $formattedParent): void
{
    // Create a client.
    $assuredWorkloadsServiceClient = new AssuredWorkloadsServiceClient();

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

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

        /** @var Workload $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 = AssuredWorkloadsServiceClient::locationName('[ORGANIZATION]', '[LOCATION]');

    list_workloads_sample($formattedParent);
}

restrictAllowedResources

Restrict the list of resources allowed in the Workload environment.

The current list of allowed products can be found at https://cloud.google.com/assured-workloads/docs/supported-products In addition to assuredworkloads.workload.update permission, the user should also have orgpolicy.policy.set permission on the folder resource to use this functionality.

The async variant is AssuredWorkloadsServiceClient::restrictAllowedResourcesAsync() .

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\RestrictAllowedResourcesRequest

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\AssuredWorkloads\V1beta1\RestrictAllowedResourcesResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AssuredWorkloads\V1beta1\Client\AssuredWorkloadsServiceClient;
use Google\Cloud\AssuredWorkloads\V1beta1\RestrictAllowedResourcesRequest;
use Google\Cloud\AssuredWorkloads\V1beta1\RestrictAllowedResourcesRequest\RestrictionType;
use Google\Cloud\AssuredWorkloads\V1beta1\RestrictAllowedResourcesResponse;

/**
 * @param string $name            The resource name of the Workload. This is the workloads's
 *                                relative path in the API, formatted as
 *                                "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}".
 *                                For example,
 *                                "organizations/123/locations/us-east1/workloads/assured-workload-1".
 * @param int    $restrictionType The type of restriction for using gcp products in the Workload environment.
 */
function restrict_allowed_resources_sample(string $name, int $restrictionType): void
{
    // Create a client.
    $assuredWorkloadsServiceClient = new AssuredWorkloadsServiceClient();

    // Prepare the request message.
    $request = (new RestrictAllowedResourcesRequest())
        ->setName($name)
        ->setRestrictionType($restrictionType);

    // Call the API and handle any network failures.
    try {
        /** @var RestrictAllowedResourcesResponse $response */
        $response = $assuredWorkloadsServiceClient->restrictAllowedResources($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
{
    $name = '[NAME]';
    $restrictionType = RestrictionType::RESTRICTION_TYPE_UNSPECIFIED;

    restrict_allowed_resources_sample($name, $restrictionType);
}

updateWorkload

Updates an existing workload.

Currently allows updating of workload display_name and labels. For force updates don't set etag field in the Workload. Only one update operation per workload can be in progress.

The async variant is AssuredWorkloadsServiceClient::updateWorkloadAsync() .

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\UpdateWorkloadRequest

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\AssuredWorkloads\V1beta1\Workload
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AssuredWorkloads\V1beta1\Client\AssuredWorkloadsServiceClient;
use Google\Cloud\AssuredWorkloads\V1beta1\UpdateWorkloadRequest;
use Google\Cloud\AssuredWorkloads\V1beta1\Workload;
use Google\Cloud\AssuredWorkloads\V1beta1\Workload\ComplianceRegime;
use Google\Protobuf\FieldMask;

/**
 * @param string $workloadDisplayName      The user-assigned display name of the Workload.
 *                                         When present it must be between 4 to 30 characters.
 *                                         Allowed characters are: lowercase and uppercase letters, numbers,
 *                                         hyphen, and spaces.
 *
 *                                         Example: My Workload
 * @param int    $workloadComplianceRegime Immutable. Compliance Regime associated with this workload.
 */
function update_workload_sample(string $workloadDisplayName, int $workloadComplianceRegime): void
{
    // Create a client.
    $assuredWorkloadsServiceClient = new AssuredWorkloadsServiceClient();

    // Prepare the request message.
    $workload = (new Workload())
        ->setDisplayName($workloadDisplayName)
        ->setComplianceRegime($workloadComplianceRegime);
    $updateMask = new FieldMask();
    $request = (new UpdateWorkloadRequest())
        ->setWorkload($workload)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var Workload $response */
        $response = $assuredWorkloadsServiceClient->updateWorkload($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
{
    $workloadDisplayName = '[DISPLAY_NAME]';
    $workloadComplianceRegime = ComplianceRegime::COMPLIANCE_REGIME_UNSPECIFIED;

    update_workload_sample($workloadDisplayName, $workloadComplianceRegime);
}

analyzeWorkloadMoveAsync

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\AnalyzeWorkloadMoveRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AssuredWorkloads\V1beta1\AnalyzeWorkloadMoveResponse>

createWorkloadAsync

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\CreateWorkloadRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteWorkloadAsync

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\DeleteWorkloadRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<void>

getWorkloadAsync

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\GetWorkloadRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AssuredWorkloads\V1beta1\Workload>

listWorkloadsAsync

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\ListWorkloadsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

restrictAllowedResourcesAsync

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\RestrictAllowedResourcesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AssuredWorkloads\V1beta1\RestrictAllowedResourcesResponse>

updateWorkloadAsync

Parameters
Name Description
request Google\Cloud\AssuredWorkloads\V1beta1\UpdateWorkloadRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AssuredWorkloads\V1beta1\Workload>

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::locationName

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

Parameters
Name Description
organization string
location string
Returns
Type Description
string The formatted location resource.

static::workloadName

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

Parameters
Name Description
organization string
location string
workload string
Returns
Type Description
string The formatted workload 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

  • location: organizations/{organization}/locations/{location}
  • workload: organizations/{organization}/locations/{location}/workloads/{workload}

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.