public void MarshalResponse(IConfig config, CompleteMultipartUploadResponse response, IDictionary <string, string> headers, Stream responseStream) { response.VersionId = headers.GetHeader(AmzHeaders.XAmzVersionId); response.SseAlgorithm = headers.GetHeaderEnum <SseAlgorithm>(AmzHeaders.XAmzSse); response.SseKmsKeyId = headers.GetHeader(AmzHeaders.XAmzSseAwsKmsKeyId); response.SseCustomerAlgorithm = headers.GetHeaderEnum <SseCustomerAlgorithm>(AmzHeaders.XAmzSseCustomerAlgorithm); response.RequestCharged = headers.ContainsKey(AmzHeaders.XAmzRequestCharged); if (HeaderParserHelper.TryParseExpiration(headers, out (DateTimeOffset expiresOn, string ruleId)data)) { response.LifeCycleExpiresOn = data.expiresOn; response.LifeCycleRuleId = data.ruleId; } using (responseStream) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(CompleteMultipartUploadResult)); using (XmlTextReader xmlReader = new XmlTextReader(responseStream)) { xmlReader.Namespaces = false; CompleteMultipartUploadResult resp = (CompleteMultipartUploadResult)xmlSerializer.Deserialize(xmlReader); response.Location = resp.Location; response.BucketName = resp.Bucket; response.ObjectKey = resp.Key; response.ETag = resp.ETag; } } }
public void MarshalResponse(IConfig config, CopyObjectResponse response, IDictionary <string, string> headers, Stream responseStream) { response.NewVersionId = headers.GetHeader(AmzHeaders.XAmzCopySourceVersionId); if (HeaderParserHelper.TryParseExpiration(headers, out (DateTimeOffset expiresOn, string ruleId)data)) { response.LifeCycleExpiresOn = data.expiresOn; response.LifeCycleRuleId = data.ruleId; } response.RequestCharged = headers.ContainsKey(AmzHeaders.XAmzRequestCharged); response.SseAlgorithm = headers.GetHeaderEnum <SseAlgorithm>(AmzHeaders.XAmzSse); response.SseKmsKeyId = headers.GetHeader(AmzHeaders.XAmzSseAwsKmsKeyId); response.SseContext = headers.GetHeader(AmzHeaders.XAmzSseContext); response.SseCustomerAlgorithm = headers.GetHeaderEnum <SseCustomerAlgorithm>(AmzHeaders.XAmzSseCustomerAlgorithm); response.SseCustomerKeyMd5 = headers.GetHeaderByteArray(AmzHeaders.XAmzSseCustomerKeyMd5, BinaryEncoding.Base64); response.VersionId = headers.GetHeader(AmzHeaders.XAmzVersionId); XmlSerializer s = new XmlSerializer(typeof(CopyObjectResult)); using (XmlTextReader r = new XmlTextReader(responseStream)) { r.Namespaces = false; CopyObjectResult deleteResult = (CopyObjectResult)s.Deserialize(r); response.LastModified = deleteResult.LastModified; response.ETag = deleteResult.ETag; } }
public void MarshalResponse(IConfig config, PutObjectRequest request, PutObjectResponse response, IDictionary <string, string> headers, Stream responseStream) { response.StorageClass = headers.GetHeaderEnum <StorageClass>(AmzHeaders.XAmzStorageClass); //It should default to standard if (response.StorageClass == StorageClass.Unknown) { response.StorageClass = StorageClass.Standard; } response.ETag = headers.GetHeader(HttpHeaders.ETag); response.SseAlgorithm = headers.GetHeaderEnum <SseAlgorithm>(AmzHeaders.XAmzSse); response.SseKmsKeyId = headers.GetHeader(AmzHeaders.XAmzSseAwsKmsKeyId); response.SseCustomerAlgorithm = headers.GetHeaderEnum <SseCustomerAlgorithm>(AmzHeaders.XAmzSseCustomerAlgorithm); response.SseCustomerKeyMd5 = headers.GetHeaderByteArray(AmzHeaders.XAmzSseCustomerKeyMd5, BinaryEncoding.Base64); response.VersionId = headers.GetHeader(AmzHeaders.XAmzVersionId); response.SseContext = headers.GetHeader(AmzHeaders.XAmzSseContext); response.RequestCharged = headers.ContainsKey(AmzHeaders.XAmzRequestCharged); if (HeaderParserHelper.TryParseExpiration(headers, out (DateTimeOffset expiresOn, string ruleId)data)) { response.LifeCycleExpiresOn = data.expiresOn; response.LifeCycleRuleId = data.ruleId; } }
public void MarshalResponse(IConfig config, GetObjectResponse response, IDictionary <string, string> headers, Stream responseStream) { response.Metadata = HeaderParserHelper.ParseMetadata(headers); response.ETag = headers.GetHeader(HttpHeaders.ETag); response.CacheControl = headers.GetHeader(HttpHeaders.CacheControl); response.LastModified = headers.GetHeaderDate(HttpHeaders.LastModified, DateTimeFormat.Rfc1123); response.ContentType = headers.GetHeader(HttpHeaders.ContentType); response.ContentDisposition = headers.GetHeader(HttpHeaders.ContentDisposition); response.ContentEncoding = headers.GetHeader(HttpHeaders.ContentEncoding); response.ContentLanguage = headers.GetHeader(HttpHeaders.ContentLanguage); response.ContentRange = headers.GetHeader(HttpHeaders.ContentRange); response.AcceptRanges = headers.GetHeader(HttpHeaders.AcceptRanges); response.ExpiresOn = headers.GetHeaderDate(HttpHeaders.Expires, DateTimeFormat.Rfc1123); response.ReplicationStatus = headers.GetHeaderEnum <ReplicationStatus>(AmzHeaders.XAmzReplicationStatus); response.SseAlgorithm = headers.GetHeaderEnum <SseAlgorithm>(AmzHeaders.XAmzSse); response.SseKmsKeyId = headers.GetHeader(AmzHeaders.XAmzSseAwsKmsKeyId); response.SseCustomerAlgorithm = headers.GetHeaderEnum <SseCustomerAlgorithm>(AmzHeaders.XAmzSseCustomerAlgorithm); response.SseCustomerKeyMd5 = headers.GetHeaderByteArray(AmzHeaders.XAmzSseCustomerKeyMd5, BinaryEncoding.Base64); response.IsDeleteMarker = headers.GetHeaderBool(AmzHeaders.XAmzDeleteMarker); response.VersionId = headers.GetHeader(AmzHeaders.XAmzVersionId); response.RequestCharged = headers.ContainsKey(AmzHeaders.XAmzRequestCharged); response.StorageClass = headers.GetHeaderEnum <StorageClass>(AmzHeaders.XAmzStorageClass); //It should default to standard if (response.StorageClass == StorageClass.Unknown) { response.StorageClass = StorageClass.Standard; } response.Restore = headers.GetHeader(AmzHeaders.XAmzRestore); response.TagCount = headers.GetHeaderInt(AmzHeaders.XAmzTaggingCount); response.WebsiteRedirectLocation = headers.GetHeader(AmzHeaders.XAmzWebsiteRedirectLocation); response.LockMode = headers.GetHeaderEnum <LockMode>(AmzHeaders.XAmzObjectLockMode); response.LockRetainUntil = headers.GetHeaderDate(AmzHeaders.XAmzObjectLockRetainUntilDate, DateTimeFormat.Iso8601DateTimeExt); response.LockLegalHold = headers.GetHeader(AmzHeaders.XAmzObjectLockLegalHold) == "ON"; response.NumberOfParts = headers.GetHeaderInt(AmzHeaders.XAmzPartsCount); response.Content = responseStream; if (HeaderParserHelper.TryParseExpiration(headers, out (DateTimeOffset expiresOn, string ruleId)data)) { response.LifeCycleExpiresOn = data.expiresOn; response.LifeCycleRuleId = data.ruleId; } }