/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListBackupsResponse response = new ListBackupsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("BackupSummaries", targetDepth)) { var unmarshaller = new ListUnmarshaller <BackupSummary, BackupSummaryUnmarshaller>(BackupSummaryUnmarshaller.Instance); response.BackupSummaries = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("LastEvaluatedBackupArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.LastEvaluatedBackupArn = unmarshaller.Unmarshall(context); continue; } } return(response); }
public static ListBackupsResponse Unmarshall(UnmarshallerContext _ctx) { ListBackupsResponse listBackupsResponse = new ListBackupsResponse(); listBackupsResponse.HttpResponse = _ctx.HttpResponse; listBackupsResponse.RequestId = _ctx.StringValue("ListBackups.RequestId"); listBackupsResponse.PageNumber = _ctx.IntegerValue("ListBackups.PageNumber"); listBackupsResponse.PageSize = _ctx.IntegerValue("ListBackups.PageSize"); listBackupsResponse.TotalCount = _ctx.IntegerValue("ListBackups.TotalCount"); List <ListBackupsResponse.ListBackups_Item> listBackupsResponse_items = new List <ListBackupsResponse.ListBackups_Item>(); for (int i = 0; i < _ctx.Length("ListBackups.Items.Length"); i++) { ListBackupsResponse.ListBackups_Item item = new ListBackupsResponse.ListBackups_Item(); item.Id = _ctx.StringValue("ListBackups.Items[" + i + "].Id"); item.BackupPlanId = _ctx.StringValue("ListBackups.Items[" + i + "].BackupPlanId"); item.ClusterId = _ctx.StringValue("ListBackups.Items[" + i + "].ClusterId"); item.CreateTime = _ctx.LongValue("ListBackups.Items[" + i + "].CreateTime"); item.Md5 = _ctx.StringValue("ListBackups.Items[" + i + "].Md5"); item.TarFileName = _ctx.StringValue("ListBackups.Items[" + i + "].TarFileName"); item.StorePath = _ctx.StringValue("ListBackups.Items[" + i + "].StorePath"); item.Status = _ctx.StringValue("ListBackups.Items[" + i + "].Status"); ListBackupsResponse.ListBackups_Item.ListBackups_MetadataInfo metadataInfo = new ListBackupsResponse.ListBackups_Item.ListBackups_MetadataInfo(); metadataInfo.MetadataType = _ctx.StringValue("ListBackups.Items[" + i + "].MetadataInfo.MetadataType"); metadataInfo.Properties = _ctx.StringValue("ListBackups.Items[" + i + "].MetadataInfo.Properties"); item.MetadataInfo = metadataInfo; listBackupsResponse_items.Add(item); } listBackupsResponse.Items = listBackupsResponse_items; return(listBackupsResponse); }
/// <summary> /// 查询备份列表 /// </summary> public static void ListBackups(DdsClient client) { ListBackupsRequest req = new ListBackupsRequest { InstanceId = "fd1cac0eee0f4ad5a139a4dd6e994ea7in02", Limit = 1 }; try { ListBackupsResponse resp = client.ListBackups(req); Console.WriteLine(resp.TotalCount); foreach (var backup in resp.Backups) { Console.WriteLine(backup.Id); Console.WriteLine(backup.Datastore.Version); } Console.WriteLine("List Backups Success!"); } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }