Class: Cumulus::VPC::Commands

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

Class Method Summary collapse

Methods inherited from Common::Commands

banner_message, format_message, help_message, manager_name, parse, usage_message, verify

Class Method Details

.command_detailsObject



6
7
8
9
10
11
12
13
14
# File 'lib/vpc/Commands.rb', line 6

def self.command_details
  format_message [
    ["diff", "print out differences between local configuration and AWS (supplying the name of the VPC will diff only that VPC)"],
    ["list", "list the locally defined VPCs"],
    ["sync", "sync local VPC definitions with AWS (supplying the name of the VPC will sync only that VPC)"],
    ["migrate", "migrate AWS configuration to Cumulus"],
    ["rename", "renames a cumulus asset and all references to it"],
  ]
end

.execute(arguments) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/vpc/Commands.rb', line 25

def self.execute(arguments)
  if arguments[0] == "diff" and arguments.size == 2
    manager.diff_one(arguments[1])
  elsif arguments[0] == "sync" and arguments.size == 2
    manager.sync_one(arguments[1])
  elsif arguments[0] == "rename"
    if arguments.size == 5
      manager.rename(arguments[1], arguments[2], arguments[3])
    else
      puts "Usage: cumulus vpc rename [network-acl|policy|route-table|subnet|vpc] <old-asset-name> <new-asset-name>"
    end
  else
    manager.method(arguments[0]).call
  end
end

.managerObject



16
17
18
19
# File 'lib/vpc/Commands.rb', line 16

def self.manager
  require "vpc/manager/Manager"
  Cumulus::VPC::Manager.new
end

.valid_optionsObject



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

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