Amazon.EC2.AmazonEC2Client.DescribeSnapshots C# (CSharp) Method

DescribeSnapshots() private method

private DescribeSnapshots ( ) : DescribeSnapshotsResponse
return DescribeSnapshotsResponse
        internal DescribeSnapshotsResponse DescribeSnapshots()
        {
            return DescribeSnapshots(new DescribeSnapshotsRequest());
        }
        internal DescribeSnapshotsResponse DescribeSnapshots(DescribeSnapshotsRequest request)

Same methods

AmazonEC2Client::DescribeSnapshots ( DescribeSnapshotsRequest request ) : DescribeSnapshotsResponse

Usage Example

Example #1
1
        public override void Execute()
        {
            AmazonEC2Client client = new AmazonEC2Client(AWSAuthConnection.OUR_ACCESS_KEY_ID, AWSAuthConnection.OUR_SECRET_ACCESS_KEY);
            DescribeSnapshotsRequest request = new DescribeSnapshotsRequest();
            DescribeSnapshotsResponse response = client.DescribeSnapshots(request);

            Dictionary<string, List<Amazon.EC2.Model.Snapshot>> snapshots = new Dictionary<string, List<Amazon.EC2.Model.Snapshot>>();
            foreach (Amazon.EC2.Model.Snapshot r in response.DescribeSnapshotsResult.Snapshot)
            {
                if (!snapshots.ContainsKey(r.VolumeId))
                    snapshots[r.VolumeId] = new List<Amazon.EC2.Model.Snapshot>();

                snapshots[r.VolumeId].Add(r);
            }

            foreach (string volumeId in snapshots.Keys)
            {
                Console.WriteLine("--- Volume: {0}", volumeId);
                snapshots[volumeId].Sort(delegate(Amazon.EC2.Model.Snapshot x,Amazon.EC2.Model.Snapshot y)
                    { return DateTime.Parse(x.StartTime).CompareTo(DateTime.Parse(y.StartTime)); });

                foreach (Amazon.EC2.Model.Snapshot s in snapshots[volumeId])
                {
                    DateTime startTime = DateTime.Parse(s.StartTime);
                    Console.Write("{0}\t{1}\t{2}\t{3}", s.SnapshotId, startTime, s.Progress, s.Status);
                    Console.WriteLine();
                }

                Console.WriteLine();
            }
        }
All Usage Examples Of Amazon.EC2.AmazonEC2Client::DescribeSnapshots
AmazonEC2Client