Google Cloud Dms V1 Client - Class DataMigrationServiceClient (1.4.2)

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. Sample code to get started:

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

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

This service has a new (beta) implementation. See Google\Cloud\CloudDms\V1\Client\DataMigrationServiceClient to use the new surface.

Namespace

Google \ Cloud \ CloudDms \ V1

Methods

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

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

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

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

↳ credentialsConfig array

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

↳ disableRetries bool

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

↳ clientConfig string|array

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

↳ transport string|TransportInterface

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

↳ transportConfig array

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

↳ clientCertSource callable

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

applyConversionWorkspace

Applies draft tree onto a specific destination database.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ filter string

Filter which entities to apply. Leaving this field empty will apply all of the entities. Supports Google AIP 160 based filtering.

↳ dryRun bool

Optional. Only validates the apply process, but doesn't change the destination database. Only works for PostgreSQL destination connection profile.

↳ autoCommit bool

Optional. Specifies whether the conversion workspace is to be committed automatically after the apply.

↳ connectionProfile string

Optional. Fully qualified (Uri) name of the destination connection profile.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->applyConversionWorkspace($formattedName);
        $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.

Parameters
NameDescription
name string

Required. Name of the conversion workspace resource to commit.

optionalArgs array

Optional.

↳ commitName string

Optional. Optional name of the commit.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->commitConversionWorkspace($formattedName);
        $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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Name of the conversion workspace resource to convert in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.

↳ autoCommit bool

Optional. Specifies whether the conversion workspace is to be committed automatically after the conversion.

↳ filter string

Optional. Filter the entities to convert. Leaving this field empty will convert all of the entities. Supports Google AIP-160 style filtering.

↳ convertFullPath bool

Optional. Automatically convert the full entity path for each entity specified by the filter. For example, if the filter specifies a table, that table schema (and database if there is one) will also be converted.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->convertConversionWorkspace();
        $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.

Parameters
NameDescription
parent string

Required. The parent which owns this collection of connection profiles.

connectionProfileId string

Required. The connection profile identifier.

connectionProfile Google\Cloud\CloudDms\V1\ConnectionProfile

Required. The create request body including the connection profile data

optionalArgs array

Optional.

↳ requestId string

Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ validateOnly bool

Optional. Only validate the connection profile, but don't create any resources. The default is false. Only supported for Oracle connection profiles.

↳ skipValidation bool

Optional. Create the connection profile without validating it. The default is false. Only supported for Oracle connection profiles.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConnectionProfile;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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 any non-scalar elements to be passed along with the request.
    $connectionProfile = new ConnectionProfile();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->createConnectionProfile(
            $formattedParent,
            $connectionProfileId,
            $connectionProfile
        );
        $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.

Parameters
NameDescription
parent string

Required. The parent which owns this collection of conversion workspaces.

conversionWorkspaceId string

Required. The ID of the conversion workspace to create.

conversionWorkspace Google\Cloud\CloudDms\V1\ConversionWorkspace

Required. Represents a conversion workspace object.

optionalArgs array

Optional.

↳ requestId string

A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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 any non-scalar elements to be passed along with the request.
    $conversionWorkspaceSource = (new DatabaseEngineInfo())
        ->setEngine($conversionWorkspaceSourceEngine)
        ->setVersion($conversionWorkspaceSourceVersion);
    $conversionWorkspaceDestination = (new DatabaseEngineInfo())
        ->setEngine($conversionWorkspaceDestinationEngine)
        ->setVersion($conversionWorkspaceDestinationVersion);
    $conversionWorkspace = (new ConversionWorkspace())
        ->setSource($conversionWorkspaceSource)
        ->setDestination($conversionWorkspaceDestination);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->createConversionWorkspace(
            $formattedParent,
            $conversionWorkspaceId,
            $conversionWorkspace
        );
        $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.

Parameters
NameDescription
parent string

Required. The parent which owns this collection of mapping rules.

mappingRuleId string

Required. The ID of the rule to create.

mappingRule Google\Cloud\CloudDms\V1\MappingRule

Required. Represents a mapping rule object.

optionalArgs array

Optional.

↳ requestId string

