Reference documentation and code samples for the Google Cloud Capacity Planner V1beta Client class UsageServiceClient.
Service Description: Provides access to historical and forecasted usage data.
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 \ CapacityPlanner \ V1beta \ ClientMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
options |
array|Google\ApiCore\Options\ClientOptions
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 |
FetchAuthTokenInterface|CredentialsWrapper
This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly |
↳ 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 |
↳ 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 |
↳ 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 |
↳ universeDomain |
string
The service domain for the client. Defaults to 'googleapis.com'. |
exportForecasts
Exports forecasted usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.
The async variant is UsageServiceClient::exportForecastsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\ExportForecastsRequest
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<Google\Cloud\CapacityPlanner\V1beta\ExportForecastsResponse> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CapacityPlanner\V1beta\Client\UsageServiceClient;
use Google\Cloud\CapacityPlanner\V1beta\ExportForecastsRequest;
use Google\Cloud\CapacityPlanner\V1beta\ExportForecastsResponse;
use Google\Cloud\CapacityPlanner\V1beta\OutputConfig;
use Google\Rpc\Status;
/**
* @param string $formattedParent The compute engine resource and location for the time series
* values to return. The format is:
* projects/{project}/locations/{location} or
* organizations/{organization}/locations/{location} or
* folders/{folder}/locations/{location}
* Please see {@see UsageServiceClient::locationName()} for help formatting this field.
* @param string $resourceType The resource for the `Forecast` values to return. Possible values
* include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk",
* "gce-gpu" and "gce-tpu".
*/
function export_forecasts_sample(string $formattedParent, string $resourceType): void
{
// Create a client.
$usageServiceClient = new UsageServiceClient();
// Prepare the request message.
$outputConfig = new OutputConfig();
$request = (new ExportForecastsRequest())
->setParent($formattedParent)
->setResourceType($resourceType)
->setOutputConfig($outputConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $usageServiceClient->exportForecasts($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ExportForecastsResponse $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 = UsageServiceClient::locationName('[PROJECT]', '[LOCATION]');
$resourceType = '[RESOURCE_TYPE]';
export_forecasts_sample($formattedParent, $resourceType);
}
exportReservationsUsage
Exports reservations usage data requested by user into either an existing Cloud Storage bucket or a new/existing BigQuery table.
The async variant is UsageServiceClient::exportReservationsUsageAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\ExportReservationsUsageRequest
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<Google\Cloud\CapacityPlanner\V1beta\ExportReservationsUsageResponse> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CapacityPlanner\V1beta\Client\UsageServiceClient;
use Google\Cloud\CapacityPlanner\V1beta\ExportReservationsUsageRequest;
use Google\Cloud\CapacityPlanner\V1beta\ExportReservationsUsageResponse;
use Google\Cloud\CapacityPlanner\V1beta\OutputConfig;
use Google\Cloud\CapacityPlanner\V1beta\UsageHistory\AggregationMethod;
use Google\Rpc\Status;
/**
* @param string $formattedParent The compute engine resource and location of the
* reservationsusage. The format is:
* projects/{project}/locations/{location} or
* organizations/{organization}/locations/{location} or
* folders/{folder}/locations/{location}
* Please see {@see UsageServiceClient::locationName()} for help formatting this field.
* @param string $cloudResourceType The resource for the `ReservationsUsage` values to return.
* Possible values include "gce-vcpus", "gce-ram", "gce-local-ssd", and
* "gce-gpu".
* @param int $usageAggregationMethod The method that should be used to convert sampled reservations
* data to daily usage values.
*/
function export_reservations_usage_sample(
string $formattedParent,
string $cloudResourceType,
int $usageAggregationMethod
): void {
// Create a client.
$usageServiceClient = new UsageServiceClient();
// Prepare the request message.
$outputConfig = new OutputConfig();
$request = (new ExportReservationsUsageRequest())
->setParent($formattedParent)
->setCloudResourceType($cloudResourceType)
->setUsageAggregationMethod($usageAggregationMethod)
->setOutputConfig($outputConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $usageServiceClient->exportReservationsUsage($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ExportReservationsUsageResponse $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 = UsageServiceClient::locationName('[PROJECT]', '[LOCATION]');
$cloudResourceType = '[CLOUD_RESOURCE_TYPE]';
$usageAggregationMethod = AggregationMethod::AGGREGATION_METHOD_UNSPECIFIED;
export_reservations_usage_sample($formattedParent, $cloudResourceType, $usageAggregationMethod);
}
exportUsageHistories
Exports historical usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.
The async variant is UsageServiceClient::exportUsageHistoriesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\ExportUsageHistoriesRequest
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<Google\Cloud\CapacityPlanner\V1beta\ExportUsageHistoriesResponse> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CapacityPlanner\V1beta\Client\UsageServiceClient;
use Google\Cloud\CapacityPlanner\V1beta\ExportUsageHistoriesRequest;
use Google\Cloud\CapacityPlanner\V1beta\ExportUsageHistoriesResponse;
use Google\Cloud\CapacityPlanner\V1beta\OutputConfig;
use Google\Rpc\Status;
/**
* @param string $formattedParent The compute engine resource and location for the time series
* values to return. The format is:
* projects/{project}/locations/{location} or
* organizations/{organization}/locations/{location} or
* folders/{folder}/locations/{location}
* Please see {@see UsageServiceClient::locationName()} for help formatting this field.
* @param string $resourceType The resource for the `UsageHistory` values to return. Possible
* values include "gce-vcpus", "gce-ram", "gce-local-ssd",
* "gce-persistent-disk", "gce-gpu" and "gce-tpu".
*/
function export_usage_histories_sample(string $formattedParent, string $resourceType): void
{
// Create a client.
$usageServiceClient = new UsageServiceClient();
// Prepare the request message.
$outputConfig = new OutputConfig();
$request = (new ExportUsageHistoriesRequest())
->setParent($formattedParent)
->setResourceType($resourceType)
->setOutputConfig($outputConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $usageServiceClient->exportUsageHistories($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ExportUsageHistoriesResponse $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 = UsageServiceClient::locationName('[PROJECT]', '[LOCATION]');
$resourceType = '[RESOURCE_TYPE]';
export_usage_histories_sample($formattedParent, $resourceType);
}
queryForecasts
Returns a list of the forecasts that are in the parent parameter and match your specified filters.
The async variant is UsageServiceClient::queryForecastsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\QueryForecastsRequest
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\CapacityPlanner\V1beta\QueryForecastsResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CapacityPlanner\V1beta\Client\UsageServiceClient;
use Google\Cloud\CapacityPlanner\V1beta\QueryForecastsRequest;
use Google\Cloud\CapacityPlanner\V1beta\QueryForecastsResponse;
/**
* @param string $formattedParent The compute engine resource and location for the time series
* values to return. The format is:
*
* projects/{project}/locations/{location} or
* organizations/{organization}/locations/{location} or
* folders/{folder}/locations/{location}
* Please see {@see UsageServiceClient::locationName()} for help formatting this field.
* @param string $cloudResourceType The resource for the `Forecast` values to return. Possible values
* include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk",
* "gce-gpu" and "gce-tpu". Empty cloud_resource_type will return results
* matching all resources.
*/
function query_forecasts_sample(string $formattedParent, string $cloudResourceType): void
{
// Create a client.
$usageServiceClient = new UsageServiceClient();
// Prepare the request message.
$request = (new QueryForecastsRequest())
->setParent($formattedParent)
->setCloudResourceType($cloudResourceType);
// Call the API and handle any network failures.
try {
/** @var QueryForecastsResponse $response */
$response = $usageServiceClient->queryForecasts($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
{
$formattedParent = UsageServiceClient::locationName('[PROJECT]', '[LOCATION]');
$cloudResourceType = '[CLOUD_RESOURCE_TYPE]';
query_forecasts_sample($formattedParent, $cloudResourceType);
}
queryReservations
Returns a list of the reservations that are in the parent parameter and match your specified filters.
The async variant is UsageServiceClient::queryReservationsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\QueryReservationsRequest
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\CapacityPlanner\V1beta\QueryReservationsResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CapacityPlanner\V1beta\Client\UsageServiceClient;
use Google\Cloud\CapacityPlanner\V1beta\QueryReservationsRequest;
use Google\Cloud\CapacityPlanner\V1beta\QueryReservationsRequest\ReservationDataLevel;
use Google\Cloud\CapacityPlanner\V1beta\QueryReservationsRequest\ReservationType;
use Google\Cloud\CapacityPlanner\V1beta\QueryReservationsResponse;
/**
* @param string $formattedParent The compute engine resource and location for the time series
* values to return. The format is:
*
* projects/{project}/locations/{location} or
* organizations/{organization}/locations/{location} or
* folders/{folder}/locations/{location}
* Please see {@see UsageServiceClient::locationName()} for help formatting this field.
* @param string $cloudResourceType The resource for the reserved values to return. Possible values
* include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-gpu" and "gce-vm".
* @param int $reservationType The Reservation type for example, future reservation request and
* allocation. If unspecified, all types are
* included.
* @param int $reservationDataLevel Reservations output data format.
*/
function query_reservations_sample(
string $formattedParent,
string $cloudResourceType,
int $reservationType,
int $reservationDataLevel
): void {
// Create a client.
$usageServiceClient = new UsageServiceClient();
// Prepare the request message.
$request = (new QueryReservationsRequest())
->setParent($formattedParent)
->setCloudResourceType($cloudResourceType)
->setReservationType($reservationType)
->setReservationDataLevel($reservationDataLevel);
// Call the API and handle any network failures.
try {
/** @var QueryReservationsResponse $response */
$response = $usageServiceClient->queryReservations($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
{
$formattedParent = UsageServiceClient::locationName('[PROJECT]', '[LOCATION]');
$cloudResourceType = '[CLOUD_RESOURCE_TYPE]';
$reservationType = ReservationType::RESERVATION_TYPE_UNSPECIFIED;
$reservationDataLevel = ReservationDataLevel::RESERVATION_DATA_LEVEL_UNSPECIFIED;
query_reservations_sample(
$formattedParent,
$cloudResourceType,
$reservationType,
$reservationDataLevel
);
}
queryUsageHistories
Returns a list of the usage histories that are in the parent parameter and match your specified filters.
The async variant is UsageServiceClient::queryUsageHistoriesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\QueryUsageHistoriesRequest
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\CapacityPlanner\V1beta\QueryUsageHistoriesResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CapacityPlanner\V1beta\Client\UsageServiceClient;
use Google\Cloud\CapacityPlanner\V1beta\QueryUsageHistoriesRequest;
use Google\Cloud\CapacityPlanner\V1beta\QueryUsageHistoriesResponse;
/**
* @param string $formattedParent The compute engine resource and location for the time series
* values to return. The format is:
*
* projects/{project}/locations/{location} or
* organizations/{organization}/locations/{location} or
* folders/{folder}/locations/{location}
* Please see {@see UsageServiceClient::locationName()} for help formatting this field.
* @param string $cloudResourceType The resource for the `UsageHistory` values to return. Possible
* values include "gce-vcpus", "gce-ram", "gce-local-ssd",
* "gce-persistent-disk", "gce-gpu" and "gce-tpu". Empty cloud_resource_type
* will return results matching all resources.
*/
function query_usage_histories_sample(string $formattedParent, string $cloudResourceType): void
{
// Create a client.
$usageServiceClient = new UsageServiceClient();
// Prepare the request message.
$request = (new QueryUsageHistoriesRequest())
->setParent($formattedParent)
->setCloudResourceType($cloudResourceType);
// Call the API and handle any network failures.
try {
/** @var QueryUsageHistoriesResponse $response */
$response = $usageServiceClient->queryUsageHistories($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
{
$formattedParent = UsageServiceClient::locationName('[PROJECT]', '[LOCATION]');
$cloudResourceType = '[CLOUD_RESOURCE_TYPE]';
query_usage_histories_sample($formattedParent, $cloudResourceType);
}
exportForecastsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\ExportForecastsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
exportReservationsUsageAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\ExportReservationsUsageRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
exportUsageHistoriesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\ExportUsageHistoriesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
queryForecastsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\QueryForecastsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CapacityPlanner\V1beta\QueryForecastsResponse> |
|
queryReservationsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\QueryReservationsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CapacityPlanner\V1beta\QueryReservationsResponse> |
|
queryUsageHistoriesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CapacityPlanner\V1beta\QueryUsageHistoriesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CapacityPlanner\V1beta\QueryUsageHistoriesResponse> |
|
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 |
project |
string
|
location |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted location 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: projects/{project}/locations/{location}
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. |