Sha256: 5fcf2c690a1522261e0afb5dde668824399eff85e780fc4a672820cca996d4ff

Contents?: true

Size: 1.85 KB

Versions: 62

Compression:

Stored size: 1.85 KB

Contents

module Fog
  module Parsers
    module CDN
      module AWS
        class GetDistributionList < Fog::Parsers::Base
          def reset
            @distribution_summary = { 'CNAME' => [], 'TrustedSigners' => [] }
            @response = { 'DistributionSummary' => [] }
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'CustomOrigin', 'S3Origin'
              @origin = name
              @distribution_summary[@origin] = {}
            end
          end

          def end_element(name)
            case name
            when 'DistributionSummary'
              @response['DistributionSummary'] << @distribution_summary
              @distribution_summary = { 'CNAME' => [], 'TrustedSigners' => [] }
            when 'Comment', 'DomainName', 'Id', 'Origin', 'Status'
              @distribution_summary[name] = value
            when 'CNAME'
              @distribution_summary[name] << value
            when 'DNSName', 'OriginAccessIdentity', 'OriginProtocolPolicy'
              @distribution_summary[@origin][name] = value
            when 'Enabled'
              if value == 'true'
                @distribution_summary[name] = true
              else
                @distribution_summary[name] = false
              end
            when 'HTTPPort', 'HTTPSPort'
              @distribution_summary[@origin][name] = value.to_i
            when 'LastModifiedTime'
              @distribution_summary[name] = Time.parse(value)
            when 'IsTruncated'
              if value == 'true'
                @response[name] = true
              else
                @response[name] = false
              end
            when 'Marker', 'NextMarker'
              @response[name] = value
            when 'MaxItems'
              @response[name] = value.to_i
            end
          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/parsers/cdn/get_distribution_list.rb
fog-aws-3.1.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/parsers/cdn/get_distribution_list.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/parsers/cdn/get_distribution_list.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-3.0.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-2.0.1 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-2.0.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-1.4.1 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-1.4.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-1.3.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-1.2.1 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-1.2.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-1.1.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-1.0.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-0.13.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-0.12.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-0.11.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-0.10.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-aws-0.9.4 lib/fog/aws/parsers/cdn/get_distribution_list.rb