Google Cloud Bare Metal Solution V2 Client - Class BareMetalSolutionClient (1.0.0)

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.

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 \ BareMetalSolution \ V2 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

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

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

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

↳ credentialsConfig array

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

↳ disableRetries bool

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

↳ clientConfig string|array

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

↳ transport string|TransportInterface

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

↳ transportConfig array

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

↳ clientCertSource callable

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

createNfsShare

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\CreateNfsShareRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\CreateNfsShareRequest;
use Google\Cloud\BareMetalSolution\V2\NfsShare;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent project and location. Please see
 *                                {@see BareMetalSolutionClient::locationName()} for help formatting this field.
 */
function create_nfs_share_sample(string $formattedParent): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

    // Prepare the request message.
    $nfsShare = new NfsShare();
    $request = (new CreateNfsShareRequest())
        ->setParent($formattedParent)
        ->setNfsShare($nfsShare);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->createNfsShare($request);
        $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());
    }
}

/**
 * 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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');

    create_nfs_share_sample($formattedParent);
}

createProvisioningConfig

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\CreateProvisioningConfigRequest

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\BareMetalSolution\V2\ProvisioningConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\CreateProvisioningConfigRequest;
use Google\Cloud\BareMetalSolution\V2\ProvisioningConfig;

/**
 * @param string $formattedParent The parent project and location containing the
 *                                ProvisioningConfig. Please see
 *                                {@see BareMetalSolutionClient::locationName()} for help formatting this field.
 */
function create_provisioning_config_sample(string $formattedParent): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

    // Prepare the request message.
    $provisioningConfig = new ProvisioningConfig();
    $request = (new CreateProvisioningConfigRequest())
        ->setParent($formattedParent)
        ->setProvisioningConfig($provisioningConfig);

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

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

    create_provisioning_config_sample($formattedParent);
}

createSSHKey

Register a public SSH key in the specified project for use with the interactive serial console feature.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::createSSHKeyAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\CreateSSHKeyRequest

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\BareMetalSolution\V2\SSHKey
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\CreateSSHKeyRequest;
use Google\Cloud\BareMetalSolution\V2\SSHKey;

/**
 * @param string $formattedParent The parent containing the SSH keys. Please see
 *                                {@see BareMetalSolutionClient::locationName()} for help formatting this field.
 * @param string $sshKeyId        The ID to use for the key, which will become the final component
 *                                of the key's resource name.
 *
 *                                This value must match the regex:
 *                                [a-zA-Z0-9@.\-_]{1,64}
 */
function create_ssh_key_sample(string $formattedParent, string $sshKeyId): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

    // Prepare the request message.
    $sshKey = new SSHKey();
    $request = (new CreateSSHKeyRequest())
        ->setParent($formattedParent)
        ->setSshKey($sshKey)
        ->setSshKeyId($sshKeyId);

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

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

    create_ssh_key_sample($formattedParent, $sshKeyId);
}

createVolumeSnapshot

Takes a snapshot of a boot volume.

Returns INVALID_ARGUMENT if called for a non-boot volume.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::createVolumeSnapshotAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\CreateVolumeSnapshotRequest

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\BareMetalSolution\V2\VolumeSnapshot
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\CreateVolumeSnapshotRequest;
use Google\Cloud\BareMetalSolution\V2\VolumeSnapshot;

/**
 * @param string $formattedParent The volume to snapshot. Please see
 *                                {@see BareMetalSolutionClient::volumeName()} for help formatting this field.
 */
function create_volume_snapshot_sample(string $formattedParent): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

    // Prepare the request message.
    $volumeSnapshot = new VolumeSnapshot();
    $request = (new CreateVolumeSnapshotRequest())
        ->setParent($formattedParent)
        ->setVolumeSnapshot($volumeSnapshot);

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

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

    create_volume_snapshot_sample($formattedParent);
}

deleteNfsShare

Delete an NFS share. The underlying volume is automatically deleted.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::deleteNfsShareAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DeleteNfsShareRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\DeleteNfsShareRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the NFS share to delete. Please see
 *                              {@see BareMetalSolutionClient::nFSShareName()} for help formatting this field.
 */
function delete_nfs_share_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->deleteNfsShare($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 = BareMetalSolutionClient::nFSShareName('[PROJECT]', '[LOCATION]', '[NFS_SHARE]');

    delete_nfs_share_sample($formattedName);
}

