Reference documentation and code samples for the Google Cloud Vm Migration V1 Client class VmMigrationClient.
Service Description: VM Migration Service
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
$vmMigrationClient = new VmMigrationClient();
try {
$formattedGroup = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]');
$operationResponse = $vmMigrationClient->addGroupMigration($formattedGroup);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $vmMigrationClient->addGroupMigration($formattedGroup);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'addGroupMigration');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$vmMigrationClient->close();
}
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Methods
cloneJobName
Formats a string containing the fully-qualified path to represent a clone_job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
source |
string
|
migratingVm |
string
|
cloneJob |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted clone_job resource. |
cutoverJobName
Formats a string containing the fully-qualified path to represent a cutover_job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
source |
string
|
migratingVm |
string
|
cutoverJob |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted cutover_job resource. |
datacenterConnectorName
Formats a string containing the fully-qualified path to represent a datacenter_connector resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
source |
string
|
datacenterConnector |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted datacenter_connector resource. |
groupName
Formats a string containing the fully-qualified path to represent a group resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
group |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted group resource. |
locationName
Formats a string containing the fully-qualified path to represent a location resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location resource. |
migratingVmName
Formats a string containing the fully-qualified path to represent a migrating_vm resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
source |
string
|
migratingVm |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted migrating_vm resource. |
sourceName
Formats a string containing the fully-qualified path to represent a source resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
source |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted source resource. |
targetProjectName
Formats a string containing the fully-qualified path to represent a target_project resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
targetProject |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted target_project resource. |
utilizationReportName
Formats a string containing the fully-qualified path to represent a utilization_report resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
source |
string
|
utilizationReport |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted utilization_report resource. |
parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- 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}
- source: projects/{project}/locations/{location}/sources/{source}
- targetProject: projects/{project}/locations/{location}/targetProjects/{target_project}
- utilizationReport: projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array | An associative array from name component IDs to component values. |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\OperationsClient |
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
addGroupMigration
Adds a MigratingVm to a Group.
Parameters | |
---|---|
Name | Description |
group |
string
Required. The full path name of the Group to add to. |
optionalArgs |
array
Optional. |
↳ migratingVm |
string
The full path name of the MigratingVm to add. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\AddGroupMigrationResponse;
use Google\Cloud\VMMigration\V1\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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->addGroupMigration($formattedGroup);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedGroup = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]');
add_group_migration_sample($formattedGroup);
}
cancelCloneJob
Initiates the cancellation of a running clone job.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The clone job id |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\CancelCloneJobResponse;
use Google\Cloud\VMMigration\V1\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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->cancelCloneJob($formattedName);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::cloneJobName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]',
'[CLONE_JOB]'
);
cancel_clone_job_sample($formattedName);
}
cancelCutoverJob
Initiates the cancellation of a running cutover job.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The cutover job id |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\CancelCutoverJobResponse;
use Google\Cloud\VMMigration\V1\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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->cancelCutoverJob($formattedName);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::cutoverJobName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]',
'[CUTOVER_JOB]'
);
cancel_cutover_job_sample($formattedName);
}
createCloneJob
Initiates a Clone of a specific migrating VM.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The Clone's parent. |
cloneJobId |
string
Required. The clone job identifier. |
cloneJob |
Google\Cloud\VMMigration\V1\CloneJob
Required. The clone request body. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\CloneJob;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$cloneJob = new CloneJob();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
$cloneJobId = '[CLONE_JOB_ID]';
create_clone_job_sample($formattedParent, $cloneJobId);
}
createCutoverJob
Initiates a Cutover of a specific migrating VM.
The returned LRO is completed when the cutover job resource is created and the job is initiated.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The Cutover's parent. |
cutoverJobId |
string
Required. The cutover job identifier. |
cutoverJob |
Google\Cloud\VMMigration\V1\CutoverJob
Required. The cutover request body. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\CutoverJob;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$cutoverJob = new CutoverJob();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
$cutoverJobId = '[CUTOVER_JOB_ID]';
create_cutover_job_sample($formattedParent, $cutoverJobId);
}
createDatacenterConnector
Creates a new DatacenterConnector in a given Source.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The DatacenterConnector's parent.
Required. The Source in where the new DatacenterConnector will be created.
For example:
|
datacenterConnectorId |
string
Required. The datacenterConnector identifier. |
datacenterConnector |
Google\Cloud\VMMigration\V1\DatacenterConnector
Required. The create request body. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\DatacenterConnector;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$datacenterConnector = new DatacenterConnector();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->createDatacenterConnector(
$formattedParent,
$datacenterConnectorId,
$datacenterConnector
);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
$datacenterConnectorId = '[DATACENTER_CONNECTOR_ID]';
create_datacenter_connector_sample($formattedParent, $datacenterConnectorId);
}
createGroup
Creates a new Group in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The Group's parent. |
groupId |
string
Required. The group identifier. |
group |
Google\Cloud\VMMigration\V1\Group
Required. The create request body. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\Group;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$group = new Group();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->createGroup($formattedParent, $groupId, $group);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
$groupId = '[GROUP_ID]';
create_group_sample($formattedParent, $groupId);
}
createMigratingVm
Creates a new MigratingVm in a given Source.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The MigratingVm's parent. |
migratingVmId |
string
Required. The migratingVm identifier. |
migratingVm |
Google\Cloud\VMMigration\V1\MigratingVm
Required. The create request body. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\MigratingVm;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$migratingVm = new MigratingVm();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
$migratingVmId = '[MIGRATING_VM_ID]';
create_migrating_vm_sample($formattedParent, $migratingVmId);
}
createSource
Creates a new Source in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The Source's parent. |
sourceId |
string
Required. The source identifier. |
source |
Google\Cloud\VMMigration\V1\Source
Required. The create request body. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\Source;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$source = new Source();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->createSource($formattedParent, $sourceId, $source);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
$sourceId = '[SOURCE_ID]';
create_source_sample($formattedParent, $sourceId);
}
createTargetProject
Creates a new TargetProject in a given project.
NOTE: TargetProject is a global resource; hence the only supported value
for location is global
.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The TargetProject's parent. |
targetProjectId |
string
Required. The target_project identifier. |
targetProject |
Google\Cloud\VMMigration\V1\TargetProject
Required. The create request body. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\TargetProject;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$targetProject = new TargetProject();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->createTargetProject(
$formattedParent,
$targetProjectId,
$targetProject
);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
$targetProjectId = '[TARGET_PROJECT_ID]';
create_target_project_sample($formattedParent, $targetProjectId);
}
createUtilizationReport
Creates a new UtilizationReport.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The Utilization Report's parent. |
utilizationReport |
Google\Cloud\VMMigration\V1\UtilizationReport
Required. The report to create. |
utilizationReportId |
string
Required. The ID to use for the report, which will become the final component of the reports's resource name. This value maximum length is 63 characters, and valid characters are /[a-z][0-9]-/. It must start with an english letter and must not end with a hyphen. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\UtilizationReport;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$utilizationReport = new UtilizationReport();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->createUtilizationReport(
$formattedParent,
$utilizationReport,
$utilizationReportId
);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
$utilizationReportId = '[UTILIZATION_REPORT_ID]';
create_utilization_report_sample($formattedParent, $utilizationReportId);
}
deleteDatacenterConnector
Deletes a single DatacenterConnector.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The DatacenterConnector name. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->deleteDatacenterConnector($formattedName);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::datacenterConnectorName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[DATACENTER_CONNECTOR]'
);
delete_datacenter_connector_sample($formattedName);
}
deleteGroup
Deletes a single Group.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The Group name. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->deleteGroup($formattedName);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]');
delete_group_sample($formattedName);
}
deleteMigratingVm
Deletes a single MigratingVm.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the MigratingVm. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->deleteMigratingVm($formattedName);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
delete_migrating_vm_sample($formattedName);
}
deleteSource
Deletes a single Source.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The Source name. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->deleteSource($formattedName);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
delete_source_sample($formattedName);
}
deleteTargetProject
Deletes a single TargetProject.
NOTE: TargetProject is a global resource; hence the only supported value
for location is global
.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The TargetProject name. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->deleteTargetProject($formattedName);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::targetProjectName(
'[PROJECT]',
'[LOCATION]',
'[TARGET_PROJECT]'
);
delete_target_project_sample($formattedName);
}
deleteUtilizationReport
Deletes a single Utilization Report.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The Utilization Report name. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->deleteUtilizationReport($formattedName);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::utilizationReportName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[UTILIZATION_REPORT]'
);
delete_utilization_report_sample($formattedName);
}
fetchInventory
List remote source's inventory of VMs.
The remote source is the onprem vCenter (remote in the sense it's not in Compute Engine). The inventory describes the list of existing VMs in that source. Note that this operation lists the VMs on the remote source, as opposed to listing the MigratingVms resources in the vmmigration service.
Parameters | |
---|---|
Name | Description |
source |
string
Required. The name of the Source. |
optionalArgs |
array
Optional. |
↳ forceRefresh |
bool
If this flag is set to true, the source will be queried instead of using cached results. Using this flag will make the call slower. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\FetchInventoryResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\FetchInventoryResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var FetchInventoryResponse $response */
$response = $vmMigrationClient->fetchInventory($formattedSource);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSource = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
fetch_inventory_sample($formattedSource);
}
finalizeMigration
Marks a migration as completed, deleting migration resources that are no longer being used. Only applicable after cutover is done.
Parameters | |
---|---|
Name | Description |
migratingVm |
string
Required. The name of the MigratingVm. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\FinalizeMigrationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->finalizeMigration($formattedMigratingVm);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedMigratingVm = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
finalize_migration_sample($formattedMigratingVm);
}
getCloneJob
Gets details of a single CloneJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the CloneJob. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\CloneJob |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\CloneJob;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var CloneJob $response */
$response = $vmMigrationClient->getCloneJob($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::cloneJobName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]',
'[CLONE_JOB]'
);
get_clone_job_sample($formattedName);
}
getCutoverJob
Gets details of a single CutoverJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the CutoverJob. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\CutoverJob |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\CutoverJob;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var CutoverJob $response */
$response = $vmMigrationClient->getCutoverJob($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::cutoverJobName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]',
'[CUTOVER_JOB]'
);
get_cutover_job_sample($formattedName);
}
getDatacenterConnector
Gets details of a single DatacenterConnector.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the DatacenterConnector. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\DatacenterConnector |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\DatacenterConnector;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var DatacenterConnector $response */
$response = $vmMigrationClient->getDatacenterConnector($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::datacenterConnectorName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[DATACENTER_CONNECTOR]'
);
get_datacenter_connector_sample($formattedName);
}
getGroup
Gets details of a single Group.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The group name. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\Group |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Group;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var Group $response */
$response = $vmMigrationClient->getGroup($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]');
get_group_sample($formattedName);
}
getMigratingVm
Gets details of a single MigratingVm.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the MigratingVm. |
optionalArgs |
array
Optional. |
↳ view |
int
Optional. The level of details of the migrating VM. For allowed values, use constants defined on Google\Cloud\VMMigration\V1\MigratingVmView |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\MigratingVm |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\MigratingVm;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var MigratingVm $response */
$response = $vmMigrationClient->getMigratingVm($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
get_migrating_vm_sample($formattedName);
}
getSource
Gets details of a single Source.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The Source name. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\Source |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\Source;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var Source $response */
$response = $vmMigrationClient->getSource($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
get_source_sample($formattedName);
}
getTargetProject
Gets details of a single TargetProject.
NOTE: TargetProject is a global resource; hence the only supported value
for location is global
.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The TargetProject name. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\TargetProject |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\TargetProject;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var TargetProject $response */
$response = $vmMigrationClient->getTargetProject($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::targetProjectName(
'[PROJECT]',
'[LOCATION]',
'[TARGET_PROJECT]'
);
get_target_project_sample($formattedName);
}
getUtilizationReport
Gets a single Utilization Report.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The Utilization Report name. |
optionalArgs |
array
Optional. |
↳ view |
int
Optional. The level of details of the report. Defaults to FULL For allowed values, use constants defined on Google\Cloud\VMMigration\V1\UtilizationReportView |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\VMMigration\V1\UtilizationReport |
use Google\ApiCore\ApiException;
use Google\Cloud\VMMigration\V1\UtilizationReport;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var UtilizationReport $response */
$response = $vmMigrationClient->getUtilizationReport($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VmMigrationClient::utilizationReportName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[UTILIZATION_REPORT]'
);
get_utilization_report_sample($formattedName);
}
listCloneJobs
Lists CloneJobs of a given migrating VM.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent, which owns this collection of source VMs. |
pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ filter |
string
Optional. The filter request. |
↳ orderBy |
string
Optional. the order by fields for the result. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VMMigration\V1\CloneJob;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $vmMigrationClient->listCloneJobs($formattedParent, $pageToken);
/** @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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
$pageToken = '[PAGE_TOKEN]';
list_clone_jobs_sample($formattedParent, $pageToken);
}
listCutoverJobs
Lists CutoverJobs of a given migrating VM.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent, which owns this collection of migrating VMs. |
pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ filter |
string
Optional. The filter request. |
↳ orderBy |
string
Optional. the order by fields for the result. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VMMigration\V1\CutoverJob;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $vmMigrationClient->listCutoverJobs($formattedParent, $pageToken);
/** @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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
$pageToken = '[PAGE_TOKEN]';
list_cutover_jobs_sample($formattedParent, $pageToken);
}
listDatacenterConnectors
Lists DatacenterConnectors in a given Source.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent, which owns this collection of connectors. |
pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ filter |
string
Optional. The filter request. |
↳ orderBy |
string
Optional. the order by fields for the result. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VMMigration\V1\DatacenterConnector;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $vmMigrationClient->listDatacenterConnectors($formattedParent, $pageToken);
/** @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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
$pageToken = '[PAGE_TOKEN]';
list_datacenter_connectors_sample($formattedParent, $pageToken);
}
listGroups
Lists Groups in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent, which owns this collection of groups. |
pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ filter |
string
Optional. The filter request. |
↳ orderBy |
string
Optional. the order by fields for the result. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VMMigration\V1\Group;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $vmMigrationClient->listGroups($formattedParent, $pageToken);
/** @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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
$pageToken = '[PAGE_TOKEN]';
list_groups_sample($formattedParent, $pageToken);
}
listMigratingVms
Lists MigratingVms in a given Source.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent, which owns this collection of MigratingVms. |
pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ filter |
string
Optional. The filter request. |
↳ orderBy |
string
Optional. the order by fields for the result. |
↳ view |
int
Optional. The level of details of each migrating VM. For allowed values, use constants defined on Google\Cloud\VMMigration\V1\MigratingVmView |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VMMigration\V1\MigratingVm;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $vmMigrationClient->listMigratingVms($formattedParent, $pageToken);
/** @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());
}
}
/**
* 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);
}
listSources
Lists Sources in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent, which owns this collection of sources. |
pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ filter |
string
Optional. The filter request. |
↳ orderBy |
string
Optional. the order by fields for the result. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VMMigration\V1\Source;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $vmMigrationClient->listSources($formattedParent, $pageToken);
/** @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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
$pageToken = '[PAGE_TOKEN]';
list_sources_sample($formattedParent, $pageToken);
}
listTargetProjects
Lists TargetProjects in a given project.
NOTE: TargetProject is a global resource; hence the only supported value
for location is global
.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent, which owns this collection of targets. |
pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ filter |
string
Optional. The filter request. |
↳ orderBy |
string
Optional. the order by fields for the result. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VMMigration\V1\TargetProject;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $vmMigrationClient->listTargetProjects($formattedParent, $pageToken);
/** @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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]');
$pageToken = '[PAGE_TOKEN]';
list_target_projects_sample($formattedParent, $pageToken);
}
listUtilizationReports
Lists Utilization Reports of the given Source.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The Utilization Reports parent. |
pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
optionalArgs |
array
Optional. |
↳ view |
int
Optional. The level of details of each report. Defaults to BASIC. For allowed values, use constants defined on Google\Cloud\VMMigration\V1\UtilizationReportView |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ filter |
string
Optional. The filter request. |
↳ orderBy |
string
Optional. the order by fields for the result. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VMMigration\V1\UtilizationReport;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $vmMigrationClient->listUtilizationReports($formattedParent, $pageToken);
/** @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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]');
$pageToken = '[PAGE_TOKEN]';
list_utilization_reports_sample($formattedParent, $pageToken);
}
pauseMigration
Pauses a migration for a VM. If cycle tasks are running they will be cancelled, preserving source task data. Further replication cycles will not be triggered while the VM is paused.
Parameters | |
---|---|
Name | Description |
migratingVm |
string
Required. The name of the MigratingVm. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\PauseMigrationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->pauseMigration($formattedMigratingVm);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedMigratingVm = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
pause_migration_sample($formattedMigratingVm);
}
removeGroupMigration
Removes a MigratingVm from a Group.
Parameters | |
---|---|
Name | Description |
group |
string
Required. The name of the Group. |
optionalArgs |
array
Optional. |
↳ migratingVm |
string
The MigratingVm to remove. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\RemoveGroupMigrationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->removeGroupMigration($formattedGroup);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedGroup = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]');
remove_group_migration_sample($formattedGroup);
}
resumeMigration
Resumes a migration for a VM. When called on a paused migration, will start the process of uploading data and creating snapshots; when called on a completed cut-over migration, will update the migration to active state and start the process of uploading data and creating snapshots.
Parameters | |
---|---|
Name | Description |
migratingVm |
string
Required. The name of the MigratingVm. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\ResumeMigrationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->resumeMigration($formattedMigratingVm);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedMigratingVm = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
resume_migration_sample($formattedMigratingVm);
}
startMigration
Starts migration for a VM. Starts the process of uploading data and creating snapshots, in replication cycles scheduled by the policy.
Parameters | |
---|---|
Name | Description |
migratingVm |
string
Required. The name of the MigratingVm. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\StartMigrationResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->startMigration($formattedMigratingVm);
$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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedMigratingVm = VmMigrationClient::migratingVmName(
'[PROJECT]',
'[LOCATION]',
'[SOURCE]',
'[MIGRATING_VM]'
);
start_migration_sample($formattedMigratingVm);
}
updateGroup
Updates the parameters of a single Group.
Parameters | |
---|---|
Name | Description |
group |
Google\Cloud\VMMigration\V1\Group
Required. The update request body. |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Field mask is used to specify the fields to be overwritten in the Group resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\Group;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$group = new Group();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->updateGroup($group);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Group $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateMigratingVm
Updates the parameters of a single MigratingVm.
Parameters | |
---|---|
Name | Description |
migratingVm |
Google\Cloud\VMMigration\V1\MigratingVm
Required. The update request body. |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Field mask is used to specify the fields to be overwritten in the MigratingVm resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\MigratingVm;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$migratingVm = new MigratingVm();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->updateMigratingVm($migratingVm);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MigratingVm $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateSource
Updates the parameters of a single Source.
Parameters | |
---|---|
Name | Description |
source |
Google\Cloud\VMMigration\V1\Source
Required. The update request body. |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Field mask is used to specify the fields to be overwritten in the Source resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\Source;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$source = new Source();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->updateSource($source);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Source $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateTargetProject
Updates the parameters of a single TargetProject.
NOTE: TargetProject is a global resource; hence the only supported value
for location is global
.
Parameters | |
---|---|
Name | Description |
targetProject |
Google\Cloud\VMMigration\V1\TargetProject
Required. The update request body. |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Field mask is used to specify the fields to be overwritten in the TargetProject resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\TargetProject;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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 any non-scalar elements to be passed along with the request.
$targetProject = new TargetProject();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->updateTargetProject($targetProject);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var TargetProject $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
upgradeAppliance
Upgrades the appliance relate to this DatacenterConnector to the in-place updateable version.
Parameters | |
---|---|
Name | Description |
datacenterConnector |
string
Required. The DatacenterConnector name. |
optionalArgs |
array
Optional. |
↳ requestId |
string
A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and t he request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VMMigration\V1\UpgradeApplianceResponse;
use Google\Cloud\VMMigration\V1\VmMigrationClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $vmMigrationClient->upgradeAppliance($formattedDatacenterConnector);
$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());
}
}
/**
* 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);
}
Constants
SERVICE_NAME
Value: 'google.cloud.vmmigration.v1.VmMigration'
The name of the service.
SERVICE_ADDRESS
Value: 'vmmigration.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.