Reference documentation and code samples for the Google Cloud License Manager V1 Client class LicenseManagerClient.
Service Description: Service describing handlers for resources
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 \ LicenseManager \ V1 \ ClientMethods
__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. Important: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud Platform, you must validate it before providing it to any Google API or library. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. For more information https://cloud.google.com/docs/authentication/external/externally-sourced-credentials |
↳ 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 |
aggregateUsage
Aggregates Usage per Instance for a Configuration.
The async variant is LicenseManagerClient::aggregateUsageAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\AggregateUsageRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\LicenseManager\V1\AggregateUsageRequest;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\Usage;
use Google\Protobuf\Timestamp;
/**
* @param string $formattedName Parent value for AggregateUsageRequest
* Please see {@see LicenseManagerClient::configurationName()} for help formatting this field.
*/
function aggregate_usage_sample(string $formattedName): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$startTime = new Timestamp();
$endTime = new Timestamp();
$request = (new AggregateUsageRequest())
->setName($formattedName)
->setStartTime($startTime)
->setEndTime($endTime);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $licenseManagerClient->aggregateUsage($request);
/** @var Usage $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
{
$formattedName = LicenseManagerClient::configurationName(
'[PROJECT]',
'[LOCATION]',
'[CONFIGURATION]'
);
aggregate_usage_sample($formattedName);
}
createConfiguration
Creates a new Configuration in a given project and ___location.
The async variant is LicenseManagerClient::createConfigurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\CreateConfigurationRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\LicenseManager\V1\BillingInfo;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\Configuration;
use Google\Cloud\LicenseManager\V1\CreateConfigurationRequest;
use Google\Cloud\LicenseManager\V1\LicenseType;
use Google\Cloud\LicenseManager\V1\UserCountBillingInfo;
use Google\Rpc\Status;
/**
* @param string $formattedParent Value for parent. Please see
* {@see LicenseManagerClient::locationName()} for help formatting this field.
* @param string $configurationId Id of the requesting object
* @param string $configurationDisplayName User given name.
* @param string $formattedConfigurationProduct Name field (with URL) of the Product offered for SPLA. Please see
* {@see LicenseManagerClient::productName()} for help formatting this field.
* @param int $configurationLicenseType LicenseType to be applied for billing
* @param int $configurationCurrentBillingInfoUserCountBillingUserCount Number of users to bill for.
* @param int $configurationNextBillingInfoUserCountBillingUserCount Number of users to bill for.
*/
function create_configuration_sample(
string $formattedParent,
string $configurationId,
string $configurationDisplayName,
string $formattedConfigurationProduct,
int $configurationLicenseType,
int $configurationCurrentBillingInfoUserCountBillingUserCount,
int $configurationNextBillingInfoUserCountBillingUserCount
): void {
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$configurationCurrentBillingInfoUserCountBilling = (new UserCountBillingInfo())
->setUserCount($configurationCurrentBillingInfoUserCountBillingUserCount);
$configurationCurrentBillingInfo = (new BillingInfo())
->setUserCountBilling($configurationCurrentBillingInfoUserCountBilling);
$configurationNextBillingInfoUserCountBilling = (new UserCountBillingInfo())
->setUserCount($configurationNextBillingInfoUserCountBillingUserCount);
$configurationNextBillingInfo = (new BillingInfo())
->setUserCountBilling($configurationNextBillingInfoUserCountBilling);
$configuration = (new Configuration())
->setDisplayName($configurationDisplayName)
->setProduct($formattedConfigurationProduct)
->setLicenseType($configurationLicenseType)
->setCurrentBillingInfo($configurationCurrentBillingInfo)
->setNextBillingInfo($configurationNextBillingInfo);
$request = (new CreateConfigurationRequest())
->setParent($formattedParent)
->setConfigurationId($configurationId)
->setConfiguration($configuration);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $licenseManagerClient->createConfiguration($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Configuration $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 = LicenseManagerClient::locationName('[PROJECT]', '[LOCATION]');
$configurationId = '[CONFIGURATION_ID]';
$configurationDisplayName = '[DISPLAY_NAME]';
$formattedConfigurationProduct = LicenseManagerClient::productName(
'[PROJECT]',
'[LOCATION]',
'[PRODUCT]'
);
$configurationLicenseType = LicenseType::LICENSE_TYPE_UNSPECIFIED;
$configurationCurrentBillingInfoUserCountBillingUserCount = 0;
$configurationNextBillingInfoUserCountBillingUserCount = 0;
create_configuration_sample(
$formattedParent,
$configurationId,
$configurationDisplayName,
$formattedConfigurationProduct,
$configurationLicenseType,
$configurationCurrentBillingInfoUserCountBillingUserCount,
$configurationNextBillingInfoUserCountBillingUserCount
);
}
deactivateConfiguration
Deactivates the given configuration.
The async variant is LicenseManagerClient::deactivateConfigurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\DeactivateConfigurationRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\Configuration;
use Google\Cloud\LicenseManager\V1\DeactivateConfigurationRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the resource. Please see
* {@see LicenseManagerClient::configurationName()} for help formatting this field.
*/
function deactivate_configuration_sample(string $formattedName): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new DeactivateConfigurationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $licenseManagerClient->deactivateConfiguration($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Configuration $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
{
$formattedName = LicenseManagerClient::configurationName(
'[PROJECT]',
'[LOCATION]',
'[CONFIGURATION]'
);
deactivate_configuration_sample($formattedName);
}
deleteConfiguration
Deletes a single Configuration.
The async variant is LicenseManagerClient::deleteConfigurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\DeleteConfigurationRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\DeleteConfigurationRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the resource
* Please see {@see LicenseManagerClient::configurationName()} for help formatting this field.
*/
function delete_configuration_sample(string $formattedName): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new DeleteConfigurationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $licenseManagerClient->deleteConfiguration($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 = LicenseManagerClient::configurationName(
'[PROJECT]',
'[LOCATION]',
'[CONFIGURATION]'
);
delete_configuration_sample($formattedName);
}
getConfiguration
Gets details of a single Configuration.
The async variant is LicenseManagerClient::getConfigurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\GetConfigurationRequest
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\LicenseManager\V1\Configuration |
use Google\ApiCore\ApiException;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\Configuration;
use Google\Cloud\LicenseManager\V1\GetConfigurationRequest;
/**
* @param string $formattedName Name of the resource
* Please see {@see LicenseManagerClient::configurationName()} for help formatting this field.
*/
function get_configuration_sample(string $formattedName): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new GetConfigurationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Configuration $response */
$response = $licenseManagerClient->getConfiguration($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 = LicenseManagerClient::configurationName(
'[PROJECT]',
'[LOCATION]',
'[CONFIGURATION]'
);
get_configuration_sample($formattedName);
}
getInstance
Gets details of a single Instance.
The async variant is LicenseManagerClient::getInstanceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\GetInstanceRequest
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\LicenseManager\V1\Instance |
use Google\ApiCore\ApiException;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\GetInstanceRequest;
use Google\Cloud\LicenseManager\V1\Instance;
/**
* @param string $formattedName Name of the resource
* Please see {@see LicenseManagerClient::instanceName()} for help formatting this field.
*/
function get_instance_sample(string $formattedName): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new GetInstanceRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Instance $response */
$response = $licenseManagerClient->getInstance($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 = LicenseManagerClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
get_instance_sample($formattedName);
}
getProduct
Gets details of a single Product.
The async variant is LicenseManagerClient::getProductAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\GetProductRequest
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\LicenseManager\V1\Product |
use Google\ApiCore\ApiException;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\GetProductRequest;
use Google\Cloud\LicenseManager\V1\Product;
/**
* @param string $formattedName Name of the resource
* Please see {@see LicenseManagerClient::productName()} for help formatting this field.
*/
function get_product_sample(string $formattedName): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new GetProductRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Product $response */
$response = $licenseManagerClient->getProduct($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 = LicenseManagerClient::productName('[PROJECT]', '[LOCATION]', '[PRODUCT]');
get_product_sample($formattedName);
}
listConfigurations
Lists Configurations in a given project and ___location.
The async variant is LicenseManagerClient::listConfigurationsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\ListConfigurationsRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\Configuration;
use Google\Cloud\LicenseManager\V1\ListConfigurationsRequest;
/**
* @param string $formattedParent Parent value for ListConfigurationsRequest
* Please see {@see LicenseManagerClient::locationName()} for help formatting this field.
*/
function list_configurations_sample(string $formattedParent): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new ListConfigurationsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $licenseManagerClient->listConfigurations($request);
/** @var Configuration $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 = LicenseManagerClient::locationName('[PROJECT]', '[LOCATION]');
list_configurations_sample($formattedParent);
}
listInstances
Lists Instances in a given project and ___location.
The async variant is LicenseManagerClient::listInstancesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\ListInstancesRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\Instance;
use Google\Cloud\LicenseManager\V1\ListInstancesRequest;
/**
* @param string $formattedParent Parent value for ListInstancesRequest
* Please see {@see LicenseManagerClient::locationName()} for help formatting this field.
*/
function list_instances_sample(string $formattedParent): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new ListInstancesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $licenseManagerClient->listInstances($request);
/** @var Instance $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 = LicenseManagerClient::locationName('[PROJECT]', '[LOCATION]');
list_instances_sample($formattedParent);
}
listProducts
Lists Products in a given project and ___location.
The async variant is LicenseManagerClient::listProductsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\ListProductsRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\ListProductsRequest;
use Google\Cloud\LicenseManager\V1\Product;
/**
* @param string $formattedParent Parent value for ListProductsRequest
* Please see {@see LicenseManagerClient::locationName()} for help formatting this field.
*/
function list_products_sample(string $formattedParent): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new ListProductsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $licenseManagerClient->listProducts($request);
/** @var Product $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 = LicenseManagerClient::locationName('[PROJECT]', '[LOCATION]');
list_products_sample($formattedParent);
}
queryConfigurationLicenseUsage
License Usage information for a Configuration.
The async variant is LicenseManagerClient::queryConfigurationLicenseUsageAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\QueryConfigurationLicenseUsageRequest
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\LicenseManager\V1\QueryConfigurationLicenseUsageResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\QueryConfigurationLicenseUsageRequest;
use Google\Cloud\LicenseManager\V1\QueryConfigurationLicenseUsageResponse;
use Google\Protobuf\Timestamp;
/**
* @param string $formattedName The resource path of the Configuration. Please see
* {@see LicenseManagerClient::configurationName()} for help formatting this field.
*/
function query_configuration_license_usage_sample(string $formattedName): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$startTime = new Timestamp();
$endTime = new Timestamp();
$request = (new QueryConfigurationLicenseUsageRequest())
->setName($formattedName)
->setStartTime($startTime)
->setEndTime($endTime);
// Call the API and handle any network failures.
try {
/** @var QueryConfigurationLicenseUsageResponse $response */
$response = $licenseManagerClient->queryConfigurationLicenseUsage($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 = LicenseManagerClient::configurationName(
'[PROJECT]',
'[LOCATION]',
'[CONFIGURATION]'
);
query_configuration_license_usage_sample($formattedName);
}
reactivateConfiguration
Reactivates the given configuration.
The async variant is LicenseManagerClient::reactivateConfigurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\ReactivateConfigurationRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\Configuration;
use Google\Cloud\LicenseManager\V1\ReactivateConfigurationRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the resource. Please see
* {@see LicenseManagerClient::configurationName()} for help formatting this field.
*/
function reactivate_configuration_sample(string $formattedName): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = (new ReactivateConfigurationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $licenseManagerClient->reactivateConfiguration($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Configuration $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
{
$formattedName = LicenseManagerClient::configurationName(
'[PROJECT]',
'[LOCATION]',
'[CONFIGURATION]'
);
reactivate_configuration_sample($formattedName);
}
updateConfiguration
Updates the parameters of a single Configuration.
The async variant is LicenseManagerClient::updateConfigurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\UpdateConfigurationRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\LicenseManager\V1\BillingInfo;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\LicenseManager\V1\Configuration;
use Google\Cloud\LicenseManager\V1\LicenseType;
use Google\Cloud\LicenseManager\V1\UpdateConfigurationRequest;
use Google\Cloud\LicenseManager\V1\UserCountBillingInfo;
use Google\Rpc\Status;
/**
* @param string $configurationDisplayName User given name.
* @param string $formattedConfigurationProduct Name field (with URL) of the Product offered for SPLA. Please see
* {@see LicenseManagerClient::productName()} for help formatting this field.
* @param int $configurationLicenseType LicenseType to be applied for billing
* @param int $configurationCurrentBillingInfoUserCountBillingUserCount Number of users to bill for.
* @param int $configurationNextBillingInfoUserCountBillingUserCount Number of users to bill for.
*/
function update_configuration_sample(
string $configurationDisplayName,
string $formattedConfigurationProduct,
int $configurationLicenseType,
int $configurationCurrentBillingInfoUserCountBillingUserCount,
int $configurationNextBillingInfoUserCountBillingUserCount
): void {
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$configurationCurrentBillingInfoUserCountBilling = (new UserCountBillingInfo())
->setUserCount($configurationCurrentBillingInfoUserCountBillingUserCount);
$configurationCurrentBillingInfo = (new BillingInfo())
->setUserCountBilling($configurationCurrentBillingInfoUserCountBilling);
$configurationNextBillingInfoUserCountBilling = (new UserCountBillingInfo())
->setUserCount($configurationNextBillingInfoUserCountBillingUserCount);
$configurationNextBillingInfo = (new BillingInfo())
->setUserCountBilling($configurationNextBillingInfoUserCountBilling);
$configuration = (new Configuration())
->setDisplayName($configurationDisplayName)
->setProduct($formattedConfigurationProduct)
->setLicenseType($configurationLicenseType)
->setCurrentBillingInfo($configurationCurrentBillingInfo)
->setNextBillingInfo($configurationNextBillingInfo);
$request = (new UpdateConfigurationRequest())
->setConfiguration($configuration);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $licenseManagerClient->updateConfiguration($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Configuration $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
{
$configurationDisplayName = '[DISPLAY_NAME]';
$formattedConfigurationProduct = LicenseManagerClient::productName(
'[PROJECT]',
'[LOCATION]',
'[PRODUCT]'
);
$configurationLicenseType = LicenseType::LICENSE_TYPE_UNSPECIFIED;
$configurationCurrentBillingInfoUserCountBillingUserCount = 0;
$configurationNextBillingInfoUserCountBillingUserCount = 0;
update_configuration_sample(
$configurationDisplayName,
$formattedConfigurationProduct,
$configurationLicenseType,
$configurationCurrentBillingInfoUserCountBillingUserCount,
$configurationNextBillingInfoUserCountBillingUserCount
);
}
getLocation
Gets information about a ___location.
The async variant is LicenseManagerClient::getLocationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
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\Location\Location |
use Google\ApiCore\ApiException;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
/**
* 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 get_location_sample(): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $licenseManagerClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
The async variant is LicenseManagerClient::listLocationsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
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 |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\LicenseManager\V1\Client\LicenseManagerClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
/**
* 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 list_locations_sample(): void
{
// Create a client.
$licenseManagerClient = new LicenseManagerClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $licenseManagerClient->listLocations($request);
/** @var Location $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());
}
}
aggregateUsageAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\AggregateUsageRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
createConfigurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\CreateConfigurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
deactivateConfigurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\DeactivateConfigurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
deleteConfigurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\DeleteConfigurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
getConfigurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\GetConfigurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\LicenseManager\V1\Configuration> |
getInstanceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\GetInstanceRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\LicenseManager\V1\Instance> |
getProductAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\GetProductRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\LicenseManager\V1\Product> |
listConfigurationsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\ListConfigurationsRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
listInstancesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\ListInstancesRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
listProductsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\ListProductsRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
queryConfigurationLicenseUsageAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\QueryConfigurationLicenseUsageRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\LicenseManager\V1\QueryConfigurationLicenseUsageResponse> |
reactivateConfigurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\ReactivateConfigurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
updateConfigurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\LicenseManager\V1\UpdateConfigurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
getLocationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location> |
listLocationsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
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::configurationName
Formats a string containing the fully-qualified path to represent a configuration resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
___location |
string
|
configuration |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted configuration resource. |
static::instanceName
Formats a string containing the fully-qualified path to represent a instance resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
___location |
string
|
instance |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted instance resource. |
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::productName
Formats a string containing the fully-qualified path to represent a product resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
___location |
string
|
product |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted product 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
- configuration: projects/{project}/locations/{___location}/configurations/{configuration}
- instance: projects/{project}/locations/{___location}/instances/{instance}
- ___location: projects/{project}/locations/{___location}
- product: projects/{project}/locations/{___location}/products/{product}
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. |