36 lines
818 B
Ruby
36 lines
818 B
Ruby
require "devops-client/handler/handler"
|
|
require "devops-client/options/group_options"
|
|
require "json"
|
|
require "devops-client/output/groups"
|
|
|
|
class Group < Handler
|
|
|
|
output_with Output::Groups
|
|
|
|
def initialize(host, def_options={})
|
|
@host, @options = host, def_options
|
|
@options_parser = GroupOptions.new(ARGV, def_options)
|
|
end
|
|
|
|
def handle
|
|
case ARGV[1]
|
|
when "list"
|
|
@options, @args = @options_parser.parse_options_for!(:list)
|
|
list_handler(@args[2], @args[3])
|
|
output
|
|
end
|
|
end
|
|
|
|
def list_handler(provider=nil, vpc_id=nil)
|
|
r = inspect_parameters @options_parser.list_params, provider
|
|
unless r.nil?
|
|
@options_parser.invalid_list_command
|
|
abort(r)
|
|
end
|
|
p = {}
|
|
p["vpc-id"] = vpc_id unless vpc_id.nil?
|
|
@list = get("/groups/#{provider}", p)
|
|
end
|
|
|
|
end
|