Sha256: f463a0c52a244f06c88cc54704534ae0c724731ae2aeb532f7546ff7b8669e95

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

module Fog
  module Parsers
    module AWS
      module CDN

        class Distribution < Fog::Parsers::Base

          def reset
            @response = { 'DistributionConfig' => { 'CNAME' => [], 'Logging' => {}, 'TrustedSigners' => [] } }
          end

          def end_element(name)
            case name
            when 'AwsAccountNumber'
              @response['DistributionConfig']['TrustedSigners'] << @value
            when 'Bucket', 'Prefix'
              @response['DistributionConfig']['Logging'][name] = @value
            when 'CNAME'
              @response['DistributionConfig']['CNAME'] << @value
            when 'DomainName', 'Id', 'Status'
              @response[name] = @value
            when 'CallerReference', 'Comment', 'DefaultRootObject', 'Origin', 'OriginAccessIdentity'
              @response['DistributionConfig'][name] << @value
            when 'Enabled'
              if @value == 'true'
                @response['DistributionConfig'][name] = true
              else
                @response['DistributionConfig'][name] = false
              end
            when 'LastModifiedTime'
              @response[name] = Time.parse(@value)
            when 'Protocol'
              @response['DistributionConfig']['RequireProtocols'] = @value
            when 'Self'
              @response['DistributionConfig']['TrustedSigners'] << 'Self'
            end
          end

        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-0.3.17 lib/fog/aws/parsers/cdn/distribution.rb
fog-0.3.16 lib/fog/aws/parsers/cdn/distribution.rb
fog-0.3.15 lib/fog/aws/parsers/cdn/distribution.rb
fog-0.3.14 lib/fog/aws/parsers/cdn/distribution.rb