Sha256: ab54a2879b953df837fbd09369c49f3c7505b6c3cd0f3b92b6c9cde9bb4da38d

Contents?: true

Size: 1.43 KB

Versions: 36

Compression:

Stored size: 1.43 KB

Contents

module Fog
  module AWS
    class CDN
      module DistributionHelper
        def destroy
          requires :identity, :etag, :caller_reference
          raise "Distribution must be disabled to be deleted" unless disabled?
          delete_distribution(identity, etag)
          true
        end

        def enabled?
          requires :identity
          !!enabled and ready?
        end

        def disabled?
          requires :identity
          not enabled? and ready?
        end

        def custom_origin?
          requires :identity
          not custom_origin.nil?
        end

        def ready?
          requires :identity
          status == 'Deployed'
        end

        def enable
          requires :identity
          reload if etag.nil? or caller_reference.nil?
          unless enabled?
            self.enabled = true
            response = put_distribution_config(identity, etag, attributes_to_options)
            etag = response.headers['ETag']
            merge_attributes(response.body)
          end
          true
        end

        def disable
          requires :identity
          reload if etag.nil? or caller_reference.nil?
          if enabled?
            self.enabled = false
            response = put_distribution_config(identity, etag, attributes_to_options)
            etag = response.headers['ETag']
            merge_attributes(response.body)
          end
          true
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

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