public string CreateDistribution(string bucketName, bool enabled)
        {
            CloudFrontDistributionConfig config = new CloudFrontDistributionConfig();

            config.WithOrigin(bucketName)
            .WithEnabled(enabled);
            CreateDistributionRequest request = new CreateDistributionRequest();

            request.WithDistributionConfig(config);
            CreateDistributionResponse response = _client.CreateDistribution(request);

            return(response.Distribution.DomainName);
        }
Beispiel #2
0
        public CreateDistributionResponse CreateDistribution(CreateDistributionRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request", "The CreateDistributionRequest specified is null!");
            }
            CloudFrontDistributionConfig distributionConfig = request.DistributionConfig;

            if (distributionConfig == null)
            {
                throw new ArgumentNullException("request", "The request's DistributionConfig is null!");
            }
            if (!distributionConfig.IsSetOrigin())
            {
                throw new ArgumentNullException("request", "The Origin Server Bucket to create the distribution with is null or empty!");
            }
            if (!distributionConfig.IsSetCallerReference())
            {
                throw new ArgumentNullException("request", "The CallerReference to create the distribution with is null or empty!");
            }
            return(this.Invoke <CreateDistributionResponse>(this.ConvertCreateDistribution(request), request.Headers));
        }