Class: Cloudfront::Helpers::OriginAccessIdentity
- Inherits:
-
Object
- Object
- Cloudfront::Helpers::OriginAccessIdentity
- Includes:
- Utils::ConfigurationChecker, Utils::XmlSerializer
- Defined in:
- lib/cloudfront/helpers/origin_access_identity.rb
Instance Attribute Summary collapse
-
#caller_reference ⇒ Object
Returns the value of attribute caller_reference.
-
#comment ⇒ Object
Returns the value of attribute comment.
Attributes included from Utils::ConfigurationChecker
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
{ “CloudFrontOriginAccessIdentityConfig” => { “CallerReference” => “ref”, “Comment” => “The comment.” } }.
Instance Method Summary collapse
-
#build_xml(xml) ⇒ Object
<?xml version=“1.0” encoding=“UTF-8”?> <CloudFrontOriginAccessIdentityConfig xmlns=“cloudfront.amazonaws.com/doc/2012-07-01/”> <CallerReference>ref</CallerReference> <Comment>The comment.</Comment> </CloudFrontOriginAccessIdentityConfig>.
-
#initialize(&block) ⇒ OriginAccessIdentity
constructor
A new instance of OriginAccessIdentity.
- #validate ⇒ Object
Methods included from Utils::XmlSerializer
Methods included from Utils::ConfigurationChecker
Constructor Details
#initialize(&block) ⇒ OriginAccessIdentity
Returns a new instance of OriginAccessIdentity.
12 13 14 15 16 17 18 19 |
# File 'lib/cloudfront/helpers/origin_access_identity.rb', line 12 def initialize(&block) #setting default values @caller_reference = Cloudfront::Utils::Util.generate_caller_reference @comment = "Created with cloudfront Gem, visit https://github.com/Belkacem/cloudfront" #set value from block instance_eval &block if block_given? end |
Instance Attribute Details
#caller_reference ⇒ Object
Returns the value of attribute caller_reference.
9 10 11 |
# File 'lib/cloudfront/helpers/origin_access_identity.rb', line 9 def caller_reference @caller_reference end |
#comment ⇒ Object
Returns the value of attribute comment.
9 10 11 |
# File 'lib/cloudfront/helpers/origin_access_identity.rb', line 9 def comment @comment end |
Class Method Details
.from_hash(hash) ⇒ Object
{
"CloudFrontOriginAccessIdentityConfig" => {
"CallerReference" => "ref",
"Comment" => "The comment."
}
}
34 35 36 37 38 39 40 |
# File 'lib/cloudfront/helpers/origin_access_identity.rb', line 34 def self.from_hash(hash) hash = hash["CloudFrontOriginAccessIdentityConfig"] || hash self.new do self.caller_reference = hash["CallerReference"] self.comment = hash["Comment"] end end |
Instance Method Details
#build_xml(xml) ⇒ Object
<?xml version=“1.0” encoding=“UTF-8”?> <CloudFrontOriginAccessIdentityConfig xmlns=“cloudfront.amazonaws.com/doc/2012-07-01/”>
<CallerReference>ref</CallerReference>
<Comment>The comment.</Comment>
</CloudFrontOriginAccessIdentityConfig>
48 49 50 51 52 53 54 |
# File 'lib/cloudfront/helpers/origin_access_identity.rb', line 48 def build_xml(xml) check_configuration xml.CloudFrontOriginAccessIdentityConfig('xmlns' => "http://cloudfront.amazonaws.com/doc/#{Cloudfront::Utils::Api.version}/") { xml.CallerReference @caller_reference xml.Comment @comment } end |
#validate ⇒ Object
21 22 23 24 25 26 |
# File 'lib/cloudfront/helpers/origin_access_identity.rb', line 21 def validate this = self # Error checking .push "The caller_reference shouldn't be empty" if @caller_reference.empty? end |