2009-10-02 02:22:47 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
require File.join(File.dirname(__FILE__), '..', 'lib', 'fog')
|
|
|
|
require 'irb'
|
|
|
|
require 'yaml'
|
|
|
|
|
2009-10-15 01:03:31 -04:00
|
|
|
module AWS
|
|
|
|
class << self
|
2009-11-22 17:53:29 -05:00
|
|
|
if Fog.credentials[:aws_access_key_id] && Fog.credentials[:aws_secret_access_key]
|
2009-10-08 02:45:33 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
@@ec2 = Fog::AWS::EC2.new(
|
2009-11-22 17:53:29 -05:00
|
|
|
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
|
|
|
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
|
2009-10-15 16:45:14 -04:00
|
|
|
)
|
2009-10-02 02:22:47 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
@@s3 = Fog::AWS::S3.new(
|
2009-11-22 17:53:29 -05:00
|
|
|
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
|
|
|
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
|
2009-10-15 16:45:14 -04:00
|
|
|
)
|
2009-10-08 02:45:33 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
def addresses
|
|
|
|
@@ec2.addresses
|
|
|
|
end
|
2009-10-02 02:22:47 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
def buckets
|
|
|
|
@@s3.buckets
|
|
|
|
end
|
2009-10-09 02:01:09 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
def instances
|
|
|
|
@@ec2.instances
|
|
|
|
end
|
2009-10-08 02:45:33 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
def key_pairs
|
|
|
|
@@ec2.key_pairs
|
|
|
|
end
|
2009-10-08 02:45:33 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
def security_groups
|
|
|
|
@@ec2.security_groups
|
|
|
|
end
|
2009-10-15 01:03:31 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
def snapshots
|
|
|
|
@@ec2.snapshots
|
|
|
|
end
|
2009-10-15 01:03:31 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
def volumes
|
|
|
|
@@ec2.volumes
|
|
|
|
end
|
2009-10-15 01:03:31 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
end
|
2009-10-15 01:03:31 -04:00
|
|
|
end
|
2009-10-08 02:45:33 -04:00
|
|
|
end
|
|
|
|
|
2009-10-15 01:03:31 -04:00
|
|
|
module Rackspace
|
|
|
|
class << self
|
2009-11-22 17:53:29 -05:00
|
|
|
if Fog.credentials[:rackspace_api_key] && Fog.credentials[:rackspace_username]
|
2009-10-15 01:03:31 -04:00
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
@@servers = Fog::Rackspace::Servers.new(
|
2009-11-22 17:53:29 -05:00
|
|
|
:rackspace_api_key => Fog.credentials[:rackspace_api_key],
|
|
|
|
:rackspace_username => Fog.credentials[:rackspace_username]
|
2009-10-15 16:45:14 -04:00
|
|
|
)
|
2009-10-15 01:03:31 -04:00
|
|
|
|
2009-11-19 11:19:46 -05:00
|
|
|
def flavors
|
|
|
|
@@servers.flavors
|
|
|
|
end
|
|
|
|
|
|
|
|
def images
|
|
|
|
@@servers.images
|
|
|
|
end
|
|
|
|
|
2009-10-15 16:45:14 -04:00
|
|
|
def servers
|
|
|
|
@@servers.servers
|
|
|
|
end
|
|
|
|
|
2009-10-15 01:03:31 -04:00
|
|
|
end
|
|
|
|
end
|
2009-10-08 02:45:33 -04:00
|
|
|
end
|
|
|
|
|
2009-10-02 02:22:47 -04:00
|
|
|
ARGV.clear # Avoid passing args to IRB
|
|
|
|
IRB.setup(nil)
|
|
|
|
@irb = IRB::Irb.new(nil)
|
|
|
|
IRB.conf[:MAIN_CONTEXT] = @irb.context
|
|
|
|
@irb.context.workspace = IRB::WorkSpace.new(binding)
|
|
|
|
catch(:IRB_EXIT) { @irb.eval_input }
|