Creating a Migration Task
Function
This API is used to create a migration task for a source server.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
sms:server:createTask
Write
server *
-
sms:server:migrationServer
-
-
g:EnterpriseProjectId
URI
POST /v3/tasks
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. The token can be obtained by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Minimum: 1 Maximum: 16384 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Task name. The value can contain only letters, digits, underscores (_), and hyphens (-). Minimum: 1 Maximum: 64 |
|
type |
Yes |
String |
The task type. MIGRATE_FILE MIGRATE_BLOCK Enumeration values: |
|
start_target_server |
No |
Boolean |
Indicates whether the target server is started after the migration is complete. Default: true |
|
auto_start |
No |
Boolean |
Indicates whether to automatically start the migration. |
|
os_type |
No |
String |
The OS type. WINDOWS LINUX Enumeration values: |
|
source_server |
Yes |
SourceServerByTask object |
The source server must exist, be connected, and does not have migration tasks. |
|
target_server |
Yes |
TargetServerByTask object |
The target server information. |
|
migration_ip |
No |
String |
The IP address used for migration. This parameter is not required if the target server is automatically created. If use_ipv6 is set to false, migration_ip must be in the IPv4 format. If use_ipv6 is set to true, migration_ip must be in the IPv6 format. Minimum: 0 Maximum: 255 |
|
region_name |
Yes |
String |
The region name. Minimum: 0 Maximum: 255 |
|
region_id |
Yes |
String |
region ID Minimum: 0 Maximum: 255 |
|
project_name |
Yes |
String |
The project name. Minimum: 0 Maximum: 255 |
|
project_id |
Yes |
String |
The project ID. Minimum: 0 Maximum: 255 |
|
priority |
No |
Integer |
Priority. The default value is 1. Minimum: 0 Maximum: 65535 |
|
vm_template_id |
No |
String |
The template used to create target servers automatically. Minimum: 0 Maximum: 100 |
|
clonevm_template_id |
No |
String |
The ID of the template for cloning the target server. Minimum: 0 Maximum: 100 |
|
use_public_ip |
No |
Boolean |
Indicates whether a public IP address is used for migration. Default: true |
|
use_ipv6 |
No |
Boolean |
Indicates whether IPv6 is used. Default: false |
|
syncing |
No |
Boolean |
Indicates whether to perform a continuous synchronization after the first replication. If this parameter is not specified, the default value false is used. Default: false |
|
exist_server |
No |
Boolean |
Checks whether the service exists. If yes, create the task. |
|
start_network_check |
No |
Boolean |
Indicates whether network performance measurement is enabled. |
|
speed_limit |
No |
Integer |
The migration speed limit. Minimum: 0 Maximum: 1000 Default: 0 |
|
over_speed_threshold |
No |
Double |
The overspeed threshold for stopping migration. This is a protection measure. If the migration speed exceeds the threshold, the task is stopped. It is used to control the consumption of resources (especially network bandwidth) during the migration to ensure that the overall system performance is not affected by a single migration task. The unit is percentage. Minimum: 10 Maximum: 100 Default: 10 |
|
is_need_consistency_check |
No |
Boolean |
Indicates whether consistency verification is enabled. |
|
need_migration_test |
No |
Boolean |
Indicates whether migration drilling is enabled. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
Yes |
String |
The source server ID. Minimum: 0 Maximum: 255 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
btrfs_list |
No |
Array of BtrfsFileSystem objects |
The Btrfs information, which is obtained from the source server. Array Length: 0 - 65535 |
|
disks |
No |
Array of TargetDisks objects |
The disk information. Array Length: 0 - 50 |
|
name |
Yes |
String |
Name. Minimum: 0 Maximum: 255 |
|
vm_id |
Yes |
String |
VM ID Minimum: 0 Maximum: 255 |
|
volume_groups |
No |
Array of VolumeGroups objects |
The volume group information, which is obtained from the source server. Array Length: 0 - 50 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
No |
String |
The file system name. Minimum: 0 Maximum: 255 |
|
label |
No |
String |
The file system tags. If no tag exists, the value is an empty string. Minimum: 0 Maximum: 255 |
|
uuid |
No |
String |
The file system UUID. Minimum: 0 Maximum: 255 |
|
device |
No |
String |
The device names of the Btrfs file system. Minimum: 0 Maximum: 255 |
|
size |
No |
Long |
The space occupied by the file system data. Minimum: 0 Maximum: 9223372036854775807 |
|
nodesize |
No |
Long |
The Btrfs node size. Minimum: 0 Maximum: 9223372036854775807 |
|
sectorsize |
No |
Integer |
The sector size. Minimum: 0 Maximum: 2147483647 |
|
data_profile |
No |
String |
The data profile (RAD). Minimum: 0 Maximum: 255 |
|
system_profile |
No |
String |
The file system profile (RAD). Minimum: 0 Maximum: 255 |
|
metadata_profile |
No |
String |
The metadata profile (RAD). Minimum: 0 Maximum: 255 |
|
global_reserve1 |
No |
String |
The Btrfs file system information. Minimum: 0 Maximum: 255 |
|
g_vol_used_size |
No |
Long |
The used space of the Btrfs volume. Minimum: 0 Maximum: 9223372036854775807 |
|
default_subvolid |
No |
String |
The ID of the default subvolume. Minimum: 0 Maximum: 255 |
|
default_subvol_name |
No |
String |
The name of the default subvolume. Minimum: 0 Maximum: 255 |
|
default_subvol_mountpath |
No |
String |
The mount path of the default subvolume or Btrfs file system. Minimum: 0 Maximum: 255 |
|
subvolumn |
No |
Array of BtrfsSubvolumn objects |
The subvolume information. Array Length: 0 - 65535 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
uuid |
No |
String |
The UUID of the parent volume. Minimum: 0 Maximum: 255 |
|
is_snapshot |
No |
String |
Indicates whether the subvolume is a snapshot. Minimum: 0 Maximum: 255 |
|
subvol_id |
No |
String |
The subvolume ID. Minimum: 0 Maximum: 255 |
|
parent_id |
No |
String |
The parent volume ID. Minimum: 0 Maximum: 255 |
|
subvol_name |
No |
String |
The subvolume name. Minimum: 0 Maximum: 255 |
|
subvol_mount_path |
No |
String |
The mount path of the subvolume. Minimum: 0 Maximum: 255 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
device_use |
No |
String |
Disk type, which is only used for information display and is not verified. BOOT: disk where the boot partition is located. OS: disk where the OS is located. NORMAL: common disk. Default: NORMAL Enumeration values: |
|
disk_id |
No |
String |
The disk ID. This parameter is not required if the target server is automatically created. Minimum: 0 Maximum: 255 |
|
name |
No |
String |
The disk name. Set this parameter to Disk X based on the disk sequence. Minimum: 0 Maximum: 255 |
|
physical_volumes |
No |
Array of PhysicalVolumes objects |
The physical volume information. Array Length: 0 - 50 |
|
size |
No |
Long |
The size. Minimum: 0 Maximum: 9223372036854775807 |
|
used_size |
No |
Long |
The used space. Minimum: 0 Maximum: 9223372036854775807 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
device_use |
No |
String |
The partition function. The partition can be a general, boot, or OS partition. Minimum: 0 Maximum: 255 |
|
file_system |
No |
String |
The file system type. Minimum: 0 Maximum: 255 |
|
index |
No |
Integer |
The serial number. Minimum: 0 Maximum: 2147483647 |
|
mount_point |
No |
String |
The mount point. Minimum: 0 Maximum: 255 |
|
name |
No |
String |
The volume name. In Windows, it indicates the drive letter, and in Linux, it indicates the device ID. Minimum: 0 Maximum: 255 |
|
size |
No |
Long |
The size. Minimum: 0 Maximum: 9223372036854775807 |
|
inode_size |
No |
Long |
The number of inodes. Minimum: 0 Maximum: 9223372036854775807 |
|
used_size |
No |
Long |
The used space. Minimum: 0 Maximum: 9223372036854775807 |
|
uuid |
No |
String |
The GUID, which can be obtained from the source server. Minimum: 0 Maximum: 255 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
components |
No |
String |
The physical volume information. Minimum: 0 Maximum: 255 |
|
free_size |
No |
Long |
The available space. Minimum: 0 Maximum: 9223372036854775807 |
|
logical_volumes |
No |
Array of LogicalVolumes objects |
The logical volume information. Array Length: 0 - 50 |
|
name |
No |
String |
Name. Minimum: 0 Maximum: 255 |
|
size |
No |
Long |
Size. Minimum: 0 Maximum: 9223372036854775807 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
block_count |
No |
Integer |
The number of blocks. Minimum: 0 Maximum: 2147483647 Default: 0 |
|
block_size |
No |
Long |
Block size. Minimum: 0 Maximum: 1048576 Default: 0 |
|
file_system |
No |
String |
The file system. Minimum: 0 Maximum: 255 |
|
inode_size |
No |
Integer |
The number of inodes. Minimum: 0 Maximum: 2147483647 |
|
inode_nums |
No |
Long |
The number of inodes. Minimum: 0 Maximum: 9223372036854775807 |
|
device_use |
No |
String |
Partition type. This is not mandatory and can be left blank. The common values are as follows: NORMAL OS: system device BOOT VOLUME_GROUP BTRFS Minimum: 0 Maximum: 255 |
|
mount_point |
No |
String |
The mount point. Minimum: 0 Maximum: 256 |
|
name |
No |
String |
Name. Minimum: 0 Maximum: 1024 |
|
size |
No |
Long |
The size. Minimum: 0 Maximum: 9223372036854775807 |
|
used_size |
No |
Long |
The used space. Minimum: 0 Maximum: 9223372036854775807 |
|
free_size |
No |
Long |
The available space. Minimum: 0 Maximum: 9223372036854775807 |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
The task ID returned when the task is created successfully. Minimum: 0 Maximum: 255 |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
The error code. Minimum: 0 Maximum: 255 |
|
error_msg |
String |
The error message. Minimum: 0 Maximum: 255 |
|
encoded_authorization_message |
String |
The encrypted authorization information. Minimum: 0 Maximum: 65535 |
|
error_param |
Array of strings |
Error parameters. Minimum: 0 Maximum: 65535 Array Length: 1 - 20 |
|
details |
Array of details objects |
The error details. Array Length: 1 - 20 |
Example Requests
This example creates a migration task whose name is MigrationTask. The migration type is MIGRATE_FILE, the source server runs Linux, the migration uses the public network, the migration region name is region_name, and the migration region ID is region_id.
POST https://{endpoint}/v3/tasks
{
"name" : "MigrationTask",
"type" : "MIGRATE_FILE",
"os_type" : "LINUX",
"start_target_server" : true,
"use_public_ip" : true,
"migration_ip" : "192.168.0.1",
"region_name" : "region_name",
"region_id" : "region_id",
"project_name" : "project_name",
"project_id" : "xxxxxxxxxxxxxxxxxxxxxxxx00000001",
"source_server" : {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001"
},
"target_server" : {
"vm_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"name" : "Auto-tar-name",
"disks" : [ {
"name" : "/dev/vda",
"disk_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"size" : 42949672960,
"used_size" : 429496,
"device_use" : "BOOT",
"physical_volumes" : [ {
"uuid" : null,
"index" : 0,
"name" : "/dev/vda1",
"device_use" : "OS",
"file_system" : "ext4",
"mount_point" : "/",
"size" : 42947575808,
"used_size" : 5346484224
} ]
} ],
"volume_groups" : [ ]
},
"is_need_consistency_check" : true
}
Example Responses
Status code: 200
The migration task was successfully created.
{
"id" : "xxxxxxxxxxxxxxxxxxxxxxxx00000001"
}
Status code: 403
Authentication failed.
{
"error_code" : "SMS.9004",
"error_msg" : "The current account does not have the permission to execute policy. You do not have permission to perform action XXX on resource XXX.",
"encoded_authorization_message" : "XXXXXX",
"error_param" : [ "You do not have permission to perform action XXX on resource XXX." ],
"details" : [ {
"error_code" : "SMS.9004",
"error_msg" : "You do not have permission to perform action XXX on resource XXX."
} ]
}
SDK Sample Code
The SDK sample code is as follows.
This example creates a migration task whose name is MigrationTask. The migration type is MIGRATE_FILE, the source server runs Linux, the migration uses the public network, the migration region name is region_name, and the migration region ID is region_id.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.GlobalCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.sms.v3.region.SmsRegion; import com.huaweicloud.sdk.sms.v3.*; import com.huaweicloud.sdk.sms.v3.model.*; import java.util.List; import java.util.ArrayList; public class CreateTaskSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new GlobalCredentials() .withAk(ak) .withSk(sk); SmsClient client = SmsClient.newBuilder() .withCredential(auth) .withRegion(SmsRegion.valueOf("<YOUR REGION>")) .build(); CreateTaskRequest request = new CreateTaskRequest(); PostTask body = new PostTask(); List<PhysicalVolumes> listDisksPhysicalVolumes = new ArrayList<>(); listDisksPhysicalVolumes.add( new PhysicalVolumes() .withDeviceUse("OS") .withFileSystem("ext4") .withIndex(0) .withMountPoint("/") .withName("/dev/vda1") .withSize(42947575808L) .withUsedSize(5346484224L) ); List<TargetDisks> listTargetServerDisks = new ArrayList<>(); listTargetServerDisks.add( new TargetDisks() .withDeviceUse(TargetDisks.DeviceUseEnum.fromValue("BOOT")) .withDiskId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001") .withName("/dev/vda") .withPhysicalVolumes(listDisksPhysicalVolumes) .withSize(42949672960L) .withUsedSize(429496L) ); TargetServerByTask targetServerbody = new TargetServerByTask(); targetServerbody.withDisks(listTargetServerDisks) .withName("Auto-tar-name") .withVmId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001"); SourceServerByTask sourceServerbody = new SourceServerByTask(); sourceServerbody.withId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001"); body.withIsNeedConsistencyCheck(true); body.withUsePublicIp(true); body.withProjectId("xxxxxxxxxxxxxxxxxxxxxxxx00000001"); body.withProjectName("project_name"); body.withRegionId("region_id"); body.withRegionName("region_name"); body.withMigrationIp("192.168.0.1"); body.withTargetServer(targetServerbody); body.withSourceServer(sourceServerbody); body.withOsType(PostTask.OsTypeEnum.fromValue("LINUX")); body.withStartTargetServer(true); body.withType(PostTask.TypeEnum.fromValue("MIGRATE_FILE")); body.withName("MigrationTask"); request.withBody(body); try { CreateTaskResponse response = client.createTask(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
This example creates a migration task whose name is MigrationTask. The migration type is MIGRATE_FILE, the source server runs Linux, the migration uses the public network, the migration region name is region_name, and the migration region ID is region_id.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import GlobalCredentials from huaweicloudsdksms.v3.region.sms_region import SmsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksms.v3 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = GlobalCredentials(ak, sk) client = SmsClient.new_builder() \ .with_credentials(credentials) \ .with_region(SmsRegion.value_of("<YOUR REGION>")) \ .build() try: request = CreateTaskRequest() listPhysicalVolumesDisks = [ PhysicalVolumes( device_use="OS", file_system="ext4", index=0, mount_point="/", name="/dev/vda1", size=42947575808, used_size=5346484224 ) ] listDisksTargetServer = [ TargetDisks( device_use="BOOT", disk_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001", name="/dev/vda", physical_volumes=listPhysicalVolumesDisks, size=42949672960, used_size=429496 ) ] targetServerbody = TargetServerByTask( disks=listDisksTargetServer, name="Auto-tar-name", vm_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001" ) sourceServerbody = SourceServerByTask( id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001" ) request.body = PostTask( is_need_consistency_check=True, use_public_ip=True, project_id="xxxxxxxxxxxxxxxxxxxxxxxx00000001", project_name="project_name", region_id="region_id", region_name="region_name", migration_ip="192.168.0.1", target_server=targetServerbody, source_server=sourceServerbody, os_type="LINUX", start_target_server=True, type="MIGRATE_FILE", name="MigrationTask" ) response = client.create_task(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
This example creates a migration task whose name is MigrationTask. The migration type is MIGRATE_FILE, the source server runs Linux, the migration uses the public network, the migration region name is region_name, and the migration region ID is region_id.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global" sms "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := global.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := sms.NewSmsClient( sms.SmsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.CreateTaskRequest{} deviceUsePhysicalVolumes:= "OS" fileSystemPhysicalVolumes:= "ext4" indexPhysicalVolumes:= int32(0) mountPointPhysicalVolumes:= "/" namePhysicalVolumes:= "/dev/vda1" sizePhysicalVolumes:= int64(42947575808) usedSizePhysicalVolumes:= int64(5346484224) var listPhysicalVolumesDisks = []model.PhysicalVolumes{ { DeviceUse: &deviceUsePhysicalVolumes, FileSystem: &fileSystemPhysicalVolumes, Index: &indexPhysicalVolumes, MountPoint: &mountPointPhysicalVolumes, Name: &namePhysicalVolumes, Size: &sizePhysicalVolumes, UsedSize: &usedSizePhysicalVolumes, }, } deviceUseDisks:= model.GetTargetDisksDeviceUseEnum().BOOT diskIdDisks:= "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001" var listDisksTargetServer = []model.TargetDisks{ { DeviceUse: &deviceUseDisks, DiskId: &diskIdDisks, Name: "/dev/vda", PhysicalVolumes: listPhysicalVolumesDisks, Size: int64(42949672960), UsedSize: int64(429496), }, } targetServerbody := &model.TargetServerByTask{ Disks: listDisksTargetServer, Name: "Auto-tar-name", VmId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001", } sourceServerbody := &model.SourceServerByTask{ Id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001", } isNeedConsistencyCheckPostTask:= true usePublicIpPostTask:= true migrationIpPostTask:= "192.168.0.1" startTargetServerPostTask:= true request.Body = &model.PostTask{ IsNeedConsistencyCheck: &isNeedConsistencyCheckPostTask, UsePublicIp: &usePublicIpPostTask, ProjectId: "xxxxxxxxxxxxxxxxxxxxxxxx00000001", ProjectName: "project_name", RegionId: "region_id", RegionName: "region_name", MigrationIp: &migrationIpPostTask, TargetServer: targetServerbody, SourceServer: sourceServerbody, OsType: model.GetPostTaskOsTypeEnum().LINUX, StartTargetServer: &startTargetServerPostTask, Type: model.GetPostTaskTypeEnum().MIGRATE_FILE, Name: "MigrationTask", } response, err := client.CreateTask(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
The migration task was successfully created. |
|
403 |
Authentication failed. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot