Reference documentation and code samples for the Google Cloud Vm Migration V1 Client class VmMigrationClient.
Service Description: VM Migration Service
This class is currently experimental and may be subject to changes.
Namespace
Google \ Cloud \ VMMigration \ V1 \ ClientMethods
__construct
Constructor.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::addGroupMigrationAsync() .
request
Google\Cloud\VMMigration\V1\AddGroupMigrationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::cancelCloneJobAsync() .
request
Google\Cloud\VMMigration\V1\CancelCloneJobRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::cancelCutoverJobAsync() .
request
Google\Cloud\VMMigration\V1\CancelCutoverJobRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::createCloneJobAsync() .
request
Google\Cloud\VMMigration\V1\CreateCloneJobRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::createCutoverJobAsync() .
request
Google\Cloud\VMMigration\V1\CreateCutoverJobRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::createDatacenterConnectorAsync() .
request
Google\Cloud\VMMigration\V1\CreateDatacenterConnectorRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::createGroupAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::createMigratingVmAsync() .
request
Google\Cloud\VMMigration\V1\CreateMigratingVmRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::createSourceAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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
.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::createTargetProjectAsync() .
request
Google\Cloud\VMMigration\V1\CreateTargetProjectRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::createUtilizationReportAsync() .
request
Google\Cloud\VMMigration\V1\CreateUtilizationReportRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::deleteDatacenterConnectorAsync() .
request
Google\Cloud\VMMigration\V1\DeleteDatacenterConnectorRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::deleteGroupAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::deleteMigratingVmAsync() .
request
Google\Cloud\VMMigration\V1\DeleteMigratingVmRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::deleteSourceAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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
.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::deleteTargetProjectAsync() .
request
Google\Cloud\VMMigration\V1\DeleteTargetProjectRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::deleteUtilizationReportAsync() .
request
Google\Cloud\VMMigration\V1\DeleteUtilizationReportRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::fetchInventoryAsync() .
request
Google\Cloud\VMMigration\V1\FetchInventoryRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::finalizeMigrationAsync() .
request
Google\Cloud\VMMigration\V1\FinalizeMigrationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getCloneJobAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getCutoverJobAsync() .
request
Google\Cloud\VMMigration\V1\GetCutoverJobRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getDatacenterConnectorAsync() .
request
Google\Cloud\VMMigration\V1\GetDatacenterConnectorRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getGroupAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getMigratingVmAsync() .
request
Google\Cloud\VMMigration\V1\GetMigratingVmRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getReplicationCycleAsync() .
request
Google\Cloud\VMMigration\V1\GetReplicationCycleRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getSourceAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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
.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getTargetProjectAsync() .
request
Google\Cloud\VMMigration\V1\GetTargetProjectRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getUtilizationReportAsync() .
request
Google\Cloud\VMMigration\V1\GetUtilizationReportRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listCloneJobsAsync() .
request
Google\Cloud\VMMigration\V1\ListCloneJobsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listCutoverJobsAsync() .
request
Google\Cloud\VMMigration\V1\ListCutoverJobsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listDatacenterConnectorsAsync() .
request
Google\Cloud\VMMigration\V1\ListDatacenterConnectorsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listGroupsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listMigratingVmsAsync() .
request
Google\Cloud\VMMigration\V1\ListMigratingVmsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listReplicationCyclesAsync() .
request
Google\Cloud\VMMigration\V1\ListReplicationCyclesRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listSourcesAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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
.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listTargetProjectsAsync() .
request
Google\Cloud\VMMigration\V1\ListTargetProjectsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listUtilizationReportsAsync() .
request
Google\Cloud\VMMigration\V1\ListUtilizationReportsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::pauseMigrationAsync() .
request
Google\Cloud\VMMigration\V1\PauseMigrationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::removeGroupMigrationAsync() .
request
Google\Cloud\VMMigration\V1\RemoveGroupMigrationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::resumeMigrationAsync() .
request
Google\Cloud\VMMigration\V1\ResumeMigrationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::startMigrationAsync() .
request
Google\Cloud\VMMigration\V1\StartMigrationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::updateGroupAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::updateMigratingVmAsync() .
request
Google\Cloud\VMMigration\V1\UpdateMigratingVmRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::updateSourceAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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
.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::updateTargetProjectAsync() .
request
Google\Cloud\VMMigration\V1\UpdateTargetProjectRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::upgradeApplianceAsync() .
request
Google\Cloud\VMMigration\V1\UpgradeApplianceRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::getLocationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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.
The async variant is Google\Cloud\VMMigration\V1\Client\BaseClient\self::listLocationsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
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());
}
}
addGroupMigrationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
cancelCloneJobAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
cancelCutoverJobAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createCloneJobAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createCutoverJobAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createDatacenterConnectorAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createGroupAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createMigratingVmAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createSourceAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createTargetProjectAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createUtilizationReportAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteDatacenterConnectorAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteGroupAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteMigratingVmAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteSourceAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteTargetProjectAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteUtilizationReportAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
fetchInventoryAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
finalizeMigrationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getCloneJobAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getCutoverJobAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getDatacenterConnectorAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getGroupAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getMigratingVmAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getReplicationCycleAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getSourceAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getTargetProjectAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getUtilizationReportAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listCloneJobsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listCutoverJobsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listDatacenterConnectorsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listGroupsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listMigratingVmsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listReplicationCyclesAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listSourcesAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listTargetProjectsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listUtilizationReportsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
pauseMigrationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
removeGroupMigrationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
resumeMigrationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
startMigrationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateGroupAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateMigratingVmAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateSourceAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateTargetProjectAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
upgradeApplianceAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getLocationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listLocationsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
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.
operationName
string
The name of the long running operation
methodName
string
The name of the method used to start the operation
static::cloneJobName
Formats a string containing the fully-qualified path to represent a clone_job resource.
project
string
location
string
source
string
migratingVm
string
cloneJob
string
string
static::cutoverJobName
Formats a string containing the fully-qualified path to represent a cutover_job resource.
project
string
location
string
source
string
migratingVm
string
cutoverJob
string
string
static::datacenterConnectorName
Formats a string containing the fully-qualified path to represent a datacenter_connector resource.
project
string
location
string
source
string
datacenterConnector
string
string
static::groupName
Formats a string containing the fully-qualified path to represent a group resource.
project
string
location
string
group
string
string
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
project
string
location
string
string
static::migratingVmName
Formats a string containing the fully-qualified path to represent a migrating_vm resource.
project
string
location
string
source
string
migratingVm
string
string
static::replicationCycleName
Formats a string containing the fully-qualified path to represent a replication_cycle resource.
project
string
location
string
source
string
migratingVm
string
replicationCycle
string
string
static::sourceName
Formats a string containing the fully-qualified path to represent a source resource.
project
string
location
string
source
string
string
static::targetProjectName
Formats a string containing the fully-qualified path to represent a target_project resource.
project
string
location
string
targetProject
string
string
static::utilizationReportName
Formats a string containing the fully-qualified path to represent a utilization_report resource.
project
string
location
string
source
string
utilizationReport
string
string
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.
formattedName
string
The formatted name string
template
string
Optional name of template to match
array