Class: RightAws::AcfInterface
- Inherits:
-
RightAwsBase
- Object
- RightAwsBase
- RightAws::AcfInterface
- Includes:
- RightAwsBaseInterface
- Defined in:
- lib/acf/right_acf_interface.rb,
lib/acf/right_acf_invalidations.rb,
lib/acf/right_acf_streaming_interface.rb,
lib/acf/right_acf_origin_access_identities.rb
Overview
RightAws::AcfInterface – RightScale Amazon’s CloudFront interface
The AcfInterface class provides a complete interface to Amazon’s CloudFront service.
For explanations of the semantics of each call, please refer to Amazon’s documentation at developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=211
Example:
acf = RightAws::AcfInterface.new('1E3GDYEOGFJPIT7XXXXXX','hgTHt68JY07JKUY08ftHYtERkjgtfERn57XXXXXX')
list = acf.list_distributions #=>
[{:status => "Deployed",
:domain_name => "d74zzrxmpmygb.6hops.net",
:aws_id => "E4U91HCJHGXVC",
:s3_origin => {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
:cnames => ["x1.my-awesome-site.net", "x1.my-awesome-site.net"]
:comment => "My comments",
:last_modified_time => "2008-09-10T17:00:04.000Z" }, ..., {...} ]
distibution = list.first
info = acf.get_distribution(distibution[:aws_id]) #=>
{:last_modified_time=>"2010-05-19T18:54:38.242Z",
:status=>"Deployed",
:domain_name=>"dpzl38cuix402.cloudfront.net",
:caller_reference=>"201005181943052207677116",
:e_tag=>"EJSXFGM5JL8ER",
:s3_origin=>
{:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
:origin_access_identity=>
"origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
:aws_id=>"E5P8HQ3ZAZIXD",
:enabled=>false}
config = acf.get_distribution_config(distibution[:aws_id]) #=>
{:enabled => true,
:caller_reference => "200809102100536497863003",
:e_tag => "E39OHHU1ON65SI",
:cnames => ["web1.my-awesome-site.net", "web2.my-awesome-site.net"]
:comment => "Woo-Hoo!",
:s3_origin => {:dns_name => "my-bucket.s3.amazonaws.com"}}
config[:comment] = 'Olah-lah!'
config[:enabled] = false
config[:cnames] << "web3.my-awesome-site.net"
acf.set_distribution_config(distibution[:aws_id], config) #=> true
Defined Under Namespace
Classes: AcfDistributionListParser, AcfInvalidationsListParser, AcfOriginAccesIdentitiesListParser
Constant Summary collapse
- API_VERSION =
"2010-11-01"
- DEFAULT_HOST =
'cloudfront.amazonaws.com'
- DEFAULT_PORT =
443
- DEFAULT_PROTOCOL =
'https'
- DEFAULT_PATH =
'/'
- @@bench =
AwsBenchmarkingBlock.new
Constants included from RightAwsBaseInterface
RightAwsBaseInterface::BLOCK_DEVICE_KEY_MAPPING, RightAwsBaseInterface::DEFAULT_SIGNATURE_VERSION
Constants inherited from RightAwsBase
RightAwsBase::AMAZON_PROBLEMS, RightAwsBase::RAISE_ON_TIMEOUT_ON_ACTIONS
Instance Attribute Summary
Attributes included from RightAwsBaseInterface
#aws_access_key_id, #aws_secret_access_key, #cache, #connection, #last_errors, #last_request, #last_request_id, #last_response, #logger, #params, #signature_version
Class Method Summary collapse
Instance Method Summary collapse
-
#create_distribution(config) ⇒ Object
(also: #create_distribution_by_config)
Create a new distribution.
-
#create_invalidation(distribution_aws_id, invalidation_batch) ⇒ Object
Create a new Invalidation batch.
-
#create_origin_access_identity(comment = '', caller_reference = nil) ⇒ Object
Create a new CloudFront Origin Access Identity.
- #create_origin_access_identity_by_config(config) ⇒ Object
-
#create_streaming_distribution(config) ⇒ Object
(also: #create_streaming_distribution_by_config)
Create a new streaming distribution.
-
#delete_distribution(aws_id, e_tag) ⇒ Object
Delete a distribution.
-
#delete_origin_access_identity(aws_id, e_tag) ⇒ Object
Get Origin Access Identity.
-
#delete_streaming_distribution(aws_id, e_tag) ⇒ Object
Delete a streaming distribution.
-
#distribution_config_to_xml(config, xml_wrapper = 'DistributionConfig') ⇒ Object
:nodoc:.
-
#generate_call_reference ⇒ Object
—————————————————————– Helpers: —————————————————————–.
-
#generate_request(method, path, params = {}, body = nil, headers = {}) ⇒ Object
Generates request hash for REST API.
-
#get_distribution(aws_id) ⇒ Object
Get a distribution’s information.
-
#get_distribution_config(aws_id) ⇒ Object
Get a distribution’s configuration.
-
#get_invalidation(distribution_aws_id, aws_id) ⇒ Object
Get Invalidation.
-
#get_origin_access_identity(aws_id) ⇒ Object
Get Origin Access Identity.
-
#get_origin_access_identity_config(aws_id) ⇒ Object
Get Origin Access Identity config.
-
#get_streaming_distribution(aws_id) ⇒ Object
Get a streaming distribution’s information.
-
#get_streaming_distribution_config(aws_id) ⇒ Object
Get a streaming distribution’s configuration.
-
#incrementally_list_distributions(params = {}, &block) ⇒ Object
Incrementally list distributions.
-
#incrementally_list_invalidations(distribution_aws_id, params = {}, &block) ⇒ Object
Incrementally list Invalidations.
-
#incrementally_list_origin_access_identities(params = {}, &block) ⇒ Object
Incrementally list Origin Access Identities.
-
#incrementally_list_streaming_distributions(params = {}, &block) ⇒ Object
Incrementally list streaming distributions.
-
#initialize(aws_access_key_id = nil, aws_secret_access_key = nil, params = {}) ⇒ AcfInterface
constructor
Create a new handle to a CloudFront account.
-
#invalidation_batch_to_xml(invalidation_batch) ⇒ Object
—————————————————————– Batch —————————————————————–.
-
#list_distributions ⇒ Object
List all distributions.
-
#list_invalidations(distribution_aws_id) ⇒ Object
List Invalidations.
-
#list_origin_access_identities ⇒ Object
List Origin Access Identities.
-
#list_streaming_distributions ⇒ Object
List all streaming distributions.
-
#merge_headers(hash) ⇒ Object
:nodoc:.
-
#origin_access_identity_config_to_xml(config) ⇒ Object
—————————————————————– Config —————————————————————–.
-
#request_info(request, parser, &block) ⇒ Object
Sends request to Amazon and parses the response.
-
#set_distribution_config(aws_id, config) ⇒ Object
Set a distribution’s configuration Returns
true
on success or RightAws::AwsError exception. -
#set_origin_access_identity_config(aws_id, config) ⇒ Object
Set Origin Access Identity config.
-
#set_streaming_distribution_config(aws_id, config) ⇒ Object
Set a streaming distribution’s configuration Returns
true
on success or RightAws::AwsError exception. -
#streaming_distribution_config_to_xml(config) ⇒ Object
:nodoc:.
Methods included from RightAwsBaseInterface
#amazonize_block_device_mappings, #amazonize_list, #cache_hits?, caching, caching=, #caching?, #destroy_connection, #generate_request_impl, #get_connection, #get_connections_storage, #get_server_url, #incrementally_list_items, #init, #on_exception, #request_cache_or_info, #request_info_impl, #signed_service_params, #update_cache, #with_connection_options
Methods inherited from RightAwsBase
amazon_problems, amazon_problems=, raise_on_timeout_on_actions, raise_on_timeout_on_actions=
Constructor Details
#initialize(aws_access_key_id = nil, aws_secret_access_key = nil, params = {}) ⇒ AcfInterface
Create a new handle to a CloudFront account. All handles share the same per process or per thread HTTP connection to CloudFront. Each handle is for a specific account. The params have the following options:
-
:endpoint_url
a fully qualified url to Amazon API endpoint (this overwrites: :server, :port, :service, :protocol). Example: ‘cloudfront.amazonaws.com’ -
:server
: CloudFront service host, default: DEFAULT_HOST -
:port
: CloudFront service port, default: DEFAULT_PORT -
:protocol
: ‘http’ or ‘https’, default: DEFAULT_PROTOCOL -
:logger
: for log messages, default: RAILS_DEFAULT_LOGGER else STDOUT
acf = RightAws::AcfInterface.new('1E3GDYEOGFJPIT7XXXXXX','hgTHt68JY07JKUY08ftHYtERkjgtfERn57XXXXXX',
{:logger => Logger.new('/tmp/x.log')}) #=> #<RightAws::AcfInterface::0xb7b3c30c>
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/acf/right_acf_interface.rb', line 105 def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={}) init({ :name => 'ACF', :default_host => ENV['ACF_URL'] ? URI.parse(ENV['ACF_URL']).host : DEFAULT_HOST, :default_port => ENV['ACF_URL'] ? URI.parse(ENV['ACF_URL']).port : DEFAULT_PORT, :default_service => ENV['ACF_URL'] ? URI.parse(ENV['ACF_URL']).path : DEFAULT_PATH, :default_protocol => ENV['ACF_URL'] ? URI.parse(ENV['ACF_URL']).scheme : DEFAULT_PROTOCOL, :default_api_version => ENV['ACF_API_VERSION'] || API_VERSION }, aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'], aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY'], params) end |
Class Method Details
.bench_service ⇒ Object
89 90 91 |
# File 'lib/acf/right_acf_interface.rb', line 89 def self.bench_service @@bench.service end |
.bench_xml ⇒ Object
86 87 88 |
# File 'lib/acf/right_acf_interface.rb', line 86 def self.bench_xml @@bench.xml end |
Instance Method Details
#create_distribution(config) ⇒ Object Also known as: create_distribution_by_config
Create a new distribution. Returns the just created distribution or RightAws::AwsError exception.
# S3 Origin
config = { :comment => "kd: delete me please",
:s3_origin => { :dns_name => "devs-us-east.s3.amazonaws.com",
:origin_access_identity => "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
:enabled => true,
:logging => { :prefix => "kd/log/",
:bucket => "devs-us-west.s3.amazonaws.com"}}
acf.create_distribution(config) #=>
{ :status=>"InProgress",
:enabled=>true,
:caller_reference=>"201012071910051044304704",
:logging=>{:prefix=>"kd/log/", :bucket=>"devs-us-west.s3.amazonaws.com"},
:e_tag=>"ESCTG5WJCFWJK",
:location=> "https://cloudfront.amazonaws.com/2010-11-01/distribution/E3KUBANZ7N1B2",
:comment=>"kd: delete me please",
:domain_name=>"d3stykk6upgs20.cloudfront.net",
:aws_id=>"E3KUBANZ7N1B2",
:s3_origin=>
{:origin_access_identity=>"origin-access-identity/cloudfront/E3JPJZ80ZBX24G",
:dns_name=>"devs-us-east.s3.amazonaws.com"},
:last_modified_time=>"2010-12-07T16:10:07.087Z",
:in_progress_invalidation_batches=>0}
# Custom Origin
custom_config = { :comment => "kd: delete me please",
:custom_origin => { :dns_name => "custom_origin.my-site.com",
:http_port => 80,
:https_port => 443,
:origin_protocol_policy => 'match-viewer' },
:enabled => true,
:logging => { :prefix => "kd/log/",
:bucket => "my-bucket.s3.amazonaws.com"}} #=>
{ :last_modified_time=>"2010-12-08T14:23:43.522Z",
:status=>"InProgress",
:custom_origin=>
{:http_port=>"80",
:https_port=>"443",
:origin_protocol_policy=>"match-viewer",
:dns_name=>"custom_origin.my-site.com"},
:enabled=>true,
:caller_reference=>"201012081723428499167245",
:in_progress_invalidation_batches=>0,
:e_tag=>"E1ZCJ8N5E52KO6",
:location=>
"https://cloudfront.amazonaws.com/2010-11-01/distribution/EK0AJ4RMNIF2P",
:logging=>{:prefix=>"kd/log/", :bucket=>"my-bucket.s3.amazonaws.com"},
:domain_name=>"do36k7s2wxklg.cloudfront.net",
:comment=>"kd: delete me please",
:aws_id=>"EK0AJ4RMNIF2P"}
372 373 374 375 376 |
# File 'lib/acf/right_acf_interface.rb', line 372 def create_distribution(config) config[:caller_reference] ||= generate_call_reference link = generate_request('POST', 'distribution', {}, distribution_config_to_xml(config)) merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first) end |
#create_invalidation(distribution_aws_id, invalidation_batch) ⇒ Object
Create a new Invalidation batch.
acf.create_invalidation('E3LTBMK4EAQS7D', :path => ['/boot.jpg', '/kd/boot.public.1.jpg']) #=>
{:status=>"InProgress",
:create_time=>"2010-12-08T14:03:38.449Z",
:location=> "https://cloudfront.amazonaws.com/2010-11-01/distribution/E3LTBMK4EAQS7D/invalidation/I3AW9PPQS0CBKV",
:aws_id=>"I3AW9PPQS0CBKV",
:invalidation_batch=>
{:caller_reference=>"201012081703372555972012",
:path=>["/boot.jpg", "/kd/boot.public.1.jpg"]}}
74 75 76 77 78 |
# File 'lib/acf/right_acf_invalidations.rb', line 74 def create_invalidation(distribution_aws_id, invalidation_batch) invalidation_batch[:caller_reference] ||= generate_call_reference link = generate_request('POST', "/distribution/#{distribution_aws_id}/invalidation", {}, invalidation_batch_to_xml(invalidation_batch)) merge_headers(request_info(link, AcfInvalidationsListParser.new(:logger => @logger))[:invalidations].first) end |
#create_origin_access_identity(comment = '', caller_reference = nil) ⇒ Object
Create a new CloudFront Origin Access Identity.
acf.create_origin_access_identity('MyTestAccessIdentity') #=>
{:e_tag=>"E2QOKZEXCUWHJX",
:comment=>"MyTestAccessIdentity",
:location=>
"https://cloudfront.amazonaws.com/origin-access-identity/cloudfront/E3JPJZ80ZBX24G",
:caller_reference=>"201004161657467493031273",
:s3_canonical_user_id=>
"de4361b33dbaf499d3d77159bfa1571d3451eaec25a2b16553de5e534da8089bb8c31a4898d73d1a658155d0e48872a7",
:aws_id=>"E3JPJZ80ZBX24G"}
109 110 111 112 113 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 109 def create_origin_access_identity(comment='', caller_reference=nil) config = { :comment => comment, :caller_reference => caller_reference } create_origin_access_identity_by_config(config) end |
#create_origin_access_identity_by_config(config) ⇒ Object
115 116 117 118 119 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 115 def create_origin_access_identity_by_config(config) config[:caller_reference] ||= generate_call_reference link = generate_request('POST', 'origin-access-identity/cloudfront', {}, origin_access_identity_config_to_xml(config)) merge_headers(request_info(link, AcfOriginAccesIdentitiesListParser.new(:logger => @logger))[:origin_access_identities].first) end |
#create_streaming_distribution(config) ⇒ Object Also known as: create_streaming_distribution_by_config
Create a new streaming distribution. Returns the just created distribution or RightAws::AwsError exception.
acf.create_streaming_distribution('bucket-for-konstantin-00.s3.amazonaws.com', 'Woo-Hoo!', true,
['stream-1.web.my-awesome-site.net']) #=>
{:status=>"InProgress",
:caller_reference=>"201004191254412191173215",
:cnames=>["stream-1.web.my-awesome-site.net"],
:aws_id=>"E1M5LERJLU636F",
:e_tag=>"E2588L5QL4BLXH",
:enabled=>true,
:domain_name=>"s1di8imd85wgld.cloudfront.net",
:s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
:last_modified_time=>Mon Apr 19 08:54:42 UTC 2010,
:location=>
"https://cloudfront.amazonaws.com/streaming-distribution/E1M5LERJLU636F",
:comment=>"Woo-Hoo!"}
127 128 129 130 131 |
# File 'lib/acf/right_acf_streaming_interface.rb', line 127 def create_streaming_distribution(config) config[:caller_reference] ||= generate_call_reference link = generate_request('POST', 'streaming-distribution', {}, streaming_distribution_config_to_xml(config)) merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first) end |
#delete_distribution(aws_id, e_tag) ⇒ Object
Delete a distribution. The enabled distribution cannot be deleted. Returns true
on success or RightAws::AwsError exception.
acf.delete_distribution('E2REJM3VUN5RSI', 'E39OHHU1ON65SI') #=> true
481 482 483 484 485 |
# File 'lib/acf/right_acf_interface.rb', line 481 def delete_distribution(aws_id, e_tag) link = generate_request('DELETE', "distribution/#{aws_id}", {}, nil, 'If-Match' => e_tag) request_info(link, RightHttp2xxParser.new(:logger => @logger)) end |
#delete_origin_access_identity(aws_id, e_tag) ⇒ Object
Get Origin Access Identity
acf.get_origin_access_identity('E3HJ7V8C3324VF') #=>
{:comment=>"kd: TEST-2",
:caller_reference=>"201004161655035372351604",
:aws_id=>"E3HJ7V8C3324VF",
:s3_canonical_user_id=>
"9af7058b1d197c2c03fdcc3ddad07012a7822f5fc4a8156025409ffac646bdae4dc714820482c92e6988e5703c8d9954",
:e_tag=>"E309Q4IM450498"}
acf.delete_origin_access_identity("E3HJ7V8C3324VF","E309Q4IM450498") #=> true
148 149 150 151 152 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 148 def delete_origin_access_identity(aws_id, e_tag) link = generate_request('DELETE', "origin-access-identity/cloudfront/#{aws_id}", {}, nil, 'If-Match' => e_tag) request_info(link, RightHttp2xxParser.new(:logger => @logger)) end |
#delete_streaming_distribution(aws_id, e_tag) ⇒ Object
Delete a streaming distribution. The enabled distribution cannot be deleted. Returns true
on success or RightAws::AwsError exception.
acf.delete_streaming_distribution('E1M5LERJLU636F', 'E2588L5QL4BLXH') #=> true
222 223 224 225 226 |
# File 'lib/acf/right_acf_streaming_interface.rb', line 222 def delete_streaming_distribution(aws_id, e_tag) link = generate_request('DELETE', "streaming-distribution/#{aws_id}", {}, nil, 'If-Match' => e_tag) request_info(link, RightHttp2xxParser.new(:logger => @logger)) end |
#distribution_config_to_xml(config, xml_wrapper = 'DistributionConfig') ⇒ Object
:nodoc:
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/acf/right_acf_interface.rb', line 169 def distribution_config_to_xml(config, xml_wrapper='DistributionConfig') # :nodoc: cnames = logging = trusted_signers = s3_origin = custom_origin = default_root_object = '' # CNAMES unless config[:cnames].right_blank? Array(config[:cnames]).each { |cname| cnames += " <CNAME>#{cname}</CNAME>\n" } end # Logging unless config[:logging].right_blank? logging = " <Logging>\n" + " <Bucket>#{config[:logging][:bucket]}</Bucket>\n" + " <Prefix>#{config[:logging][:prefix]}</Prefix>\n" + " </Logging>\n" end unless config[:required_protocols].right_blank? required_protocols = " <RequiredProtocols>\n" + " <Protocol>#{config[:required_protocols]}</Protocol>\n" + " </RequiredProtocols>\n" else required_protocols = "" end # Default Root Object unless config[:default_root_object].right_blank? default_root_object = " <DefaultRootObject>#{config[:default_root_object]}</DefaultRootObject>\n" unless config[:default_root_object].right_blank? end # Trusted Signers unless config[:trusted_signers].right_blank? trusted_signers = " <TrustedSigners>\n" Array(config[:trusted_signers]).each do |trusted_signer| trusted_signers += if trusted_signer.to_s[/self/i] " <Self/>\n" else " <AwsAccountNumber>#{trusted_signer}</AwsAccountNumber>\n" end end trusted_signers += " </TrustedSigners>\n" end # S3Origin unless config[:s3_origin].right_blank? origin_access_identity = '' # Origin Access Identity unless config[:s3_origin][:origin_access_identity].right_blank? origin_access_identity = config[:s3_origin][:origin_access_identity] unless origin_access_identity[%r{^origin-access-identity}] origin_access_identity = "origin-access-identity/cloudfront/#{origin_access_identity}" end origin_access_identity = " <OriginAccessIdentity>#{origin_access_identity}</OriginAccessIdentity>\n" end s3_origin = " <S3Origin>\n" + " <DNSName>#{config[:s3_origin][:dns_name]}</DNSName>\n" + "#{origin_access_identity}" + " </S3Origin>\n" end # Custom Origin unless config[:custom_origin].right_blank? http_port = https_port = origin_protocol_policy = '' http_port = " <HTTPPort>#{config[:custom_origin][:http_port]}</HTTPPort>\n" unless config[:custom_origin][:http_port].right_blank? https_port = " <HTTPSPort>#{config[:custom_origin][:https_port]}</HTTPSPort>" unless config[:custom_origin][:https_port].right_blank? origin_protocol_policy = " <OriginProtocolPolicy>#{config[:custom_origin][:origin_protocol_policy]}</OriginProtocolPolicy>\n" unless config[:custom_origin][:origin_protocol_policy].right_blank? custom_origin = " <CustomOrigin>\n" + " <DNSName>#{config[:custom_origin][:dns_name]}</DNSName>\n" + "#{http_port}" + "#{https_port}" + "#{origin_protocol_policy}" + " </CustomOrigin>\n" end # XML "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<#{xml_wrapper} xmlns=\"http://#{@params[:server]}/doc/#{API_VERSION}/\">\n" + " <CallerReference>#{config[:caller_reference]}</CallerReference>\n" + " <Comment>#{AwsUtils::xml_escape(config[:comment].to_s)}</Comment>\n" + " <Enabled>#{config[:enabled]}</Enabled>\n" + s3_origin + custom_origin + default_root_object + cnames + logging + required_protocols + trusted_signers + "</#{xml_wrapper}>" end |
#generate_call_reference ⇒ Object
Helpers:
157 158 159 160 161 |
# File 'lib/acf/right_acf_interface.rb', line 157 def generate_call_reference # :nodoc: result = Time.now.strftime('%Y%m%d%H%M%S') 10.times{ result << rand(10).to_s } result end |
#generate_request(method, path, params = {}, body = nil, headers = {}) ⇒ Object
Generates request hash for REST API.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/acf/right_acf_interface.rb', line 122 def generate_request(method, path, params={}, body=nil, headers={}) # :nodoc: # Params params.delete_if{ |key, val| val.right_blank? } unless params.right_blank? path += "?" + params.to_a.collect{ |key,val| "#{AwsUtils::amz_escape(key)}=#{AwsUtils::amz_escape(val.to_s)}" }.join("&") end # Headers headers['content-type'] ||= 'text/xml' if body headers['date'] = Time.now.httpdate # Auth signature = AwsUtils::sign(@aws_secret_access_key, headers['date']) headers['Authorization'] = "AWS #{@aws_access_key_id}:#{signature}" # Request path = "#{@params[:service]}#{@params[:api_version]}/#{path}" request = "Net::HTTP::#{method.capitalize}".right_constantize.new(path) request.body = body if body # Set request headers headers.each { |key, value| request[key.to_s] = value } # prepare output hash { :request => request, :server => @params[:server], :port => @params[:port], :protocol => @params[:protocol] } end |
#get_distribution(aws_id) ⇒ Object
Get a distribution’s information. Returns a distribution’s information or RightAws::AwsError exception.
acf.get_distribution('E2REJM3VUN5RSI') #=>
{:last_modified_time=>"2010-05-19T18:54:38.242Z",
:status=>"Deployed",
:domain_name=>"dpzl38cuix402.cloudfront.net",
:caller_reference=>"201005181943052207677116",
:e_tag=>"EJSXFGM5JL8ER",
:s3_origin=>
{:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
:origin_access_identity=>
"origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
:aws_id=>"E5P8HQ3ZAZIXD",
:enabled=>false}
acf.get_distribution('E2FNSBHNVVF11E') #=>
{:e_tag=>"E1Q2DJEPTQOLJD",
:status=>"InProgress",
:last_modified_time=>"2010-04-17T17:24:25.000Z",
:cnames=>["web1.my-awesome-site.net", "web2.my-awesome-site.net"],
:aws_id=>"E2FNSBHNVVF11E",
:logging=>{:prefix=>"xlog/", :bucket=>"my-bucket.s3.amazonaws.com"},
:enabled=>true,
:active_trusted_signers=>
[{:aws_account_number=>"120288270000",
:key_pair_ids=>["APKAJTD5OHNDX0000000", "APKAIK74BJWCL0000000"]},
{:aws_account_number=>"self"},
{:aws_account_number=>"648772220000"}],
:caller_reference=>"201004171154450740700072",
:domain_name=>"d1f6lpevremt5m.cloudfront.net",
:s3_origin=>
{:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
:origin_access_identity=>
"origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
:trusted_signers=>["self", "648772220000", "120288270000"]}
416 417 418 419 |
# File 'lib/acf/right_acf_interface.rb', line 416 def get_distribution(aws_id) link = generate_request('GET', "distribution/#{aws_id}") merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first) end |
#get_distribution_config(aws_id) ⇒ Object
Get a distribution’s configuration. Returns a distribution’s configuration or RightAws::AwsError exception.
acf.get_distribution_config('E2REJM3VUN5RSI') #=>
{:caller_reference=>"201005181943052207677116",
:e_tag=>"EJSXFGM5JL8ER",
:s3_origin=>
{:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
:origin_access_identity=>
"origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
:enabled=>false}
acf.get_distribution_config('E2FNSBHNVVF11E') #=>
{:e_tag=>"E1Q2DJEPTQOLJD",
:logging=>{:prefix=>"xlog/", :bucket=>"my-bucket.s3.amazonaws.com"},
:enabled=>true,
:caller_reference=>"201004171154450740700072",
:trusted_signers=>["self", "648772220000", "120288270000"],
:s3_origin=>
{:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
:origin_access_identity=>
"origin-access-identity/cloudfront/E3JPJZ80ZBX24G"}}
444 445 446 447 |
# File 'lib/acf/right_acf_interface.rb', line 444 def get_distribution_config(aws_id) link = generate_request('GET', "distribution/#{aws_id}/config") merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first) end |
#get_invalidation(distribution_aws_id, aws_id) ⇒ Object
Get Invalidation
acf.get_invalidation('E3LTBMK4EAQS7D', 'I3AW9PPQS0CBKV') #=>
{:create_time=>"2010-12-08T14:03:38.449Z",
:status=>"InProgress",
:aws_id=>"I3AW9PPQS0CBKV",
:invalidation_batch=>
{:caller_reference=>"201012081703372555972012",
:path=>["/boot.jpg", "/kd/boot.public.1.jpg"]}}
90 91 92 93 |
# File 'lib/acf/right_acf_invalidations.rb', line 90 def get_invalidation(distribution_aws_id, aws_id) link = generate_request('GET', "distribution/#{distribution_aws_id}/invalidation/#{aws_id}") merge_headers(request_info(link, AcfInvalidationsListParser.new(:logger => @logger))[:invalidations].first) end |
#get_origin_access_identity(aws_id) ⇒ Object
Get Origin Access Identity
acf.get_origin_access_identity('E3HJ7V8C3324VF') #=>
{:comment=>"kd: TEST-2",
:caller_reference=>"201004161655035372351604",
:aws_id=>"E3HJ7V8C3324VF",
:s3_canonical_user_id=>
"9af7058b1d197c2c03fdcc3ddad07012a7822f5fc4a8156025409ffac646bdae4dc714820482c92e6988e5703c8d9954",
:e_tag=>"E309Q4IM450498"}
131 132 133 134 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 131 def get_origin_access_identity(aws_id) link = generate_request('GET', "origin-access-identity/cloudfront/#{aws_id}") merge_headers(request_info(link, AcfOriginAccesIdentitiesListParser.new(:logger => @logger))[:origin_access_identities].first) end |
#get_origin_access_identity_config(aws_id) ⇒ Object
Get Origin Access Identity config
acf.get_origin_access_identity_config("E3JPJZ80ZBX24G") #=>
{:comment=>"MyTestAccessIdentity",
:caller_reference=>"201004161657467493031273",
:e_tag=>"E2QOKZEXCUWHJX"}
173 174 175 176 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 173 def get_origin_access_identity_config(aws_id) link = generate_request('GET', "origin-access-identity/cloudfront/#{aws_id}/config") merge_headers(request_info(link, AcfOriginAccesIdentitiesListParser.new(:logger => @logger))[:origin_access_identities].first) end |
#get_streaming_distribution(aws_id) ⇒ Object
Get a streaming distribution’s information. Returns a distribution’s information or RightAws::AwsError exception.
acf.get_streaming_distribution('E3CWE2Z9USOS6B') #=>
{:status=>"Deployed",
:e_tag=>"EXTZ2SXAQT39K",
:cnames=>["stream.web.my-awesome-site.net"],
:aws_id=>"E3CWE2Z9USOS6B",
:enabled=>true,
:domain_name=>"s2jz1ourvss1fj.cloudfront.net",
:s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
:last_modified_time=>"2010-04-19T08:53:32.574Z",
:comment=>"Woo-Hoo!",
:caller_reference=>"201004191253311625537161"}
acf.get_streaming_distribution('E1M5LERJLU636F') #=>
{:trusted_signers=>["self", "648772220000", "120288270000"],
:status=>"InProgress",
:e_tag=>"E2K6XD13RCJQ6E",
:cnames=>["stream-1.web.my-awesome-site.net"],
:active_trusted_signers=>
[{:key_pair_ids=>["APKAIK74BJWCLXZUMEJA"],
:aws_account_number=>"120288270000"},
{:aws_account_number=>"self"},
{:aws_account_number=>"648772220000"}],
:aws_id=>"E1M5LERJLU636F",
:enabled=>false,
:domain_name=>"s1di8imd85wgld.cloudfront.net",
:s3_origin=> {
:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com",
:origin_access_identity=>"origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
:last_modified_time=>"2010-04-19T09:14:07.160Z",
:comment=>"Olah-lah!",
:caller_reference=>"201004191254412191173215"}
169 170 171 172 |
# File 'lib/acf/right_acf_streaming_interface.rb', line 169 def get_streaming_distribution(aws_id) link = generate_request('GET', "streaming-distribution/#{aws_id}") merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first) end |
#get_streaming_distribution_config(aws_id) ⇒ Object
Get a streaming distribution’s configuration. Returns a distribution’s configuration or RightAws::AwsError exception.
acf.get_streaming_distribution_config('E1M5LERJLU636F') #=>
{:trusted_signers=>["self", "648772220000", "120288270000"],
:e_tag=>"E2K6XD13RCJQ6E",
:cnames=>["stream-1.web.my-awesome-site.net"],
:enabled=>false,
:s3_origin=> {
:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com",
:origin_access_identity=>"origin-access-identity/cloudfront/E3JPJZ80ZBX24G",},
:comment=>"Olah-lah!",
:caller_reference=>"201004191254412191173215"}
188 189 190 191 |
# File 'lib/acf/right_acf_streaming_interface.rb', line 188 def get_streaming_distribution_config(aws_id) link = generate_request('GET', "streaming-distribution/#{aws_id}/config") merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first) end |
#incrementally_list_distributions(params = {}, &block) ⇒ Object
Incrementally list distributions.
Optional params: :marker
and :max_items
.
# get first distribution
incrementally_list_distributions(:max_items => 1) #=>
{:distributions=>
[{:status=>"Deployed",
:aws_id=>"E2Q0AOOMFNPSYL",
:s3_origin=>{:dns_name=>"example.s3.amazonaws.com"},
:domain_name=>"d1s5gmdtmafnre.6hops.net",
:comment=>"ONE LINE OF COMMENT",
:last_modified_time=>"2008-10-22T19:31:23.000Z",
:enabled=>true,
:cnames=>[]}],
:is_truncated=>true,
:max_items=>1,
:marker=>"",
:next_marker=>"E2Q0AOOMFNPSYL"}
# get max 100 distributions (the list will be restricted by a default MaxItems value ==100 )
incrementally_list_distributions
# list distributions by 10
incrementally_list_distributions(:max_items => 10) do |response|
puts response.inspect # a list of 10 distributions
true # return false if the listing should be broken otherwise use true
end
303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/acf/right_acf_interface.rb', line 303 def incrementally_list_distributions(params={}, &block) opts = {} opts['MaxItems'] = params[:max_items] if params[:max_items] opts['Marker'] = params[:marker] if params[:marker] last_response = nil loop do link = generate_request('GET', 'distribution', opts) last_response = request_info(link, AcfDistributionListParser.new(:logger => @logger)) opts['Marker'] = last_response[:next_marker] break unless block && block.call(last_response) && !last_response[:next_marker].right_blank? end last_response end |
#incrementally_list_invalidations(distribution_aws_id, params = {}, &block) ⇒ Object
Incrementally list Invalidations. Optional params: :marker
and :max_items
.
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/acf/right_acf_invalidations.rb', line 45 def incrementally_list_invalidations(distribution_aws_id, params={}, &block) opts = {} opts['MaxItems'] = params[:max_items] if params[:max_items] opts['Marker'] = params[:marker] if params[:marker] last_response = nil loop do link = generate_request('GET', "distribution/#{distribution_aws_id}/invalidation", opts) last_response = request_info(link, AcfInvalidationsListParser.new(:logger => @logger)) opts['Marker'] = last_response[:next_marker] break unless block && block.call(last_response) && !last_response[:next_marker].right_blank? end last_response end |
#incrementally_list_origin_access_identities(params = {}, &block) ⇒ Object
Incrementally list Origin Access Identities. Optional params: :marker
and :max_items
.
acf.incrementally_list_origin_access_identities(:max_items => 2) #=>
{:origin_access_identities=>
[{:comment=>"kd: TEST",
:s3_canonical_user_id=>
"c7ca36f6c5d384e60aeca02032ac748bae3c458c5322a2e279382935f1f71b16d9ac251f7f71f1ea91c37d3c214645b8",
:aws_id=>"E3TL4XWF5KTGH"},
{:comment=>"kd: TEST-2",
:s3_canonical_user_id=>
"9af7058b1d197c2c03fdcc3ddad07012a7822f5fc4a8156025409ffac646bdae4dc714820482c92e6988e5703c8d9954",
:aws_id=>"E3HJ7V8C3324VF"}],
:is_truncated=>true,
:max_items=>2,
:marker=>"",
:next_marker=>"E3HJ7V8C3324VF"}
# get max 100 origin access identities (the list will be restricted by a default MaxItems value ==100 )
incrementally_list_origin_access_identities
# list origin access identities by 10
acf.incrementally_list_origin_access_identities(:max_items => 10) do |response|
puts response.inspect # a list of 10 distributions
true # return false if the listing should be broken otherwise use true
end
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 79 def incrementally_list_origin_access_identities(params={}, &block) opts = {} opts['MaxItems'] = params[:max_items] if params[:max_items] opts['Marker'] = params[:marker] if params[:marker] last_response = nil loop do link = generate_request('GET', 'origin-access-identity/cloudfront', opts) last_response = request_info(link, AcfOriginAccesIdentitiesListParser.new(:logger => @logger)) opts['Marker'] = last_response[:next_marker] break unless block && block.call(last_response) && !last_response[:next_marker].right_blank? end last_response end |
#incrementally_list_streaming_distributions(params = {}, &block) ⇒ Object
Incrementally list streaming distributions.
Optional params: :marker
and :max_items
.
# get first streaming distribution
incrementally_list_distributions(:max_items => 1) #=>
{:marker=>"",
:next_marker=>"E3CWE2Z9USOS6B",
:distributions=>
[{:status=>"Deployed",
:cnames=>["stream.web.my-awesome-site.net"],
:aws_id=>"E3CWE2Z9USOS6B",
:enabled=>true,
:last_modified_time=>"2010-04-19T08:53:32.574Z",
:domain_name=>"s2jz1ourvss1fj.cloudfront.net",
:s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
:comment=>"Woo-Hoo!"}],
:max_items=>1,
:is_truncated=>true}
# get max 100 streaming distributions (the list will be restricted by a default MaxItems value ==100 )
incrementally_list_streaming_distributions
# list streaming distributions by 10
incrementally_list_streaming_distributions(:max_items => 10) do |response|
puts response.inspect # a list of 10 distributions
true # return false if the listing should be broken otherwise use true
end
95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/acf/right_acf_streaming_interface.rb', line 95 def incrementally_list_streaming_distributions(params={}, &block) opts = {} opts['MaxItems'] = params[:max_items] if params[:max_items] opts['Marker'] = params[:marker] if params[:marker] last_response = nil loop do link = generate_request('GET', 'streaming-distribution', opts) last_response = request_info(link, AcfDistributionListParser.new(:logger => @logger)) opts['Marker'] = last_response[:next_marker] break unless block && block.call(last_response) && !last_response[:next_marker].right_blank? end last_response end |
#invalidation_batch_to_xml(invalidation_batch) ⇒ Object
Batch
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/acf/right_acf_invalidations.rb', line 99 def invalidation_batch_to_xml(invalidation_batch) # :nodoc: paths = '' Array(invalidation_batch[:path]).each do |path| paths << " <Path>#{AwsUtils::xml_escape(path)}</Path>\n" end "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<InvalidationBatch xmlns=\"http://#{@params[:server]}/doc/#{API_VERSION}/\">\n" + " <CallerReference>#{invalidation_batch[:caller_reference]}</CallerReference>\n" + paths + "</InvalidationBatch>" end |
#list_distributions ⇒ Object
List all distributions. Returns an array of distributions or RightAws::AwsError exception.
acf.list_distributions #=>
[{:status=>"Deployed",
:domain_name=>"dgmde.6os.net",
:comment=>"ONE LINE OF COMMENT",
:last_modified_time=>"2009-06-16T16:10:02.210Z",
:s3_origin=>{:dns_name=>"example.s3.amazonaws.com"},
:aws_id=>"12Q05OOMFN7SYL",
:enabled=>true}, ... ]
265 266 267 268 269 270 271 272 |
# File 'lib/acf/right_acf_interface.rb', line 265 def list_distributions result = [] incrementally_list_distributions do |response| result += response[:distributions] true end result end |
#list_invalidations(distribution_aws_id) ⇒ Object
List Invalidations
acf.list_invalidations('E3LTBMK4EAQS7D') #=>
[{:status=>"InProgress", :aws_id=>"I3AW9PPQS0CBKV"},
{:status=>"InProgress", :aws_id=>"I1HV23N5KD3XH9"}]
33 34 35 36 37 38 39 40 |
# File 'lib/acf/right_acf_invalidations.rb', line 33 def list_invalidations(distribution_aws_id) result = [] incrementally_list_invalidations(distribution_aws_id) do |response| result += response[:invalidations] true end result end |
#list_origin_access_identities ⇒ Object
List Origin Access Identities.
acf.list_origin_access_identities #=>
[{:comment=>"kd: TEST",
:s3_canonical_user_id=>
"c7ca36f6c5d384e60aeca02032ac748bae3c458c5322a2e279382935f1f71b16d9ac251f7f71f1ea91c37d3c214645b8",
:aws_id=>"E3TL4XWF5KTGH"},
{:comment=>"kd: TEST-2",
:s3_canonical_user_id=>
"9af7058b1d197c2c03fdcc3ddad07012a7822f5fc4a8156025409ffac646bdae4dc714820482c92e6988e5703c8d9954",
:aws_id=>"E3HJ7V8C3324VF"},
{:comment=>"MyTestAccessIdentity",
:s3_canonical_user_id=>
"de4361b33dbaf499d3d77159bfa1571d3451eaec25a2b16553de5e534da8089bb8c31a4898d73d1a658155d0e48872a7",
:aws_id=>"E3JPJZ80ZBX24G"}]
43 44 45 46 47 48 49 50 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 43 def list_origin_access_identities result = [] incrementally_list_origin_access_identities do |response| result += response[:origin_access_identities] true end result end |
#list_streaming_distributions ⇒ Object
List all streaming distributions. Returns an array of distributions or RightAws::AwsError exception.
acf.list_streaming_distributions #=>
[{:status=>"Deployed",
:aws_id=>"E3CWE2Z9USOS6B",
:enabled=>true,
:domain_name=>"s2jz1ourvss1fj.cloudfront.net",
:s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
:last_modified_time=>"2010-04-19T08:53:32.574Z",
:comment=>"Woo-Hoo!",
:cnames=>["stream.web.my-awesome-site.net"]},
...
{:status=>"Deployed",
:aws_id=>"E3NPQZY4LKAYQ8",
:enabled=>true,
:domain_name=>"sw9nrsq9pudk3.cloudfront.net",
:s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
:last_modified_time=>"2010-04-19T08:59:09.600Z",
:comment=>"Woo-Hoo!",
:cnames=>["stream-6.web.my-awesome-site.net"]}]
57 58 59 60 61 62 63 64 |
# File 'lib/acf/right_acf_streaming_interface.rb', line 57 def list_streaming_distributions result = [] incrementally_list_streaming_distributions do |response| result += response[:distributions] true end result end |
#merge_headers(hash) ⇒ Object
:nodoc:
163 164 165 166 167 |
# File 'lib/acf/right_acf_interface.rb', line 163 def merge_headers(hash) # :nodoc: hash[:location] = @last_response['Location'] if @last_response['Location'] hash[:e_tag] = @last_response['ETag'] if @last_response['ETag'] hash end |
#origin_access_identity_config_to_xml(config) ⇒ Object
Config
158 159 160 161 162 163 164 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 158 def origin_access_identity_config_to_xml(config) # :nodoc: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<CloudFrontOriginAccessIdentityConfig xmlns=\"http://#{@params[:server]}/doc/#{API_VERSION}/\">\n" + " <CallerReference>#{config[:caller_reference]}</CallerReference>\n" + " <Comment>#{AwsUtils::xml_escape(config[:comment].to_s)}</Comment>\n" + "</CloudFrontOriginAccessIdentityConfig>" end |
#request_info(request, parser, &block) ⇒ Object
Sends request to Amazon and parses the response. Raises AwsError if any banana happened.
149 150 151 |
# File 'lib/acf/right_acf_interface.rb', line 149 def request_info(request, parser, &block) # :nodoc: request_info_impl(:acf_connection, @@bench, request, parser, &block) end |
#set_distribution_config(aws_id, config) ⇒ Object
Set a distribution’s configuration Returns true
on success or RightAws::AwsError exception.
config = acf.get_distribution_config('E2REJM3VUN5RSI') #=>
{:enabled => true,
:caller_reference => "200809102100536497863003",
:e_tag => "E39OHHU1ON65SI",
:cnames => ["web1.my-awesome-site.net", "web2.my-awesome-site.net"]
:comment => "Woo-Hoo!",
:s3_origin => { :dns_name => "my-bucket.s3.amazonaws.com"}}
config[:comment] = 'Olah-lah!'
config[:enabled] = false
config[:s3_origin][:origin_access_identity] = "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"
# or just
# config[:s3_origin][:origin_access_identity] = "E3JPJZ80ZBX24G"
config[:trusted_signers] = ['self', '648772220000', '120288270000']
config[:logging] = { :bucket => 'my-bucket.s3.amazonaws.com', :prefix => 'xlog/' }
acf.set_distribution_config('E2REJM3VUN5RSI', config) #=> true
470 471 472 473 474 |
# File 'lib/acf/right_acf_interface.rb', line 470 def set_distribution_config(aws_id, config) link = generate_request('PUT', "distribution/#{aws_id}/config", {}, distribution_config_to_xml(config), 'If-Match' => config[:e_tag]) request_info(link, RightHttp2xxParser.new(:logger => @logger)) end |
#set_origin_access_identity_config(aws_id, config) ⇒ Object
Set Origin Access Identity config
acf.set_origin_access_identity_config("E2QOKZEXCUWHJX",
:comment => "MyBestOriginAccessConfig",
:caller_reference => '01234567890',
:e_tag=>"E2QOKZEXCUWHJX") #=> true
P.S. This guy is not tested yet: developer.amazonwebservices.com/connect/thread.jspa?threadID=45256
187 188 189 190 191 |
# File 'lib/acf/right_acf_origin_access_identities.rb', line 187 def set_origin_access_identity_config(aws_id, config) link = generate_request('PUT', "origin-access-identity/cloudfront/#{aws_id}/config", {}, origin_access_identity_config_to_xml(config), 'If-Match' => config[:e_tag]) request_info(link, RightHttp2xxParser.new(:logger => @logger)) end |
#set_streaming_distribution_config(aws_id, config) ⇒ Object
Set a streaming distribution’s configuration Returns true
on success or RightAws::AwsError exception.
acf.get_streaming_distribution_config('E1M5LERJLU636F') #=>
{:e_tag=>"E2588L5QL4BLXH",
:cnames=>["stream-1.web.my-awesome-site.net"],
:enabled=>true,
:s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
:comment=>"Woo-Hoo!",
:caller_reference=>"201004191254412191173215"}
config[:comment] = 'Olah-lah!'
config[:enabled] = false
config[:s3_origin][:origin_access_identity] = "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"
config[:trusted_signers] = ['self', '648772220000', '120288270000']
acf.set_distribution_config('E2REJM3VUN5RSI', config) #=> true
211 212 213 214 215 |
# File 'lib/acf/right_acf_streaming_interface.rb', line 211 def set_streaming_distribution_config(aws_id, config) link = generate_request('PUT', "streaming-distribution/#{aws_id}/config", {}, streaming_distribution_config_to_xml(config), 'If-Match' => config[:e_tag]) request_info(link, RightHttp2xxParser.new(:logger => @logger)) end |
#streaming_distribution_config_to_xml(config) ⇒ Object
:nodoc:
27 28 29 |
# File 'lib/acf/right_acf_streaming_interface.rb', line 27 def streaming_distribution_config_to_xml(config) # :nodoc: distribution_config_to_xml(config, 'StreamingDistributionConfig') end |