Reference documentation and code samples for the Google Cloud Bare Metal Solution V2 Client class BareMetalSolutionClient.
Service Description: Performs management operations on Bare Metal Solution servers.
The baremetalsolution.googleapis.com
service provides management
capabilities for Bare Metal Solution servers. To access the API methods, you
must assign Bare Metal Solution IAM roles containing the desired permissions
to your staff in your Google Cloud project. You must also enable the Bare
Metal Solution API. Once enabled, the methods act
upon specific servers in your Bare Metal Solution environment.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
$bareMetalSolutionClient = new BareMetalSolutionClient();
try {
$formattedInstance = $bareMetalSolutionClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
$formattedLun = $bareMetalSolutionClient->lunName('[PROJECT]', '[LOCATION]', '[VOLUME]', '[LUN]');
$operationResponse = $bareMetalSolutionClient->detachLun($formattedInstance, $formattedLun);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $bareMetalSolutionClient->detachLun($formattedInstance, $formattedLun);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $bareMetalSolutionClient->resumeOperation($operationName, 'detachLun');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$bareMetalSolutionClient->close();
}
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.
Methods
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. |
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. |
lunName
Formats a string containing the fully-qualified path to represent a lun resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
volume |
string
|
lun |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted lun resource. |
nFSShareName
Formats a string containing the fully-qualified path to represent a nfs_share resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
nfsShare |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted nfs_share resource. |
networkName
Formats a string containing the fully-qualified path to represent a network resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
network |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted network resource. |
serverNetworkTemplateName
Formats a string containing the fully-qualified path to represent a server_network_template resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
serverNetworkTemplate |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted server_network_template resource. |
volumeName
Formats a string containing the fully-qualified path to represent a volume resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
volume |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted volume resource. |
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
- instance: projects/{project}/locations/{location}/instances/{instance}
- location: projects/{project}/locations/{location}
- lun: projects/{project}/locations/{location}/volumes/{volume}/luns/{lun}
- nFSShare: projects/{project}/locations/{location}/nfsShares/{nfs_share}
- network: projects/{project}/locations/{location}/networks/{network}
- serverNetworkTemplate: projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}
- volume: projects/{project}/locations/{location}/volumes/{volume}
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. |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\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 |
__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 |
↳ 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. |
detachLun
Detach LUN from Instance.
Parameters | |
---|---|
Name | Description |
instance |
string
Required. Name of the instance. |
lun |
string
Required. Name of the Lun to detach. |
optionalArgs |
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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Instance;
use Google\Rpc\Status;
/**
* @param string $formattedInstance Name of the instance. Please see
* {@see BareMetalSolutionClient::instanceName()} for help formatting this field.
* @param string $formattedLun Name of the Lun to detach. Please see
* {@see BareMetalSolutionClient::lunName()} for help formatting this field.
*/
function detach_lun_sample(string $formattedInstance, string $formattedLun): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->detachLun($formattedInstance, $formattedLun);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Instance $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());
}
}
/**
* 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
{
$formattedInstance = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
$formattedLun = BareMetalSolutionClient::lunName('[PROJECT]', '[LOCATION]', '[VOLUME]', '[LUN]');
detach_lun_sample($formattedInstance, $formattedLun);
}
getInstance
Get details about a single server.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. |
optionalArgs |
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\BareMetalSolution\V2\Instance |
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Instance;
/**
* @param string $formattedName Name of the resource. Please see
* {@see BareMetalSolutionClient::instanceName()} for help formatting this field.
*/
function get_instance_sample(string $formattedName): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var Instance $response */
$response = $bareMetalSolutionClient->getInstance($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
get_instance_sample($formattedName);
}
getLun
Get details of a single storage logical unit number(LUN).
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. |
optionalArgs |
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\BareMetalSolution\V2\Lun |
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Lun;
/**
* @param string $formattedName Name of the resource. Please see
* {@see BareMetalSolutionClient::lunName()} for help formatting this field.
*/
function get_lun_sample(string $formattedName): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var Lun $response */
$response = $bareMetalSolutionClient->getLun($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BareMetalSolutionClient::lunName('[PROJECT]', '[LOCATION]', '[VOLUME]', '[LUN]');
get_lun_sample($formattedName);
}
getNetwork
Get details of a single network.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. |
optionalArgs |
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\BareMetalSolution\V2\Network |
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Network;
/**
* @param string $formattedName Name of the resource. Please see
* {@see BareMetalSolutionClient::networkName()} for help formatting this field.
*/
function get_network_sample(string $formattedName): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var Network $response */
$response = $bareMetalSolutionClient->getNetwork($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BareMetalSolutionClient::networkName('[PROJECT]', '[LOCATION]', '[NETWORK]');
get_network_sample($formattedName);
}
getNfsShare
Get details of a single NFS share.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. |
optionalArgs |
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\BareMetalSolution\V2\NfsShare |
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\NfsShare;
/**
* @param string $formattedName Name of the resource. Please see
* {@see BareMetalSolutionClient::nFSShareName()} for help formatting this field.
*/
function get_nfs_share_sample(string $formattedName): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var NfsShare $response */
$response = $bareMetalSolutionClient->getNfsShare($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BareMetalSolutionClient::nFSShareName('[PROJECT]', '[LOCATION]', '[NFS_SHARE]');
get_nfs_share_sample($formattedName);
}
getVolume
Get details of a single storage volume.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. |
optionalArgs |
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\BareMetalSolution\V2\Volume |
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Volume;
/**
* @param string $formattedName Name of the resource. Please see
* {@see BareMetalSolutionClient::volumeName()} for help formatting this field.
*/
function get_volume_sample(string $formattedName): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var Volume $response */
$response = $bareMetalSolutionClient->getVolume($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BareMetalSolutionClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
get_volume_sample($formattedName);
}
listInstances
List servers in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Parent value for ListInstancesRequest. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ filter |
string
List filter. |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Instance;
/**
* @param string $formattedParent Parent value for ListInstancesRequest. Please see
* {@see BareMetalSolutionClient::locationName()} for help formatting this field.
*/
function list_instances_sample(string $formattedParent): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $bareMetalSolutionClient->listInstances($formattedParent);
/** @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());
}
}
/**
* 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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');
list_instances_sample($formattedParent);
}
listLuns
List storage volume luns for given storage volume.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Parent value for ListLunsRequest. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Lun;
/**
* @param string $formattedParent Parent value for ListLunsRequest. Please see
* {@see BareMetalSolutionClient::volumeName()} for help formatting this field.
*/
function list_luns_sample(string $formattedParent): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $bareMetalSolutionClient->listLuns($formattedParent);
/** @var Lun $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());
}
}
/**
* 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 = BareMetalSolutionClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
list_luns_sample($formattedParent);
}
listNetworkUsage
List all Networks (and used IPs for each Network) in the vendor account associated with the specified project.
Parameters | |
---|---|
Name | Description |
location |
string
Required. Parent value (project and location). |
optionalArgs |
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\BareMetalSolution\V2\ListNetworkUsageResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListNetworkUsageResponse;
/**
* @param string $formattedLocation Parent value (project and location). Please see
* {@see BareMetalSolutionClient::locationName()} for help formatting this field.
*/
function list_network_usage_sample(string $formattedLocation): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var ListNetworkUsageResponse $response */
$response = $bareMetalSolutionClient->listNetworkUsage($formattedLocation);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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
{
$formattedLocation = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');
list_network_usage_sample($formattedLocation);
}
listNetworks
List network in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Parent value for ListNetworksRequest. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ filter |
string
List filter. |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Network;
/**
* @param string $formattedParent Parent value for ListNetworksRequest. Please see
* {@see BareMetalSolutionClient::locationName()} for help formatting this field.
*/
function list_networks_sample(string $formattedParent): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $bareMetalSolutionClient->listNetworks($formattedParent);
/** @var Network $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());
}
}
/**
* 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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');
list_networks_sample($formattedParent);
}
listNfsShares
List NFS shares.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Parent value for ListNfsSharesRequest. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ filter |
string
List filter. |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\NfsShare;
/**
* @param string $formattedParent Parent value for ListNfsSharesRequest. Please see
* {@see BareMetalSolutionClient::locationName()} for help formatting this field.
*/
function list_nfs_shares_sample(string $formattedParent): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $bareMetalSolutionClient->listNfsShares($formattedParent);
/** @var NfsShare $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());
}
}
/**
* 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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');
list_nfs_shares_sample($formattedParent);
}
listVolumes
List storage volumes in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Parent value for ListVolumesRequest. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ filter |
string
List filter. |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Volume;
/**
* @param string $formattedParent Parent value for ListVolumesRequest. Please see
* {@see BareMetalSolutionClient::locationName()} for help formatting this field.
*/
function list_volumes_sample(string $formattedParent): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $bareMetalSolutionClient->listVolumes($formattedParent);
/** @var Volume $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());
}
}
/**
* 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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');
list_volumes_sample($formattedParent);
}
resetInstance
Perform an ungraceful, hard reset on a server. Equivalent to shutting the power off and then turning it back on.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. |
optionalArgs |
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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ResetInstanceResponse;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the resource. Please see
* {@see BareMetalSolutionClient::instanceName()} for help formatting this field.
*/
function reset_instance_sample(string $formattedName): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->resetInstance($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ResetInstanceResponse $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());
}
}
/**
* 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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
reset_instance_sample($formattedName);
}
resizeVolume
Emergency Volume resize.
Parameters | |
---|---|
Name | Description |
volume |
string
Required. Volume to resize. |
optionalArgs |
array
Optional. |
↳ sizeGib |
int
New Volume size, in GiB. |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Volume;
use Google\Rpc\Status;
/**
* @param string $formattedVolume Volume to resize. Please see
* {@see BareMetalSolutionClient::volumeName()} for help formatting this field.
*/
function resize_volume_sample(string $formattedVolume): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->resizeVolume($formattedVolume);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Volume $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());
}
}
/**
* 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
{
$formattedVolume = BareMetalSolutionClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
resize_volume_sample($formattedVolume);
}
startInstance
Starts a server that was shutdown.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. |
optionalArgs |
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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\StartInstanceResponse;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the resource. Please see
* {@see BareMetalSolutionClient::instanceName()} for help formatting this field.
*/
function start_instance_sample(string $formattedName): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->startInstance($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var StartInstanceResponse $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());
}
}
/**
* 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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
start_instance_sample($formattedName);
}
stopInstance
Stop a running server.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. |
optionalArgs |
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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\StopInstanceResponse;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the resource. Please see
* {@see BareMetalSolutionClient::instanceName()} for help formatting this field.
*/
function stop_instance_sample(string $formattedName): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->stopInstance($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var StopInstanceResponse $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());
}
}
/**
* 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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
stop_instance_sample($formattedName);
}
updateInstance
Update details of a single server.
Parameters | |
---|---|
Name | Description |
instance |
Google\Cloud\BareMetalSolution\V2\Instance
Required. The server to update. The |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
The list of fields to update. The currently supported fields are: |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Instance;
use Google\Rpc\Status;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function update_instance_sample(): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Prepare any non-scalar elements to be passed along with the request.
$instance = new Instance();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->updateInstance($instance);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Instance $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());
}
}
updateNetwork
Update details of a single network.
Parameters | |
---|---|
Name | Description |
network |
Google\Cloud\BareMetalSolution\V2\Network
Required. The network to update. The |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
The list of fields to update. The only currently supported fields are: |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Network;
use Google\Rpc\Status;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function update_network_sample(): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Prepare any non-scalar elements to be passed along with the request.
$network = new Network();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->updateNetwork($network);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Network $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());
}
}
updateNfsShare
Update details of a single NFS share.
Parameters | |
---|---|
Name | Description |
nfsShare |
Google\Cloud\BareMetalSolution\V2\NfsShare
Required. The NFS share to update. The |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
The list of fields to update. The only currently supported fields are: |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\NfsShare;
use Google\Rpc\Status;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function update_nfs_share_sample(): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Prepare any non-scalar elements to be passed along with the request.
$nfsShare = new NfsShare();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->updateNfsShare($nfsShare);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var NfsShare $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());
}
}
updateVolume
Update details of a single storage volume.
Parameters | |
---|---|
Name | Description |
volume |
Google\Cloud\BareMetalSolution\V2\Volume
Required. The volume to update. The |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
The list of fields to update. The only currently supported fields are: |
↳ 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\BareMetalSolution\V2\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Volume;
use Google\Rpc\Status;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function update_volume_sample(): void
{
// Create a client.
$bareMetalSolutionClient = new BareMetalSolutionClient();
// Prepare any non-scalar elements to be passed along with the request.
$volume = new Volume();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $bareMetalSolutionClient->updateVolume($volume);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Volume $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());
}
}
Constants
SERVICE_NAME
Value: 'google.cloud.baremetalsolution.v2.BareMetalSolution'
The name of the service.
SERVICE_ADDRESS
Value: 'baremetalsolution.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.