Пример #1
0
 public SetDistributionConfigResponse SetDistributionConfig(SetDistributionConfigRequest request)
 {
     if (request == null)
     {
         throw new ArgumentNullException("request", "The SetDistributionConfigRequest specified is null!");
     }
     if (!request.IsSetId())
     {
         throw new ArgumentNullException("request", "The Distribution Id specified is null or empty!");
     }
     if (!request.IsSetDistributionConfig())
     {
         throw new ArgumentNullException("request", "No Distribution Config specified!");
     }
     if (!request.IsSetETag())
     {
         throw new ArgumentNullException("request", "The Distribution ETag specified is null or empty!");
     }
     return(this.Invoke <SetDistributionConfigResponse>(this.ConvertSetDistributionConfig(request), request.Headers));
 }
Пример #2
0
        private IDictionary <CloudFrontQueryParameter, string> ConvertSetDistributionConfig(SetDistributionConfigRequest request)
        {
            IDictionary <CloudFrontQueryParameter, string> parameters = new Dictionary <CloudFrontQueryParameter, string>(5);

            parameters.Add(CloudFrontQueryParameter.Verb, CloudFrontConstants.PutVerb);
            parameters.Add(CloudFrontQueryParameter.Action, "SetDistributionConfig");
            parameters.Add(CloudFrontQueryParameter.Query, "/config");
            parameters.Add(CloudFrontQueryParameter.ContentBody, request.DistributionConfig.ToString());
            parameters.Add(CloudFrontQueryParameter.ContentType, "application/x-www-form-urlencoded; charset=utf-8");
            parameters.Add(CloudFrontQueryParameter.Id, request.Id);
            request.Headers["If-Match"] = request.ETag;
            this.AddCloudFrontQueryParameters(parameters, request.Headers);
            return(parameters);
        }