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

Reference documentation and code samples for the Google Cloud Bare Metal Solution V2 Client class BareMetalSolutionClient.

Service Description: Performs management operations on Bare Metal Solution servers.

The baremetalsolution.googleapis.com service provides management capabilities for Bare Metal Solution servers. To access the API methods, you must assign Bare Metal Solution IAM roles containing the desired permissions to your staff in your Google Cloud project. You must also enable the Bare Metal Solution API. Once enabled, the methods act upon specific servers in your Bare Metal Solution environment.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

$bareMetalSolutionClient = new BareMetalSolutionClient();
try {
    $formattedParent = $bareMetalSolutionClient->locationName('[PROJECT]', '[LOCATION]');
    $nfsShare = new NfsShare();
    $operationResponse = $bareMetalSolutionClient->createNfsShare($formattedParent, $nfsShare);
    $operationResponse->pollUntilComplete();
    if ($operationResponse->operationSucceeded()) {
        $result = $operationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $operationResponse->getError();
        // handleError($error)
    }
    // Alternatively:
    // start the operation, keep the operation name, and resume later
    $operationResponse = $bareMetalSolutionClient->createNfsShare($formattedParent, $nfsShare);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $bareMetalSolutionClient->resumeOperation($operationName, 'createNfsShare');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $bareMetalSolutionClient->close();
}

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

This service has a new (beta) implementation. See Google\Cloud\BareMetalSolution\V2\Client\BareMetalSolutionClient to use the new surface.

Namespace

Google \ Cloud \ BareMetalSolution \ V2

Methods

__construct

Constructor.

Parameters
NameDescription
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

Create an NFS share.

Parameters
NameDescription
parent string

Required. The parent project and location.

nfsShare Google\Cloud\BareMetalSolution\V2\NfsShare

Required. The NfsShare to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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

Create new ProvisioningConfig.

Parameters
NameDescription
parent string

Required. The parent project and location containing the ProvisioningConfig.

provisioningConfig Google\Cloud\BareMetalSolution\V2\ProvisioningConfig

Required. The ProvisioningConfig to create.

optionalArgs array

Optional.

↳ email string

Optional. Email provided to send a confirmation with provisioning config to.

↳ 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
TypeDescription
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.

Parameters
NameDescription
parent string

Required. The parent containing the SSH keys.

sshKey Google\Cloud\BareMetalSolution\V2\SSHKey

Required. The SSH key to register.

sshKeyId string

Required. 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}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. The volume to snapshot.

volumeSnapshot Google\Cloud\BareMetalSolution\V2\VolumeSnapshot

Required. The snapshot to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name of the NFS share to delete.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name of the SSH key to delete. Currently, the only valid value for the location is "global".

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

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.

Parameters
NameDescription
name string

Required. The name of the snapshot to delete.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

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

Detach LUN from Instance.

Parameters
NameDescription
instance string

Required. Name of the instance.

lun string

Required. Name of the Lun to detach.

optionalArgs array

Optional.

↳ skipReboot bool

If true, performs lun unmapping without instance reboot.

↳ 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
TypeDescription
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.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name of the lun.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name of the Volume.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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).

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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

Get ProvisioningConfig by name.

Parameters
NameDescription
name string

Required. Name of the ProvisioningConfig.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name of the snapshot.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. Parent value for ListInstancesRequest.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

List filter.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. Parent value for ListLunsRequest.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
location string

Required. Parent value (project and location).

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. Parent value for ListNetworksRequest.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

List filter.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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

List NFS shares.

Parameters
NameDescription
parent string

Required. Parent value for ListNfsSharesRequest.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

List filter.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. Parent value for ListProvisioningQuotasRequest.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. Parent value for ListProvisioningQuotasRequest.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. The parent containing the SSH keys. Currently, the only valid value for the location is "global".

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. Parent value for ListVolumesRequest.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ 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
TypeDescription
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.

Parameters
NameDescription
parent string

Required. Parent value for ListVolumesRequest.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

List filter.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name field is used to identify the instance. Format: projects/{project}/locations/{location}/instances/{instance}

newInstanceId string

Required. The new id of the instance.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name field is used to identify the network. Format: projects/{project}/locations/{location}/networks/{network}

newNetworkId string

Required. The new id of the network.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name field is used to identify the nfsshare. Format: projects/{project}/locations/{location}/nfsshares/{nfsshare}

newNfsshareId string

Required. The new id of the nfsshare.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. The name field is used to identify the volume. Format: projects/{project}/locations/{location}/volumes/{volume}

newVolumeId string

Required. The new id of the volume.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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

Emergency Volume resize.

Parameters
NameDescription
volume string

Required. Volume to resize.

optionalArgs array

Optional.

↳ sizeGib int

New Volume size, in GiB.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
volumeSnapshot string

Required. Name of the snapshot which will be used to restore its parent volume.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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

Stop a running server.

Parameters
NameDescription
name string

Required. Name of the resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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.

Parameters
NameDescription
parent string

Required. The parent project and location containing the ProvisioningConfig.

provisioningConfig Google\Cloud\BareMetalSolution\V2\ProvisioningConfig

Required. The ProvisioningConfig to create.

optionalArgs array

Optional.

↳ email string

Optional. Email provided to send a confirmation with provisioning config to.

↳ 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
TypeDescription
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.

Parameters
NameDescription
instance Google\Cloud\BareMetalSolution\V2\Instance

Required. The server to update.

The name field is used to identify the instance to update. Format: projects/{project}/locations/{location}/instances/{instance}

optionalArgs array

Optional.

↳ updateMask FieldMask

The list of fields to update. The currently supported fields are: labels hyperthreading_enabled os_image

↳ 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
TypeDescription
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.

Parameters
NameDescription
network Google\Cloud\BareMetalSolution\V2\Network

Required. The network to update.

The name field is used to identify the instance to update. Format: projects/{project}/locations/{location}/networks/{network}

optionalArgs array

Optional.

↳ updateMask FieldMask

The list of fields to update. The only currently supported fields are: labels, reservations, vrf.vlan_attachments

↳ 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
TypeDescription
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.

Parameters
NameDescription
nfsShare Google\Cloud\BareMetalSolution\V2\NfsShare

Required. The NFS share to update.

The name field is used to identify the NFS share to update. Format: projects/{project}/locations/{location}/nfsShares/{nfs_share}

optionalArgs array

Optional.

↳ updateMask FieldMask

The list of fields to update. The only currently supported fields are: labels allowed_clients

↳ 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
TypeDescription
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

Update existing ProvisioningConfig.

Parameters
NameDescription
provisioningConfig Google\Cloud\BareMetalSolution\V2\ProvisioningConfig

Required. The ProvisioningConfig to update.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to update.

optionalArgs array

Optional.

↳ email string

Optional. Email provided to send a confirmation with provisioning config to.

↳ 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
TypeDescription
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.

Parameters
NameDescription
volume Google\Cloud\BareMetalSolution\V2\Volume

Required. The volume to update.

The name field is used to identify the volume to update. Format: projects/{project}/locations/{location}/volumes/{volume}

optionalArgs array

Optional.

↳ updateMask FieldMask

The list of fields to update. The only currently supported fields are: 'labels'

↳ 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
TypeDescription
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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Resource name for the location.

↳ 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
TypeDescription
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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

The resource that owns the locations collection, if applicable.

↳ filter string

The standard list filter.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
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());
    }
}

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
TypeDescription
Google\ApiCore\LongRunning\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::instanceName

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

Parameters
NameDescription
project string
location string
instance string
Returns
TypeDescription
stringThe formatted instance resource.

static::instanceConfigName

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

Parameters
NameDescription
project string
location string
instanceConfig string
Returns
TypeDescription
stringThe formatted instance_config resource.

static::interconnectAttachmentName

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

Parameters
NameDescription
project string
region string
interconnectAttachment string
Returns
TypeDescription
stringThe formatted interconnect_attachment resource.

static::locationName

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

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

static::lunName

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

Parameters
NameDescription
project string
location string
volume string
lun string
Returns
TypeDescription
stringThe formatted lun resource.

static::nFSShareName

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

Parameters
NameDescription
project string
location string
nfsShare string
Returns
TypeDescription
stringThe formatted nfs_share resource.

static::networkName

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

Parameters
NameDescription
project string
location string
network string
Returns
TypeDescription
stringThe formatted network resource.

static::networkConfigName

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

Parameters
NameDescription
project string
location string
networkConfig string
Returns
TypeDescription
stringThe formatted network_config resource.

static::provisioningConfigName

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

Parameters
NameDescription
project string
location string
provisioningConfig string
Returns
TypeDescription
stringThe formatted provisioning_config resource.

static::serverNetworkTemplateName

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

Parameters
NameDescription
project string
location string
serverNetworkTemplate string
Returns
TypeDescription
stringThe formatted server_network_template resource.

static::sshKeyName

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

Parameters
NameDescription
project string
location string
sshKey string
Returns
TypeDescription
stringThe formatted ssh_key resource.

static::volumeName

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

Parameters
NameDescription
project string
location string
volume string
Returns
TypeDescription
stringThe formatted volume resource.

static::volumeConfigName

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

Parameters
NameDescription
project string
location string
volumeConfig string
Returns
TypeDescription
stringThe formatted volume_config resource.

static::volumeSnapshotName

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

Parameters
NameDescription
project string
location string
volume string
snapshot string
Returns
TypeDescription
stringThe 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
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

Constants

SERVICE_NAME

Value: 'google.cloud.baremetalsolution.v2.BareMetalSolution'

The name of the service.

SERVICE_ADDRESS

Value: 'baremetalsolution.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.