Skip to main content

migration_jobs

Creates, updates, deletes, gets or lists a migration_jobs resource.

Overview

Namemigration_jobs
TypeResource
Idgoogle.datamigration.migration_jobs

Fields

NameDatatypeDescription
namestringThe name (URI) of this migration job resource, in the form of: projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
cmekKeyNamestringThe CMEK (customer-managed encryption key) fully qualified key name used for the migration job. This field supports all migration jobs types except for: Mysql to Mysql (use the cmek field in the cloudsql connection profile instead). PostrgeSQL to PostgreSQL (use the cmek field in the cloudsql connection profile instead). * PostgreSQL to AlloyDB (use the kms_key_name field in the alloydb connection profile instead). Each Cloud CMEK key has the following format: projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]
conversionWorkspaceobjectA conversion workspace's version.
createTimestringOutput only. The timestamp when the migration job resource was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
destinationstringRequired. The resource name (URI) of the destination connection profile.
destinationDatabaseobjectA message defining the database engine and provider.
displayNamestringThe migration job display name.
dumpFlagsobjectDump flags definition.
dumpPathstringThe path to the dump file in Google Cloud Storage, in the format: (gs://[BUCKET_NAME]/[OBJECT_NAME]). This field and the "dump_flags" field are mutually exclusive.
dumpTypestringOptional. The type of the data dump. Supported for MySQL to CloudSQL for MySQL migrations only.
durationstringOutput only. The duration of the migration job (in seconds). A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
endTimestringOutput only. If the migration job is completed, the time when it was completed.
errorobjectThe Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide.
filterstringThis field can be used to select the entities to migrate as part of the migration job. It uses AIP-160 notation to select a subset of the entities configured on the associated conversion-workspace. This field should not be set on migration-jobs that are not associated with a conversion workspace.
labelsobjectThe resource labels for migration job to use to annotate any related underlying resources such as Compute Engine VMs. An object containing a list of "key": "value" pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
performanceConfigobjectPerformance configuration definition.
phasestringOutput only. The current migration job phase.
reverseSshConnectivityobjectThe details needed to configure a reverse SSH tunnel between the source and destination databases. These details will be used when calling the generateSshScript method (see https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.migrationJobs/generateSshScript) to produce the script that will help set up the reverse SSH tunnel, and to set up the VPC peering between the Cloud SQL private network and the VPC.
sourcestringRequired. The resource name (URI) of the source connection profile.
sourceDatabaseobjectA message defining the database engine and provider.
sqlserverHomogeneousMigrationJobConfigobjectConfiguration for homogeneous migration to Cloud SQL for SQL Server.
statestringThe current migration job state.
staticIpConnectivityobjectThe source database will allow incoming connections from the public IP of the destination database. You can retrieve the public IP of the Cloud SQL instance from the Cloud SQL console or using Cloud SQL APIs. No additional configuration is required.
typestringRequired. The migration job type.
updateTimestringOutput only. The timestamp when the migration job resource was last updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
vpcPeeringConnectivityobjectThe details of the VPC where the source database is located in Google Cloud. We will use this information to set up the VPC peering connection between Cloud SQL and this VPC.

Methods

NameAccessible byRequired ParamsDescription
getSELECTlocationsId, migrationJobsId, projectsIdGets details of a single migration job.
listSELECTlocationsId, projectsIdLists migration jobs in a given project and location.
createINSERTlocationsId, projectsIdCreates a new migration job in a given project and location.
deleteDELETElocationsId, migrationJobsId, projectsIdDeletes a single migration job.
patchUPDATElocationsId, migrationJobsId, projectsIdUpdates the parameters of a single migration job.
demote_destinationEXEClocationsId, migrationJobsId, projectsIdDemotes the destination database to become a read replica of the source. This is applicable for the following migrations: 1. MySQL to Cloud SQL for MySQL 2. PostgreSQL to Cloud SQL for PostgreSQL 3. PostgreSQL to AlloyDB for PostgreSQL.
generate_ssh_scriptEXEClocationsId, migrationJobsId, projectsIdGenerate a SSH configuration script to configure the reverse SSH connectivity.
generate_tcp_proxy_scriptEXEClocationsId, migrationJobsId, projectsIdGenerate a TCP Proxy configuration script to configure a cloud-hosted VM running a TCP Proxy.
promoteEXEClocationsId, migrationJobsId, projectsIdPromote a migration job, stopping replication to the destination and promoting the destination to be a standalone database.
restartEXEClocationsId, migrationJobsId, projectsIdRestart a stopped or failed migration job, resetting the destination instance to its original state and starting the migration process from scratch.
resumeEXEClocationsId, migrationJobsId, projectsIdResume a migration job that is currently stopped and is resumable (was stopped during CDC phase).
startEXEClocationsId, migrationJobsId, projectsIdStart an already created migration job.
stopEXEClocationsId, migrationJobsId, projectsIdStops a running migration job.
verifyEXEClocationsId, migrationJobsId, projectsIdVerify a migration job, making sure the destination can reach the source and that all configuration and prerequisites are met.

SELECT examples

Lists migration jobs in a given project and location.

SELECT
name,
cmekKeyName,
conversionWorkspace,
createTime,
destination,
destinationDatabase,
displayName,
dumpFlags,
dumpPath,
dumpType,
duration,
endTime,
error,
filter,
labels,
performanceConfig,
phase,
reverseSshConnectivity,
source,
sourceDatabase,
sqlserverHomogeneousMigrationJobConfig,
state,
staticIpConnectivity,
type,
updateTime,
vpcPeeringConnectivity
FROM google.datamigration.migration_jobs
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new migration_jobs resource.

/*+ create */
INSERT INTO google.datamigration.migration_jobs (
locationsId,
projectsId,
name,
labels,
displayName,
state,
type,
dumpPath,
dumpFlags,
source,
destination,
reverseSshConnectivity,
vpcPeeringConnectivity,
staticIpConnectivity,
sourceDatabase,
destinationDatabase,
conversionWorkspace,
filter,
cmekKeyName,
performanceConfig,
sqlserverHomogeneousMigrationJobConfig,
dumpType
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ labels }}',
'{{ displayName }}',
'{{ state }}',
'{{ type }}',
'{{ dumpPath }}',
'{{ dumpFlags }}',
'{{ source }}',
'{{ destination }}',
'{{ reverseSshConnectivity }}',
'{{ vpcPeeringConnectivity }}',
'{{ staticIpConnectivity }}',
'{{ sourceDatabase }}',
'{{ destinationDatabase }}',
'{{ conversionWorkspace }}',
'{{ filter }}',
'{{ cmekKeyName }}',
'{{ performanceConfig }}',
'{{ sqlserverHomogeneousMigrationJobConfig }}',
'{{ dumpType }}'
;

