public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeDBSnapshotsResponse response = new DescribeDBSnapshotsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("DescribeDBSnapshotsResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeDBSnapshotsResponse 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("DBSnapshots/DBSnapshot", targetDepth)) { var unmarshaller = DBSnapshotUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.DBSnapshots.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) { AmazonRDSConfig config = new AmazonRDSConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonRDSClient client = new AmazonRDSClient(creds, config); DescribeDBSnapshotsResponse resp = new DescribeDBSnapshotsResponse(); do { DescribeDBSnapshotsRequest req = new DescribeDBSnapshotsRequest { Marker = resp.Marker , MaxRecords = maxItems }; resp = client.DescribeDBSnapshots(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.DBSnapshots) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
/// <summary> /// <para> Returns information about DBSnapshots. This API supports pagination. </para> /// </summary> /// /// <param name="describeDBSnapshotsRequest">Container for the necessary parameters to execute the DescribeDBSnapshots service method on /// AmazonRDS.</param> /// /// <returns>The response from the DescribeDBSnapshots service method, as returned by AmazonRDS.</returns> /// /// <exception cref="DBSnapshotNotFoundException"/> public DescribeDBSnapshotsResponse DescribeDBSnapshots(DescribeDBSnapshotsRequest describeDBSnapshotsRequest) { IRequest <DescribeDBSnapshotsRequest> request = new DescribeDBSnapshotsRequestMarshaller().Marshall(describeDBSnapshotsRequest); DescribeDBSnapshotsResponse response = Invoke <DescribeDBSnapshotsRequest, DescribeDBSnapshotsResponse> (request, this.signer, DescribeDBSnapshotsResponseUnmarshaller.GetInstance()); return(response); }
public async Task <IReadOnlyList <DatabaseSnapshotInfo> > GetRecentSnapshots() { using AmazonRDSClient rdsClient = new AmazonRDSClient(); DescribeDBSnapshotsRequest request = new DescribeDBSnapshotsRequest() { DBInstanceIdentifier = _instanceName }; DescribeDBSnapshotsResponse snaps = await rdsClient.DescribeDBSnapshotsAsync(request, CancellationToken.None); var orderedSnaps = snaps.DBSnapshots.OrderBy(x => x.PercentProgress).ThenByDescending(x => x.SnapshotCreateTime); var domainObjects = orderedSnaps .Select(x => new DatabaseSnapshotInfo(x.DBSnapshotIdentifier, Instant.FromDateTimeUtc(x.SnapshotCreateTime.ToUniversalTime()), x.PercentProgress, x.Status)) .ToList(); return(domainObjects); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeDBSnapshotsResponse response = new DescribeDBSnapshotsResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("DescribeDBSnapshotsResult", 2)) { response.DescribeDBSnapshotsResult = DescribeDBSnapshotsResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeDBSnapshotsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Marker", targetDepth)) { response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("DBSnapshots/DBSnapshot", targetDepth)) { response.DBSnapshots.Add(DBSnapshotUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }