Sha256: 45b8e115b99450272e0d4a2ac081702401bc9a54927c0fc6b39c1e3fbcce15aa

Contents?: true

Size: 1.89 KB

Versions: 31

Compression:

Stored size: 1.89 KB

Contents

module Fog
  module CDN
    class AWS
      class Real

        require 'fog/aws/parsers/cdn/post_invalidation'

        # List information about distributions in CloudFront
        #
        # ==== Parameters
        # * distribution_id<~String> - Id of distribution for invalidations
        # * paths<~Array> - Array of string paths to objects to invalidate
        # * caller_reference<~String> - Used to prevent replay, defaults to Time.now.to_i.to_s
        #
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'Id'<~String> - Id of invalidation
        #     * 'Status'<~String> - Status of invalidation
        #     * 'CreateTime'<~Integer> - Time of invalidation creation
        #     * 'InvalidationBatch'<~Array>:
        #       * 'Path'<~Array> - Array of strings of objects to invalidate
        #       * 'CallerReference'<~String> - Used to prevent replay, defaults to Time.now.to_i.to_s
        #
        # ==== See Also
        # http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/CreateInvalidation.html

        def post_invalidation(distribution_id, paths, caller_reference = Time.now.to_i.to_s)
          body = '<?xml version="1.0" encoding="UTF-8"?>'
          body << "<InvalidationBatch>"
          for path in [*paths]
            body << "<Path>" << path << "</Path>"
          end
          body << "<CallerReference>" << caller_reference << "</CallerReference>"
          body << "</InvalidationBatch>"
          request({
            :body       => body,
            :expects    => 201,
            :headers    => {'Content-Type' => 'text/xml'},
            :idempotent => true,
            :method     => 'POST',
            :parser     => Fog::Parsers::CDN::AWS::PostInvalidation.new,
            :path       => "/distribution/#{distribution_id}/invalidation"
          })
        end

      end
    end
  end
end

Version data entries

31 entries across 31 versions & 9 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/aws/requests/cdn/post_invalidation.rb
fog-test-again-1.6.0 lib/fog/aws/requests/cdn/post_invalidation.rb
fog-parser-fix-1.6.0 lib/fog/aws/requests/cdn/post_invalidation.rb
fog-1.6.0 lib/fog/aws/requests/cdn/post_invalidation.rb
fog-1.5.0 lib/fog/aws/requests/cdn/post_invalidation.rb
fog-1.4.0 lib/fog/aws/requests/cdn/post_invalidation.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cdn/post_invalidation.rb
michiels-fog-1.3.1 lib/fog/aws/requests/cdn/post_invalidation.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/requests/cdn/post_invalidation.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cdn/post_invalidation.rb
fog-1.3.1 lib/fog/aws/requests/cdn/post_invalidation.rb
fog-1.3.0 lib/fog/aws/requests/cdn/post_invalidation.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cdn/post_invalidation.rb
fog-1.2.0 lib/fog/aws/requests/cdn/post_invalidation.rb
ktheory-fog-1.1.2 lib/fog/aws/requests/cdn/post_invalidation.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cdn/post_invalidation.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cdn/post_invalidation.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cdn/post_invalidation.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cdn/post_invalidation.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cdn/post_invalidation.rb