UPDATE example

Updates a migration_jobs resource.

/*+ update */
UPDATE google.datamigration.migration_jobs
SET
name = '{{ name }}',
labels = '{{ labels }}',
displayName = '{{ displayName }}',
state = '{{ state }}',
type = '{{ type }}',
dumpPath = '{{ dumpPath }}',
dumpFlags = '{{ dumpFlags }}',
source = '{{ source }}',
destination = '{{ destination }}',
reverseSshConnectivity = '{{ reverseSshConnectivity }}',
vpcPeeringConnectivity = '{{ vpcPeeringConnectivity }}',
staticIpConnectivity = '{{ staticIpConnectivity }}',
sourceDatabase = '{{ sourceDatabase }}',
destinationDatabase = '{{ destinationDatabase }}',
conversionWorkspace = '{{ conversionWorkspace }}',
filter = '{{ filter }}',
cmekKeyName = '{{ cmekKeyName }}',
performanceConfig = '{{ performanceConfig }}',
sqlserverHomogeneousMigrationJobConfig = '{{ sqlserverHomogeneousMigrationJobConfig }}',
dumpType = '{{ dumpType }}'
WHERE
locationsId = '{{ locationsId }}'
AND migrationJobsId = '{{ migrationJobsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified migration_jobs resource.

/*+ delete */
DELETE FROM google.datamigration.migration_jobs
WHERE locationsId = '{{ locationsId }}'
AND migrationJobsId = '{{ migrationJobsId }}'
AND projectsId = '{{ projectsId }}';