Google Cloud Dms V1 Client - Class DataMigrationServiceClient (1.5.3)

Reference documentation and code samples for the Google Cloud Dms V1 Client class DataMigrationServiceClient.

Service Description: Database Migration service

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

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

Namespace

Google \ Cloud \ CloudDms \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

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

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

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

↳ credentialsConfig array

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

↳ disableRetries bool

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

↳ clientConfig string|array

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

↳ transport string|TransportInterface

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

↳ transportConfig array

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

↳ clientCertSource callable

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

applyConversionWorkspace

Applies draft tree onto a specific destination database.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::applyConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ApplyConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ApplyConversionWorkspaceRequest;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the conversion workspace resource for which to apply
 *                              the draft tree. Must be in the form of:
 *                              projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}. Please see
 *                              {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function apply_conversion_workspace_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var ConversionWorkspace $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    apply_conversion_workspace_sample($formattedName);
}

commitConversionWorkspace

Marks all the data in the conversion workspace as committed.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::commitConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CommitConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\CommitConversionWorkspaceRequest;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the conversion workspace resource to commit. Please see
 *                              {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function commit_conversion_workspace_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var ConversionWorkspace $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    commit_conversion_workspace_sample($formattedName);
}

convertConversionWorkspace

Creates a draft tree schema for the destination database.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::convertConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ConvertConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\ConvertConversionWorkspaceRequest;
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 convert_conversion_workspace_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

createConnectionProfile

