awscli 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- metadata +5 -53
- data/README.rdoc +0 -5
- data/Rakefile +0 -44
- data/bin/awscli +0 -32
- data/features/awscli.feature +0 -8
- data/features/step_definitions/awscli_steps.rb +0 -6
- data/features/support/env.rb +0 -15
- data/lib/awscli.rb +0 -44
- data/lib/awscli/cli.rb +0 -21
- data/lib/awscli/cli/ec2.rb +0 -23
- data/lib/awscli/cli/ec2/ami.rb +0 -46
- data/lib/awscli/cli/ec2/ebs.rb +0 -85
- data/lib/awscli/cli/ec2/eip.rb +0 -56
- data/lib/awscli/cli/ec2/instances.rb +0 -195
- data/lib/awscli/cli/ec2/keypairs.rb +0 -60
- data/lib/awscli/cli/ec2/monitoring.rb +0 -35
- data/lib/awscli/cli/ec2/placement.rb +0 -42
- data/lib/awscli/cli/ec2/reservedinstmng.rb +0 -45
- data/lib/awscli/cli/ec2/secgroups.rb +0 -66
- data/lib/awscli/cli/ec2/spot.rb +0 -81
- data/lib/awscli/cli/ec2/subnet.rb +0 -43
- data/lib/awscli/cli/ec2/tags.rb +0 -45
- data/lib/awscli/cli/ec2/vmmng.rb +0 -17
- data/lib/awscli/cli/ec2/vpc.rb +0 -42
- data/lib/awscli/cli/ec2/vpc/connections.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/cust_gateways.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/dhcp.rb +0 -51
- data/lib/awscli/cli/ec2/vpc/internet_gateways.rb +0 -58
- data/lib/awscli/cli/ec2/vpc/net_interfaces.rb +0 -75
- data/lib/awscli/cli/ec2/vpc/network_acls.rb +0 -29
- data/lib/awscli/cli/ec2/vpc/priv_gatewats.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/route_tables.rb +0 -0
- data/lib/awscli/cli/s3.rb +0 -12
- data/lib/awscli/cli/s3/directories.rb +0 -82
- data/lib/awscli/cli/s3/files.rb +0 -77
- data/lib/awscli/connection.rb +0 -55
- data/lib/awscli/ec2.rb +0 -790
- data/lib/awscli/errors.rb +0 -64
- data/lib/awscli/helper.rb +0 -8
- data/lib/awscli/s3.rb +0 -108
- data/lib/awscli/version.rb +0 -3
- data/test/default_test.rb +0 -14
- data/test/test_helper.rb +0 -9
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzJlN2M3MjNkZTMxMjM5ZmFhYTUwNTBjNTczMmQ5ZjI4NGY2MjllYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmVhNDhiZjMxNjM0YTIzM2ZhNzFlMDY3NTg0MTEwMzE3ZGUxZDI5NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGFlZTc5NzczMmFiNzU5Mzc2Y2E3M2U5OGQxODE5MWI4MjJkMjJhZDk2ZWNj
|
10
|
+
YjJiNWVjNmUzY2RiOTllNzZmOTQzNDEwM2ViNjA3ODFiMzA3NzlkZjgyZGUy
|
11
|
+
OTQ3MzlkMzFhMDI5OGI3MjU4M2RlZjU3ZjlkNzM1ODc2YjMwMzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjY0MjU4YzFiYmUwYjJlNjgyNzYxNzdjYzc0ZDVkZGVjNGI2ZWY5NTcxOWRj
|
14
|
+
MmI2ODMzM2EyYWM3NzM2YjljZTJiYzE0N2RhMDkxZDUzZTlkODMzMzAzOGQ5
|
15
|
+
NWQwYjI0YTZlYmZhM2M3NTc2NDNjNzQxNDgwMzEwMjhjMTBhZmM=
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awscli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashrith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -97,53 +97,10 @@ dependencies:
|
|
97
97
|
description: Command Line Interface for Amazon Web Services built in Ruby, using Fog
|
98
98
|
and Thor, This gem is still in development.
|
99
99
|
email: ashrith@me.com
|
100
|
-
executables:
|
101
|
-
- awscli
|
100
|
+
executables: []
|
102
101
|
extensions: []
|
103
102
|
extra_rdoc_files: []
|
104
|
-
files:
|
105
|
-
- Rakefile
|
106
|
-
- bin/awscli
|
107
|
-
- lib/awscli/cli/ec2/ami.rb
|
108
|
-
- lib/awscli/cli/ec2/ebs.rb
|
109
|
-
- lib/awscli/cli/ec2/eip.rb
|
110
|
-
- lib/awscli/cli/ec2/instances.rb
|
111
|
-
- lib/awscli/cli/ec2/keypairs.rb
|
112
|
-
- lib/awscli/cli/ec2/monitoring.rb
|
113
|
-
- lib/awscli/cli/ec2/placement.rb
|
114
|
-
- lib/awscli/cli/ec2/reservedinstmng.rb
|
115
|
-
- lib/awscli/cli/ec2/secgroups.rb
|
116
|
-
- lib/awscli/cli/ec2/spot.rb
|
117
|
-
- lib/awscli/cli/ec2/subnet.rb
|
118
|
-
- lib/awscli/cli/ec2/tags.rb
|
119
|
-
- lib/awscli/cli/ec2/vmmng.rb
|
120
|
-
- lib/awscli/cli/ec2/vpc/connections.rb
|
121
|
-
- lib/awscli/cli/ec2/vpc/cust_gateways.rb
|
122
|
-
- lib/awscli/cli/ec2/vpc/dhcp.rb
|
123
|
-
- lib/awscli/cli/ec2/vpc/internet_gateways.rb
|
124
|
-
- lib/awscli/cli/ec2/vpc/net_interfaces.rb
|
125
|
-
- lib/awscli/cli/ec2/vpc/network_acls.rb
|
126
|
-
- lib/awscli/cli/ec2/vpc/priv_gatewats.rb
|
127
|
-
- lib/awscli/cli/ec2/vpc/route_tables.rb
|
128
|
-
- lib/awscli/cli/ec2/vpc.rb
|
129
|
-
- lib/awscli/cli/ec2.rb
|
130
|
-
- lib/awscli/cli/s3/directories.rb
|
131
|
-
- lib/awscli/cli/s3/files.rb
|
132
|
-
- lib/awscli/cli/s3.rb
|
133
|
-
- lib/awscli/cli.rb
|
134
|
-
- lib/awscli/connection.rb
|
135
|
-
- lib/awscli/ec2.rb
|
136
|
-
- lib/awscli/errors.rb
|
137
|
-
- lib/awscli/helper.rb
|
138
|
-
- lib/awscli/s3.rb
|
139
|
-
- lib/awscli/version.rb
|
140
|
-
- lib/awscli.rb
|
141
|
-
- test/default_test.rb
|
142
|
-
- test/test_helper.rb
|
143
|
-
- README.rdoc
|
144
|
-
- features/awscli.feature
|
145
|
-
- features/step_definitions/awscli_steps.rb
|
146
|
-
- features/support/env.rb
|
103
|
+
files: []
|
147
104
|
homepage: http://github.com/ashrithr/awscli
|
148
105
|
licenses: []
|
149
106
|
metadata: {}
|
@@ -174,9 +131,4 @@ signing_key:
|
|
174
131
|
specification_version: 4
|
175
132
|
summary: Command Line Interface for Amazon Web Services built in Ruby, using Fog and
|
176
133
|
Thor
|
177
|
-
test_files:
|
178
|
-
- features/awscli.feature
|
179
|
-
- features/step_definitions/awscli_steps.rb
|
180
|
-
- features/support/env.rb
|
181
|
-
- test/default_test.rb
|
182
|
-
- test/test_helper.rb
|
134
|
+
test_files: []
|
data/README.rdoc
DELETED
data/Rakefile
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'rake/clean'
|
2
|
-
require 'rubygems'
|
3
|
-
require 'rubygems/package_task'
|
4
|
-
require 'rdoc/task'
|
5
|
-
require 'cucumber'
|
6
|
-
require 'cucumber/rake/task'
|
7
|
-
Rake::RDocTask.new do |rd|
|
8
|
-
rd.main = "README.rdoc"
|
9
|
-
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
-
rd.title = 'Your application title'
|
11
|
-
end
|
12
|
-
|
13
|
-
spec = eval(File.read('awscli.gemspec'))
|
14
|
-
|
15
|
-
Gem::PackageTask.new(spec) do |pkg|
|
16
|
-
end
|
17
|
-
CUKE_RESULTS = 'results.html'
|
18
|
-
CLEAN << CUKE_RESULTS
|
19
|
-
desc 'Run features'
|
20
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
-
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
-
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
-
t.cucumber_opts = opts
|
24
|
-
t.fork = false
|
25
|
-
end
|
26
|
-
|
27
|
-
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
-
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
-
tag_opts = ' --tags ~@pending'
|
30
|
-
tag_opts = ' --tags @wip'
|
31
|
-
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
-
t.fork = false
|
33
|
-
end
|
34
|
-
|
35
|
-
task :cucumber => :features
|
36
|
-
task 'cucumber:wip' => 'features:wip'
|
37
|
-
task :wip => 'features:wip'
|
38
|
-
require 'rake/testtask'
|
39
|
-
Rake::TestTask.new do |t|
|
40
|
-
t.libs << "test"
|
41
|
-
t.test_files = FileList['test/*_test.rb']
|
42
|
-
end
|
43
|
-
|
44
|
-
task :default => [:test,:features]
|
data/bin/awscli
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#Trap interupt to quit cleanly
|
4
|
-
Signal.trap("INT") { exit 1 }
|
5
|
-
|
6
|
-
#load the path if not loaded previously
|
7
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') unless $LOAD_PATH.include?(File.dirname(__FILE__) + '/../lib')
|
8
|
-
|
9
|
-
begin
|
10
|
-
require "awscli"
|
11
|
-
rescue LoadError
|
12
|
-
require "rubygems"
|
13
|
-
require "awscli"
|
14
|
-
end
|
15
|
-
|
16
|
-
#Start the cli
|
17
|
-
begin
|
18
|
-
AwsCli::Cli.start
|
19
|
-
rescue Interrupt
|
20
|
-
puts "Caught Interrupt, Exiting..."
|
21
|
-
rescue Excon::Errors::SocketError => e
|
22
|
-
puts "Error: Establishing Connection to AWS, #{e}"
|
23
|
-
rescue Fog::Compute::AWS::Error
|
24
|
-
puts "Error: #{$!}"
|
25
|
-
rescue Fog::Compute::AWS::NotFound
|
26
|
-
puts "Cannot find Resource: #{$!}"
|
27
|
-
rescue Excon::Errors::InternalServerError
|
28
|
-
puts "Something went wrong, please try again!."
|
29
|
-
puts "Error: #{$!}"
|
30
|
-
rescue ArgumentError => e
|
31
|
-
puts "Cannot recognize the argument passed, #{e}"
|
32
|
-
end
|
data/features/awscli.feature
DELETED
data/features/support/env.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'aruba/cucumber'
|
2
|
-
|
3
|
-
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
-
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
-
|
6
|
-
Before do
|
7
|
-
# Using "announce" causes massive warnings on 1.9.2
|
8
|
-
@puts = true
|
9
|
-
@original_rubylib = ENV['RUBYLIB']
|
10
|
-
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
-
end
|
12
|
-
|
13
|
-
After do
|
14
|
-
ENV['RUBYLIB'] = @original_rubylib
|
15
|
-
end
|
data/lib/awscli.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
#external dependencies
|
2
|
-
begin
|
3
|
-
require 'thor'
|
4
|
-
require 'thor/group'
|
5
|
-
require 'fog'
|
6
|
-
require 'highline'
|
7
|
-
require 'yaml'
|
8
|
-
rescue LoadError
|
9
|
-
puts "Failed to load gems: fog, highline, thor"
|
10
|
-
exit 1
|
11
|
-
end
|
12
|
-
|
13
|
-
module AwsCli
|
14
|
-
# => require all interfaces for awscli/
|
15
|
-
require 'awscli/version.rb' #to get version
|
16
|
-
require 'awscli/errors'
|
17
|
-
|
18
|
-
# => first require cli so all subcommands can register
|
19
|
-
require 'awscli/cli'
|
20
|
-
# => register all subcommands
|
21
|
-
#EC2
|
22
|
-
require 'awscli/cli/ec2'
|
23
|
-
require 'awscli/cli/ec2/instances'
|
24
|
-
require 'awscli/cli/ec2/ami'
|
25
|
-
require 'awscli/cli/ec2/ebs'
|
26
|
-
require 'awscli/cli/ec2/eip'
|
27
|
-
require 'awscli/cli/ec2/keypairs'
|
28
|
-
require 'awscli/cli/ec2/monitoring'
|
29
|
-
require 'awscli/cli/ec2/placement'
|
30
|
-
require 'awscli/cli/ec2/reservedinstmng'
|
31
|
-
require 'awscli/cli/ec2/secgroups'
|
32
|
-
require 'awscli/cli/ec2/spot'
|
33
|
-
require 'awscli/cli/ec2/tags'
|
34
|
-
require 'awscli/cli/ec2/vmmng'
|
35
|
-
require 'awscli/cli/ec2/vpc'
|
36
|
-
require 'awscli/cli/ec2/vpc/network_acls'
|
37
|
-
require 'awscli/cli/ec2/vpc/net_interfaces'
|
38
|
-
require 'awscli/cli/ec2/vpc/internet_gateways'
|
39
|
-
require 'awscli/cli/ec2/vpc/dhcp'
|
40
|
-
#S3
|
41
|
-
require 'awscli/cli/s3'
|
42
|
-
require 'awscli/cli/s3/files'
|
43
|
-
require 'awscli/cli/s3/directories'
|
44
|
-
end
|
data/lib/awscli/cli.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module AwsCli
|
2
|
-
#This it the main cli runner class
|
3
|
-
#All class_methods should be defined here except for Thor::Groups
|
4
|
-
class Cli < ::Thor
|
5
|
-
|
6
|
-
default_task :help_banner #if no option is passed call help_banner task
|
7
|
-
# class_option :config, :banner => "PATH", :type => :string,
|
8
|
-
# :desc => 'Configuration file, accepts ENV $AWSCLI_CONFIG_FILE',
|
9
|
-
# :default => ENV['AWSCLI_CONFIG_FILE'] || "~/.awscli.yml"
|
10
|
-
|
11
|
-
desc "help", "help banner"
|
12
|
-
def help_banner
|
13
|
-
puts <<-HELP.gsub(/^ {8}/, '')
|
14
|
-
Amazon Web Services Command Line Interface, Version - #{Awscli::VERSION}
|
15
|
-
|
16
|
-
HELP
|
17
|
-
help #call help
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
data/lib/awscli/cli/ec2.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module AwsCli
|
2
|
-
module CLI
|
3
|
-
require 'awscli/cli'
|
4
|
-
require 'awscli/connection'
|
5
|
-
require 'awscli/ec2'
|
6
|
-
class Ec2 < Thor
|
7
|
-
|
8
|
-
class_option :region, :type => :string, :desc => "region to connect to", :default => 'us-west-1'
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def create_ec2_object
|
13
|
-
puts "ec2 Establishing Connetion..."
|
14
|
-
$ec2_conn = Awscli::Connection.new.request_ec2
|
15
|
-
puts $ec2_conn
|
16
|
-
puts "ec2 Establishing Connetion... OK"
|
17
|
-
@ec2 = Awscli::EC2::EC2.new($ec2_conn)
|
18
|
-
end
|
19
|
-
|
20
|
-
AwsCli::Cli.register AwsCli::CLI::Ec2, :ec2, 'ec2 [COMMAND]', 'Elastic Cloud Compute Interface'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/awscli/cli/ec2/ami.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
module AwsCli
|
2
|
-
module CLI
|
3
|
-
module EC2
|
4
|
-
require 'awscli/cli/ec2'
|
5
|
-
class Ami < Thor
|
6
|
-
|
7
|
-
desc "list", "List Images"
|
8
|
-
method_option :filter, :aliases => "-f", :type => :hash, :desc => "filter the images based on filters"
|
9
|
-
method_option :amazon_owned, :aliases => "-a", :type => :boolean, :default => false, :desc => "lists amazon owned images"
|
10
|
-
method_option :show_filters, :aliases => "-s", :type => :boolean, :default => false, :desc => "filters available"
|
11
|
-
def list
|
12
|
-
create_ec2_object
|
13
|
-
if options[:amazon_owned]
|
14
|
-
@ec2.list_amazon
|
15
|
-
elsif options[:show_filters]
|
16
|
-
@ec2.show_filters
|
17
|
-
else
|
18
|
-
@ec2.list options[:filter]
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "create", "Create a bootable EBS volume AMI, from instance specified"
|
23
|
-
method_option :instance_id, :aliases => "-i", :type => :string, :required => true, :desc => "Instance used to create image"
|
24
|
-
method_option :name, :aliases => "-n", :type => :string, :default => "awscli_image_#{Time.now.to_i}", :desc => "Name to give image"
|
25
|
-
method_option :desc, :aliases => "-d", :type => :string, :default => "awscli_image-created_at-#{Time.now.to_i}", :desc => "Description of image"
|
26
|
-
method_option :no_reboot, :aliases => "-r", :type => :boolean, :default => false, :desc => "Optional, whether or not to reboot the image when making the snapshot"
|
27
|
-
def create
|
28
|
-
create_ec2_object
|
29
|
-
@ec2.create_image_from_instance options
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def create_ec2_object
|
35
|
-
puts "ec2 Establishing Connetion..."
|
36
|
-
$ec2_conn = Awscli::Connection.new.request_ec2
|
37
|
-
puts "ec2 Establishing Connetion... OK"
|
38
|
-
@ec2 = Awscli::EC2::Ami.new($ec2_conn)
|
39
|
-
end
|
40
|
-
|
41
|
-
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::Ami, :ami, 'ami [COMMAND]', 'EC2 AMI Management'
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/awscli/cli/ec2/ebs.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
module AwsCli
|
2
|
-
module CLI
|
3
|
-
module EC2
|
4
|
-
require 'awscli/cli/ec2'
|
5
|
-
class Ebs < Thor
|
6
|
-
|
7
|
-
desc "list", "List ELastic Block Storages"
|
8
|
-
method_option :snapshots, :aliases => "-s", :type => :boolean, :default => false, :desc => "list snapshots"
|
9
|
-
def list
|
10
|
-
create_ec2_object
|
11
|
-
@ec2.list options
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "create", "Create a EBS Volume"
|
15
|
-
method_option :availability_zone, :aliases => "-z", :required => true, :banner => "ZONE", :type => :string, :desc => "Name of the availability zone to create the voulume in"
|
16
|
-
method_option :size, :aliases => "-s", :required => true, :type => :numeric, :desc => "Size of the volume to create (in GB)"
|
17
|
-
method_option :snapshot_id, :aliases => "-i", :banner => "ID", :type => :string, :desc => "Snapshot ID from which to create volume from"
|
18
|
-
method_option :device, :aliases => "-d", :type => :string, :desc => "how the volume is exposed(in unix '/dev/sdx', in windows 'xvdf')"
|
19
|
-
def create
|
20
|
-
create_ec2_object
|
21
|
-
@ec2.create options
|
22
|
-
end
|
23
|
-
|
24
|
-
desc "attach_volume", "Attach a volume to instance"
|
25
|
-
method_option :instance_id, :aliases => "-i", :banner => "ID", :type => :string, :desc => "instance id to attach the volume to"
|
26
|
-
method_option :volume_id, :aliases => "-v", :banner => "VID", :type => :string, :desc => "volume id to attach"
|
27
|
-
method_option :device, :aliases => "-d", :type => :string, :desc => "how the volume is exposed(in unix '/dev/sdx', in windows 'xvdf')"
|
28
|
-
def attach_volume
|
29
|
-
create_ec2_object
|
30
|
-
@ec2.attach_volume options
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "detach_voulme", "Detach a volume from instance"
|
34
|
-
method_option :volume_id, :aliases => "-v", :banner => "VID", :type => :string, :desc => "volume id to attach"
|
35
|
-
method_option :force, :aliase => "-f", :type => :boolean, :default => false, :desc => "force detaches the volume"
|
36
|
-
def detach_volume
|
37
|
-
create_ec2_object
|
38
|
-
@ec2.detach_volume options
|
39
|
-
end
|
40
|
-
|
41
|
-
desc "delete", "Delete Volume"
|
42
|
-
method_option :volume_id, :aliases => "-v", :banner => "VID", :required => true, :type => :string, :desc => "volume id to delete"
|
43
|
-
def delete
|
44
|
-
#ask if the user is sure about deleting the volume which leads to data loss or can make a snapshot before deleting it
|
45
|
-
create_ec2_object
|
46
|
-
@ec2.delete_volume options
|
47
|
-
end
|
48
|
-
|
49
|
-
desc "create_snapshot", "Create a snapshot from volume"
|
50
|
-
method_option :volume_id, :aliases => "-v", :banner => "VID", :required => true, :type => :string, :desc => "volume to make a snapshot from"
|
51
|
-
def create_snapshot
|
52
|
-
create_ec2_object
|
53
|
-
@ec2.create_snapshot
|
54
|
-
end
|
55
|
-
|
56
|
-
desc "copy_snapshot", "Copy a snapshot to a different region"
|
57
|
-
method_option :source_region, :aliases => "-s", :banner => "REGION", :required => true, :type => :string, :desc => "Region to move it from"
|
58
|
-
method_option :snapshot_id, :aliases => "-i", :banner => "ID", :required => true, :type => :string, :desc => "Id of the snapshot"
|
59
|
-
def copy_snapshot
|
60
|
-
create_ec2_object
|
61
|
-
@ec2.copy_snapshot
|
62
|
-
end
|
63
|
-
|
64
|
-
desc "delete_snapshot", "Delete SnapShot"
|
65
|
-
method_option :snapshot_id, :aliases => "-i", :banner => "ID", :required => true, :type => :string, :desc => "Snapshot Id to delete"
|
66
|
-
def delete_snapshot
|
67
|
-
create_ec2_object
|
68
|
-
@ec2.delete_snapshot options
|
69
|
-
end
|
70
|
-
|
71
|
-
private
|
72
|
-
|
73
|
-
def create_ec2_object
|
74
|
-
puts "ec2 Establishing Connetion..."
|
75
|
-
$ec2_conn = Awscli::Connection.new.request_ec2
|
76
|
-
puts "ec2 Establishing Connetion... OK"
|
77
|
-
@ec2 = Awscli::EC2::Ebs.new($ec2_conn)
|
78
|
-
end
|
79
|
-
|
80
|
-
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::Ebs, :ebs, 'ebs [COMMAND]', 'EC2 EBS Management'
|
81
|
-
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|