Class: RightAws::AcfInterface::AcfDistributionListParser

Inherits:
RightAWSParser show all
Defined in:
lib/acf/right_acf_interface.rb

Overview


PARSERS:

Constant Summary

Constants inherited from RightAWSParser

RightAWSParser::DEFAULT_XML_LIBRARY

Instance Attribute Summary

Attributes inherited from RightAWSParser

#full_tag_name, #result, #tag, #xml_lib, #xmlpath

Instance Method Summary collapse

Methods inherited from RightAWSParser

#initialize, #method_missing, #parse, #tag_end, #tag_start, #tagtext, #text, xml_lib, xml_lib=

Constructor Details

This class inherits a constructor from RightAws::RightAWSParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightAws::RightAWSParser

Instance Method Details

#resetObject

:nodoc:



438
439
440
# File 'lib/acf/right_acf_interface.rb', line 438

def reset
  @result = { :distributions => [] }
end

#tagend(name) ⇒ Object



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/acf/right_acf_interface.rb', line 451

def tagend(name)
  case name
    when 'Marker'      then @result[:marker]       = @text
    when 'NextMarker'  then @result[:next_marker]  = @text
    when 'MaxItems'    then @result[:max_items]    = @text.to_i
    when 'IsTruncated' then @result[:is_truncated] = (@text == 'true')
    when 'Id'               then @distribution[:aws_id]             = @text
    when 'Status'           then @distribution[:status]             = @text
    when 'LastModifiedTime' then @distribution[:last_modified_time] = @text
    when 'DomainName'       then @distribution[:domain_name]        = @text
    when 'Origin'           then @distribution[:origin]             = @text
    when 'Comment'          then @distribution[:comment]            = AcfInterface::unescape(@text)
    when 'CallerReference'  then @distribution[:caller_reference]   = @text
    when 'CNAME'            then (@distribution[:cnames] ||= [])   << @text
    when 'Enabled'          then @distribution[:enabled]            = (@text == 'true')
    when 'Bucket'           then (@distribution[:logging] ||= {})[:bucket] = @text
    when 'Prefix'           then (@distribution[:logging] ||= {})[:prefix] = @text
    when 'OriginAccessIdentity' then @distribution[:origin_access_identity] = @text
  end
  case full_tag_name
  when %r{/TrustedSigners/Self$}             then (@distribution[:trusted_signers] ||= []) << 'self'
  when %r{/TrustedSigners/AwsAccountNumber$} then (@distribution[:trusted_signers] ||= []) << @text
  when %r{/Signer/Self$}                     then @active_signer[:aws_account_number] = 'self'
  when %r{/Signer/AwsAccountNumber$}         then @active_signer[:aws_account_number] = @text
  when %r{/Signer/KeyPairId$}                then (@active_signer[:key_pair_ids] ||= []) << @text
  when %r{/Signer$}                          then (@distribution[:active_trusted_signers] ||= []) << @active_signer
  when %r{(Streaming)?DistributionSummary$},
       %r{^(Streaming)?Distribution$},
       %r{^(Streaming)?DistributionConfig$}
    @result[:distributions] << @distribution
  end
end

#tagstart(name, attributes) ⇒ Object



441
442
443
444
445
446
447
448
449
450
# File 'lib/acf/right_acf_interface.rb', line 441

def tagstart(name, attributes)
  case full_tag_name
  when %r{/Signer$}
    @active_signer = {}
  when %r{(Streaming)?DistributionSummary$},
       %r{^(Streaming)?Distribution$},
       %r{^(Streaming)?DistributionConfig$}
    @distribution = { }
  end
end