private static void UnmarshallResult(XmlUnmarshallerContext context, DeleteObjectsResponse response) { IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } int currentDepth = context.get_CurrentDepth(); int num = currentDepth + 1; if (context.get_IsStartOfDocument()) { num += 2; } while (context.Read()) { if (context.get_IsStartElement() || context.get_IsAttribute()) { if (context.TestExpression("Deleted", num)) { response.DeletedObjects.Add(DeletedObjectUnmarshaller.Instance.Unmarshall(context)); } else if (context.TestExpression("Error", num)) { response.DeleteErrors.Add(ErrorsItemUnmarshaller.Instance.Unmarshall(context)); } } else if (context.get_IsEndElement() && context.get_CurrentDepth() < currentDepth) { break; } } }
private static void UnmarshallResult(XmlUnmarshallerContext context, PutObjectResponse response) { IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("x-amz-expiration")) { response.Expiration = new Expiration(responseData.GetHeaderValue("x-amz-expiration")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("ETag")) { response.ETag = S3Transforms.ToString(responseData.GetHeaderValue("ETag")); } if (responseData.IsHeaderPresent("x-amz-version-id")) { response.VersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-version-id")); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, CopyObjectResponse 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("ETag", targetDepth)) { response.ETag = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("LastModified", targetDepth)) { response.LastModified = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("x-amz-expiration")) { response.Expiration = new Expiration(responseData.GetHeaderValue("x-amz-expiration")); } if (responseData.IsHeaderPresent("x-amz-copy-source-version-id")) { response.SourceVersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-copy-source-version-id")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, CompleteMultipartUploadResponse response) { int currentDepth = context.get_CurrentDepth(); int num = currentDepth + 1; if (context.get_IsStartOfDocument()) { num += 2; } while (context.Read()) { if (context.get_IsStartElement() || context.get_IsAttribute()) { if (context.TestExpression("Location", num)) { response.Location = StringUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("Bucket", num)) { response.BucketName = StringUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("Key", num)) { response.Key = StringUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("ETag", num)) { response.ETag = StringUnmarshaller.GetInstance().Unmarshall(context); } } else if (context.get_IsEndElement() && context.get_CurrentDepth() < currentDepth) { return; } } IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent("x-amz-expiration")) { response.Expiration = new Expiration(responseData.GetHeaderValue("x-amz-expiration")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("x-amz-version-id")) { response.VersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-version-id")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-aws-kms-key-id")) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption-aws-kms-key-id")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } }
/// <summary> /// Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about DeleteObjectsResponse /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> protected DeleteObjectsResponse(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { if (info != null) { this.deleted = (List <DeletedObject>)info.GetValue("deleted", typeof(List <DeletedObject>)); this.errors = (List <DeleteError>)info.GetValue("errors", typeof(List <DeleteError>)); this.requestCharged = RequestCharged.FindValue((string)info.GetValue("requestCharged", typeof(string))); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, GetObjectTorrentResponse response) { response.ResponseStream = context.get_Stream(); IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } }
protected DeleteObjectsResponse(SerializationInfo info, StreamingContext context) : this() { if (info != null) { deleted = (List <DeletedObject>)info.GetValue("deleted", typeof(List <DeletedObject>)); errors = (List <DeleteError>)info.GetValue("errors", typeof(List <DeleteError>)); requestCharged = RequestCharged.FindValue((string)info.GetValue("requestCharged", typeof(string))); } }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { AbortMultipartUploadResponse abortMultipartUploadResponse = new AbortMultipartUploadResponse(); IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { abortMultipartUploadResponse.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } return(abortMultipartUploadResponse); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { RestoreObjectResponse restoreObjectResponse = new RestoreObjectResponse(); IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { restoreObjectResponse.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } return(restoreObjectResponse); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DeleteObjectResponse response) { IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent("x-amz-delete-marker")) { response.DeleteMarker = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-delete-marker")); } if (responseData.IsHeaderPresent("x-amz-version-id")) { response.VersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-version-id")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, UploadPartResponse response) { IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("ETag")) { response.ETag = S3Transforms.ToString(responseData.GetHeaderValue("ETag")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, DeleteObjectsResponse response) { IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Deleted", targetDepth)) { response.DeletedObjects.Add(DeletedObjectUnmarshaller.Instance.Unmarshall(context)); continue; } if (context.TestExpression("Error", targetDepth)) { response.DeleteErrors.Add(ErrorsItemUnmarshaller.Instance.Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, UploadPartResponse response) { IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("ETag")) { response.ETag = S3Transforms.ToString(responseData.GetHeaderValue("ETag")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderBucketKeyEnabled)) { response.BucketKeyEnabled = S3Transforms.ToBool(responseData.GetHeaderValue(S3Constants.AmzHeaderBucketKeyEnabled)); } if (context.ResponseData.IsHeaderPresent("x-amz-checksum-crc32")) { response.ChecksumCRC32 = S3Transforms.ToString(context.ResponseData.GetHeaderValue("x-amz-checksum-crc32")); } if (context.ResponseData.IsHeaderPresent("x-amz-checksum-crc32c")) { response.ChecksumCRC32C = S3Transforms.ToString(context.ResponseData.GetHeaderValue("x-amz-checksum-crc32c")); } if (context.ResponseData.IsHeaderPresent("x-amz-checksum-sha1")) { response.ChecksumSHA1 = S3Transforms.ToString(context.ResponseData.GetHeaderValue("x-amz-checksum-sha1")); } if (context.ResponseData.IsHeaderPresent("x-amz-checksum-sha256")) { response.ChecksumSHA256 = S3Transforms.ToString(context.ResponseData.GetHeaderValue("x-amz-checksum-sha256")); } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListPartsResponse 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("Bucket", targetDepth)) { response.BucketName = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Key", targetDepth)) { response.Key = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("UploadId", targetDepth)) { response.UploadId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("PartNumberMarker", targetDepth)) { response.PartNumberMarker = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("NextPartNumberMarker", targetDepth)) { response.NextPartNumberMarker = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("MaxParts", targetDepth)) { response.MaxParts = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("IsTruncated", targetDepth)) { response.IsTruncated = BoolUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Part", targetDepth)) { response.Parts.Add(PartDetailUnmarshaller.Instance.Unmarshall(context)); continue; } if (context.TestExpression("Initiator", targetDepth)) { response.Initiator = InitiatorUnmarshaller.Instance.Unmarshall(context); continue; } if (context.TestExpression("Owner", targetDepth)) { response.Owner = OwnerUnmarshaller.Instance.Unmarshall(context); continue; } if (context.TestExpression("StorageClass", targetDepth)) { response.StorageClass = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent(HeaderKeys.XAmzAbortDateHeader)) { response.AbortDate = S3Transforms.ToDateTime(responseData.GetHeaderValue(HeaderKeys.XAmzAbortDateHeader)); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzAbortRuleIdHeader)) { response.AbortRuleId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzAbortRuleIdHeader)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, GetObjectMetadataResponse response) { IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("x-amz-delete-marker")) { response.DeleteMarker = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-delete-marker")); } if (responseData.IsHeaderPresent("accept-ranges")) { response.AcceptRanges = S3Transforms.ToString(responseData.GetHeaderValue("accept-ranges")); } if (responseData.IsHeaderPresent("x-amz-expiration")) { response.Expiration = new Expiration(responseData.GetHeaderValue("x-amz-expiration")); } if (responseData.IsHeaderPresent("x-amz-restore")) { bool restoreInProgress; DateTime?restoreExpiration; AmazonS3Util.ParseAmzRestoreHeader(responseData.GetHeaderValue("x-amz-restore"), out restoreInProgress, out restoreExpiration); response.RestoreInProgress = restoreInProgress; response.RestoreExpiration = restoreExpiration; } if (responseData.IsHeaderPresent("Last-Modified")) { response.LastModified = S3Transforms.ToDateTime(responseData.GetHeaderValue("Last-Modified")); } if (responseData.IsHeaderPresent("ETag")) { response.ETag = S3Transforms.ToString(responseData.GetHeaderValue("ETag")); } if (responseData.IsHeaderPresent("x-amz-missing-meta")) { response.MissingMeta = S3Transforms.ToInt(responseData.GetHeaderValue("x-amz-missing-meta")); } if (responseData.IsHeaderPresent("x-amz-version-id")) { response.VersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-version-id")); } if (responseData.IsHeaderPresent("Cache-Control")) { response.Headers.CacheControl = S3Transforms.ToString(responseData.GetHeaderValue("Cache-Control")); } if (responseData.IsHeaderPresent("Content-Disposition")) { response.Headers.ContentDisposition = S3Transforms.ToString(responseData.GetHeaderValue("Content-Disposition")); } if (responseData.IsHeaderPresent("Content-Encoding")) { response.Headers.ContentEncoding = S3Transforms.ToString(responseData.GetHeaderValue("Content-Encoding")); } if (responseData.IsHeaderPresent("Content-Length")) { response.Headers.ContentLength = long.Parse(responseData.GetHeaderValue("Content-Length"), CultureInfo.InvariantCulture); } if (responseData.IsHeaderPresent("Content-Type")) { response.Headers.ContentType = S3Transforms.ToString(responseData.GetHeaderValue("Content-Type")); } if (responseData.IsHeaderPresent("Expires")) { response.RawExpires = S3Transforms.ToString(responseData.GetHeaderValue("Expires")); } if (responseData.IsHeaderPresent("x-amz-website-redirect-location")) { response.WebsiteRedirectLocation = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-website-redirect-location")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-customer-algorithm")) { response.ServerSideEncryptionCustomerMethod = ServerSideEncryptionCustomerMethod.FindValue(responseData.GetHeaderValue("x-amz-server-side-encryption-customer-algorithm")); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)); } if (responseData.IsHeaderPresent("x-amz-replication-status")) { response.ReplicationStatus = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-replication-status")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderMultipartPartsCount)) { response.PartsCount = S3Transforms.ToInt(responseData.GetHeaderValue(S3Constants.AmzHeaderMultipartPartsCount)); } if (responseData.IsHeaderPresent("x-amz-object-lock-mode")) { response.ObjectLockMode = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-object-lock-mode")); } if (responseData.IsHeaderPresent("x-amz-object-lock-retain-until-date")) { response.ObjectLockRetainUntilDate = S3Transforms.ToDateTime(responseData.GetHeaderValue("x-amz-object-lock-retain-until-date")); } if (responseData.IsHeaderPresent("x-amz-object-lock-legal-hold")) { response.ObjectLockLegalHoldStatus = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-object-lock-legal-hold")); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzStorageClassHeader)) { response.StorageClass = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzStorageClassHeader)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } foreach (var name in responseData.GetHeaderNames()) { if (name.StartsWith("x-amz-meta-", StringComparison.OrdinalIgnoreCase)) { response.Metadata[name] = responseData.GetHeaderValue(name); } } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, CompleteMultipartUploadResponse 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("Location", targetDepth)) { response.Location = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Bucket", targetDepth)) { response.BucketName = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Key", targetDepth)) { response.Key = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ETag", targetDepth)) { response.ETag = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ChecksumCRC32", targetDepth)) { response.ChecksumCRC32 = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ChecksumCRC32C", targetDepth)) { response.ChecksumCRC32C = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ChecksumSHA1", targetDepth)) { response.ChecksumSHA1 = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ChecksumSHA256", targetDepth)) { response.ChecksumSHA256 = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("x-amz-expiration")) { response.Expiration = new Expiration(responseData.GetHeaderValue("x-amz-expiration")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("x-amz-version-id")) { response.VersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-version-id")); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderBucketKeyEnabled)) { response.BucketKeyEnabled = S3Transforms.ToBool(responseData.GetHeaderValue(S3Constants.AmzHeaderBucketKeyEnabled)); } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, InitiateMultipartUploadResponse 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("Bucket", targetDepth)) { response.BucketName = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Key", targetDepth)) { response.Key = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("UploadId", targetDepth)) { response.UploadId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzAbortDateHeader)) { response.AbortDate = S3Transforms.ToDateTime(responseData.GetHeaderValue(HeaderKeys.XAmzAbortDateHeader)); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzAbortRuleIdHeader)) { response.AbortRuleId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzAbortRuleIdHeader)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } return; }
/// <summary> /// Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about DeleteObjectsResponse /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> protected DeleteObjectsResponse(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { if (info != null) { this.deleted = (List<DeletedObject>)info.GetValue("deleted", typeof(List<DeletedObject>)); this.errors = (List<DeleteError>)info.GetValue("errors", typeof(List<DeleteError>)); this.requestCharged = RequestCharged.FindValue((string) info.GetValue("requestCharged", typeof(string))); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListPartsResponse response) { int currentDepth = context.get_CurrentDepth(); int num = currentDepth + 1; if (context.get_IsStartOfDocument()) { num += 2; } while (context.Read()) { if (context.get_IsStartElement() || context.get_IsAttribute()) { if (context.TestExpression("Bucket", num)) { response.BucketName = StringUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("Key", num)) { response.Key = StringUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("UploadId", num)) { response.UploadId = StringUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("PartNumberMarker", num)) { response.PartNumberMarker = IntUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("NextPartNumberMarker", num)) { response.NextPartNumberMarker = IntUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("MaxParts", num)) { response.MaxParts = IntUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("IsTruncated", num)) { response.IsTruncated = BoolUnmarshaller.GetInstance().Unmarshall(context); } else if (context.TestExpression("Part", num)) { response.Parts.Add(PartDetailUnmarshaller.Instance.Unmarshall(context)); } else if (context.TestExpression("Initiator", num)) { response.Initiator = InitiatorUnmarshaller.Instance.Unmarshall(context); } else if (context.TestExpression("Owner", num)) { response.Owner = OwnerUnmarshaller.Instance.Unmarshall(context); } else if (context.TestExpression("StorageClass", num)) { response.StorageClass = StringUnmarshaller.GetInstance().Unmarshall(context); } } else if (context.get_IsEndElement() && context.get_CurrentDepth() < currentDepth) { return; } } IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent("x-amz-abort-date")) { response.AbortDate = S3Transforms.ToDateTime(responseData.GetHeaderValue("x-amz-abort-date")); } if (responseData.IsHeaderPresent("x-amz-abort-rule-id")) { response.AbortRuleId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-abort-rule-id")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, GetObjectResponse response) { response.ResponseStream = context.get_Stream(); IWebResponseData responseData = context.get_ResponseData(); if (responseData.IsHeaderPresent("x-amz-delete-marker")) { response.DeleteMarker = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-delete-marker")); } if (responseData.IsHeaderPresent("accept-ranges")) { response.AcceptRanges = S3Transforms.ToString(responseData.GetHeaderValue("accept-ranges")); } if (responseData.IsHeaderPresent("x-amz-expiration")) { response.Expiration = new Expiration(responseData.GetHeaderValue("x-amz-expiration")); } if (responseData.IsHeaderPresent("x-amz-restore")) { AmazonS3Util.ParseAmzRestoreHeader(responseData.GetHeaderValue("x-amz-restore"), out bool restoreInProgress, out DateTime? restoreExpiration); response.RestoreInProgress = restoreInProgress; response.RestoreExpiration = restoreExpiration; } if (responseData.IsHeaderPresent("Last-Modified")) { response.LastModified = S3Transforms.ToDateTime(responseData.GetHeaderValue("Last-Modified")); } if (responseData.IsHeaderPresent("ETag")) { response.ETag = S3Transforms.ToString(responseData.GetHeaderValue("ETag")); } if (responseData.IsHeaderPresent("x-amz-missing-meta")) { response.MissingMeta = S3Transforms.ToInt(responseData.GetHeaderValue("x-amz-missing-meta")); } if (responseData.IsHeaderPresent("x-amz-version-id")) { response.VersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-version-id")); } if (responseData.IsHeaderPresent("Cache-Control")) { response.Headers.CacheControl = S3Transforms.ToString(responseData.GetHeaderValue("Cache-Control")); } if (responseData.IsHeaderPresent("Content-Disposition")) { response.Headers.ContentDisposition = S3Transforms.ToString(responseData.GetHeaderValue("Content-Disposition")); } if (responseData.IsHeaderPresent("Content-Encoding")) { response.Headers.ContentEncoding = S3Transforms.ToString(responseData.GetHeaderValue("Content-Encoding")); } if (responseData.IsHeaderPresent("Content-Length")) { response.Headers.ContentLength = long.Parse(responseData.GetHeaderValue("Content-Length"), CultureInfo.InvariantCulture); } if (responseData.IsHeaderPresent("Content-Type")) { response.Headers.ContentType = S3Transforms.ToString(responseData.GetHeaderValue("Content-Type")); } if (responseData.IsHeaderPresent("Expires")) { response.RawExpires = S3Transforms.ToString(responseData.GetHeaderValue("Expires")); } if (responseData.IsHeaderPresent("x-amz-website-redirect-location")) { response.WebsiteRedirectLocation = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-website-redirect-location")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-customer-algorithm")) { response.ServerSideEncryptionCustomerMethod = ServerSideEncryptionCustomerMethod.FindValue(responseData.GetHeaderValue("x-amz-server-side-encryption-customer-algorithm")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-aws-kms-key-id")) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption-aws-kms-key-id")); } if (responseData.IsHeaderPresent("x-amz-replication-status")) { response.ReplicationStatus = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-replication-status")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderMultipartPartsCount)) { response.PartsCount = S3Transforms.ToInt(responseData.GetHeaderValue(S3Constants.AmzHeaderMultipartPartsCount)); } if (responseData.IsHeaderPresent("x-amz-storage-class")) { response.StorageClass = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-storage-class")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderTaggingCount)) { response.TagCount = S3Transforms.ToInt(responseData.GetHeaderValue(S3Constants.AmzHeaderTaggingCount)); } string[] headerNames = responseData.GetHeaderNames(); foreach (string text in headerNames) { if (text.StartsWith("x-amz-meta-", StringComparison.OrdinalIgnoreCase)) { response.Metadata[text] = responseData.GetHeaderValue(text); } } }
private static void UnmarshallResult(XmlUnmarshallerContext context, PutObjectResponse response) { IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("x-amz-expiration")) { response.Expiration = new Expiration(responseData.GetHeaderValue("x-amz-expiration")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-customer-algorithm")) { response.ServerSideEncryptionCustomerMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption-customer-algorithm")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-customer-key-MD5")) { response.ServerSideEncryptionCustomerProvidedKeyMD5 = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption-customer-key-MD5")); } if (responseData.IsHeaderPresent("ETag")) { response.ETag = S3Transforms.ToString(responseData.GetHeaderValue("ETag")); } if (responseData.IsHeaderPresent("x-amz-version-id")) { response.VersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-version-id")); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-context")) { response.ServerSideEncryptionKeyManagementServiceEncryptionContext = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption-context")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderBucketKeyEnabled)) { response.BucketKeyEnabled = S3Transforms.ToBool(responseData.GetHeaderValue(S3Constants.AmzHeaderBucketKeyEnabled)); } if (responseData.IsHeaderPresent("x-amz-checksum-crc32")) { response.ChecksumCRC32 = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-checksum-crc32")); } if (responseData.IsHeaderPresent("x-amz-checksum-crc32c")) { response.ChecksumCRC32C = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-checksum-crc32c")); } if (responseData.IsHeaderPresent("x-amz-checksum-sha1")) { response.ChecksumSHA1 = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-checksum-sha1")); } if (responseData.IsHeaderPresent("x-amz-checksum-sha256")) { response.ChecksumSHA256 = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-checksum-sha256")); } return; }