Google Cloud Vm Migration V1 Client - Class VmMigrationClient (0.5.2)

Reference documentation and code samples for the Google Cloud Vm Migration V1 Client class VmMigrationClient.

Service Description: VM Migration Service

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:

$vmMigrationClient = new VmMigrationClient();
try {
    $formattedGroup = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]');
    $operationResponse = $vmMigrationClient->addGroupMigration($formattedGroup);
    $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 = $vmMigrationClient->addGroupMigration($formattedGroup);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'addGroupMigration');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $vmMigrationClient->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\VMMigration\V1\Client\VmMigrationClient to use the new surface.

Namespace

Google \ Cloud \ VMMigration \ V1

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.

addGroupMigration

Adds a MigratingVm to a Group.

Parameters
NameDescription
group string

Required. The full path name of the Group to add to.

optionalArgs array

Optional.

↳ migratingVm string

The full path name of the MigratingVm to add.

↳ 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\VMMigration\V1\AddGroupMigrationRequest;
use Google\Cloud\VMMigration\V1\AddGroupMigrationResponse;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Rpc\Status;

/**
 * @param string $formattedGroup The full path name of the Group to add to. Please see
 *                               {@see VmMigrationClient::groupName()} for help formatting this field.
 */
function add_group_migration_sample(string $formattedGroup): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $request = (new AddGroupMigrationRequest())
        ->setGroup($formattedGroup);

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

        if ($response->operationSucceeded()) {
            /** @var AddGroupMigrationResponse $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
{
    $formattedGroup = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]');

    add_group_migration_sample($formattedGroup);
}

cancelCloneJob

Initiates the cancellation of a running clone job.

Parameters
NameDescription
name string

Required. The clone job id

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\VMMigration\V1\CancelCloneJobRequest;
use Google\Cloud\VMMigration\V1\CancelCloneJobResponse;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The clone job id
 *                              Please see {@see VmMigrationClient::cloneJobName()} for help formatting this field.
 */
function cancel_clone_job_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var CancelCloneJobResponse $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 = VmMigrationClient::cloneJobName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]',
        '[CLONE_JOB]'
    );

    cancel_clone_job_sample($formattedName);
}

cancelCutoverJob

Initiates the cancellation of a running cutover job.

Parameters
NameDescription
name string

Required. The cutover job id

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\VMMigration\V1\CancelCutoverJobRequest;
use Google\Cloud\VMMigration\V1\CancelCutoverJobResponse;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The cutover job id
 *                              Please see {@see VmMigrationClient::cutoverJobName()} for help formatting this field.
 */
function cancel_cutover_job_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var CancelCutoverJobResponse $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 = VmMigrationClient::cutoverJobName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]',
        '[CUTOVER_JOB]'
    );

    cancel_cutover_job_sample($formattedName);
}

createCloneJob

Initiates a Clone of a specific migrating VM.

Parameters
NameDescription
parent string

Required. The Clone's parent.

cloneJobId string

Required. The clone job identifier.

cloneJob Google\Cloud\VMMigration\V1\CloneJob