Creates a new connection profile in a given project and location.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::createConnectionProfileAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreateConnectionProfileRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConnectionProfile;
use Google\Cloud\CloudDms\V1\CreateConnectionProfileRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent     The parent which owns this collection of connection profiles. Please see
 *                                    {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 * @param string $connectionProfileId The connection profile identifier.
 */
function create_connection_profile_sample(
    string $formattedParent,
    string $connectionProfileId
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $connectionProfile = new ConnectionProfile();
    $request = (new CreateConnectionProfileRequest())
        ->setParent($formattedParent)
        ->setConnectionProfileId($connectionProfileId)
        ->setConnectionProfile($connectionProfile);

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

        if ($response->operationSucceeded()) {
            /** @var ConnectionProfile $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    create_connection_profile_sample($formattedParent, $connectionProfileId);
}

createConversionWorkspace

Creates a new conversion workspace in a given project and location.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::createConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreateConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\CreateConversionWorkspaceRequest;
use Google\Cloud\CloudDms\V1\DatabaseEngine;
use Google\Cloud\CloudDms\V1\DatabaseEngineInfo;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                       The parent which owns this collection of conversion workspaces. Please see
 *                                                      {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 * @param string $conversionWorkspaceId                 The ID of the conversion workspace to create.
 * @param int    $conversionWorkspaceSourceEngine       Engine type.
 * @param string $conversionWorkspaceSourceVersion      Engine named version, for example 12.c.1.
 * @param int    $conversionWorkspaceDestinationEngine  Engine type.
 * @param string $conversionWorkspaceDestinationVersion Engine named version, for example 12.c.1.
 */
function create_conversion_workspace_sample(
    string $formattedParent,
    string $conversionWorkspaceId,
    int $conversionWorkspaceSourceEngine,
    string $conversionWorkspaceSourceVersion,
    int $conversionWorkspaceDestinationEngine,
    string $conversionWorkspaceDestinationVersion
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $conversionWorkspaceSource = (new DatabaseEngineInfo())
        ->setEngine($conversionWorkspaceSourceEngine)
        ->setVersion($conversionWorkspaceSourceVersion);
    $conversionWorkspaceDestination = (new DatabaseEngineInfo())
        ->setEngine($conversionWorkspaceDestinationEngine)
        ->setVersion($conversionWorkspaceDestinationVersion);
    $conversionWorkspace = (new ConversionWorkspace())
        ->setSource($conversionWorkspaceSource)
        ->setDestination($conversionWorkspaceDestination);
    $request = (new CreateConversionWorkspaceRequest())
        ->setParent($formattedParent)
        ->setConversionWorkspaceId($conversionWorkspaceId)
        ->setConversionWorkspace($conversionWorkspace);

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

        if ($response->operationSucceeded()) {
            /** @var ConversionWorkspace $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    create_conversion_workspace_sample(
        $formattedParent,
        $conversionWorkspaceId,
        $conversionWorkspaceSourceEngine,
        $conversionWorkspaceSourceVersion,
        $conversionWorkspaceDestinationEngine,
        $conversionWorkspaceDestinationVersion
    );
}

createMappingRule

Creates a new mapping rule for a given conversion workspace.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::createMappingRuleAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreateMappingRuleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\MappingRule
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\CreateMappingRuleRequest;
use Google\Cloud\CloudDms\V1\DatabaseEntityType;
use Google\Cloud\CloudDms\V1\MappingRule;
use Google\Cloud\CloudDms\V1\MappingRuleFilter;

/**
 * @param string $formattedParent      The parent which owns this collection of mapping rules. Please see
 *                                     {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 * @param string $mappingRuleId        The ID of the rule to create.
 * @param int    $mappingRuleRuleScope The rule scope
 * @param int    $mappingRuleRuleOrder The order in which the rule is applied. Lower order rules are
 *                                     applied before higher value rules so they may end up being overridden.
 */
function create_mapping_rule_sample(
    string $formattedParent,
    string $mappingRuleId,
    int $mappingRuleRuleScope,
    int $mappingRuleRuleOrder
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $mappingRuleFilter = new MappingRuleFilter();
    $mappingRule = (new MappingRule())
        ->setRuleScope($mappingRuleRuleScope)
        ->setFilter($mappingRuleFilter)
        ->setRuleOrder($mappingRuleRuleOrder);
    $request = (new CreateMappingRuleRequest())
        ->setParent($formattedParent)
        ->setMappingRuleId($mappingRuleId)
        ->setMappingRule($mappingRule);

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

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

    create_mapping_rule_sample(
        $formattedParent,
        $mappingRuleId,
        $mappingRuleRuleScope,
        $mappingRuleRuleOrder
    );
}

createMigrationJob

Creates a new migration job in a given project and location.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::createMigrationJobAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreateMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\CreateMigrationJobRequest;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\MigrationJob\Type;
use Google\Rpc\Status;

/**
 * @param string $formattedParent         The parent which owns this collection of migration jobs. Please see
 *                                        {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 * @param string $migrationJobId          The ID of the instance to create.
 * @param int    $migrationJobType        The migration job type.
 * @param string $migrationJobSource      The resource name (URI) of the source connection profile.
 * @param string $migrationJobDestination The resource name (URI) of the destination connection profile.
 */
function create_migration_job_sample(
    string $formattedParent,
    string $migrationJobId,
    int $migrationJobType,
    string $migrationJobSource,
    string $migrationJobDestination
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $migrationJob = (new MigrationJob())
        ->setType($migrationJobType)
        ->setSource($migrationJobSource)
        ->setDestination($migrationJobDestination);
    $request = (new CreateMigrationJobRequest())
        ->setParent($formattedParent)
        ->setMigrationJobId($migrationJobId)
        ->setMigrationJob($migrationJob);

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

        if ($response->operationSucceeded()) {
            /** @var MigrationJob $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    create_migration_job_sample(
        $formattedParent,
        $migrationJobId,
        $migrationJobType,
        $migrationJobSource,
        $migrationJobDestination
    );
}

createPrivateConnection

Creates a new private connection in a given project and location.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::createPrivateConnectionAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreatePrivateConnectionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\CreatePrivateConnectionRequest;
use Google\Cloud\CloudDms\V1\PrivateConnection;
use Google\Rpc\Status;

/**
 * @param string $formattedParent     The parent that owns the collection of PrivateConnections. Please see
 *                                    {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 * @param string $privateConnectionId The private connection identifier.
 */
function create_private_connection_sample(
    string $formattedParent,
    string $privateConnectionId
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $privateConnection = new PrivateConnection();
    $request = (new CreatePrivateConnectionRequest())
        ->setParent($formattedParent)
        ->setPrivateConnectionId($privateConnectionId)
        ->setPrivateConnection($privateConnection);

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

        if ($response->operationSucceeded()) {
            /** @var PrivateConnection $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    create_private_connection_sample($formattedParent, $privateConnectionId);
}

deleteConnectionProfile

Deletes a single Database Migration Service connection profile.

A connection profile can only be deleted if it is not in use by any active migration jobs.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::deleteConnectionProfileAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeleteConnectionProfileRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DeleteConnectionProfileRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the connection profile resource to delete. Please see
 *                              {@see DataMigrationServiceClient::connectionProfileName()} for help formatting this field.
 */
function delete_connection_profile_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    delete_connection_profile_sample($formattedName);
}

deleteConversionWorkspace

Deletes a single conversion workspace.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::deleteConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeleteConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DeleteConversionWorkspaceRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the conversion workspace resource to delete. Please see
 *                              {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function delete_conversion_workspace_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    delete_conversion_workspace_sample($formattedName);
}

deleteMappingRule

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeleteMappingRuleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DeleteMappingRuleRequest;

/**
 * @param string $formattedName Name of the mapping rule resource to delete. Please see
 *                              {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function delete_mapping_rule_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

    delete_mapping_rule_sample($formattedName);
}

deleteMigrationJob

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeleteMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DeleteMigrationJobRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the migration job resource to delete. Please see
 *                              {@see DataMigrationServiceClient::migrationJobName()} for help formatting this field.
 */
function delete_migration_job_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    delete_migration_job_sample($formattedName);
}

deletePrivateConnection

Deletes a single Database Migration Service private connection.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::deletePrivateConnectionAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeletePrivateConnectionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DeletePrivateConnectionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the private connection to delete. Please see
 *                              {@see DataMigrationServiceClient::privateConnectionName()} for help formatting this field.
 */
function delete_private_connection_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    delete_private_connection_sample($formattedName);
}

describeConversionWorkspaceRevisions

Retrieves a list of committed revisions of a specific conversion workspace.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::describeConversionWorkspaceRevisionsAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DescribeConversionWorkspaceRevisionsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\DescribeConversionWorkspaceRevisionsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DescribeConversionWorkspaceRevisionsRequest;
use Google\Cloud\CloudDms\V1\DescribeConversionWorkspaceRevisionsResponse;

/**
 * @param string $formattedConversionWorkspace Name of the conversion workspace resource whose revisions are
 *                                             listed. Must be in the form of:
 *                                             projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}. Please see
 *                                             {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function describe_conversion_workspace_revisions_sample(
    string $formattedConversionWorkspace
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $request = (new DescribeConversionWorkspaceRevisionsRequest())
        ->setConversionWorkspace($formattedConversionWorkspace);

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

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

    describe_conversion_workspace_revisions_sample($formattedConversionWorkspace);
}

describeDatabaseEntities

Describes the database entities tree for a specific conversion workspace and a specific tree type.

Database entities are not resources like conversion workspaces or mapping rules, and they can't be created, updated or deleted. Instead, they are simple data objects describing the structure of the client database.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::describeDatabaseEntitiesAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DescribeDatabaseEntitiesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DatabaseEntity;
use Google\Cloud\CloudDms\V1\DescribeDatabaseEntitiesRequest;

/**
 * @param string $formattedConversionWorkspace Name of the conversion workspace resource whose database entities
 *                                             are described. Must be in the form of:
 *                                             projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}. Please see
 *                                             {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function describe_database_entities_sample(string $formattedConversionWorkspace): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $request = (new DescribeDatabaseEntitiesRequest())
        ->setConversionWorkspace($formattedConversionWorkspace);

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

        /** @var DatabaseEntity $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    describe_database_entities_sample($formattedConversionWorkspace);
}

fetchStaticIps

Fetches a set of static IP addresses that need to be allowlisted by the customer when using the static-IP connectivity method.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::fetchStaticIpsAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\FetchStaticIpsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\FetchStaticIpsRequest;

/**
 * @param string $formattedName The resource name for the location for which static IPs should be
 *                              returned. Must be in the format `projects/*/locations/*`. Please see
 *                              {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 */
function fetch_static_ips_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        /** @var string $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element);
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    fetch_static_ips_sample($formattedName);
}

generateSshScript

Generate a SSH configuration script to configure the reverse SSH connectivity.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::generateSshScriptAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GenerateSshScriptRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\SshScript
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\GenerateSshScriptRequest;
use Google\Cloud\CloudDms\V1\SshScript;

/**
 * @param string $vm Bastion VM Instance name to use or to create.
 */
function generate_ssh_script_sample(string $vm): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $request = (new GenerateSshScriptRequest())
        ->setVm($vm);

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

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

    generate_ssh_script_sample($vm);
}

generateTcpProxyScript

Generate a TCP Proxy configuration script to configure a cloud-hosted VM running a TCP Proxy.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::generateTcpProxyScriptAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GenerateTcpProxyScriptRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\TcpProxyScript
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\GenerateTcpProxyScriptRequest;
use Google\Cloud\CloudDms\V1\TcpProxyScript;

/**
 * @param string $vmName        The name of the Compute instance that will host the proxy.
 * @param string $vmMachineType The type of the Compute instance that will host the proxy.
 * @param string $vmSubnet      The name of the subnet the Compute instance will use for private
 *                              connectivity. Must be supplied in the form of
 *                              projects/{project}/regions/{region}/subnetworks/{subnetwork}.
 *                              Note: the region for the subnet must match the Compute instance region.
 */
function generate_tcp_proxy_script_sample(
    string $vmName,
    string $vmMachineType,
    string $vmSubnet
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $request = (new GenerateTcpProxyScriptRequest())
        ->setVmName($vmName)
        ->setVmMachineType($vmMachineType)
        ->setVmSubnet($vmSubnet);

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

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

    generate_tcp_proxy_script_sample($vmName, $vmMachineType, $vmSubnet);
}

getConnectionProfile

Gets details of a single connection profile.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::getConnectionProfileAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetConnectionProfileRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\ConnectionProfile
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConnectionProfile;
use Google\Cloud\CloudDms\V1\GetConnectionProfileRequest;

/**
 * @param string $formattedName Name of the connection profile resource to get. Please see
 *                              {@see DataMigrationServiceClient::connectionProfileName()} for help formatting this field.
 */
function get_connection_profile_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

    get_connection_profile_sample($formattedName);
}

getConversionWorkspace

Gets details of a single conversion workspace.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::getConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\ConversionWorkspace
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\GetConversionWorkspaceRequest;

/**
 * @param string $formattedName Name of the conversion workspace resource to get. Please see
 *                              {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function get_conversion_workspace_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

    get_conversion_workspace_sample($formattedName);
}

getMappingRule

Gets the details of a mapping rule.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::getMappingRuleAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetMappingRuleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\MappingRule
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\GetMappingRuleRequest;
use Google\Cloud\CloudDms\V1\MappingRule;

/**
 * @param string $formattedName Name of the mapping rule resource to get.
 *                              Example: conversionWorkspaces/123/mappingRules/rule123
 *
 *                              In order to retrieve a previous revision of the mapping rule, also provide
 *                              the revision ID.
 *                              Example:
 *                              conversionWorkspace/123/mappingRules/rule123@c7cfa2a8c7cfa2a8c7cfa2a8c7cfa2a8
 *                              Please see {@see DataMigrationServiceClient::mappingRuleName()} for help formatting this field.
 */
function get_mapping_rule_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

    get_mapping_rule_sample($formattedName);
}

getMigrationJob

Gets details of a single migration job.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::getMigrationJobAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\MigrationJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\GetMigrationJobRequest;
use Google\Cloud\CloudDms\V1\MigrationJob;

/**
 * @param string $formattedName Name of the migration job resource to get. Please see
 *                              {@see DataMigrationServiceClient::migrationJobName()} for help formatting this field.
 */
function get_migration_job_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

    get_migration_job_sample($formattedName);
}

getPrivateConnection

Gets details of a single private connection.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::getPrivateConnectionAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetPrivateConnectionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\PrivateConnection
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\GetPrivateConnectionRequest;
use Google\Cloud\CloudDms\V1\PrivateConnection;

/**
 * @param string $formattedName The name of the private connection to get. Please see
 *                              {@see DataMigrationServiceClient::privateConnectionName()} for help formatting this field.
 */
function get_private_connection_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

    get_private_connection_sample($formattedName);
}

importMappingRules

Imports the mapping rules for a given conversion workspace.

Supports various formats of external rules files.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::importMappingRulesAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ImportMappingRulesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\ImportMappingRulesRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Name of the conversion workspace resource to import the rules to
 *                                in the form of:
 *                                projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}. Please see
 *                                {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function import_mapping_rules_sample(string $formattedParent): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var ConversionWorkspace $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    import_mapping_rules_sample($formattedParent);
}

