A complex type that contains information about the objects that you want to invalidate. For more information, see Specifying the Objects to Invalidate in the Amazon CloudFront Developer Guide.
예제 #1
0
 public InvalidationBatch WithPaths(Paths paths)
 {
     this.paths = paths;
     return this;
 }
예제 #2
0
 /// <summary>
 /// Instantiates InvalidationBatch with the parameterized properties
 /// </summary>
 /// <param name="paths">The path of the object to invalidate. The path is relative to the distribution and must begin with a slash (/). You must enclose each invalidation object with the Path element tags. If the path includes non-ASCII characters or unsafe characters as defined in RFC 1783 (http://www.ietf.org/rfc/rfc1738.txt), URL encode those characters. Do not URL encode any other characters in the path, or CloudFront will not invalidate the old version of the updated object.</param>
 /// <param name="callerReference">A unique name that ensures the request can't be replayed. If the CallerReference is new (no matter the content of the Path object), a new distribution is created. If the CallerReference is a value you already sent in a previous request to create an invalidation batch, and the content of each Path element is identical to the original request, the response includes the same information returned to the original request. If the CallerReference is a value you already sent in a previous request to create a distribution but the content of any Path is different from the original request, CloudFront returns an InvalidationBatchAlreadyExists error.</param>
 public InvalidationBatch(Paths paths, string callerReference)
 {
     _paths = paths;
     _callerReference = callerReference;
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CloudFront.Model.CreateInvalidationRequest();

            if (cmdletContext.DistributionId != null)
            {
                request.DistributionId = cmdletContext.DistributionId;
            }

            // populate InvalidationBatch
            var requestInvalidationBatchIsNull = true;

            request.InvalidationBatch = new Amazon.CloudFront.Model.InvalidationBatch();
            System.String requestInvalidationBatch_invalidationBatch_CallerReference = null;
            if (cmdletContext.InvalidationBatch_CallerReference != null)
            {
                requestInvalidationBatch_invalidationBatch_CallerReference = cmdletContext.InvalidationBatch_CallerReference;
            }
            if (requestInvalidationBatch_invalidationBatch_CallerReference != null)
            {
                request.InvalidationBatch.CallerReference = requestInvalidationBatch_invalidationBatch_CallerReference;
                requestInvalidationBatchIsNull            = false;
            }
            Amazon.CloudFront.Model.Paths requestInvalidationBatch_invalidationBatch_Paths = null;

            // populate Paths
            var requestInvalidationBatch_invalidationBatch_PathsIsNull = true;

            requestInvalidationBatch_invalidationBatch_Paths = new Amazon.CloudFront.Model.Paths();
            List <System.String> requestInvalidationBatch_invalidationBatch_Paths_paths_Item = null;

            if (cmdletContext.Paths_Item != null)
            {
                requestInvalidationBatch_invalidationBatch_Paths_paths_Item = cmdletContext.Paths_Item;
            }
            if (requestInvalidationBatch_invalidationBatch_Paths_paths_Item != null)
            {
                requestInvalidationBatch_invalidationBatch_Paths.Items = requestInvalidationBatch_invalidationBatch_Paths_paths_Item;
                requestInvalidationBatch_invalidationBatch_PathsIsNull = false;
            }
            System.Int32?requestInvalidationBatch_invalidationBatch_Paths_paths_Quantity = null;
            if (cmdletContext.Paths_Quantity != null)
            {
                requestInvalidationBatch_invalidationBatch_Paths_paths_Quantity = cmdletContext.Paths_Quantity.Value;
            }
            if (requestInvalidationBatch_invalidationBatch_Paths_paths_Quantity != null)
            {
                requestInvalidationBatch_invalidationBatch_Paths.Quantity = requestInvalidationBatch_invalidationBatch_Paths_paths_Quantity.Value;
                requestInvalidationBatch_invalidationBatch_PathsIsNull    = false;
            }
            // determine if requestInvalidationBatch_invalidationBatch_Paths should be set to null
            if (requestInvalidationBatch_invalidationBatch_PathsIsNull)
            {
                requestInvalidationBatch_invalidationBatch_Paths = null;
            }
            if (requestInvalidationBatch_invalidationBatch_Paths != null)
            {
                request.InvalidationBatch.Paths = requestInvalidationBatch_invalidationBatch_Paths;
                requestInvalidationBatchIsNull  = false;
            }
            // determine if request.InvalidationBatch should be set to null
            if (requestInvalidationBatchIsNull)
            {
                request.InvalidationBatch = null;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }