Method: Cfdef::Driver#create_distribution

Defined in:
lib/cfdef/driver.rb

#create_distribution(dist_id, distribution) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cfdef/driver.rb', line 10

def create_distribution(dist_id, distribution)
  log(:info, "Create Distribution `#{dist_id}`", color: :cyan)

  unless @options[:dry_run]
    caller_reference = "#{dist_id} #{SecureRandom.uuid}"

    params = {
      distribution_config: {
        caller_reference: caller_reference,
      }.merge(distribution),
    }

    resp = @client.create_distribution(params)

    log(:info, "Distribution `#{resp.distribution.id}` has been created", color: :cyan)
  end
end