Class: Cloudfront::Helpers::S3Origin
- Inherits:
-
Object
- Object
- Cloudfront::Helpers::S3Origin
- Includes:
- Utils::ConfigurationChecker, Utils::XmlSerializer
- Defined in:
- lib/cloudfront/helpers/s3_origin.rb
Instance Attribute Summary collapse
-
#domain_name ⇒ Object
Returns the value of attribute domain_name.
-
#origin_access_identity ⇒ Object
Returns the value of attribute origin_access_identity.
Attributes included from Utils::ConfigurationChecker
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
{ “S3Origin” => { “DomainName” => “CloudFront domain name assigned to the distribution”, “OriginAccessIdentity” => “origin-access-identity/cloudfront/ID” } }.
Instance Method Summary collapse
-
#build_xml(xml) ⇒ Object
The origin class container <S3Origin> <DomainName>CloudFront domain name assigned to the distribution</DNSName> <OriginAccessIdentity>origin-access-identity/cloudfront/ID</OriginAccessIdentity> </S3Origin>.
-
#initialize(&block) ⇒ S3Origin
constructor
A new instance of S3Origin.
- #validate ⇒ Object
Methods included from Utils::XmlSerializer
Methods included from Utils::ConfigurationChecker
Constructor Details
#initialize(&block) ⇒ S3Origin
Returns a new instance of S3Origin.
12 13 14 15 |
# File 'lib/cloudfront/helpers/s3_origin.rb', line 12 def initialize(&block) #set value from block instance_eval &block if block_given? end |
Instance Attribute Details
#domain_name ⇒ Object
Returns the value of attribute domain_name.
9 10 11 |
# File 'lib/cloudfront/helpers/s3_origin.rb', line 9 def domain_name @domain_name end |
#origin_access_identity ⇒ Object
Returns the value of attribute origin_access_identity.
9 10 11 |
# File 'lib/cloudfront/helpers/s3_origin.rb', line 9 def origin_access_identity @origin_access_identity end |
Class Method Details
.from_hash(hash) ⇒ Object
{
"S3Origin" => {
"DomainName" => "CloudFront domain name assigned to the distribution",
"OriginAccessIdentity" => "origin-access-identity/cloudfront/ID"
}
}
28 29 30 31 32 33 34 |
# File 'lib/cloudfront/helpers/s3_origin.rb', line 28 def self.from_hash(hash) hash = hash["S3Origin"] || hash self.new do self.domain_name = hash["DomainName"] self.origin_access_identity = hash["OriginAccessIdentity"] end end |
Instance Method Details
#build_xml(xml) ⇒ Object
The origin class container
<S3Origin>
<DomainName>CloudFront domain name assigned to the distribution</DNSName>
<OriginAccessIdentity>origin-access-identity/cloudfront/ID</OriginAccessIdentity>
</S3Origin>
41 42 43 44 45 46 47 |
# File 'lib/cloudfront/helpers/s3_origin.rb', line 41 def build_xml(xml) check_configuration xml.S3Origin { xml.DomainName @domain_name unless @domain_name.nil? xml.OriginAccessIdentity @origin_access_identity } end |
#validate ⇒ Object
17 18 19 20 |
# File 'lib/cloudfront/helpers/s3_origin.rb', line 17 def validate .push "domain_name can't be null" if @domain_name.nil? .push "origin_access_identity can't be null" if @origin_access_identity.nil? end |