private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeDBClustersResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("DBClusters/DBCluster", targetDepth)) { var unmarshaller = DBClusterUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.DBClusters.Add(item); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } } } return; }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonDocDBConfig config = new AmazonDocDBConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonDocDBClient client = new AmazonDocDBClient(creds, config); DescribeDBClustersResponse resp = new DescribeDBClustersResponse(); do { DescribeDBClustersRequest req = new DescribeDBClustersRequest { Marker = resp.Marker , MaxRecords = maxItems }; resp = client.DescribeDBClusters(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.DBClusters) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeDBClustersResponse response = new DescribeDBClustersResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("DescribeDBClustersResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
public void Setup() { _firstPage = new DescribeDBClustersResponse { Marker = "token-1", DBClusters = new List <DBCluster> { new DBCluster { DBClusterIdentifier = "DBCluster-1" } } }; _secondPage = new DescribeDBClustersResponse { Marker = "token-2", DBClusters = new List <DBCluster> { new DBCluster { DBClusterIdentifier = "DBCluster-2" } } }; _thirdPage = new DescribeDBClustersResponse { DBClusters = new List <DBCluster> { new DBCluster { DBClusterIdentifier = "DBCluster-3" } } }; var rdsMock = new Mock <IAmazonRDS>(); rdsMock.Setup(s => s.DescribeDBClustersAsync( It.Is <DescribeDBClustersRequest>(r => r.Marker == null), It.IsAny <CancellationToken>())) .ReturnsAsync(_firstPage); rdsMock.Setup(s => s.DescribeDBClustersAsync( It.Is <DescribeDBClustersRequest>(r => r.Marker == "token-1"), It.IsAny <CancellationToken>())) .ReturnsAsync(_secondPage); rdsMock.Setup(s => s.DescribeDBClustersAsync( It.Is <DescribeDBClustersRequest>(r => r.Marker == "token-2"), It.IsAny <CancellationToken>())) .ReturnsAsync(_thirdPage); _rdsClusterSource = new RdsClusterSource(rdsMock.Object); }
public static DescribeDBClustersResponse Unmarshall(UnmarshallerContext context) { DescribeDBClustersResponse describeDBClustersResponse = new DescribeDBClustersResponse(); describeDBClustersResponse.HttpResponse = context.HttpResponse; describeDBClustersResponse.RequestId = context.StringValue("DescribeDBClusters.RequestId"); describeDBClustersResponse.PageNumber = context.IntegerValue("DescribeDBClusters.PageNumber"); describeDBClustersResponse.TotalCount = context.IntegerValue("DescribeDBClusters.TotalCount"); describeDBClustersResponse.PageSize = context.IntegerValue("DescribeDBClusters.PageSize"); List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster> describeDBClustersResponse_items = new List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster>(); for (int i = 0; i < context.Length("DescribeDBClusters.Items.Length"); i++) { DescribeDBClustersResponse.DescribeDBClusters_DBCluster dBCluster = new DescribeDBClustersResponse.DescribeDBClusters_DBCluster(); dBCluster.DBClusterId = context.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterId"); dBCluster.DBClusterType = context.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterType"); dBCluster.DBClusterDescription = context.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterDescription"); dBCluster.PayType = context.StringValue("DescribeDBClusters.Items[" + i + "].PayType"); dBCluster.RegionId = context.StringValue("DescribeDBClusters.Items[" + i + "].RegionId"); dBCluster.ExpireTime = context.StringValue("DescribeDBClusters.Items[" + i + "].ExpireTime"); dBCluster.Expired = context.StringValue("DescribeDBClusters.Items[" + i + "].Expired"); dBCluster.DBClusterStatus = context.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterStatus"); dBCluster.DBVersion = context.StringValue("DescribeDBClusters.Items[" + i + "].DBVersion"); dBCluster.LockMode = context.StringValue("DescribeDBClusters.Items[" + i + "].LockMode"); dBCluster.LockReason = context.StringValue("DescribeDBClusters.Items[" + i + "].LockReason"); dBCluster.CreateTime = context.StringValue("DescribeDBClusters.Items[" + i + "].CreateTime"); dBCluster.DBNodeStorage = context.LongValue("DescribeDBClusters.Items[" + i + "].DBNodeStorage"); dBCluster.DBNodeClass = context.StringValue("DescribeDBClusters.Items[" + i + "].DBNodeClass"); dBCluster.DBNodeCount = context.LongValue("DescribeDBClusters.Items[" + i + "].DBNodeCount"); dBCluster.CommodityCode = context.StringValue("DescribeDBClusters.Items[" + i + "].CommodityCode"); dBCluster.Category = context.StringValue("DescribeDBClusters.Items[" + i + "].Category"); List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag> dBCluster_tags = new List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag>(); for (int j = 0; j < context.Length("DescribeDBClusters.Items[" + i + "].Tags.Length"); j++) { DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag tag = new DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag(); tag.Key = context.StringValue("DescribeDBClusters.Items[" + i + "].Tags[" + j + "].Key"); tag._Value = context.StringValue("DescribeDBClusters.Items[" + i + "].Tags[" + j + "].Value"); dBCluster_tags.Add(tag); } dBCluster.Tags = dBCluster_tags; describeDBClustersResponse_items.Add(dBCluster); } describeDBClustersResponse.Items = describeDBClustersResponse_items; return(describeDBClustersResponse); }
public static DescribeDBClustersResponse Unmarshall(UnmarshallerContext context) { DescribeDBClustersResponse describeDBClustersResponse = new DescribeDBClustersResponse(); describeDBClustersResponse.HttpResponse = context.HttpResponse; describeDBClustersResponse.RequestId = context.StringValue("DescribeDBClusters.RequestId"); describeDBClustersResponse.PageNumber = context.IntegerValue("DescribeDBClusters.PageNumber"); describeDBClustersResponse.TotalRecordCount = context.IntegerValue("DescribeDBClusters.TotalRecordCount"); describeDBClustersResponse.PageRecordCount = context.IntegerValue("DescribeDBClusters.PageRecordCount"); List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster> describeDBClustersResponse_items = new List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster>(); for (int i = 0; i < context.Length("DescribeDBClusters.Items.Length"); i++) { DescribeDBClustersResponse.DescribeDBClusters_DBCluster dBCluster = new DescribeDBClustersResponse.DescribeDBClusters_DBCluster(); dBCluster.DBClusterId = context.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterId"); dBCluster.DBClusterDescription = context.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterDescription"); dBCluster.PayType = context.StringValue("DescribeDBClusters.Items[" + i + "].PayType"); dBCluster.DBClusterNetworkType = context.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterNetworkType"); dBCluster.RegionId = context.StringValue("DescribeDBClusters.Items[" + i + "].RegionId"); dBCluster.ZoneId = context.StringValue("DescribeDBClusters.Items[" + i + "].ZoneId"); dBCluster.ExpireTime = context.StringValue("DescribeDBClusters.Items[" + i + "].ExpireTime"); dBCluster.Expired = context.StringValue("DescribeDBClusters.Items[" + i + "].Expired"); dBCluster.DBClusterStatus = context.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterStatus"); dBCluster.Engine = context.StringValue("DescribeDBClusters.Items[" + i + "].Engine"); dBCluster.DBType = context.StringValue("DescribeDBClusters.Items[" + i + "].DBType"); dBCluster.DBVersion = context.StringValue("DescribeDBClusters.Items[" + i + "].DBVersion"); dBCluster.LockMode = context.StringValue("DescribeDBClusters.Items[" + i + "].LockMode"); dBCluster.DeletionLock = context.IntegerValue("DescribeDBClusters.Items[" + i + "].DeletionLock"); dBCluster.CreateTime = context.StringValue("DescribeDBClusters.Items[" + i + "].CreateTime"); dBCluster.VpcId = context.StringValue("DescribeDBClusters.Items[" + i + "].VpcId"); dBCluster.DBNodeNumber = context.IntegerValue("DescribeDBClusters.Items[" + i + "].DBNodeNumber"); dBCluster.DBNodeClass = context.StringValue("DescribeDBClusters.Items[" + i + "].DBNodeClass"); dBCluster.StorageUsed = context.LongValue("DescribeDBClusters.Items[" + i + "].StorageUsed"); List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_DBNode> dBCluster_dBNodes = new List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_DBNode>(); for (int j = 0; j < context.Length("DescribeDBClusters.Items[" + i + "].DBNodes.Length"); j++) { DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_DBNode dBNode = new DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_DBNode(); dBNode.DBNodeId = context.StringValue("DescribeDBClusters.Items[" + i + "].DBNodes[" + j + "].DBNodeId"); dBNode.DBNodeClass = context.StringValue("DescribeDBClusters.Items[" + i + "].DBNodes[" + j + "].DBNodeClass"); dBNode.DBNodeRole = context.StringValue("DescribeDBClusters.Items[" + i + "].DBNodes[" + j + "].DBNodeRole"); dBNode.RegionId = context.StringValue("DescribeDBClusters.Items[" + i + "].DBNodes[" + j + "].RegionId"); dBNode.ZoneId = context.StringValue("DescribeDBClusters.Items[" + i + "].DBNodes[" + j + "].ZoneId"); dBCluster_dBNodes.Add(dBNode); } dBCluster.DBNodes = dBCluster_dBNodes; List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag> dBCluster_tags = new List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag>(); for (int j = 0; j < context.Length("DescribeDBClusters.Items[" + i + "].Tags.Length"); j++) { DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag tag = new DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag(); tag.Key = context.StringValue("DescribeDBClusters.Items[" + i + "].Tags[" + j + "].Key"); tag._Value = context.StringValue("DescribeDBClusters.Items[" + i + "].Tags[" + j + "].Value"); dBCluster_tags.Add(tag); } dBCluster.Tags = dBCluster_tags; describeDBClustersResponse_items.Add(dBCluster); } describeDBClustersResponse.Items = describeDBClustersResponse_items; return(describeDBClustersResponse); }
public static DescribeDBClustersResponse Unmarshall(UnmarshallerContext _ctx) { DescribeDBClustersResponse describeDBClustersResponse = new DescribeDBClustersResponse(); describeDBClustersResponse.HttpResponse = _ctx.HttpResponse; describeDBClustersResponse.RequestId = _ctx.StringValue("DescribeDBClusters.RequestId"); describeDBClustersResponse.PageNumber = _ctx.IntegerValue("DescribeDBClusters.PageNumber"); describeDBClustersResponse.TotalCount = _ctx.IntegerValue("DescribeDBClusters.TotalCount"); describeDBClustersResponse.PageSize = _ctx.IntegerValue("DescribeDBClusters.PageSize"); List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster> describeDBClustersResponse_items = new List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster>(); for (int i = 0; i < _ctx.Length("DescribeDBClusters.Items.Length"); i++) { DescribeDBClustersResponse.DescribeDBClusters_DBCluster dBCluster = new DescribeDBClustersResponse.DescribeDBClusters_DBCluster(); dBCluster.DBClusterId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterId"); dBCluster.DBClusterType = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterType"); dBCluster.DBClusterDescription = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterDescription"); dBCluster.PayType = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].PayType"); dBCluster.RegionId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].RegionId"); dBCluster.ExpireTime = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].ExpireTime"); dBCluster.Expired = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].Expired"); dBCluster.DBClusterStatus = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterStatus"); dBCluster.DBVersion = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DBVersion"); dBCluster.LockMode = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].LockMode"); dBCluster.LockReason = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].LockReason"); dBCluster.CreateTime = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].CreateTime"); dBCluster.DBNodeStorage = _ctx.LongValue("DescribeDBClusters.Items[" + i + "].DBNodeStorage"); dBCluster.DBNodeClass = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DBNodeClass"); dBCluster.DBNodeCount = _ctx.LongValue("DescribeDBClusters.Items[" + i + "].DBNodeCount"); dBCluster.CommodityCode = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].CommodityCode"); dBCluster.Category = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].Category"); dBCluster.RdsInstanceId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].RdsInstanceId"); dBCluster.DtsJobId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DtsJobId"); dBCluster.ExecutorCount = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].ExecutorCount"); dBCluster.DiskType = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DiskType"); dBCluster.VPCCloudInstanceId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].VPCCloudInstanceId"); dBCluster.Engine = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].Engine"); dBCluster.DBClusterNetworkType = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].DBClusterNetworkType"); dBCluster.VPCId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].VPCId"); dBCluster.VSwitchId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].VSwitchId"); dBCluster.ZoneId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].ZoneId"); dBCluster.ConnectionString = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].ConnectionString"); dBCluster.Port = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].Port"); dBCluster.ComputeResource = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].ComputeResource"); dBCluster.StorageResource = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].StorageResource"); dBCluster.Mode = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].Mode"); dBCluster.ResourceGroupId = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].ResourceGroupId"); dBCluster.ElasticIOResource = _ctx.IntegerValue("DescribeDBClusters.Items[" + i + "].ElasticIOResource"); List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag> dBCluster_tags = new List <DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag>(); for (int j = 0; j < _ctx.Length("DescribeDBClusters.Items[" + i + "].Tags.Length"); j++) { DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag tag = new DescribeDBClustersResponse.DescribeDBClusters_DBCluster.DescribeDBClusters_Tag(); tag.Key = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].Tags[" + j + "].Key"); tag._Value = _ctx.StringValue("DescribeDBClusters.Items[" + i + "].Tags[" + j + "].Value"); dBCluster_tags.Add(tag); } dBCluster.Tags = dBCluster_tags; describeDBClustersResponse_items.Add(dBCluster); } describeDBClustersResponse.Items = describeDBClustersResponse_items; return(describeDBClustersResponse); }