Sha256: f87a31a558db5fcdce40f0a52876bf1e39a3fde82f604503f4590f5ff5369eb2

Contents?: true

Size: 1.72 KB

Versions: 36

Compression:

Stored size: 1.72 KB

Contents

module Fog
  module AWS
    class CDN
      class Real
        # Delete a streaming distribution from CloudFront.
        #
        # @param [String] distribution_id Id of distribution to delete.
        # @param [String] etag Etag of that distribution from earlier get or put
        #
        # @see http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/DeleteStreamingDistribution.html

        def delete_streaming_distribution(distribution_id, etag)
          request({
            :expects    => 204,
            :headers    => { 'If-Match' => etag },
            :idempotent => true,
            :method     => 'DELETE',
            :path       => "/streaming-distribution/#{distribution_id}"
          })
        end
      end

      class Mock
        def delete_streaming_distribution(distribution_id, etag)
          distribution = self.data[:streaming_distributions][distribution_id]

          if distribution
            if distribution['ETag'] != etag
              Fog::AWS::CDN::Mock.error(:invalid_if_match_version)
            end
            unless distribution['StreamingDistributionConfig']['CallerReference']
              Fog::AWS::CDN::Mock.error(:illegal_update)
            end
            if distribution['StreamingDistributionConfig']['Enabled']
              Fog::AWS::CDN::Mock.error(:distribution_not_disabled)
            end

            self.data[:streaming_distributions].delete(distribution_id)

            response = Excon::Response.new
            response.status = 204
            response.body = "x-amz-request-id: #{Fog::AWS::Mock.request_id}"
            response
          else
            Fog::AWS::CDN::Mock.error(:no_such_streaming_distribution)
          end
        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/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.29.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.28.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.27.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.26.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.25.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.24.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.23.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.22.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.21.1 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.21.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.20.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.19.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.18.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.17.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.16.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.15.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.14.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.13.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.12.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb