Sha256: 854f5cbf341b9a685ee9409e8ef26ea0f471f213dbb93aef91baa9e27741b940

Contents?: true

Size: 1.37 KB

Versions: 35

Compression:

Stored size: 1.37 KB

Contents

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

module Fog
  module AWS
    class CDN
      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::AWS::CDN::Invalidation

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

          data = service.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 = service.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

35 entries across 35 versions & 1 rubygems

Version Path
fog-aws-3.29.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.28.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.27.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.26.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.25.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.24.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.23.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.22.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.21.1 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.21.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.20.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.19.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.18.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.17.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.16.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.15.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.14.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.13.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.12.0 lib/fog/aws/models/cdn/invalidations.rb
fog-aws-3.11.0 lib/fog/aws/models/cdn/invalidations.rb