private static void UnmarshallResult(XmlUnmarshallerContext context, PutObjectResponseECS response)
        {
            IWebResponseData responseData = context.ResponseData;

            if (responseData.IsHeaderPresent("x-amz-expiration"))
            {
                response.Expiration = ParseExpirationHeader(responseData.GetHeaderValue("x-amz-expiration"));
            }
            if (responseData.IsHeaderPresent("x-amz-server-side-encryption"))
            {
                response.ServerSideEncryptionMethod = ECSTransforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption"));
            }
            if (responseData.IsHeaderPresent("ETag"))
            {
                response.ETag = ECSTransforms.ToString(responseData.GetHeaderValue("ETag"));
            }
            if (responseData.IsHeaderPresent("x-amz-version-id"))
            {
                response.VersionId = ECSTransforms.ToString(responseData.GetHeaderValue("x-amz-version-id"));
            }
            if (responseData.IsHeaderPresent(COMMON.XAmzServerSideEncryptionAwsKmsKeyIdHeader))
            {
                response.ServerSideEncryptionKeyManagementServiceKeyId = ECSTransforms.ToString(responseData.GetHeaderValue(COMMON.XAmzServerSideEncryptionAwsKmsKeyIdHeader));
            }
            if (responseData.IsHeaderPresent(COMMON.EMC_APPEND_OFFSET))
            {
                response.AppendOffset = Convert.ToInt64(ECSTransforms.ToString(responseData.GetHeaderValue(COMMON.EMC_APPEND_OFFSET)));
            }

            return;
        }
        public IRequest Marshall(ListBucketMetaSearchKeysRequest listMetaSearcKeysRequest)
        {
            IRequest request = new DefaultRequest(listMetaSearcKeysRequest, "AmazonS3");

            request.HttpMethod   = "GET";
            request.ResourcePath = string.Concat("/", ECSTransforms.ToStringValue(listMetaSearcKeysRequest.BucketName));

            request.AddSubResource("searchmetadata");

            request.UseQueryString = true;
            return(request);
        }
Esempio n. 3
0
        public IRequest Marshall(PutBucketRequestECS putBucketRequest)
        {
            var marshaller = new PutBucketRequestMarshaller();
            var request    = marshaller.Marshall(putBucketRequest);

            if (putBucketRequest.EnableFileSystem)
            {
                request.Headers.Add(COMMON.EMC_FS_ENABLED, "true");
            }
            if (putBucketRequest.StaleReadAllowed)
            {
                request.Headers.Add(COMMON.EMC_STALE_READ_ALLOWED, "true");
            }
            if (putBucketRequest.EnableCompliance)
            {
                request.Headers.Add(COMMON.EMC_COMPLIANCE_ENABLED, "true");
            }
            if (putBucketRequest.EnableServerSideEncryption)
            {
                request.Headers.Add(COMMON.EMC_DARE_ENABLED, "true");
            }
            if (putBucketRequest.IsSetNamespace())
            {
                request.Headers.Add(COMMON.EMC_NAMESPACE, ECSTransforms.ToStringValue(putBucketRequest.Namespace));
            }
            if (putBucketRequest.IsSetVirtualPoolId())
            {
                request.Headers.Add(COMMON.EMC_VPOOL, ECSTransforms.ToStringValue(putBucketRequest.VirtualPoolId));
            }
            if (putBucketRequest.IsSetRetentionPeriod())
            {
                request.Headers.Add(COMMON.EMC_RETENTION_PERIOD, ECSTransforms.ToStringValue(putBucketRequest.RetentionPeriod));
            }
            if (putBucketRequest.IsSetMetadataSearchKeys())
            {
                request.Headers.Add(COMMON.EMC_METADATA_SEARCH, ECSTransforms.ToStringValue(putBucketRequest.GetMetadataSearchKeys()));
            }

            return(request);
        }
Esempio n. 4
0
        public IRequest Marshall(QueryObjectsRequest queryObjectsRequest)
        {
            IRequest request = new DefaultRequest(queryObjectsRequest, "AmazonS3");

            request.HttpMethod   = "GET";
            request.ResourcePath = string.Concat("/", ECSTransforms.ToStringValue(queryObjectsRequest.BucketName));

            if (queryObjectsRequest.IsSetQuery())
            {
                request.SubResources.Add(COMMON.PARAM_QUERY, ECSTransforms.ToStringValue(queryObjectsRequest.Query));
            }
            else
            {
                throw new System.ArgumentNullException("Query", "Unable to submit query objecsts request with null or empty Query parameter.");
            }

            if (queryObjectsRequest.IsSetAttributes())
            {
                request.Parameters.Add(COMMON.PARAM_ATTRIBUTES, string.Join(",", queryObjectsRequest.Attributes.Select(s => ECSTransforms.ToStringValue(s))));
            }
            if (queryObjectsRequest.IsSetSorted())
            {
                request.Parameters.Add(COMMON.PARAM_SORTED, ECSTransforms.ToStringValue(queryObjectsRequest.Sorted));
            }
            if (queryObjectsRequest.IsSetMaxKeys())
            {
                request.Parameters.Add(COMMON.PARAM_MAX_KEYS, ECSTransforms.ToStringValue(queryObjectsRequest.MaxKeys));
            }
            if (queryObjectsRequest.IsSetMarker())
            {
                request.Parameters.Add(COMMON.PARAM_MARKER, ECSTransforms.ToStringValue(queryObjectsRequest.Marker));
            }
            if (queryObjectsRequest.IncludeOlderVersions)
            {
                request.Parameters.Add(COMMON.PARAM_INCLUDE_OLDER_VERSIONS, "true");
            }

            request.UseQueryString = true;
            return(request);
        }
Esempio n. 5
0
        public IRequest Marshall(PutObjectRequestECS putObjectRequest)
        {
            var marshaller = new PutObjectRequestMarshaller();
            var request    = marshaller.Marshall(putObjectRequest);

            if (putObjectRequest.IsSetRange())
            {
                request.Headers.Add(COMMON.HEADER_RANGE, "bytes=" + putObjectRequest.Range.ToString());
            }
            if (putObjectRequest.IsSetEtagToMatch())
            {
                request.Headers.Add(COMMON.HEADER_IF_MATCH, ECSTransforms.ToStringValue(putObjectRequest.EtagToMatch));
            }
            if (putObjectRequest.IsSetEtagToNotMatch())
            {
                request.Headers.Add(COMMON.HEADER_IF_NONE_MATCH, ECSTransforms.ToStringValue(putObjectRequest.EtagToNotMatch));
            }
            if (putObjectRequest.IsSetModifiedSinceDate())
            {
                request.Headers.Add(COMMON.HEADER_IF_MODIFIED_SINCE, ECSTransforms.ToStringValue(putObjectRequest.ModifiedSinceDate));
            }
            if (putObjectRequest.IsSetUnmodifiedSinceDate())
            {
                request.Headers.Add(COMMON.HEADER_IF_UNMODIFIED_SINCE, ECSTransforms.ToStringValue(putObjectRequest.UnmodifiedSinceDate));
            }
            if (putObjectRequest.IsSetRetentionPeriod())
            {
                request.Headers.Add(COMMON.EMC_RETENTION_PERIOD, ECSTransforms.ToStringValue(putObjectRequest.RetentionPeriod));
            }
            if (putObjectRequest.IsSetRetentionPolicy())
            {
                request.Headers.Add(COMMON.EMC_RETENTION_POLICY, ECSTransforms.ToStringValue(putObjectRequest.RetentionPolicy));
            }

            return(request);
        }