static void ReadObjectRetention()
        {
            string id = Common.InputString("Key:", null, false);

            GetObjectRetentionRequest request = new GetObjectRetentionRequest();

            request.BucketName = _Bucket;
            request.Key        = id;

            GetObjectRetentionResponse response = _S3Client.GetObjectRetentionAsync(request).Result;

            if (response != null)
            {
                if (response.Retention != null)
                {
                    Console.WriteLine(Common.SerializeXml(response.Retention));
                }

                Console.WriteLine("Success");
            }
            else
            {
                Console.WriteLine("Failed");
            }
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            GetObjectRetentionResponse response = new GetObjectRetentionResponse();

            UnmarshallResult(context, response);

            return(response);
        }
        private static void UnmarshallResult(XmlUnmarshallerContext context, GetObjectRetentionResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Retention", targetDepth))
                    {
                        var unmarshaller = ObjectLockRetentionUnmarshaller.Instance;
                        response.Retention = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }

            return;
        }