Required. The clone request body.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CloneJob;
use Google\Cloud\VMMigration\V1\CreateCloneJobRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The Clone's parent. Please see
 *                                {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 * @param string $cloneJobId      The clone job identifier.
 */
function create_clone_job_sample(string $formattedParent, string $cloneJobId): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $cloneJob = new CloneJob();
    $request = (new CreateCloneJobRequest())
        ->setParent($formattedParent)
        ->setCloneJobId($cloneJobId)
        ->setCloneJob($cloneJob);

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

        if ($response->operationSucceeded()) {
            /** @var CloneJob $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 = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );
    $cloneJobId = '[CLONE_JOB_ID]';

    create_clone_job_sample($formattedParent, $cloneJobId);
}

createCutoverJob

Initiates a Cutover of a specific migrating VM.

The returned LRO is completed when the cutover job resource is created and the job is initiated.

Parameters
NameDescription
parent string

Required. The Cutover's parent.

cutoverJobId string

Required. The cutover job identifier.

cutoverJob Google\Cloud\VMMigration\V1\CutoverJob

Required. The cutover request body.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CreateCutoverJobRequest;
use Google\Cloud\VMMigration\V1\CutoverJob;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The Cutover's parent. Please see
 *                                {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 * @param string $cutoverJobId    The cutover job identifier.
 */
function create_cutover_job_sample(string $formattedParent, string $cutoverJobId): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $cutoverJob = new CutoverJob();
    $request = (new CreateCutoverJobRequest())
        ->setParent($formattedParent)
        ->setCutoverJobId($cutoverJobId)
        ->setCutoverJob($cutoverJob);

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

        if ($response->operationSucceeded()) {
            /** @var CutoverJob $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 = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );
    $cutoverJobId = '[CUTOVER_JOB_ID]';

    create_cutover_job_sample($formattedParent, $cutoverJobId);
}

createDatacenterConnector

Creates a new DatacenterConnector in a given Source.

Parameters
NameDescription
parent string

Required. The DatacenterConnector's parent. Required. The Source in where the new DatacenterConnector will be created. For example: projects/my-project/locations/us-central1/sources/my-source

datacenterConnectorId string

Required. The datacenterConnector identifier.

datacenterConnector Google\Cloud\VMMigration\V1\DatacenterConnector

Required. The create request body.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CreateDatacenterConnectorRequest;
use Google\Cloud\VMMigration\V1\DatacenterConnector;
use Google\Rpc\Status;

/**
 * @param string $formattedParent       The DatacenterConnector's parent.
 *                                      The Source in where the new DatacenterConnector will be created.
 *                                      For example:
 *                                      `projects/my-project/locations/us-central1/sources/my-source`
 *                                      Please see {@see VmMigrationClient::sourceName()} for help formatting this field.
 * @param string $datacenterConnectorId The datacenterConnector identifier.
 */
function create_datacenter_connector_sample(
    string $formattedParent,
    string $datacenterConnectorId
): void {
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $datacenterConnector = new DatacenterConnector();
    $request = (new CreateDatacenterConnectorRequest())
        ->setParent($formattedParent)
        ->setDatacenterConnectorId($datacenterConnectorId)
        ->setDatacenterConnector($datacenterConnector);

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

        if ($response->operationSucceeded()) {
            /** @var DatacenterConnector $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 = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
    $datacenterConnectorId = '[DATACENTER_CONNECTOR_ID]';

    create_datacenter_connector_sample($formattedParent, $datacenterConnectorId);
}

createGroup

Creates a new Group in a given project and location.

Parameters
NameDescription
parent string

Required. The Group's parent.

groupId string

Required. The group identifier.

group Google\Cloud\VMMigration\V1\Group

Required. The create request body.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CreateGroupRequest;
use Google\Cloud\VMMigration\V1\Group;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The Group's parent. Please see
 *                                {@see VmMigrationClient::locationName()} for help formatting this field.
 * @param string $groupId         The group identifier.
 */
function create_group_sample(string $formattedParent, string $groupId): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $group = new Group();
    $request = (new CreateGroupRequest())
        ->setParent($formattedParent)
        ->setGroupId($groupId)
        ->setGroup($group);

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

        if ($response->operationSucceeded()) {
            /** @var Group $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 = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
    $groupId = '[GROUP_ID]';

    create_group_sample($formattedParent, $groupId);
}

createMigratingVm

Creates a new MigratingVm in a given Source.

Parameters
NameDescription
parent string

Required. The MigratingVm's parent.

migratingVmId string

Required. The migratingVm identifier.

migratingVm Google\Cloud\VMMigration\V1\MigratingVm

Required. The create request body.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CreateMigratingVmRequest;
use Google\Cloud\VMMigration\V1\MigratingVm;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The MigratingVm's parent. Please see
 *                                {@see VmMigrationClient::sourceName()} for help formatting this field.
 * @param string $migratingVmId   The migratingVm identifier.
 */
function create_migrating_vm_sample(string $formattedParent, string $migratingVmId): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $migratingVm = new MigratingVm();
    $request = (new CreateMigratingVmRequest())
        ->setParent($formattedParent)
        ->setMigratingVmId($migratingVmId)
        ->setMigratingVm($migratingVm);

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

        if ($response->operationSucceeded()) {
            /** @var MigratingVm $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 = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
    $migratingVmId = '[MIGRATING_VM_ID]';

    create_migrating_vm_sample($formattedParent, $migratingVmId);
}

createSource

Creates a new Source in a given project and location.

Parameters
NameDescription
parent string

Required. The Source's parent.

sourceId string

Required. The source identifier.

source Google\Cloud\VMMigration\V1\Source

Required. The create request body.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CreateSourceRequest;
use Google\Cloud\VMMigration\V1\Source;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The Source's parent. Please see
 *                                {@see VmMigrationClient::locationName()} for help formatting this field.
 * @param string $sourceId        The source identifier.
 */
function create_source_sample(string $formattedParent, string $sourceId): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $source = new Source();
    $request = (new CreateSourceRequest())
        ->setParent($formattedParent)
        ->setSourceId($sourceId)
        ->setSource($source);

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

        if ($response->operationSucceeded()) {
            /** @var Source $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 = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
    $sourceId = '[SOURCE_ID]';

    create_source_sample($formattedParent, $sourceId);
}

createTargetProject

Creates a new TargetProject in a given project.

NOTE: TargetProject is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parent string

Required. The TargetProject's parent.

targetProjectId string

Required. The target_project identifier.

targetProject Google\Cloud\VMMigration\V1\TargetProject

Required. The create request body.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CreateTargetProjectRequest;
use Google\Cloud\VMMigration\V1\TargetProject;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The TargetProject's parent. Please see
 *                                {@see VmMigrationClient::locationName()} for help formatting this field.
 * @param string $targetProjectId The target_project identifier.
 */
function create_target_project_sample(string $formattedParent, string $targetProjectId): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $targetProject = new TargetProject();
    $request = (new CreateTargetProjectRequest())
        ->setParent($formattedParent)
        ->setTargetProjectId($targetProjectId)
        ->setTargetProject($targetProject);

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

        if ($response->operationSucceeded()) {
            /** @var TargetProject $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 = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
    $targetProjectId = '[TARGET_PROJECT_ID]';

    create_target_project_sample($formattedParent, $targetProjectId);
}

createUtilizationReport

Creates a new UtilizationReport.

Parameters
NameDescription
parent string

Required. The Utilization Report's parent.

utilizationReport Google\Cloud\VMMigration\V1\UtilizationReport

Required. The report to create.

utilizationReportId string

Required. The ID to use for the report, which will become the final component of the reports's resource name.

This value maximum length is 63 characters, and valid characters are /[a-z][0-9]-/. It must start with an english letter and must not end with a hyphen.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CreateUtilizationReportRequest;
use Google\Cloud\VMMigration\V1\UtilizationReport;
use Google\Rpc\Status;

/**
 * @param string $formattedParent     The Utilization Report's parent. Please see
 *                                    {@see VmMigrationClient::sourceName()} for help formatting this field.
 * @param string $utilizationReportId The ID to use for the report, which will become the final
 *                                    component of the reports's resource name.
 *
 *                                    This value maximum length is 63 characters, and valid characters
 *                                    are /[a-z][0-9]-/. It must start with an english letter and must not
 *                                    end with a hyphen.
 */
function create_utilization_report_sample(
    string $formattedParent,
    string $utilizationReportId
): void {
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $utilizationReport = new UtilizationReport();
    $request = (new CreateUtilizationReportRequest())
        ->setParent($formattedParent)
        ->setUtilizationReport($utilizationReport)
        ->setUtilizationReportId($utilizationReportId);

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

        if ($response->operationSucceeded()) {
            /** @var UtilizationReport $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 = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
    $utilizationReportId = '[UTILIZATION_REPORT_ID]';

    create_utilization_report_sample($formattedParent, $utilizationReportId);
}

deleteDatacenterConnector

Deletes a single DatacenterConnector.

Parameters
NameDescription
name string

Required. The DatacenterConnector name.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\DeleteDatacenterConnectorRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The DatacenterConnector name. Please see
 *                              {@see VmMigrationClient::datacenterConnectorName()} for help formatting this field.
 */
function delete_datacenter_connector_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $vmMigrationClient->deleteDatacenterConnector($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 = VmMigrationClient::datacenterConnectorName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[DATACENTER_CONNECTOR]'
    );

    delete_datacenter_connector_sample($formattedName);
}

deleteGroup

Deletes a single Group.

Parameters
NameDescription
name string

Required. The Group name.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\DeleteGroupRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The Group name. Please see
 *                              {@see VmMigrationClient::groupName()} for help formatting this field.
 */
function delete_group_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $vmMigrationClient->deleteGroup($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 = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]');

    delete_group_sample($formattedName);
}

deleteMigratingVm

Deletes a single MigratingVm.

Parameters
NameDescription
name string

Required. The name of the MigratingVm.

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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\DeleteMigratingVmRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the MigratingVm. Please see
 *                              {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 */
function delete_migrating_vm_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $vmMigrationClient->deleteMigratingVm($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 = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );

    delete_migrating_vm_sample($formattedName);
}

deleteSource

Deletes a single Source.

Parameters
NameDescription
name string

Required. The Source name.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\DeleteSourceRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The Source name. Please see
 *                              {@see VmMigrationClient::sourceName()} for help formatting this field.
 */
function delete_source_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $vmMigrationClient->deleteSource($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 = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');

    delete_source_sample($formattedName);
}

deleteTargetProject

Deletes a single TargetProject.

NOTE: TargetProject is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
name string

Required. The TargetProject name.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\DeleteTargetProjectRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The TargetProject name. Please see
 *                              {@see VmMigrationClient::targetProjectName()} for help formatting this field.
 */
function delete_target_project_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $vmMigrationClient->deleteTargetProject($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 = VmMigrationClient::targetProjectName(
        '[PROJECT]',
        '[LOCATION]',
        '[TARGET_PROJECT]'
    );

    delete_target_project_sample($formattedName);
}

deleteUtilizationReport

Deletes a single Utilization Report.

Parameters
NameDescription
name string

Required. The Utilization Report name.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\DeleteUtilizationReportRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The Utilization Report name. Please see
 *                              {@see VmMigrationClient::utilizationReportName()} for help formatting this field.
 */
function delete_utilization_report_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $vmMigrationClient->deleteUtilizationReport($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 = VmMigrationClient::utilizationReportName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[UTILIZATION_REPORT]'
    );

    delete_utilization_report_sample($formattedName);
}

fetchInventory

List remote source's inventory of VMs.

The remote source is the onprem vCenter (remote in the sense it's not in Compute Engine). The inventory describes the list of existing VMs in that source. Note that this operation lists the VMs on the remote source, as opposed to listing the MigratingVms resources in the vmmigration service.

Parameters
NameDescription
source string

Required. The name of the Source.

optionalArgs array

Optional.

↳ forceRefresh bool

If this flag is set to true, the source will be queried instead of using cached results. Using this flag will make the call slower.

↳ 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\VMMigration\V1\FetchInventoryResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\FetchInventoryRequest;
use Google\Cloud\VMMigration\V1\FetchInventoryResponse;

/**
 * @param string $formattedSource The name of the Source. Please see
 *                                {@see VmMigrationClient::sourceName()} for help formatting this field.
 */
function fetch_inventory_sample(string $formattedSource): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $request = (new FetchInventoryRequest())
        ->setSource($formattedSource);

    // Call the API and handle any network failures.
    try {
        /** @var FetchInventoryResponse $response */
        $response = $vmMigrationClient->fetchInventory($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
{
    $formattedSource = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');

    fetch_inventory_sample($formattedSource);
}

finalizeMigration

Marks a migration as completed, deleting migration resources that are no longer being used. Only applicable after cutover is done.

Parameters
NameDescription
migratingVm string

Required. The name of the MigratingVm.

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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\FinalizeMigrationRequest;
use Google\Cloud\VMMigration\V1\FinalizeMigrationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedMigratingVm The name of the MigratingVm. Please see
 *                                     {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 */
function finalize_migration_sample(string $formattedMigratingVm): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $request = (new FinalizeMigrationRequest())
        ->setMigratingVm($formattedMigratingVm);

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

        if ($response->operationSucceeded()) {
            /** @var FinalizeMigrationResponse $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
{
    $formattedMigratingVm = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );

    finalize_migration_sample($formattedMigratingVm);
}

getCloneJob

Gets details of a single CloneJob.

Parameters
NameDescription
name string

Required. The name of the CloneJob.

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\VMMigration\V1\CloneJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CloneJob;
use Google\Cloud\VMMigration\V1\GetCloneJobRequest;

/**
 * @param string $formattedName The name of the CloneJob. Please see
 *                              {@see VmMigrationClient::cloneJobName()} for help formatting this field.
 */
function get_clone_job_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var CloneJob $response */
        $response = $vmMigrationClient->getCloneJob($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 = VmMigrationClient::cloneJobName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]',
        '[CLONE_JOB]'
    );

    get_clone_job_sample($formattedName);
}

getCutoverJob

Gets details of a single CutoverJob.

Parameters
NameDescription
name string

Required. The name of the CutoverJob.

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\VMMigration\V1\CutoverJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CutoverJob;
use Google\Cloud\VMMigration\V1\GetCutoverJobRequest;

/**
 * @param string $formattedName The name of the CutoverJob. Please see
 *                              {@see VmMigrationClient::cutoverJobName()} for help formatting this field.
 */
function get_cutover_job_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var CutoverJob $response */
        $response = $vmMigrationClient->getCutoverJob($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 = VmMigrationClient::cutoverJobName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]',
        '[CUTOVER_JOB]'
    );

    get_cutover_job_sample($formattedName);
}

getDatacenterConnector

Gets details of a single DatacenterConnector.

Parameters
NameDescription
name string

Required. The name of the DatacenterConnector.

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\VMMigration\V1\DatacenterConnector
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\DatacenterConnector;
use Google\Cloud\VMMigration\V1\GetDatacenterConnectorRequest;

/**
 * @param string $formattedName The name of the DatacenterConnector. Please see
 *                              {@see VmMigrationClient::datacenterConnectorName()} for help formatting this field.
 */
function get_datacenter_connector_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var DatacenterConnector $response */
        $response = $vmMigrationClient->getDatacenterConnector($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 = VmMigrationClient::datacenterConnectorName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[DATACENTER_CONNECTOR]'
    );

    get_datacenter_connector_sample($formattedName);
}

getGroup

Gets details of a single Group.

Parameters
NameDescription
name string

Required. The group name.

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\VMMigration\V1\Group
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\GetGroupRequest;
use Google\Cloud\VMMigration\V1\Group;

/**
 * @param string $formattedName The group name. Please see
 *                              {@see VmMigrationClient::groupName()} for help formatting this field.
 */
function get_group_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Group $response */
        $response = $vmMigrationClient->getGroup($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 = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]');

    get_group_sample($formattedName);
}

getMigratingVm

Gets details of a single MigratingVm.

Parameters
NameDescription
name string

Required. The name of the MigratingVm.

optionalArgs array

Optional.

↳ view int

Optional. The level of details of the migrating VM. For allowed values, use constants defined on Google\Cloud\VMMigration\V1\MigratingVmView

↳ 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\VMMigration\V1\MigratingVm
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\GetMigratingVmRequest;
use Google\Cloud\VMMigration\V1\MigratingVm;

/**
 * @param string $formattedName The name of the MigratingVm. Please see
 *                              {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 */
function get_migrating_vm_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var MigratingVm $response */
        $response = $vmMigrationClient->getMigratingVm($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 = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );

    get_migrating_vm_sample($formattedName);
}

getReplicationCycle

Gets details of a single ReplicationCycle.

Parameters
NameDescription
name string

Required. The name of the ReplicationCycle.

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\VMMigration\V1\ReplicationCycle
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\GetReplicationCycleRequest;
use Google\Cloud\VMMigration\V1\ReplicationCycle;

/**
 * @param string $formattedName The name of the ReplicationCycle. Please see
 *                              {@see VmMigrationClient::replicationCycleName()} for help formatting this field.
 */
function get_replication_cycle_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var ReplicationCycle $response */
        $response = $vmMigrationClient->getReplicationCycle($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 = VmMigrationClient::replicationCycleName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]',
        '[REPLICATION_CYCLE]'
    );

    get_replication_cycle_sample($formattedName);
}

getSource

Gets details of a single Source.

Parameters
NameDescription
name string

Required. The Source name.

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\VMMigration\V1\Source
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\GetSourceRequest;
use Google\Cloud\VMMigration\V1\Source;

/**
 * @param string $formattedName The Source name. Please see
 *                              {@see VmMigrationClient::sourceName()} for help formatting this field.
 */
function get_source_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Source $response */
        $response = $vmMigrationClient->getSource($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 = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');

    get_source_sample($formattedName);
}

getTargetProject

Gets details of a single TargetProject.

NOTE: TargetProject is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
name string

Required. The TargetProject name.

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\VMMigration\V1\TargetProject
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\GetTargetProjectRequest;
use Google\Cloud\VMMigration\V1\TargetProject;

/**
 * @param string $formattedName The TargetProject name. Please see
 *                              {@see VmMigrationClient::targetProjectName()} for help formatting this field.
 */
function get_target_project_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var TargetProject $response */
        $response = $vmMigrationClient->getTargetProject($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 = VmMigrationClient::targetProjectName(
        '[PROJECT]',
        '[LOCATION]',
        '[TARGET_PROJECT]'
    );

    get_target_project_sample($formattedName);
}

getUtilizationReport

Gets a single Utilization Report.

Parameters
NameDescription
name string

Required. The Utilization Report name.

optionalArgs array

Optional.

↳ view int

Optional. The level of details of the report. Defaults to FULL For allowed values, use constants defined on Google\Cloud\VMMigration\V1\UtilizationReportView

↳ 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\VMMigration\V1\UtilizationReport
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\GetUtilizationReportRequest;
use Google\Cloud\VMMigration\V1\UtilizationReport;

/**
 * @param string $formattedName The Utilization Report name. Please see
 *                              {@see VmMigrationClient::utilizationReportName()} for help formatting this field.
 */
function get_utilization_report_sample(string $formattedName): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var UtilizationReport $response */
        $response = $vmMigrationClient->getUtilizationReport($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 = VmMigrationClient::utilizationReportName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[UTILIZATION_REPORT]'
    );

    get_utilization_report_sample($formattedName);
}

listCloneJobs

Lists CloneJobs of a given migrating VM.

Parameters
NameDescription
parent string

Required. The parent, which owns this collection of source VMs.

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.

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.

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CloneJob;
use Google\Cloud\VMMigration\V1\ListCloneJobsRequest;

/**
 * @param string $formattedParent The parent, which owns this collection of source VMs. Please see
 *                                {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_clone_jobs_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

        /** @var CloneJob $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 = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );
    $pageToken = '[PAGE_TOKEN]';

    list_clone_jobs_sample($formattedParent, $pageToken);
}

listCutoverJobs

Lists CutoverJobs of a given migrating VM.

Parameters
NameDescription
parent string

Required. The parent, which owns this collection of migrating VMs.

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.

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.

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\CutoverJob;
use Google\Cloud\VMMigration\V1\ListCutoverJobsRequest;

/**
 * @param string $formattedParent The parent, which owns this collection of migrating VMs. Please see
 *                                {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_cutover_jobs_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

        /** @var CutoverJob $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 = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );
    $pageToken = '[PAGE_TOKEN]';

    list_cutover_jobs_sample($formattedParent, $pageToken);
}

listDatacenterConnectors

Lists DatacenterConnectors in a given Source.

Parameters
NameDescription
parent string

Required. The parent, which owns this collection of connectors.

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.

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.

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\DatacenterConnector;
use Google\Cloud\VMMigration\V1\ListDatacenterConnectorsRequest;

/**
 * @param string $formattedParent The parent, which owns this collection of connectors. Please see
 *                                {@see VmMigrationClient::sourceName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_datacenter_connectors_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

        /** @var DatacenterConnector $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 = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
    $pageToken = '[PAGE_TOKEN]';

    list_datacenter_connectors_sample($formattedParent, $pageToken);
}

listGroups

Lists Groups in a given project and location.

Parameters
NameDescription
parent string

Required. The parent, which owns this collection of groups.

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.

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.

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\Group;
use Google\Cloud\VMMigration\V1\ListGroupsRequest;

/**
 * @param string $formattedParent The parent, which owns this collection of groups. Please see
 *                                {@see VmMigrationClient::locationName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_groups_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

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

    list_groups_sample($formattedParent, $pageToken);
}

listMigratingVms

Lists MigratingVms in a given Source.

Parameters
NameDescription
parent string

Required. The parent, which owns this collection of MigratingVms.

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.

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.

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ view int

Optional. The level of details of each migrating VM. For allowed values, use constants defined on Google\Cloud\VMMigration\V1\MigratingVmView

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\ListMigratingVmsRequest;
use Google\Cloud\VMMigration\V1\MigratingVm;

/**
 * @param string $formattedParent The parent, which owns this collection of MigratingVms. Please see
 *                                {@see VmMigrationClient::sourceName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_migrating_vms_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

        /** @var MigratingVm $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 = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
    $pageToken = '[PAGE_TOKEN]';

    list_migrating_vms_sample($formattedParent, $pageToken);
}

listReplicationCycles

Lists ReplicationCycles in a given MigratingVM.

Parameters
NameDescription
parent string

Required. The parent, which owns this collection of ReplicationCycles.

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.

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.

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\ListReplicationCyclesRequest;
use Google\Cloud\VMMigration\V1\ReplicationCycle;

/**
 * @param string $formattedParent The parent, which owns this collection of ReplicationCycles. Please see
 *                                {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_replication_cycles_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

        /** @var ReplicationCycle $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 = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );
    $pageToken = '[PAGE_TOKEN]';

    list_replication_cycles_sample($formattedParent, $pageToken);
}

listSources

Lists Sources in a given project and location.

Parameters
NameDescription
parent string

Required. The parent, which owns this collection of sources.

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.

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.

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\ListSourcesRequest;
use Google\Cloud\VMMigration\V1\Source;

/**
 * @param string $formattedParent The parent, which owns this collection of sources. Please see
 *                                {@see VmMigrationClient::locationName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_sources_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

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

    list_sources_sample($formattedParent, $pageToken);
}

listTargetProjects

Lists TargetProjects in a given project.

NOTE: TargetProject is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parent string

Required. The parent, which owns this collection of targets.

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.

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.

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\ListTargetProjectsRequest;
use Google\Cloud\VMMigration\V1\TargetProject;

/**
 * @param string $formattedParent The parent, which owns this collection of targets. Please see
 *                                {@see VmMigrationClient::locationName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_target_projects_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

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

    list_target_projects_sample($formattedParent, $pageToken);
}

listUtilizationReports

Lists Utilization Reports of the given Source.

Parameters
NameDescription
parent string

Required. The Utilization Reports parent.

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.

optionalArgs array

Optional.

↳ view int

Optional. The level of details of each report. Defaults to BASIC. For allowed values, use constants defined on Google\Cloud\VMMigration\V1\UtilizationReportView

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

↳ filter string

Optional. The filter request.

↳ orderBy string

Optional. the order by fields for the result.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\ListUtilizationReportsRequest;
use Google\Cloud\VMMigration\V1\UtilizationReport;

/**
 * @param string $formattedParent The Utilization Reports parent. Please see
 *                                {@see VmMigrationClient::sourceName()} for help formatting this field.
 * @param string $pageToken       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.
 */
function list_utilization_reports_sample(string $formattedParent, string $pageToken): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

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

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

        /** @var UtilizationReport $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 = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
    $pageToken = '[PAGE_TOKEN]';

    list_utilization_reports_sample($formattedParent, $pageToken);
}

pauseMigration

Pauses a migration for a VM. If cycle tasks are running they will be cancelled, preserving source task data. Further replication cycles will not be triggered while the VM is paused.

Parameters
NameDescription
migratingVm string

Required. The name of the MigratingVm.

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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\PauseMigrationRequest;
use Google\Cloud\VMMigration\V1\PauseMigrationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedMigratingVm The name of the MigratingVm. Please see
 *                                     {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 */
function pause_migration_sample(string $formattedMigratingVm): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $request = (new PauseMigrationRequest())
        ->setMigratingVm($formattedMigratingVm);

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

        if ($response->operationSucceeded()) {
            /** @var PauseMigrationResponse $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
{
    $formattedMigratingVm = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );

    pause_migration_sample($formattedMigratingVm);
}

removeGroupMigration

Removes a MigratingVm from a Group.

Parameters
NameDescription
group string

Required. The name of the Group.

optionalArgs array

Optional.

↳ migratingVm string

The MigratingVm to remove.

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\RemoveGroupMigrationRequest;
use Google\Cloud\VMMigration\V1\RemoveGroupMigrationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedGroup The name of the Group. Please see
 *                               {@see VmMigrationClient::groupName()} for help formatting this field.
 */
function remove_group_migration_sample(string $formattedGroup): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $request = (new RemoveGroupMigrationRequest())
        ->setGroup($formattedGroup);

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

        if ($response->operationSucceeded()) {
            /** @var RemoveGroupMigrationResponse $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
{
    $formattedGroup = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]');

    remove_group_migration_sample($formattedGroup);
}

resumeMigration

Resumes a migration for a VM. When called on a paused migration, will start the process of uploading data and creating snapshots; when called on a completed cut-over migration, will update the migration to active state and start the process of uploading data and creating snapshots.

Parameters
NameDescription
migratingVm string

Required. The name of the MigratingVm.

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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\ResumeMigrationRequest;
use Google\Cloud\VMMigration\V1\ResumeMigrationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedMigratingVm The name of the MigratingVm. Please see
 *                                     {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 */
function resume_migration_sample(string $formattedMigratingVm): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $request = (new ResumeMigrationRequest())
        ->setMigratingVm($formattedMigratingVm);

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

        if ($response->operationSucceeded()) {
            /** @var ResumeMigrationResponse $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
{
    $formattedMigratingVm = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );

    resume_migration_sample($formattedMigratingVm);
}

startMigration

Starts migration for a VM. Starts the process of uploading data and creating snapshots, in replication cycles scheduled by the policy.

Parameters
NameDescription
migratingVm string

Required. The name of the MigratingVm.

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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\StartMigrationRequest;
use Google\Cloud\VMMigration\V1\StartMigrationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedMigratingVm The name of the MigratingVm. Please see
 *                                     {@see VmMigrationClient::migratingVmName()} for help formatting this field.
 */
function start_migration_sample(string $formattedMigratingVm): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $request = (new StartMigrationRequest())
        ->setMigratingVm($formattedMigratingVm);

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

        if ($response->operationSucceeded()) {
            /** @var StartMigrationResponse $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
{
    $formattedMigratingVm = VmMigrationClient::migratingVmName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[MIGRATING_VM]'
    );

    start_migration_sample($formattedMigratingVm);
}

updateGroup

Updates the parameters of a single Group.

Parameters
NameDescription
group Google\Cloud\VMMigration\V1\Group

Required. The update request body.

optionalArgs array

Optional.

↳ updateMask FieldMask

Field mask is used to specify the fields to be overwritten in the Group resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\Group;
use Google\Cloud\VMMigration\V1\UpdateGroupRequest;
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_group_sample(): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $group = new Group();
    $request = (new UpdateGroupRequest())
        ->setGroup($group);

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

        if ($response->operationSucceeded()) {
            /** @var Group $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());
    }
}

updateMigratingVm

Updates the parameters of a single MigratingVm.

Parameters
NameDescription
migratingVm Google\Cloud\VMMigration\V1\MigratingVm

Required. The update request body.

optionalArgs array

Optional.

↳ updateMask FieldMask

Field mask is used to specify the fields to be overwritten in the MigratingVm resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\MigratingVm;
use Google\Cloud\VMMigration\V1\UpdateMigratingVmRequest;
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_migrating_vm_sample(): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $migratingVm = new MigratingVm();
    $request = (new UpdateMigratingVmRequest())
        ->setMigratingVm($migratingVm);

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

        if ($response->operationSucceeded()) {
            /** @var MigratingVm $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());
    }
}

updateSource

Updates the parameters of a single Source.

Parameters
NameDescription
source Google\Cloud\VMMigration\V1\Source

Required. The update request body.

optionalArgs array

Optional.

↳ updateMask FieldMask

Field mask is used to specify the fields to be overwritten in the Source resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\Source;
use Google\Cloud\VMMigration\V1\UpdateSourceRequest;
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_source_sample(): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $source = new Source();
    $request = (new UpdateSourceRequest())
        ->setSource($source);

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

        if ($response->operationSucceeded()) {
            /** @var Source $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());
    }
}

updateTargetProject

Updates the parameters of a single TargetProject.

NOTE: TargetProject is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
targetProject Google\Cloud\VMMigration\V1\TargetProject

Required. The update request body.

optionalArgs array

Optional.

↳ updateMask FieldMask

Field mask is used to specify the fields to be overwritten in the TargetProject resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\TargetProject;
use Google\Cloud\VMMigration\V1\UpdateTargetProjectRequest;
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_target_project_sample(): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $targetProject = new TargetProject();
    $request = (new UpdateTargetProjectRequest())
        ->setTargetProject($targetProject);

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

        if ($response->operationSucceeded()) {
            /** @var TargetProject $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());
    }
}

upgradeAppliance

Upgrades the appliance relate to this DatacenterConnector to the in-place updateable version.

Parameters
NameDescription
datacenterConnector string

Required. The DatacenterConnector name.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\VMMigration\V1\Client\VmMigrationClient;
use Google\Cloud\VMMigration\V1\UpgradeApplianceRequest;
use Google\Cloud\VMMigration\V1\UpgradeApplianceResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedDatacenterConnector The DatacenterConnector name. Please see
 *                                             {@see VmMigrationClient::datacenterConnectorName()} for help formatting this field.
 */
function upgrade_appliance_sample(string $formattedDatacenterConnector): void
{
    // Create a client.
    $vmMigrationClient = new VmMigrationClient();

    // Prepare the request message.
    $request = (new UpgradeApplianceRequest())
        ->setDatacenterConnector($formattedDatacenterConnector);

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

        if ($response->operationSucceeded()) {
            /** @var UpgradeApplianceResponse $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
{
    $formattedDatacenterConnector = VmMigrationClient::datacenterConnectorName(
        '[PROJECT]',
        '[LOCATION]',
        '[SOURCE]',
        '[DATACENTER_CONNECTOR]'
    );

    upgrade_appliance_sample($formattedDatacenterConnector);
}

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\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;

/**
 * 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.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $vmMigrationClient->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\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\VMMigration\V1\Client\VmMigrationClient;

/**
 * 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.
    $vmMigrationClient = new VmMigrationClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $vmMigrationClient->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::cloneJobName

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

Parameters
NameDescription
project string
location string
source string
migratingVm string
cloneJob string
Returns
TypeDescription
stringThe formatted clone_job resource.

static::cutoverJobName

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

Parameters
NameDescription
project string
location string
source string
migratingVm string
cutoverJob string
Returns
TypeDescription
stringThe formatted cutover_job resource.

static::datacenterConnectorName

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

Parameters
NameDescription
project string
location string
source string
datacenterConnector string
Returns
TypeDescription
stringThe formatted datacenter_connector resource.

static::groupName

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

Parameters
NameDescription
project string
location string
group string
Returns
TypeDescription
stringThe formatted group 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::migratingVmName

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

Parameters
NameDescription
project string
location string
source string
migratingVm string
Returns
TypeDescription
stringThe formatted migrating_vm resource.

static::replicationCycleName

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

Parameters
NameDescription
project string
location string
source string
migratingVm string
replicationCycle string
Returns
TypeDescription
stringThe formatted replication_cycle resource.

static::sourceName

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

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

static::targetProjectName

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

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

static::utilizationReportName

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

Parameters
NameDescription
project string
location string
source string
utilizationReport string
Returns
TypeDescription
stringThe formatted utilization_report 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

  • cloneJob: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job}
  • cutoverJob: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job}
  • datacenterConnector: projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector}
  • group: projects/{project}/locations/{location}/groups/{group}
  • location: projects/{project}/locations/{location}
  • migratingVm: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}
  • replicationCycle: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle}
  • source: projects/{project}/locations/{location}/sources/{source}
  • targetProject: projects/{project}/locations/{location}/targetProjects/{target_project}
  • utilizationReport: projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report}

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.vmmigration.v1.VmMigration'

The name of the service.

SERVICE_ADDRESS

Value: 'vmmigration.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.