Class: Cumulus::CloudFront::Commands

Inherits:
Cumulus::Common::Commands show all
Defined in:
lib/cloudfront/Commands.rb

Class Method Summary collapse

Methods inherited from Cumulus::Common::Commands

format_message, help_message, manager_name, parse, usage_message, verify

Class Method Details



6
7
8
9
10
11
# File 'lib/cloudfront/Commands.rb', line 6

def self.banner_message
  format_message [
    "cloudfront: Manage CloudFront",
    "\tDiff and sync CloudFront configuration with AWS.",
  ]
end

.command_detailsObject



13
14
15
16
17
18
19
20
21
# File 'lib/cloudfront/Commands.rb', line 13

def self.command_details
  format_message [
    ["diff", "print out differences between local configuration and AWS (supplying the id of the distribution will diff only that distribution)"],
    ["invalidate", "create an invalidation.  Must supply the name of the invalidation to run.  Specifying 'list' as an argument lists the local invalidation configurations"],
    ["list", "list the locally defined distributions"],
    ["migrate", "produce Cumulus CloudFront distribution configuration from current AWS configuration"],
    ["sync", "sync local cloudfront distribution configuration with AWS (supplying the id of the distribution will sync only that distribution)"],
  ]
end

.execute(arguments) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/cloudfront/Commands.rb', line 32

def self.execute(arguments)
  if arguments[0] == "invalidate"
    if arguments.size != 2
      puts "Specify one invalidation to run"
      exit
    else
      if arguments[1] == "list"
        manager.list_invalidations
      else
        manager.invalidate(arguments[1])
      end
    end
  else
    super(arguments)
  end
end

.managerObject



23
24
25
26
# File 'lib/cloudfront/Commands.rb', line 23

def self.manager
  require "cloudfront/manager/Manager"
  Cumulus::CloudFront::Manager.new
end

.valid_optionsObject



28
29
30
# File 'lib/cloudfront/Commands.rb', line 28

def self.valid_options
  [["diff", "invalidate", "list", "migrate", "sync"]]
end