deleteSSHKey

Deletes a public SSH key registered in the specified project.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::deleteSSHKeyAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DeleteSSHKeyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\DeleteSSHKeyRequest;

/**
 * @param string $formattedName The name of the SSH key to delete.
 *                              Currently, the only valid value for the location is "global". Please see
 *                              {@see BareMetalSolutionClient::sshKeyName()} for help formatting this field.
 */
function delete_ssh_key_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        $bareMetalSolutionClient->deleteSSHKey($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    delete_ssh_key_sample($formattedName);
}

deleteVolumeSnapshot

Deletes a volume snapshot.

Returns INVALID_ARGUMENT if called for a non-boot volume.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::deleteVolumeSnapshotAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DeleteVolumeSnapshotRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\DeleteVolumeSnapshotRequest;

/**
 * @param string $formattedName The name of the snapshot to delete. Please see
 *                              {@see BareMetalSolutionClient::volumeSnapshotName()} for help formatting this field.
 */
function delete_volume_snapshot_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        $bareMetalSolutionClient->deleteVolumeSnapshot($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    delete_volume_snapshot_sample($formattedName);
}

detachLun

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DetachLunRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\DetachLunRequest;
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();

    // Prepare the request message.
    $request = (new DetachLunRequest())
        ->setInstance($formattedInstance)
        ->setLun($formattedLun);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->detachLun($request);
        $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());
    }
}

/**
 * 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
{
    $formattedInstance = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
    $formattedLun = BareMetalSolutionClient::lunName('[PROJECT]', '[LOCATION]', '[VOLUME]', '[LUN]');

    detach_lun_sample($formattedInstance, $formattedLun);
}

disableInteractiveSerialConsole

Disable the interactive serial console feature on an instance.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::disableInteractiveSerialConsoleAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DisableInteractiveSerialConsoleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\DisableInteractiveSerialConsoleRequest;
use Google\Cloud\BareMetalSolution\V2\DisableInteractiveSerialConsoleResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see BareMetalSolutionClient::instanceName()} for help formatting this field.
 */
function disable_interactive_serial_console_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var DisableInteractiveSerialConsoleResponse $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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    disable_interactive_serial_console_sample($formattedName);
}

enableInteractiveSerialConsole

Enable the interactive serial console feature on an instance.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::enableInteractiveSerialConsoleAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\EnableInteractiveSerialConsoleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\EnableInteractiveSerialConsoleRequest;
use Google\Cloud\BareMetalSolution\V2\EnableInteractiveSerialConsoleResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see BareMetalSolutionClient::instanceName()} for help formatting this field.
 */
function enable_interactive_serial_console_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var EnableInteractiveSerialConsoleResponse $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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    enable_interactive_serial_console_sample($formattedName);
}

evictLun

Skips lun's cooloff and deletes it now.

Lun must be in cooloff state.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::evictLunAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\EvictLunRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\EvictLunRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the lun. Please see
 *                              {@see BareMetalSolutionClient::lunName()} for help formatting this field.
 */
function evict_lun_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->evictLun($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 = BareMetalSolutionClient::lunName('[PROJECT]', '[LOCATION]', '[VOLUME]', '[LUN]');

    evict_lun_sample($formattedName);
}

evictVolume

Skips volume's cooloff and deletes it now.

Volume must be in cooloff state.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::evictVolumeAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\EvictVolumeRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\EvictVolumeRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the Volume. Please see
 *                              {@see BareMetalSolutionClient::volumeName()} for help formatting this field.
 */
function evict_volume_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->evictVolume($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 = BareMetalSolutionClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');

    evict_volume_sample($formattedName);
}

getInstance

Get details about a single server.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::getInstanceAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\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\BareMetalSolution\V2\Instance
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\GetInstanceRequest;
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();

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

    // Call the API and handle any network failures.
    try {
        /** @var Instance $response */
        $response = $bareMetalSolutionClient->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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    get_instance_sample($formattedName);
}

getLun