listConnectionProfiles

Retrieves a list of all connection profiles in a given project and location.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::listConnectionProfilesAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListConnectionProfilesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConnectionProfile;
use Google\Cloud\CloudDms\V1\ListConnectionProfilesRequest;

/**
 * @param string $formattedParent The parent which owns this collection of connection profiles. Please see
 *                                {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 */
function list_connection_profiles_sample(string $formattedParent): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        /** @var ConnectionProfile $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    list_connection_profiles_sample($formattedParent);
}

listConversionWorkspaces

Lists conversion workspaces in a given project and location.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::listConversionWorkspacesAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListConversionWorkspacesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\ListConversionWorkspacesRequest;

/**
 * @param string $formattedParent The parent which owns this collection of conversion workspaces. Please see
 *                                {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 */
function list_conversion_workspaces_sample(string $formattedParent): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        /** @var ConversionWorkspace $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    list_conversion_workspaces_sample($formattedParent);
}

listMappingRules

Lists the mapping rules for a specific conversion workspace.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::listMappingRulesAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListMappingRulesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ListMappingRulesRequest;
use Google\Cloud\CloudDms\V1\MappingRule;

/**
 * @param string $formattedParent Name of the conversion workspace resource whose mapping rules are
 *                                listed in the form of:
 *                                projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}. Please see
 *                                {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function list_mapping_rules_sample(string $formattedParent): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        /** @var MappingRule $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    list_mapping_rules_sample($formattedParent);
}

listMigrationJobs

Lists migration jobs in a given project and location.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::listMigrationJobsAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListMigrationJobsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ListMigrationJobsRequest;
use Google\Cloud\CloudDms\V1\MigrationJob;

/**
 * @param string $formattedParent The parent which owns this collection of migrationJobs. Please see
 *                                {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 */
function list_migration_jobs_sample(string $formattedParent): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        /** @var MigrationJob $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    list_migration_jobs_sample($formattedParent);
}

listPrivateConnections

Retrieves a list of private connections in a given project and location.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::listPrivateConnectionsAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListPrivateConnectionsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ListPrivateConnectionsRequest;
use Google\Cloud\CloudDms\V1\PrivateConnection;

/**
 * @param string $formattedParent The parent that owns the collection of private connections. Please see
 *                                {@see DataMigrationServiceClient::locationName()} for help formatting this field.
 */
function list_private_connections_sample(string $formattedParent): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        /** @var PrivateConnection $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    list_private_connections_sample($formattedParent);
}

promoteMigrationJob

Promote a migration job, stopping replication to the destination and promoting the destination to be a standalone database.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::promoteMigrationJobAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\PromoteMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\PromoteMigrationJobRequest;
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 promote_migration_job_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

restartMigrationJob

Restart a stopped or failed migration job, resetting the destination instance to its original state and starting the migration process from scratch.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::restartMigrationJobAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\RestartMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\RestartMigrationJobRequest;
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 restart_migration_job_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

resumeMigrationJob

Resume a migration job that is currently stopped and is resumable (was stopped during CDC phase).

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::resumeMigrationJobAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ResumeMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\ResumeMigrationJobRequest;
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 resume_migration_job_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

rollbackConversionWorkspace

Rolls back a conversion workspace to the last committed snapshot.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::rollbackConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\RollbackConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\RollbackConversionWorkspaceRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the conversion workspace resource to roll back to. Please see
 *                              {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function rollback_conversion_workspace_sample(string $formattedName): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var ConversionWorkspace $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    rollback_conversion_workspace_sample($formattedName);
}

searchBackgroundJobs

Searches/lists the background jobs for a specific conversion workspace.

The background jobs are not resources like conversion workspaces or mapping rules, and they can't be created, updated or deleted. Instead, they are a way to expose the data plane jobs log.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::searchBackgroundJobsAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\SearchBackgroundJobsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\CloudDms\V1\SearchBackgroundJobsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\SearchBackgroundJobsRequest;
use Google\Cloud\CloudDms\V1\SearchBackgroundJobsResponse;

/**
 * @param string $formattedConversionWorkspace Name of the conversion workspace resource whose jobs are listed,
 *                                             in the form of:
 *                                             projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}. Please see
 *                                             {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
 */
function search_background_jobs_sample(string $formattedConversionWorkspace): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $request = (new SearchBackgroundJobsRequest())
        ->setConversionWorkspace($formattedConversionWorkspace);

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

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

    search_background_jobs_sample($formattedConversionWorkspace);
}

seedConversionWorkspace

Imports a snapshot of the source database into the conversion workspace.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::seedConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\SeedConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\SeedConversionWorkspaceRequest;
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 seed_conversion_workspace_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

startMigrationJob

Start an already created migration job.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::startMigrationJobAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\StartMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\StartMigrationJobRequest;
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 start_migration_job_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

stopMigrationJob

Parameters
Name Description
request Google\Cloud\CloudDms\V1\StopMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\StopMigrationJobRequest;
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 stop_migration_job_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

updateConnectionProfile

Update the configuration of a single connection profile.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::updateConnectionProfileAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\UpdateConnectionProfileRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConnectionProfile;
use Google\Cloud\CloudDms\V1\UpdateConnectionProfileRequest;
use Google\Protobuf\FieldMask;
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_connection_profile_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $connectionProfile = new ConnectionProfile();
    $request = (new UpdateConnectionProfileRequest())
        ->setUpdateMask($updateMask)
        ->setConnectionProfile($connectionProfile);

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

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

