Method: Aws::AcfInterface#create_distribution

Defined in:
lib/acf/acf_interface.rb

#create_distribution(origin, comment = '', enabled = true, cnames = [], caller_reference = nil, default_root_object = nil) ⇒ Object

Create a new distribution. Returns the just created distribution or Aws::AwsError exception.

acf.create_distribution('bucket-for-k-dzreyev.s3.amazonaws.com', 'Woo-Hoo!', true, ['web1.my-awesome-site.net'] ) #=>
  {:comment            => "Woo-Hoo!",
   :enabled            => true,
   :location           => "https://cloudfront.amazonaws.com/2008-06-30/distribution/E2REJM3VUN5RSI",
   :status             => "InProgress",
   :aws_id             => "E2REJM3VUN5RSI",
   :domain_name        => "d3dxv71tbbt6cd.6hops.net",
   :origin             => "my-bucket.s3.amazonaws.com",
   :cnames             => ["web1.my-awesome-site.net"]
   :last_modified_time => Wed Sep 10 17:00:54 UTC 2008,
   :caller_reference   => "200809102100536497863003"}


229
230
231
232
233
# File 'lib/acf/acf_interface.rb', line 229

def create_distribution(origin, comment='', enabled=true, cnames=[], caller_reference=nil, default_root_object=nil)
  body         = distribution_config_for(origin, comment, enabled, cnames, caller_reference, false, default_root_object)
  request_hash = generate_request('POST', 'distribution', body.strip)
  merge_headers(request_info(request_hash, AcfDistributionParser.new))
end