32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/ec2cli/ec2-driver.rb', line 32
def execute(query, opts = {})
parsed, script_type, script = EC2::Parser.parse(query)
command = parsed.class.name.split('::').last.to_sym
case command
when :DESCRIBE_INSTANCES
describe_instances(parsed.filter)
when :DESCRIBE_IMAGES
describe_images(parsed.filter, :all => parsed.all)
when :RUN_INSTANCES
run_instainces(parsed.image_id, parsed.options)
when :START_INSTANCES
start_instainces(parsed.instances)
when :STOP_INSTANCES
stop_instainces(parsed.instances)
when :CREATE_TAGS
create_tags(parsed.filter, parsed.tags)
when :SHOW_REGIONS
EC2::Endpoint.regions
when :USE
set_endpoint_and_region(parsed.endpoint_or_region)
nil
else
raise 'must not happen'
end
end
|