コード例 #1
0
        public HttpWebRequest Prepare()
        {
            if (Parameters == null)
            {
                throw new ArgumentException("Parameters");
            }

            if ((Parameters.Content == null || Parameters.Content.Length == 0) &&
                (!Parameters.Resource.PathAndQuery[Parameters.Resource.PathAndQuery.Length - 1].Equals('/')))
            {
                throw new ArgumentOutOfRangeException("If resource path is specified as an object content length must be non-zero");
            }

            var request = _commandBuilder.GenerateRequest(Parameters, _userId, WebRequestMethods.Http.Post);

            _authenticator.AuthenticateRequest(request, _secret);

            var contentStream = request.GetRequestStream();

            if (Parameters.Content != null)
            {
                contentStream.Write(Parameters.Content, 0, Parameters.Content.Length);
            }

            return(request);
        }
コード例 #2
0
        public HttpWebRequest Prepare()
        {
            var request = _commandBuilder.GenerateRequest(Parameters, _userId, WebRequestMethods.Http.Get);

            _authenticator.AuthenticateRequest(request, _secret);

            return(request);
        }
コード例 #3
0
        public HttpWebRequest Prepare()
        {
            if (!Parameters.Resource.PathAndQuery.Contains("metadata/user"))
            {
                Parameters.Resource = new Uri(Parameters.Resource, "?metadata/user");
            }

            var request = _commandBuilder.GenerateRequest(Parameters, _userId, "DELETE");

            _authenticator.AuthenticateRequest(request, _secret);

            return(request);
        }
コード例 #4
0
        public HttpWebRequest Prepare()
        {
            if (!Parameters.Resource.PathAndQuery.Contains("acl"))
            {
                Parameters.Resource = new Uri(Parameters.Resource, "?acl");
            }

            var request = _commandBuilder.GenerateRequest(Parameters, _userId, WebRequestMethods.Http.Get);

            _authenticator.AuthenticateRequest(request, _secret);

            return(request);
        }
コード例 #5
0
        public HttpWebRequest Prepare()
        {
            var request = _commandBuilder.GenerateRequest(Parameters, _userId, WebRequestMethods.Http.Get);

            if (Parameters.LowerRange > Parameters.UpperRange)
            {
                request.AddRange(Parameters.LowerRange);
            }

            if (Parameters.UpperRange > 0)
            {
                request.AddRange(Parameters.LowerRange, Parameters.UpperRange);
            }
            _authenticator.AuthenticateRequest(request, _secret);

            return(request);
        }
コード例 #6
0
        public HttpWebRequest Prepare()
        {
            if (!Parameters.Resource.PathAndQuery.Contains("acl"))
            {
                Parameters.Resource = new Uri(Parameters.Resource, "?acl");
            }

            if (string.IsNullOrWhiteSpace(Parameters.GroupACL) && (string.IsNullOrWhiteSpace(Parameters.UserACL)))
            {
                throw new ArgumentOutOfRangeException("Either a group acl or a user acl must be supplied to the SetObjectACL command");
            }

            var request = _commandBuilder.GenerateRequest(Parameters, _userId, WebRequestMethods.Http.Post);

            _authenticator.AuthenticateRequest(request, _secret);

            return(request);
        }
コード例 #7
0
        public HttpWebRequest Prepare()
        {
            if (string.IsNullOrWhiteSpace(Parameters.Tags) && (string.IsNullOrWhiteSpace(Parameters.ListableTags)))
            {
                throw new ArgumentOutOfRangeException("Either tags or listable tags must be supplied to the SetUserMetadata command");
            }

            if (!Parameters.Resource.PathAndQuery.Contains("metadata/user"))
            {
                Parameters.Resource = new Uri(Parameters.Resource, "?metadata/user");
            }

            var request = _commandBuilder.GenerateRequest(Parameters, _userId, WebRequestMethods.Http.Post);

            _authenticator.AuthenticateRequest(request, _secret);

            return(request);
        }
コード例 #8
0
        public HttpWebRequest Prepare()
        {
            var request = _commandBuilder.GenerateRequest(Parameters, _userId, WebRequestMethods.Http.Put);

            if (!string.IsNullOrWhiteSpace(Parameters.RangeSpecification))
            {
                request.Headers.Add("range", Parameters.RangeSpecification);
            }

            _authenticator.AuthenticateRequest(request, _secret);

            var contentStream = request.GetRequestStream();

            if (Parameters.Content != null)
            {
                contentStream.Write(Parameters.Content, 0, Parameters.Content.Length);
            }

            return(request);
        }