描述
通过这个接口可以查询调用账号下所有同步作业的状态及同步详情。
请求参数
返回参数
SynchronizationInstance 参数定义
PrecheckStatus参数定义
CheckItem的参数定义
StructureInitializationStatus参数定义
DataInitializationStatus参数定义
DataSynchronizationStatus参数定义
Performance 参数定义
示例
下面简单演示通过JAVA SDK 查询同步任务列表的示例:
public void descSyncJobs(DefaultAcsClient client) {
DescribeSynchronizationJobsRequest request = new DescribeSynchronizationJobsRequest();
DescribeSynchronizationJobsResponse response = new DescribeSynchronizationJobsResponse();
try {
response = client.getAcsResponse(request);
System.out.println("Describe all Synchronization Jobs Succeed!");
List<SynchronizationInstance> syncInstances=response.getSynchronizationInstances();
System.out.println("Total num of Synchronization Jobs:"+syncInstances.size());
for (SynchronizationInstance syncInstance : syncInstances) {
System.out.println("SyncJobId:"+syncInstance.getSynchronizationJobId()
+"; SyncJobName:"+syncInstance.getSynchronizationJobName()
+"; PayType:"+syncInstance.getPayType()
+"; InstanceClass:"+syncInstance.getSynchronizationJobClass()
+"; StrucInit:"+syncInstance.getStructureInitialization()
+"; DataInit:"+syncInstance.getDataInitialization()
+"; Status:"+syncInstance.getStatus()
+"; ErrMSG:"+syncInstance.getErrorMessage()
+"; Delay:"+syncInstance.getDelay());
System.out.println("SourceEndpointInstanceType:"+syncInstance.getSourceEndpoint().getInstanceType()
+"SourceEnpointInstanceId:"+syncInstance.getSourceEndpoint().getInstanceId());
System.out.println("DestEndpointInstanceType:"+syncInstance.getDestinationEndpoint().getInstanceType()
+"DestEndpointInstanceId:"+syncInstance.getDestinationEndpoint().getInstanceId());
// Get Precheck Status
try {
com.aliyuncs.dts.model.v20160801.DescribeSynchronizationJobsResponse.SynchronizationInstance.PrecheckStatus precheckStatus = syncInstance.getPrecheckStatus();
System.out.println("Get Precheck Status for Sync Job Succeed");
System.out.println("Precheck Status:"+syncInstance.getPrecheckStatus().getStatus()
+"Precheck Percent:"+syncInstance.getPrecheckStatus().getPercent());
for (int j = 0; j < syncInstance.getPrecheckStatus().getDetail().size(); j++) {
System.out.println("CheckItem:"+syncInstance.getPrecheckStatus().getDetail().get(j).getCheckStatus()
+"; ErrorMSG:"+syncInstance.getPrecheckStatus().getDetail().get(j).getErrorMessage()
+"; RepairMethod:"+syncInstance.getPrecheckStatus().getDetail().get(j).getRepairMethod());
}
} catch (Exception e) {
// TODO: handle exception
System.out.println("Get Precheck Status for Sync Job Failed");
}
// Get Structure Initialization Status
try {
System.out.println("Get Structure Initialization Status Succeed!");
System.out.println("Structure Init Status:"+syncInstance.getStructureInitializationStatus().getStatus()
+"; Percent:"+syncInstance.getStructureInitializationStatus().getPercent()
+"; Progress:"+syncInstance.getStructureInitializationStatus().getProgress()
+"; ErrMSG:"+syncInstance.getStructureInitializationStatus().getErrorMessage());
} catch (Exception e) {
// TODO: handle exception
System.out.println("Get Structure Initialization Status Failed!");
}
// Get Data Initialization Status
try {
System.out.println("Get Data Init Status Succeed!");
System.out.println("Data Init Status:"+syncInstance.getDataInitializationStatus().getStatus()
+"; Percent:"+syncInstance.getDataInitializationStatus().getPercent()
+"; Progress:"+syncInstance.getDataInitializationStatus().getProgress()
+"; ErrMSG:"+syncInstance.getDataInitializationStatus().getErrorMessage());
} catch (Exception e) {
// TODO: handle exception
System.out.println("Get Data Init Status Failed!");
System.out.println(e.toString());
}
//Get Data Synchronization Status
try {
System.out.println("Get Data Synchronization Status Succeed!");
System.out.println("Data Sync Status:"+syncInstance.getDataSynchronizationStatus().getStatus()
+"; Percent:"+syncInstance.getDataSynchronizationStatus().getPercent()
+"; Delay:"+syncInstance.getDataSynchronizationStatus().getDelay()
+"; ErrMSG:"+syncInstance.getDataSynchronizationStatus().getErrorMessage());
} catch (Exception e) {
// TODO: handle exception
System.out.println("Get Data Sync Status Failed!");
System.out.println(e.toString());
}
}
} catch (Exception e) {
// TODO: handle exception
System.out.println("Desc all Sync Jobs Failed!");
System.out.println(e.toString());
}
}