Sha256: 8f8f09cc52f9b634a019137aae3c546416f8a48a9ce1ecbcd6c1172d9e8de9e5

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

require 'fog/core/collection'
require 'fog/aws/models/cdn/invalidation'

module Fog
  module CDN
    class AWS

      class Invalidations < Fog::Collection

        attribute :is_truncated,            :aliases => ['IsTruncated']
        attribute :max_items,               :aliases => ['MaxItems']
        attribute :next_marker,             :aliases => ['NextMarker']
        attribute :marker,                  :aliases => ['Marker']

        attribute :distribution

        model Fog::CDN::AWS::Invalidation

        def all(options = {})
          requires :distribution
          options[:max_items]  ||= max_items
          options.delete_if {|key, value| value.nil?}

          data = connection.get_invalidation_list(distribution.identity, options).body

          merge_attributes(data.reject {|key, value| !['IsTruncated', 'MaxItems', 'NextMarker', 'Marker'].include?(key)})

          load(data['InvalidationSummary'])
        end

        def get(invalidation_id)
          requires :distribution

          data = connection.get_invalidation(distribution.identity, invalidation_id).body

          if data
            invalidation = new(data)
          else
            nil
          end
        rescue Excon::Errors::NotFound
          nil
        end

        def new(attributes = {})
          requires :distribution
          super({ :distribution => distribution }.merge!(attributes))
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 5 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/models/cdn/invalidations.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/cdn/invalidations.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/cdn/invalidations.rb
fog-sgonyea-1.8.1 lib/fog/aws/models/cdn/invalidations.rb
fog-1.8.0 lib/fog/aws/models/cdn/invalidations.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/cdn/invalidations.rb
fog-1.7.0 lib/fog/aws/models/cdn/invalidations.rb