updateConversionWorkspace

Updates the parameters of a single conversion workspace.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::updateConversionWorkspaceAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\UpdateConversionWorkspaceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DatabaseEngine;
use Google\Cloud\CloudDms\V1\DatabaseEngineInfo;
use Google\Cloud\CloudDms\V1\UpdateConversionWorkspaceRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param int    $conversionWorkspaceSourceEngine       Engine type.
 * @param string $conversionWorkspaceSourceVersion      Engine named version, for example 12.c.1.
 * @param int    $conversionWorkspaceDestinationEngine  Engine type.
 * @param string $conversionWorkspaceDestinationVersion Engine named version, for example 12.c.1.
 */
function update_conversion_workspace_sample(
    int $conversionWorkspaceSourceEngine,
    string $conversionWorkspaceSourceVersion,
    int $conversionWorkspaceDestinationEngine,
    string $conversionWorkspaceDestinationVersion
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $conversionWorkspaceSource = (new DatabaseEngineInfo())
        ->setEngine($conversionWorkspaceSourceEngine)
        ->setVersion($conversionWorkspaceSourceVersion);
    $conversionWorkspaceDestination = (new DatabaseEngineInfo())
        ->setEngine($conversionWorkspaceDestinationEngine)
        ->setVersion($conversionWorkspaceDestinationVersion);
    $conversionWorkspace = (new ConversionWorkspace())
        ->setSource($conversionWorkspaceSource)
        ->setDestination($conversionWorkspaceDestination);
    $request = (new UpdateConversionWorkspaceRequest())
        ->setUpdateMask($updateMask)
        ->setConversionWorkspace($conversionWorkspace);

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

        if ($response->operationSucceeded()) {
            /** @var ConversionWorkspace $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    update_conversion_workspace_sample(
        $conversionWorkspaceSourceEngine,
        $conversionWorkspaceSourceVersion,
        $conversionWorkspaceDestinationEngine,
        $conversionWorkspaceDestinationVersion
    );
}

updateMigrationJob

Updates the parameters of a single migration job.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::updateMigrationJobAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\UpdateMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\MigrationJob\Type;
use Google\Cloud\CloudDms\V1\UpdateMigrationJobRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param int    $migrationJobType        The migration job type.
 * @param string $migrationJobSource      The resource name (URI) of the source connection profile.
 * @param string $migrationJobDestination The resource name (URI) of the destination connection profile.
 */
function update_migration_job_sample(
    int $migrationJobType,
    string $migrationJobSource,
    string $migrationJobDestination
): void {
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $migrationJob = (new MigrationJob())
        ->setType($migrationJobType)
        ->setSource($migrationJobSource)
        ->setDestination($migrationJobDestination);
    $request = (new UpdateMigrationJobRequest())
        ->setUpdateMask($updateMask)
        ->setMigrationJob($migrationJob);

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

        if ($response->operationSucceeded()) {
            /** @var MigrationJob $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    update_migration_job_sample($migrationJobType, $migrationJobSource, $migrationJobDestination);
}

verifyMigrationJob

Verify a migration job, making sure the destination can reach the source and that all configuration and prerequisites are met.

The async variant is Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient::verifyMigrationJobAsync() .

Parameters
Name Description
request Google\Cloud\CloudDms\V1\VerifyMigrationJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\VerifyMigrationJobRequest;
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 verify_migration_job_sample(): void
{
    // Create a client.
    $dataMigrationServiceClient = new DataMigrationServiceClient();

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

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

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

applyConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ApplyConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

commitConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CommitConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

convertConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ConvertConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createConnectionProfileAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreateConnectionProfileRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreateConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createMappingRuleAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreateMappingRuleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreateMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createPrivateConnectionAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\CreatePrivateConnectionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteConnectionProfileAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeleteConnectionProfileRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeleteConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteMappingRuleAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeleteMappingRuleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeleteMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deletePrivateConnectionAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DeletePrivateConnectionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

describeConversionWorkspaceRevisionsAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DescribeConversionWorkspaceRevisionsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

describeDatabaseEntitiesAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\DescribeDatabaseEntitiesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

fetchStaticIpsAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\FetchStaticIpsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

generateSshScriptAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GenerateSshScriptRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

generateTcpProxyScriptAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GenerateTcpProxyScriptRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getConnectionProfileAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetConnectionProfileRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getMappingRuleAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetMappingRuleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getPrivateConnectionAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\GetPrivateConnectionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

importMappingRulesAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ImportMappingRulesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listConnectionProfilesAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListConnectionProfilesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listConversionWorkspacesAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListConversionWorkspacesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listMappingRulesAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListMappingRulesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listMigrationJobsAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListMigrationJobsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listPrivateConnectionsAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ListPrivateConnectionsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

promoteMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\PromoteMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

restartMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\RestartMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

resumeMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\ResumeMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

rollbackConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\RollbackConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

searchBackgroundJobsAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\SearchBackgroundJobsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

seedConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\SeedConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

startMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\StartMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

stopMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\StopMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateConnectionProfileAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\UpdateConnectionProfileRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateConversionWorkspaceAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\UpdateConversionWorkspaceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\UpdateMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

verifyMigrationJobAsync

Parameters
Name Description
request Google\Cloud\CloudDms\V1\VerifyMigrationJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

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

static::connectionProfileName

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

Parameters
Name Description
project string
location string
connectionProfile string
Returns
Type Description
string The formatted connection_profile resource.

static::conversionWorkspaceName

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

Parameters
Name Description
project string
location string
conversionWorkspace string
Returns
Type Description
string The formatted conversion_workspace resource.

static::locationName

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

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

static::mappingRuleName

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

Parameters
Name Description
project string
location string
conversionWorkspace string
mappingRule string
Returns
Type Description
string The formatted mapping_rule resource.

static::migrationJobName

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

Parameters
Name Description
project string
location string
migrationJob string
Returns
Type Description
string The formatted migration_job resource.

static::networksName

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

Parameters
Name Description
project string
network string
Returns
Type Description
string The formatted networks resource.

static::privateConnectionName

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

Parameters
Name Description
project string
location string
privateConnection string
Returns
Type Description
string The formatted private_connection resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • connectionProfile: projects/{project}/locations/{location}/connectionProfiles/{connection_profile}
  • conversionWorkspace: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}
  • location: projects/{project}/locations/{location}
  • mappingRule: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}/mappingRules/{mapping_rule}
  • migrationJob: projects/{project}/locations/{location}/migrationJobs/{migration_job}
  • networks: projects/{project}/global/networks/{network}
  • privateConnection: projects/{project}/locations/{location}/privateConnections/{private_connection}

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.