Sha256: a0579dfda202ac59ee3f05bee6d5aa325075b6e29708559ee3b46a789f000cf5

Contents?: true

Size: 1.72 KB

Versions: 62

Compression:

Stored size: 1.72 KB

Contents

module Fog
  module CDN
    class AWS
      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::CDN::AWS::Mock.error(:invalid_if_match_version)
            end
            unless distribution['StreamingDistributionConfig']['CallerReference']
              Fog::CDN::AWS::Mock.error(:illegal_update)
            end
            if distribution['StreamingDistributionConfig']['Enabled']
              Fog::CDN::AWS::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::CDN::AWS::Mock.error(:no_such_streaming_distribution)
          end
        end
      end
    end
  end
end

Version data entries

62 entries across 60 versions & 6 rubygems

Version Path
fog-aws-3.2.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.1.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-3.0.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-2.0.1 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-2.0.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-1.4.1 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-1.4.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-1.3.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-1.2.1 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-1.2.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-1.1.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-1.0.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-0.13.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-0.12.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-0.11.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-0.10.0 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb
fog-aws-0.9.4 lib/fog/aws/requests/cdn/delete_streaming_distribution.rb