示例#1
0
        internal CreateStreamingDistributionResponse CreateStreamingDistribution(CreateStreamingDistributionRequest request)
        {
            var marshaller   = new CreateStreamingDistributionRequestMarshaller();
            var unmarshaller = CreateStreamingDistributionResponseUnmarshaller.Instance;

            return(Invoke <CreateStreamingDistributionRequest, CreateStreamingDistributionResponse>(request, marshaller, unmarshaller));
        }
示例#2
0
        internal CreateStreamingDistributionResponse CreateStreamingDistribution(CreateStreamingDistributionRequest request)
        {
            var task = CreateStreamingDistributionAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
示例#3
0
        public CreateStreamingDistributionResponse CreateStreamingDistribution(CreateStreamingDistributionRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request", "The CreateStreamingDistributionRequest specified is null!");
            }
            CloudFrontStreamingDistributionConfig streamingDistributionConfig = request.StreamingDistributionConfig;

            if (streamingDistributionConfig == null)
            {
                throw new ArgumentNullException("request", "The request's StreamingDistributionConfig is null!");
            }
            if (!streamingDistributionConfig.IsSetOrigin())
            {
                throw new ArgumentNullException("request", "The Origin Server Bucket to create the distribution with is null or empty!");
            }
            if (!streamingDistributionConfig.IsSetCallerReference())
            {
                throw new ArgumentNullException("request", "The CallerReference to create the distribution with is null or empty!");
            }
            return(this.Invoke <CreateStreamingDistributionResponse>(this.ConvertCreateStreamingDistribution(request), request.Headers));
        }
示例#4
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateStreamingDistribution operation.
        /// <seealso cref="Amazon.CloudFront.IAmazonCloudFront"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateStreamingDistribution operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <CreateStreamingDistributionResponse> CreateStreamingDistributionAsync(CreateStreamingDistributionRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new CreateStreamingDistributionRequestMarshaller();
            var unmarshaller = CreateStreamingDistributionResponseUnmarshaller.Instance;

            return(Invoke <IRequest, CreateStreamingDistributionRequest, CreateStreamingDistributionResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
示例#5
0
        private IDictionary <CloudFrontQueryParameter, string> ConvertCreateStreamingDistribution(CreateStreamingDistributionRequest request)
        {
            IDictionary <CloudFrontQueryParameter, string> parameters = new Dictionary <CloudFrontQueryParameter, string>(5);

            parameters.Add(CloudFrontQueryParameter.Verb, CloudFrontConstants.PostVerb);
            parameters.Add(CloudFrontQueryParameter.Action, "CreateStreamingDistribution");
            parameters.Add(CloudFrontQueryParameter.ContentBody, request.StreamingDistributionConfig.ToString());
            parameters.Add(CloudFrontQueryParameter.ContentType, "application/x-www-form-urlencoded; charset=utf-8");
            this.AddCloudFrontQueryParameters(parameters, request.Headers);
            return(parameters);
        }