Class: Cumulus::EC2::Commands

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

Class Method Summary collapse

Methods inherited from Common::Commands

banner_message, format_message, help_message, manager, parse, usage_message, verify

Class Method Details

.command_detailsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ec2/Commands.rb', line 6

def self.command_details
  format_message([
    "ebs - Manage EBS volumes in groups",
    ["diff", "get a list of groups that have different definitions locally than in AWS (supplying the name of the group will diff only that group)"],
    ["list", "list the groups defined in configuration"],
    ["migrate", "create group configuration files that match the definitions in AWS"],
    ["sync", "sync the local group definition with AWS (supplying the name of the group will sync only that group). Also creates volumes in a group"],
    "instances - Manage EC2 instances",
    ["diff", "get a list of instances that have different definitions locally than in AWS (supplying the name of the instance will diff only that instance)"],
    ["list", "list the instances defined in configuration"],
    ["migrate", "create instances configuration files that match the definitions in AWS"],
    ["sync", "sync the local instance definition with AWS (supplying the name of the instance will sync only that instance)"],
  ], indent: 1)
end

.execute(arguments) ⇒ Object



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

def self.execute(arguments)
  manager = if arguments[0] == "ebs"
    require "ec2/managers/EbsManager"
    Cumulus::EC2::EbsManager.new
  elsif arguments[0] == "instances"
    require "ec2/managers/InstanceManager"
    Cumulus::EC2::InstanceManager.new
  else
    nil
  end

  if arguments[1] == "diff" and arguments.size == 3
    manager.diff_one(arguments[2])
  elsif arguments[1] == "sync" and arguments.size == 3
    manager.sync_one(arguments[2])
  else
    manager.method(arguments[1]).call
  end
end

.manager_nameObject



21
22
23
# File 'lib/ec2/Commands.rb', line 21

def self.manager_name
  "ec2"
end

.valid_optionsObject



25
26
27
# File 'lib/ec2/Commands.rb', line 25

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