A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\MappingRule
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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 any non-scalar elements to be passed along with the request.
    $mappingRuleFilter = new MappingRuleFilter();
    $mappingRule = (new MappingRule())
        ->setRuleScope($mappingRuleRuleScope)
        ->setFilter($mappingRuleFilter)
        ->setRuleOrder($mappingRuleRuleOrder);

    // Call the API and handle any network failures.
    try {
        /** @var MappingRule $response */
        $response = $dataMigrationServiceClient->createMappingRule(
            $formattedParent,
            $mappingRuleId,
            $mappingRule
        );
        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.

Parameters
NameDescription
parent string

Required. The parent which owns this collection of migration jobs.

migrationJobId string

Required. The ID of the instance to create.

migrationJob Google\Cloud\CloudDms\V1\MigrationJob

Required. Represents a migration job object.

optionalArgs array

Optional.

↳ requestId string

Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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 any non-scalar elements to be passed along with the request.
    $migrationJob = (new MigrationJob())
        ->setType($migrationJobType)
        ->setSource($migrationJobSource)
        ->setDestination($migrationJobDestination);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->createMigrationJob(
            $formattedParent,
            $migrationJobId,
            $migrationJob
        );
        $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.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of PrivateConnections.

privateConnectionId string

Required. The private connection identifier.

privateConnection Google\Cloud\CloudDms\V1\PrivateConnection

Required. The private connection resource to create.

optionalArgs array

Optional.

↳ requestId string

Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ skipValidation bool

Optional. If set to true, will skip validations.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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 any non-scalar elements to be passed along with the request.
    $privateConnection = new PrivateConnection();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->createPrivateConnection(
            $formattedParent,
            $privateConnectionId,
            $privateConnection
        );
        $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.

Parameters
NameDescription
name string

Required. Name of the connection profile resource to delete.

optionalArgs array

Optional.

↳ requestId string

A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ force bool

In case of force delete, the CloudSQL replica database is also deleted (only for CloudSQL connection profile).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

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

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

/**
 * 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.

Parameters
NameDescription
name string

Required. Name of the conversion workspace resource to delete.

optionalArgs array

Optional.

↳ requestId string

A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ force bool

Force delete the conversion workspace, even if there's a running migration that is using the workspace.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

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

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

/**
 * 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

Deletes a single mapping rule.

Parameters
NameDescription
name string

Required. Name of the mapping rule resource to delete.

optionalArgs array

Optional.

↳ requestId string

Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ 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\DataMigrationServiceClient;

/**
 * @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();

    // Call the API and handle any network failures.
    try {
        $dataMigrationServiceClient->deleteMappingRule($formattedName);
        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

Deletes a single migration job.

Parameters
NameDescription
name string

Required. Name of the migration job resource to delete.

optionalArgs array

Optional.

↳ requestId string

A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ force bool

The destination CloudSQL connection profile is always deleted with the migration job. In case of force delete, the destination CloudSQL replica database is also deleted.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

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

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

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the private connection to delete.

optionalArgs array

Optional.

↳ requestId string

Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

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

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

/**
 * 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.

Parameters
NameDescription
conversionWorkspace string

Required. Name of the conversion workspace resource whose revisions are listed. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.

optionalArgs array

Optional.

↳ commitId string

Optional. Optional filter to request a specific commit ID.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\DescribeConversionWorkspaceRevisionsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var DescribeConversionWorkspaceRevisionsResponse $response */
        $response = $dataMigrationServiceClient->describeConversionWorkspaceRevisions(
            $formattedConversionWorkspace
        );
        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.

Parameters
NameDescription
conversionWorkspace string

Required. Name of the conversion workspace resource whose database entities are described. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ tree int

Required. The tree to fetch. For allowed values, use constants defined on Google\Cloud\CloudDms\V1\DescribeDatabaseEntitiesRequest\DBTreeType

↳ uncommitted bool

Optional. Whether to retrieve the latest committed version of the entities or the latest version. This field is ignored if a specific commit_id is specified.

↳ commitId string

Optional. Request a specific commit ID. If not specified, the entities from the latest commit are returned.

↳ filter string

Optional. Filter the returned entities based on AIP-160 standard.

↳ view int

Optional. Results view based on AIP-157 For allowed values, use constants defined on Google\Cloud\CloudDms\V1\DatabaseEntityView

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DatabaseEntity;

/**
 * @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();

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

        /** @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.

Parameters
NameDescription
name string

Required. The resource name for the location for which static IPs should be returned. Must be in the format projects/*/locations/*.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;

/**
 * @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();

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

        /** @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.

Parameters
NameDescription
vm string

Required. Bastion VM Instance name to use or to create.

optionalArgs array

Optional.

↳ migrationJob string

Name of the migration job resource to generate the SSH script.

↳ vmCreationConfig VmCreationConfig

The VM creation configuration

↳ vmSelectionConfig VmSelectionConfig

The VM selection configuration

↳ vmPort int

The port that will be open on the bastion host.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\SshScript
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var SshScript $response */
        $response = $dataMigrationServiceClient->generateSshScript($vm);
        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.

Parameters
NameDescription
vmName string

Required. The name of the Compute instance that will host the proxy.

vmMachineType string

Required. The type of the Compute instance that will host the proxy.

vmSubnet string

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

optionalArgs array

Optional.

↳ migrationJob string

Name of the migration job resource to generate the TCP Proxy script.

↳ vmZone string

Optional. The Google Cloud Platform zone to create the VM in. The fully qualified name of the zone must be specified, including the region name, for example "us-central1-b". If not specified, uses the "-b" zone of the destination Connection Profile's region.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\TcpProxyScript
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var TcpProxyScript $response */
        $response = $dataMigrationServiceClient->generateTcpProxyScript($vmName, $vmMachineType, $vmSubnet);
        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.

Parameters
NameDescription
name string

Required. Name of the connection profile resource to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\ConnectionProfile
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\ConnectionProfile;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;

/**
 * @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();

    // Call the API and handle any network failures.
    try {
        /** @var ConnectionProfile $response */
        $response = $dataMigrationServiceClient->getConnectionProfile($formattedName);
        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.

Parameters
NameDescription
name string

Required. Name of the conversion workspace resource to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\ConversionWorkspace
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;

/**
 * @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();

    // Call the API and handle any network failures.
    try {
        /** @var ConversionWorkspace $response */
        $response = $dataMigrationServiceClient->getConversionWorkspace($formattedName);
        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.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\MappingRule
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var MappingRule $response */
        $response = $dataMigrationServiceClient->getMappingRule($formattedName);
        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.

Parameters
NameDescription
name string

Required. Name of the migration job resource to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\MigrationJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var MigrationJob $response */
        $response = $dataMigrationServiceClient->getMigrationJob($formattedName);
        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.

Parameters
NameDescription
name string

Required. The name of the private connection to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\PrivateConnection
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var PrivateConnection $response */
        $response = $dataMigrationServiceClient->getPrivateConnection($formattedName);
        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.

Parameters
NameDescription
parent string

Required. Name of the conversion workspace resource to import the rules to in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.

optionalArgs array

Optional.

↳ rulesFormat int

Required. The format of the rules content file. For allowed values, use constants defined on Google\Cloud\CloudDms\V1\ImportRulesFileFormat

↳ rulesFiles RulesFile[]

Required. One or more rules files.

↳ autoCommit bool

Required. Should the conversion workspace be committed automatically after the import operation.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->importMappingRules($formattedParent);
        $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.

Parameters
NameDescription
parent string

Required. The parent which owns this collection of connection profiles.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ filter string

A filter expression that filters connection profiles listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, list connection profiles created this year by specifying createTime %gt; 2020-01-01T00:00:00.000000000Z. You can also filter nested fields. For example, you could specify mySql.username = %lt;my_username%gt; to list all connection profiles configured to connect with a specific username.

↳ orderBy string

A comma-separated list of fields to order results according to.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\ConnectionProfile;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;

/**
 * @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();

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

        /** @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.

Parameters
NameDescription
parent string

Required. The parent which owns this collection of conversion workspaces.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ filter string

A filter expression that filters conversion workspaces listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, list conversion workspaces created this year by specifying createTime %gt; 2020-01-01T00:00:00.000000000Z. You can also filter nested fields. For example, you could specify source.version = "12.c.1" to select all conversion workspaces with source database version equal to 12.c.1.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;

/**
 * @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();

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

        /** @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.

Parameters
NameDescription
parent string

Required. Name of the conversion workspace resource whose mapping rules are listed in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

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

        /** @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.

Parameters
NameDescription
parent string

Required. The parent which owns this collection of migrationJobs.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ filter string

A filter expression that filters migration jobs listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, list migration jobs created this year by specifying createTime %gt; 2020-01-01T00:00:00.000000000Z. You can also filter nested fields. For example, you could specify reverseSshConnectivity.vmIp = "1.2.3.4" to select all migration jobs connecting through the specific SSH tunnel bastion.

↳ orderBy string

Sort the results based on the migration job name. Valid values are: "name", "name asc", and "name desc".

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

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

        /** @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.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of private connections.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ filter string

A filter expression that filters private connections listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, list private connections created this year by specifying createTime %gt; 2021-01-01T00:00:00.000000000Z.

↳ orderBy string

Order by fields for the result.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

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

        /** @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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Name of the migration job resource to promote.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->promoteMigrationJob();
        $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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Name of the migration job resource to restart.

↳ skipValidation bool

Optional. Restart the migration job without running prior configuration verification. Defaults to false.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->restartMigrationJob();
        $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).

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Name of the migration job resource to resume.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->resumeMigrationJob();
        $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.

Parameters
NameDescription
name string

Required. Name of the conversion workspace resource to roll back to.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->rollbackConversionWorkspace($formattedName);
        $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.

Parameters
NameDescription
conversionWorkspace string

Required. Name of the conversion workspace resource whose jobs are listed, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.

optionalArgs array

Optional.

↳ returnMostRecentPerJobType bool

Optional. Whether or not to return just the most recent job per job type,

↳ maxSize int

Optional. The maximum number of jobs to return. The service may return fewer than this value. If unspecified, at most 100 jobs are returned. The maximum value is 100; values above 100 are coerced to 100.

↳ completedUntilTime Timestamp

Optional. If provided, only returns jobs that completed until (not including) the given timestamp.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\CloudDms\V1\SearchBackgroundJobsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var SearchBackgroundJobsResponse $response */
        $response = $dataMigrationServiceClient->searchBackgroundJobs($formattedConversionWorkspace);
        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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Name of the conversion workspace resource to seed with new database structure, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.

↳ autoCommit bool

Should the conversion workspace be committed automatically after the seed operation.

↳ sourceConnectionProfile string

Optional. Fully qualified (Uri) name of the source connection profile.

↳ destinationConnectionProfile string

Optional. Fully qualified (Uri) name of the destination connection profile.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->seedConversionWorkspace();
        $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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Name of the migration job resource to start.

↳ skipValidation bool

Optional. Start the migration job without running prior configuration verification. Defaults to false.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->startMigrationJob();
        $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

Stops a running migration job.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Name of the migration job resource to stop.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->stopMigrationJob();
        $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.

Parameters
NameDescription
updateMask Google\Protobuf\FieldMask

Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.

connectionProfile Google\Cloud\CloudDms\V1\ConnectionProfile

Required. The connection profile parameters to update.

optionalArgs array

Optional.

↳ requestId string

Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ validateOnly bool

Optional. Only validate the connection profile, but don't update any resources. The default is false. Only supported for Oracle connection profiles.

↳ skipValidation bool

Optional. Update the connection profile without validating it. The default is false. Only supported for Oracle connection profiles.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConnectionProfile;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();
    $connectionProfile = new ConnectionProfile();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->updateConnectionProfile($updateMask, $connectionProfile);
        $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.

Parameters
NameDescription
updateMask Google\Protobuf\FieldMask

Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.

conversionWorkspace Google\Cloud\CloudDms\V1\ConversionWorkspace

Required. The conversion workspace parameters to update.

optionalArgs array

Optional.

↳ requestId string

A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DatabaseEngine;
use Google\Cloud\CloudDms\V1\DatabaseEngineInfo;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();
    $conversionWorkspaceSource = (new DatabaseEngineInfo())
        ->setEngine($conversionWorkspaceSourceEngine)
        ->setVersion($conversionWorkspaceSourceVersion);
    $conversionWorkspaceDestination = (new DatabaseEngineInfo())
        ->setEngine($conversionWorkspaceDestinationEngine)
        ->setVersion($conversionWorkspaceDestinationVersion);
    $conversionWorkspace = (new ConversionWorkspace())
        ->setSource($conversionWorkspaceSource)
        ->setDestination($conversionWorkspaceDestination);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->updateConversionWorkspace(
            $updateMask,
            $conversionWorkspace
        );
        $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.

Parameters
NameDescription
updateMask Google\Protobuf\FieldMask

Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.

migrationJob Google\Cloud\CloudDms\V1\MigrationJob

Required. The migration job parameters to update.

optionalArgs array

Optional.

↳ requestId string

A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
use Google\Cloud\CloudDms\V1\MigrationJob\Type;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();
    $migrationJob = (new MigrationJob())
        ->setType($migrationJobType)
        ->setSource($migrationJobSource)
        ->setDestination($migrationJobDestination);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->updateMigrationJob($updateMask, $migrationJob);
        $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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Name of the migration job resource to verify.

↳ updateMask FieldMask

Optional. Field mask is used to specify the changed fields to be verified. It will not update the migration job.

↳ migrationJob MigrationJob

Optional. The changed migration job parameters to verify. It will not update the migration job.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MigrationJob;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataMigrationServiceClient->verifyMigrationJob();
        $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());
    }
}

getOperationsClient

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

Returns
TypeDescription
Google\ApiCore\LongRunning\OperationsClient

resumeOperation

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

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::connectionProfileName

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

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

static::conversionWorkspaceName

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

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

static::locationName

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

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

static::mappingRuleName

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

Parameters
NameDescription
project string
location string
conversionWorkspace string
mappingRule string
Returns
TypeDescription
stringThe formatted mapping_rule resource.

static::migrationJobName

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

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

static::networksName

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

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

static::privateConnectionName

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

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

The formatted name string

template string

Optional name of template to match

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

Constants

SERVICE_NAME

Value: 'google.cloud.clouddms.v1.DataMigrationService'

The name of the service.

SERVICE_ADDRESS

Value: 'datamigration.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

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