private static DBSnapshot getNewerSnapshot(string databaseNameOrigin, AmazonRDSClient rdsClient)
{
DescribeDBSnapshotsRequest describeSnapshotsRequest =
new DescribeDBSnapshotsRequest()
{
DBInstanceIdentifier = databaseNameOrigin,
SnapshotType = "automated"
};
DescribeDBSnapshotsResponse describeSnapshotsResponse =
rdsClient.DescribeDBSnapshots(describeSnapshotsRequest);
List<DBSnapshot> snapshots = describeSnapshotsResponse.DBSnapshots;
IEnumerable<DBSnapshot> orderedSnapshots = snapshots.OrderByDescending(x => x.SnapshotCreateTime);
DBSnapshot newerSnapshot = orderedSnapshots.First();
return newerSnapshot;
}