Get details of a single storage logical unit number(LUN).

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::getLunAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetLunRequest

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\BareMetalSolution\V2\Lun
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\GetLunRequest;
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();

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

    // Call the API and handle any network failures.
    try {
        /** @var Lun $response */
        $response = $bareMetalSolutionClient->getLun($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 = BareMetalSolutionClient::lunName('[PROJECT]', '[LOCATION]', '[VOLUME]', '[LUN]');

    get_lun_sample($formattedName);
}

getNetwork

Get details of a single network.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::getNetworkAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetNetworkRequest

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\BareMetalSolution\V2\Network
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\GetNetworkRequest;
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();

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

    // Call the API and handle any network failures.
    try {
        /** @var Network $response */
        $response = $bareMetalSolutionClient->getNetwork($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 = BareMetalSolutionClient::networkName('[PROJECT]', '[LOCATION]', '[NETWORK]');

    get_network_sample($formattedName);
}

getNfsShare

Get details of a single NFS share.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::getNfsShareAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetNfsShareRequest

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\BareMetalSolution\V2\NfsShare
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\GetNfsShareRequest;
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();

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

    // Call the API and handle any network failures.
    try {
        /** @var NfsShare $response */
        $response = $bareMetalSolutionClient->getNfsShare($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 = BareMetalSolutionClient::nFSShareName('[PROJECT]', '[LOCATION]', '[NFS_SHARE]');

    get_nfs_share_sample($formattedName);
}

getProvisioningConfig

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetProvisioningConfigRequest

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\BareMetalSolution\V2\ProvisioningConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\GetProvisioningConfigRequest;
use Google\Cloud\BareMetalSolution\V2\ProvisioningConfig;

/**
 * @param string $formattedName Name of the ProvisioningConfig. Please see
 *                              {@see BareMetalSolutionClient::provisioningConfigName()} for help formatting this field.
 */
function get_provisioning_config_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var ProvisioningConfig $response */
        $response = $bareMetalSolutionClient->getProvisioningConfig($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 = BareMetalSolutionClient::provisioningConfigName(
        '[PROJECT]',
        '[LOCATION]',
        '[PROVISIONING_CONFIG]'
    );

    get_provisioning_config_sample($formattedName);
}

getVolume

Get details of a single storage volume.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::getVolumeAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetVolumeRequest

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\BareMetalSolution\V2\Volume
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\GetVolumeRequest;
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();

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

    // Call the API and handle any network failures.
    try {
        /** @var Volume $response */
        $response = $bareMetalSolutionClient->getVolume($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 = BareMetalSolutionClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');

    get_volume_sample($formattedName);
}

getVolumeSnapshot

Returns the specified snapshot resource.

Returns INVALID_ARGUMENT if called for a non-boot volume.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::getVolumeSnapshotAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetVolumeSnapshotRequest

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\BareMetalSolution\V2\VolumeSnapshot
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\GetVolumeSnapshotRequest;
use Google\Cloud\BareMetalSolution\V2\VolumeSnapshot;

/**
 * @param string $formattedName The name of the snapshot. Please see
 *                              {@see BareMetalSolutionClient::volumeSnapshotName()} for help formatting this field.
 */
function get_volume_snapshot_sample(string $formattedName): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var VolumeSnapshot $response */
        $response = $bareMetalSolutionClient->getVolumeSnapshot($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 = BareMetalSolutionClient::volumeSnapshotName(
        '[PROJECT]',
        '[LOCATION]',
        '[VOLUME]',
        '[SNAPSHOT]'
    );

    get_volume_snapshot_sample($formattedName);
}

listInstances

List servers in a given project and location.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listInstancesAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Instance;
use Google\Cloud\BareMetalSolution\V2\ListInstancesRequest;

/**
 * @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();

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

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $bareMetalSolutionClient->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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');

    list_instances_sample($formattedParent);
}

listLuns

List storage volume luns for given storage volume.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listLunsAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListLunsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListLunsRequest;
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();

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

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

        /** @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());
    }
}

/**
 * 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 = 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.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listNetworkUsageAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListNetworkUsageRequest

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\BareMetalSolution\V2\ListNetworkUsageResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListNetworkUsageRequest;
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();

    // Prepare the request message.
    $request = (new ListNetworkUsageRequest())
        ->setLocation($formattedLocation);

    // Call the API and handle any network failures.
    try {
        /** @var ListNetworkUsageResponse $response */
        $response = $bareMetalSolutionClient->listNetworkUsage($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
{
    $formattedLocation = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');

    list_network_usage_sample($formattedLocation);
}

listNetworks

List network in a given project and location.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listNetworksAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListNetworksRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListNetworksRequest;
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();

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

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

        /** @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());
    }
}

/**
 * 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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');

    list_networks_sample($formattedParent);
}

listNfsShares

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListNfsSharesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListNfsSharesRequest;
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();

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

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

        /** @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());
    }
}

/**
 * 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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');

    list_nfs_shares_sample($formattedParent);
}

listOSImages

Retrieves the list of OS images which are currently approved.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listOSImagesAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListOSImagesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListOSImagesRequest;
use Google\Cloud\BareMetalSolution\V2\OSImage;

/**
 * @param string $formattedParent Parent value for ListProvisioningQuotasRequest. Please see
 *                                {@see BareMetalSolutionClient::locationName()} for help formatting this field.
 */
function list_os_images_sample(string $formattedParent): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

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

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

    list_os_images_sample($formattedParent);
}

listProvisioningQuotas

List the budget details to provision resources on a given project.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listProvisioningQuotasAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListProvisioningQuotasRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListProvisioningQuotasRequest;
use Google\Cloud\BareMetalSolution\V2\ProvisioningQuota;

/**
 * @param string $formattedParent Parent value for ListProvisioningQuotasRequest. Please see
 *                                {@see BareMetalSolutionClient::locationName()} for help formatting this field.
 */
function list_provisioning_quotas_sample(string $formattedParent): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

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

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

    list_provisioning_quotas_sample($formattedParent);
}

listSSHKeys

Lists the public SSH keys registered for the specified project.

These SSH keys are used only for the interactive serial console feature.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listSSHKeysAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListSSHKeysRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListSSHKeysRequest;
use Google\Cloud\BareMetalSolution\V2\SSHKey;

/**
 * @param string $formattedParent The parent containing the SSH keys.
 *                                Currently, the only valid value for the location is "global". Please see
 *                                {@see BareMetalSolutionClient::locationName()} for help formatting this field.
 */
function list_ssh_keys_sample(string $formattedParent): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

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

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

    list_ssh_keys_sample($formattedParent);
}

listVolumeSnapshots

Retrieves the list of snapshots for the specified volume.

Returns a response with an empty list of snapshots if called for a non-boot volume.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listVolumeSnapshotsAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListVolumeSnapshotsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListVolumeSnapshotsRequest;
use Google\Cloud\BareMetalSolution\V2\VolumeSnapshot;

/**
 * @param string $formattedParent Parent value for ListVolumesRequest. Please see
 *                                {@see BareMetalSolutionClient::volumeName()} for help formatting this field.
 */
function list_volume_snapshots_sample(string $formattedParent): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

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

        /** @var VolumeSnapshot $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 = BareMetalSolutionClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');

    list_volume_snapshots_sample($formattedParent);
}

listVolumes

List storage volumes in a given project and location.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::listVolumesAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListVolumesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ListVolumesRequest;
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();

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

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

        /** @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());
    }
}

/**
 * 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 = BareMetalSolutionClient::locationName('[PROJECT]', '[LOCATION]');

    list_volumes_sample($formattedParent);
}

renameInstance

RenameInstance sets a new name for an instance.

Use with caution, previous names become immediately invalidated.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::renameInstanceAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RenameInstanceRequest

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\BareMetalSolution\V2\Instance
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Instance;
use Google\Cloud\BareMetalSolution\V2\RenameInstanceRequest;

/**
 * @param string $formattedName The `name` field is used to identify the instance.
 *                              Format: projects/{project}/locations/{location}/instances/{instance}
 *                              Please see {@see BareMetalSolutionClient::instanceName()} for help formatting this field.
 * @param string $newInstanceId The new `id` of the instance.
 */
function rename_instance_sample(string $formattedName, string $newInstanceId): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Instance $response */
        $response = $bareMetalSolutionClient->renameInstance($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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
    $newInstanceId = '[NEW_INSTANCE_ID]';

    rename_instance_sample($formattedName, $newInstanceId);
}

renameNetwork

RenameNetwork sets a new name for a network.

Use with caution, previous names become immediately invalidated.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::renameNetworkAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RenameNetworkRequest

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\BareMetalSolution\V2\Network
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Network;
use Google\Cloud\BareMetalSolution\V2\RenameNetworkRequest;

/**
 * @param string $formattedName The `name` field is used to identify the network.
 *                              Format: projects/{project}/locations/{location}/networks/{network}
 *                              Please see {@see BareMetalSolutionClient::networkName()} for help formatting this field.
 * @param string $newNetworkId  The new `id` of the network.
 */
function rename_network_sample(string $formattedName, string $newNetworkId): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Network $response */
        $response = $bareMetalSolutionClient->renameNetwork($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 = BareMetalSolutionClient::networkName('[PROJECT]', '[LOCATION]', '[NETWORK]');
    $newNetworkId = '[NEW_NETWORK_ID]';

    rename_network_sample($formattedName, $newNetworkId);
}

renameNfsShare

RenameNfsShare sets a new name for an nfsshare.

Use with caution, previous names become immediately invalidated.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::renameNfsShareAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RenameNfsShareRequest

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\BareMetalSolution\V2\NfsShare
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\NfsShare;
use Google\Cloud\BareMetalSolution\V2\RenameNfsShareRequest;

/**
 * @param string $formattedName The `name` field is used to identify the nfsshare.
 *                              Format: projects/{project}/locations/{location}/nfsshares/{nfsshare}
 *                              Please see {@see BareMetalSolutionClient::nFSShareName()} for help formatting this field.
 * @param string $newNfsshareId The new `id` of the nfsshare.
 */
function rename_nfs_share_sample(string $formattedName, string $newNfsshareId): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var NfsShare $response */
        $response = $bareMetalSolutionClient->renameNfsShare($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 = BareMetalSolutionClient::nFSShareName('[PROJECT]', '[LOCATION]', '[NFS_SHARE]');
    $newNfsshareId = '[NEW_NFSSHARE_ID]';

    rename_nfs_share_sample($formattedName, $newNfsshareId);
}

renameVolume

RenameVolume sets a new name for a volume.

Use with caution, previous names become immediately invalidated.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::renameVolumeAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RenameVolumeRequest

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\BareMetalSolution\V2\Volume
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\RenameVolumeRequest;
use Google\Cloud\BareMetalSolution\V2\Volume;

/**
 * @param string $formattedName The `name` field is used to identify the volume.
 *                              Format: projects/{project}/locations/{location}/volumes/{volume}
 *                              Please see {@see BareMetalSolutionClient::volumeName()} for help formatting this field.
 * @param string $newVolumeId   The new `id` of the volume.
 */
function rename_volume_sample(string $formattedName, string $newVolumeId): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Volume $response */
        $response = $bareMetalSolutionClient->renameVolume($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 = BareMetalSolutionClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
    $newVolumeId = '[NEW_VOLUME_ID]';

    rename_volume_sample($formattedName, $newVolumeId);
}

resetInstance

Perform an ungraceful, hard reset on a server. Equivalent to shutting the power off and then turning it back on.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::resetInstanceAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ResetInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ResetInstanceRequest;
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();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->resetInstance($request);
        $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());
    }
}

/**
 * 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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    reset_instance_sample($formattedName);
}

resizeVolume

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ResizeVolumeRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ResizeVolumeRequest;
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();

    // Prepare the request message.
    $request = (new ResizeVolumeRequest())
        ->setVolume($formattedVolume);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->resizeVolume($request);
        $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());
    }
}

/**
 * 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
{
    $formattedVolume = BareMetalSolutionClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');

    resize_volume_sample($formattedVolume);
}

restoreVolumeSnapshot

Uses the specified snapshot to restore its parent volume.

Returns INVALID_ARGUMENT if called for a non-boot volume.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::restoreVolumeSnapshotAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RestoreVolumeSnapshotRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\RestoreVolumeSnapshotRequest;
use Google\Cloud\BareMetalSolution\V2\VolumeSnapshot;
use Google\Rpc\Status;

/**
 * @param string $formattedVolumeSnapshot Name of the snapshot which will be used to restore its parent
 *                                        volume. Please see
 *                                        {@see BareMetalSolutionClient::volumeSnapshotName()} for help formatting this field.
 */
function restore_volume_snapshot_sample(string $formattedVolumeSnapshot): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

    // Prepare the request message.
    $request = (new RestoreVolumeSnapshotRequest())
        ->setVolumeSnapshot($formattedVolumeSnapshot);

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

        if ($response->operationSucceeded()) {
            /** @var VolumeSnapshot $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
{
    $formattedVolumeSnapshot = BareMetalSolutionClient::volumeSnapshotName(
        '[PROJECT]',
        '[LOCATION]',
        '[VOLUME]',
        '[SNAPSHOT]'
    );

    restore_volume_snapshot_sample($formattedVolumeSnapshot);
}

startInstance

Starts a server that was shutdown.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::startInstanceAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\StartInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\StartInstanceRequest;
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();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->startInstance($request);
        $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());
    }
}

/**
 * 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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    start_instance_sample($formattedName);
}

stopInstance

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\StopInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\StopInstanceRequest;
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();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->stopInstance($request);
        $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());
    }
}

/**
 * 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 = BareMetalSolutionClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    stop_instance_sample($formattedName);
}

submitProvisioningConfig

Submit a provisiong configuration for a given project.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::submitProvisioningConfigAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\SubmitProvisioningConfigRequest

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\BareMetalSolution\V2\SubmitProvisioningConfigResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ProvisioningConfig;
use Google\Cloud\BareMetalSolution\V2\SubmitProvisioningConfigRequest;
use Google\Cloud\BareMetalSolution\V2\SubmitProvisioningConfigResponse;

/**
 * @param string $formattedParent The parent project and location containing the
 *                                ProvisioningConfig. Please see
 *                                {@see BareMetalSolutionClient::locationName()} for help formatting this field.
 */
function submit_provisioning_config_sample(string $formattedParent): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

    // Prepare the request message.
    $provisioningConfig = new ProvisioningConfig();
    $request = (new SubmitProvisioningConfigRequest())
        ->setParent($formattedParent)
        ->setProvisioningConfig($provisioningConfig);

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

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

    submit_provisioning_config_sample($formattedParent);
}

updateInstance

Update details of a single server.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::updateInstanceAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Instance;
use Google\Cloud\BareMetalSolution\V2\UpdateInstanceRequest;
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 the request message.
    $instance = new Instance();
    $request = (new UpdateInstanceRequest())
        ->setInstance($instance);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->updateInstance($request);
        $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.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::updateNetworkAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateNetworkRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\Network;
use Google\Cloud\BareMetalSolution\V2\UpdateNetworkRequest;
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 the request message.
    $network = new Network();
    $request = (new UpdateNetworkRequest())
        ->setNetwork($network);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->updateNetwork($request);
        $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.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::updateNfsShareAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateNfsShareRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\NfsShare;
use Google\Cloud\BareMetalSolution\V2\UpdateNfsShareRequest;
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 the request message.
    $nfsShare = new NfsShare();
    $request = (new UpdateNfsShareRequest())
        ->setNfsShare($nfsShare);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->updateNfsShare($request);
        $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());
    }
}

updateProvisioningConfig

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateProvisioningConfigRequest

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\BareMetalSolution\V2\ProvisioningConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\ProvisioningConfig;
use Google\Cloud\BareMetalSolution\V2\UpdateProvisioningConfigRequest;
use Google\Protobuf\FieldMask;

/**
 * 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_provisioning_config_sample(): void
{
    // Create a client.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

    // Prepare the request message.
    $provisioningConfig = new ProvisioningConfig();
    $updateMask = new FieldMask();
    $request = (new UpdateProvisioningConfigRequest())
        ->setProvisioningConfig($provisioningConfig)
        ->setUpdateMask($updateMask);

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

updateVolume

Update details of a single storage volume.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::updateVolumeAsync() .

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateVolumeRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
use Google\Cloud\BareMetalSolution\V2\UpdateVolumeRequest;
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 the request message.
    $volume = new Volume();
    $request = (new UpdateVolumeRequest())
        ->setVolume($volume);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $bareMetalSolutionClient->updateVolume($request);
        $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());
    }
}

getLocation

Gets information about a location.

The async variant is Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::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
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
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.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $bareMetalSolutionClient->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 Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient::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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient;
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.
    $bareMetalSolutionClient = new BareMetalSolutionClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $bareMetalSolutionClient->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());
    }
}

createNfsShareAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\CreateNfsShareRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createProvisioningConfigAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\CreateProvisioningConfigRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createSSHKeyAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\CreateSSHKeyRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createVolumeSnapshotAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\CreateVolumeSnapshotRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteNfsShareAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DeleteNfsShareRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteSSHKeyAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DeleteSSHKeyRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteVolumeSnapshotAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DeleteVolumeSnapshotRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

detachLunAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DetachLunRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

disableInteractiveSerialConsoleAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\DisableInteractiveSerialConsoleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

enableInteractiveSerialConsoleAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\EnableInteractiveSerialConsoleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

evictLunAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\EvictLunRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

evictVolumeAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\EvictVolumeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getInstanceAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getLunAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetLunRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getNetworkAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetNetworkRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getNfsShareAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetNfsShareRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getProvisioningConfigAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetProvisioningConfigRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getVolumeAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetVolumeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getVolumeSnapshotAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\GetVolumeSnapshotRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listInstancesAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListInstancesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listLunsAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListLunsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listNetworkUsageAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListNetworkUsageRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listNetworksAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListNetworksRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listNfsSharesAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListNfsSharesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listOSImagesAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListOSImagesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listProvisioningQuotasAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListProvisioningQuotasRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listSSHKeysAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListSSHKeysRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listVolumeSnapshotsAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListVolumeSnapshotsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listVolumesAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ListVolumesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

renameInstanceAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RenameInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

renameNetworkAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RenameNetworkRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

renameNfsShareAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RenameNfsShareRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

renameVolumeAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RenameVolumeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

resetInstanceAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ResetInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

resizeVolumeAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\ResizeVolumeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

restoreVolumeSnapshotAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\RestoreVolumeSnapshotRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

startInstanceAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\StartInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

stopInstanceAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\StopInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

submitProvisioningConfigAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\SubmitProvisioningConfigRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateInstanceAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateNetworkAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateNetworkRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateNfsShareAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateNfsShareRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateProvisioningConfigAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateProvisioningConfigRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateVolumeAsync

Parameters
Name Description
request Google\Cloud\BareMetalSolution\V2\UpdateVolumeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getLocationAsync

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listLocationsAsync

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

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

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

Parameters
Name Description
project string
location string
instanceConfig string
Returns
Type Description
string The formatted instance_config resource.

static::interconnectAttachmentName

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

Parameters
Name Description
project string
region string
interconnectAttachment string
Returns
Type Description
string The formatted interconnect_attachment 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::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.

static::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.

static::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.

static::networkConfigName

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

Parameters
Name Description
project string
location string
networkConfig string
Returns
Type Description
string The formatted network_config resource.

static::provisioningConfigName

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

Parameters
Name Description
project string
location string
provisioningConfig string
Returns
Type Description
string The formatted provisioning_config resource.

static::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.

static::sshKeyName

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

Parameters
Name Description
project string
location string
sshKey string
Returns
Type Description
string The formatted ssh_key resource.

static::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.

static::volumeConfigName

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

Parameters
Name Description
project string
location string
volumeConfig string
Returns
Type Description
string The formatted volume_config resource.

static::volumeSnapshotName

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

Parameters
Name Description
project string
location string
volume string
snapshot string
Returns
Type Description
string The formatted volume_snapshot 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

  • instance: projects/{project}/locations/{location}/instances/{instance}
  • instanceConfig: projects/{project}/locations/{location}/instanceConfigs/{instance_config}
  • interconnectAttachment: projects/{project}/regions/{region}/interconnectAttachments/{interconnect_attachment}
  • 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}
  • networkConfig: projects/{project}/locations/{location}/networkConfigs/{network_config}
  • provisioningConfig: projects/{project}/locations/{location}/provisioningConfigs/{provisioning_config}
  • serverNetworkTemplate: projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}
  • sshKey: projects/{project}/locations/{location}/sshKeys/{ssh_key}
  • volume: projects/{project}/locations/{location}/volumes/{volume}
  • volumeConfig: projects/{project}/locations/{location}/volumeConfigs/{volume_config}
  • volumeSnapshot: projects/{project}/locations/{location}/volumes/{volume}/snapshots/{snapshot}

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.