awscli 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/awscli.rb +1 -0
- data/lib/awscli/cli/ec2/vpc/route_tables.rb +85 -0
- data/lib/awscli/ec2.rb +50 -0
- data/lib/awscli/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGQ0YjU3MDljNjk3NTg4OTViOTcwYTNjZjdkMjk5ZjAwOTc0NjVmOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTA0ZGIyNDZjN2RhMWU2M2IzM2YwMTk2ZDdjNThiZjY1ZDM0YWQ0NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDVlNGJlOWU5ZmY5MjQ2MjQ0OTFiZTYyMDQyZDA4MDk0YWRlNDA4ODAzZjc2
|
10
|
+
OWM5MGNlNmI3NWRjNGRiYjcwYmZiOTk0Y2VjMWUyYTU4NjhmNzFhZWZhN2Vk
|
11
|
+
MWI1NTQ3YTMzNGQxOWE3YjFmZjFiYTEyYjQ2YTFlYjFmMWNlZWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTRmZDFhZGVhNmI4OGU3YWI5MzhlNWY5MTk1ZDQ3NjgyNWZmZWQ2ODQ0NGJk
|
14
|
+
YjU0MDRkNWU1NWI0ZTJlNjc0ZDBjYjNmOGE1ZmM1Y2FjMWY0Mzg2YWVhMzBm
|
15
|
+
OTJlMzNjNmZhYjc1ZWE3N2MzNDNmNzkwYjA5YmFlMGM2MWQ5NDE=
|
data/lib/awscli.rb
CHANGED
@@ -0,0 +1,85 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
module VPC
|
5
|
+
require 'awscli/cli/ec2/vpc'
|
6
|
+
class RouteTables < Thor
|
7
|
+
|
8
|
+
desc "list", "List available route tables"
|
9
|
+
method_option :route_table_id, :aliases => "-r", :type => :string, :desc => "Comma seperated list of route table ID(s) to list"
|
10
|
+
def list
|
11
|
+
create_ec2_object
|
12
|
+
@ec2.list options
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "create", "Creates a route table for the specified VPC. After you create a route table, you can add routes and associate the table with a subnet."
|
16
|
+
method_option :vpc_id, :aliases => "-v", :type => :string, :required => true, :desc => "The ID of the VPC"
|
17
|
+
def create
|
18
|
+
create_ec2_object
|
19
|
+
@ec2.create options
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "create_route", "Creates a route in a route table within a VPC"
|
23
|
+
method_option :route_table_id, :aliases => "-r", :type => :string, :required => true, :desc => "The ID of the route table for the route"
|
24
|
+
method_option :dest_cidr, :aliases => "-d", :type => :string, :required => true, :desc => "The CIDR address block used for the destination match, routing decisions are based on the most specific match"
|
25
|
+
method_option :gateway_id, :aliases => "-g", :type => :string, :desc => "The ID of an Internet gateway attached to your VPC"
|
26
|
+
method_option :instance_id, :aliases => "-i", :type => :string, :desc => "ID of a NAT instance in your VPC. The operation fails if you specify an instance ID unless exactly one network interface is attached"
|
27
|
+
method_option :net_interface_id, :aliases => "-n", :type => :string, :desc => "ID of a network interface"
|
28
|
+
def create_route
|
29
|
+
if options[:gateway_id] || options[:instance_id] || options[:net_interface_id]
|
30
|
+
create_ec2_object
|
31
|
+
@ec2.create_route(options)
|
32
|
+
else
|
33
|
+
Formatador.display_line("[red]Error: [/]Any one of the following options (--gateway-id, --instance-id, --net-interface-id) is requried")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "delete", "Deletes the specified route table, you must disassociate the route table from any subnets before you can delete it"
|
38
|
+
method_option :route_table_id, :aliases => "-r", :type => :string, :required => true, :desc => "The ID of the route table"
|
39
|
+
def delete
|
40
|
+
create_ec2_object
|
41
|
+
@ec2.delete(options)
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "delete_route", "Deletes the specified route from the specified route table"
|
45
|
+
method_option :route_table_id, :aliases => "-r", :type => :string, :required => true, :desc => "The ID of the route table"
|
46
|
+
method_option :dest_cidr, :aliases => "-d", :type => :string, :required => true, :desc => "The CIDR range for the route(the value you specify must match the CIDR for the route exactly)"
|
47
|
+
def delete_route
|
48
|
+
create_ec2_object
|
49
|
+
@ec2.delete_route(options)
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "associate_route_table", "Associates a subnet with a route table (the subnet and route table must be in the same VPC)"
|
53
|
+
method_option :route_table_id, :aliases => "-r", :type => :string, :required => true, :desc => "The ID of the route table"
|
54
|
+
method_option :subnet_id, :aliases => "-s", :type => :string, :required => true, :desc => "The ID of the subnet"
|
55
|
+
def associate_route_table
|
56
|
+
create_ec2_object
|
57
|
+
@ec2.associate_route_table(options)
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "disassociate_route_table", "Disassociates a subnet from a route table"
|
61
|
+
method_option :association_id, :aliases => "-a", :type => :string, :required => true, :desc => "The association ID representing the current association between the route table and subnet"
|
62
|
+
def disassociate_route_table
|
63
|
+
create_ec2_object
|
64
|
+
@ec2.disassociate_route_table(options)
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def create_ec2_object
|
70
|
+
puts "ec2 Establishing Connetion..."
|
71
|
+
$ec2_conn = if parent_options[:region]
|
72
|
+
Awscli::Connection.new.request_ec2(parent_options[:region])
|
73
|
+
else
|
74
|
+
Awscli::Connection.new.request_ec2
|
75
|
+
end
|
76
|
+
puts "ec2 Establishing Connetion... OK"
|
77
|
+
@ec2 = Awscli::EC2::RouteTable.new($ec2_conn)
|
78
|
+
end
|
79
|
+
|
80
|
+
AwsCli::CLI::EC2::Vpc.register AwsCli::CLI::EC2::VPC::RouteTables, :routetable, 'routetable [COMMAND]', 'VPC RouteTable Management'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/lib/awscli/ec2.rb
CHANGED
@@ -784,6 +784,56 @@ module Awscli
|
|
784
784
|
end
|
785
785
|
end # => Subnet
|
786
786
|
|
787
|
+
class RouteTable
|
788
|
+
def initialize(connection)
|
789
|
+
@conn = connection
|
790
|
+
end
|
791
|
+
|
792
|
+
def list(options)
|
793
|
+
if options[:route_table_id]
|
794
|
+
puts @conn.describe_route_tables('route-table-id' => options[:route_table_id].split(',')).body['routeTableSet'].to_yaml
|
795
|
+
else
|
796
|
+
Formatador.display_line("[green]#{@conn.describe_route_tables.body['routeTableSet'].map {|k| k['associationSet'].first}.map{|k| k['routeTableId']}}[/]")
|
797
|
+
puts "For more info on a specific route table pass route-table-id to '--route-table-id' or '-r' of `list` subcommand"
|
798
|
+
end
|
799
|
+
end
|
800
|
+
|
801
|
+
def create(options)
|
802
|
+
@conn.create_route_table(options[:vpc_id])
|
803
|
+
puts "Created route table"
|
804
|
+
end
|
805
|
+
|
806
|
+
def create_route(options)
|
807
|
+
@conn.create_route(
|
808
|
+
options[:route_table_id],
|
809
|
+
options[:dest_cidr],
|
810
|
+
options[:gateway_id] || nil,
|
811
|
+
options[:instance_id] || nil,
|
812
|
+
options[:net_interface_id] || nil)
|
813
|
+
puts "Created specified route"
|
814
|
+
end
|
815
|
+
|
816
|
+
def delete(options)
|
817
|
+
@conn.delete_route_table(options[:route_table_id])
|
818
|
+
puts "Deleted route table with id #{options[:route_table_id]}"
|
819
|
+
end
|
820
|
+
|
821
|
+
def delete_route(options)
|
822
|
+
@conn.delete_route(options[:route_table_id], options[:dest_cidr])
|
823
|
+
puts "Deleted route from routetable: #{options[:route_table_id]} with destination cidr: #{options[:dest_cidr]}"
|
824
|
+
end
|
825
|
+
|
826
|
+
def associate_route_table(options)
|
827
|
+
@conn.associate_route_table(options[:route_table_id], options[:subnet_id])
|
828
|
+
puts "Associated route table: #{options[:route_table_id]} with subnet: #{options[:subnet_id]}"
|
829
|
+
end
|
830
|
+
|
831
|
+
def disassociate_route_table(options)
|
832
|
+
@conn.disassociate_route_table(options[:association_id])
|
833
|
+
puts "Disassociated route talbe with association_id: #{options[:association_id]}"
|
834
|
+
end
|
835
|
+
end # => RouteTable
|
836
|
+
|
787
837
|
class NetworkAcl
|
788
838
|
def initialize(connection)
|
789
839
|
@conn = connection
|
data/lib/awscli/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashrith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.16.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.16.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: multi_json
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|