aws-sdk 1.3.5 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/aws/api_config/EC2-2011-12-15.yml +2791 -0
- data/lib/aws/core.rb +4 -4
- data/lib/aws/core/client.rb +1 -0
- data/lib/aws/core/client_logging.rb +9 -2
- data/lib/aws/core/lazy_error_classes.rb +1 -1
- data/lib/aws/core/response.rb +5 -0
- data/lib/aws/core/service_interface.rb +3 -2
- data/lib/aws/core/uri_escape.rb +1 -2
- data/lib/aws/ec2.rb +80 -1
- data/lib/aws/ec2/client.rb +29 -10
- data/lib/aws/ec2/client/xml.rb +51 -1
- data/lib/aws/ec2/customer_gateway.rb +90 -0
- data/lib/aws/ec2/customer_gateway_collection.rb +73 -0
- data/lib/aws/ec2/dhcp_options.rb +106 -0
- data/lib/aws/ec2/dhcp_options_collection.rb +87 -0
- data/lib/aws/ec2/filtered_collection.rb +27 -2
- data/lib/aws/ec2/image.rb +7 -4
- data/lib/aws/ec2/instance.rb +54 -2
- data/lib/aws/ec2/instance_collection.rb +5 -3
- data/lib/aws/ec2/internet_gateway.rb +122 -0
- data/lib/aws/ec2/internet_gateway/attachment.rb +78 -0
- data/lib/aws/ec2/internet_gateway_collection.rb +54 -0
- data/lib/aws/ec2/network_acl.rb +254 -0
- data/lib/aws/ec2/network_acl/association.rb +56 -0
- data/lib/aws/ec2/network_acl/entry.rb +147 -0
- data/lib/aws/ec2/network_acl_collection.rb +65 -0
- data/lib/aws/ec2/network_interface.rb +174 -0
- data/lib/aws/ec2/network_interface/attachment.rb +100 -0
- data/lib/aws/ec2/network_interface_collection.rb +103 -0
- data/lib/aws/ec2/region.rb +11 -1
- data/lib/aws/ec2/resource.rb +6 -2
- data/lib/aws/ec2/route_table.rb +204 -0
- data/lib/aws/ec2/route_table/association.rb +119 -0
- data/lib/aws/ec2/route_table/route.rb +113 -0
- data/lib/aws/ec2/route_table_collection.rb +73 -0
- data/lib/aws/ec2/security_group.rb +15 -5
- data/lib/aws/ec2/security_group_collection.rb +15 -12
- data/lib/aws/ec2/subnet.rb +161 -0
- data/lib/aws/ec2/subnet_collection.rb +115 -0
- data/lib/aws/ec2/vpc.rb +166 -0
- data/lib/aws/ec2/vpc_collection.rb +71 -0
- data/lib/aws/ec2/vpn_connection.rb +99 -0
- data/lib/aws/ec2/vpn_connection/telemetry.rb +49 -0
- data/lib/aws/ec2/vpn_connection_collection.rb +96 -0
- data/lib/aws/ec2/vpn_gateway.rb +123 -0
- data/lib/aws/ec2/vpn_gateway/attachment.rb +45 -0
- data/lib/aws/ec2/vpn_gateway_collection.rb +77 -0
- data/lib/aws/iam/login_profile.rb +4 -0
- data/lib/aws/iam/user.rb +6 -0
- data/lib/aws/record/hash_model.rb +3 -3
- data/lib/aws/simple_workflow.rb +6 -3
- data/lib/aws/simple_workflow/activity_task_collection.rb +7 -2
- data/lib/aws/simple_workflow/decision_task_collection.rb +11 -5
- data/lib/aws/simple_workflow/option_formatters.rb +7 -0
- data/lib/net/http/connection_pool.rb +19 -5
- metadata +33 -5
- data/lib/aws/api_config/EC2-2011-02-28.yml +0 -2314
@@ -0,0 +1,65 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class EC2
|
16
|
+
|
17
|
+
class NetworkACLCollection < Collection
|
18
|
+
|
19
|
+
include TaggedCollection
|
20
|
+
include Core::Collection::Simple
|
21
|
+
|
22
|
+
# Creates a network ACL.
|
23
|
+
#
|
24
|
+
# @param [Hash] options
|
25
|
+
#
|
26
|
+
# @option options [VPC,String] :vpc The vpc or vpc id of where you want
|
27
|
+
# to create the subnet. This option is required if this collection
|
28
|
+
# does not have a populated vpc ({#vpc} returns nil).
|
29
|
+
#
|
30
|
+
# @return [NetworkACL]
|
31
|
+
#
|
32
|
+
def create options = {}
|
33
|
+
|
34
|
+
client_opts = {}
|
35
|
+
client_opts[:vpc_id] = vpc_id_option(options)
|
36
|
+
|
37
|
+
resp = client.create_network_acl(client_opts)
|
38
|
+
|
39
|
+
NetworkACL.new_from(:create_network_acl, resp.network_acl,
|
40
|
+
resp.network_acl.network_acl_id, :config => config)
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param [String] network_acl_id
|
45
|
+
# @return [NetworkACL]
|
46
|
+
def [] network_acl_id
|
47
|
+
NetworkACL.new(network_acl_id, :config => config)
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
def _each_item options = {}, &block
|
52
|
+
response = filtered_request(:describe_network_acls, options, &block)
|
53
|
+
response.network_acl_set.each do |a|
|
54
|
+
|
55
|
+
network_acl = NetworkACL.new_from(:describe_network_acls, a,
|
56
|
+
a.network_acl_id, :config => config)
|
57
|
+
|
58
|
+
yield(network_acl)
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
require 'aws/ec2/network_interface/attachment'
|
15
|
+
|
16
|
+
module AWS
|
17
|
+
class EC2
|
18
|
+
|
19
|
+
# Represents a network interface in EC2.
|
20
|
+
class NetworkInterface < Resource
|
21
|
+
|
22
|
+
include TaggedItem
|
23
|
+
|
24
|
+
def initialize network_interface_id, options = {}
|
25
|
+
@network_interface_id = network_interface_id
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
attr_reader :network_interface_id
|
31
|
+
|
32
|
+
alias_method :id, :network_interface_id
|
33
|
+
|
34
|
+
attribute :vpc_id, :static => true
|
35
|
+
|
36
|
+
attribute :subnet_id, :static => true
|
37
|
+
|
38
|
+
mutable_attribute :description
|
39
|
+
|
40
|
+
attribute :owner_id, :static => true
|
41
|
+
|
42
|
+
attribute :status, :to_sym => true
|
43
|
+
|
44
|
+
attribute :private_ip_address, :static => true
|
45
|
+
|
46
|
+
attribute :private_dns_name, :static => true
|
47
|
+
|
48
|
+
mutable_attribute :source_dest_check?,
|
49
|
+
:set_as => :source_dest_check
|
50
|
+
|
51
|
+
alias_method :source_dest_check, :source_dest_check?
|
52
|
+
|
53
|
+
attribute :attachment_details, :as => :attachment
|
54
|
+
|
55
|
+
protected :attachment_details
|
56
|
+
|
57
|
+
mutable_attribute :groups
|
58
|
+
|
59
|
+
protected :groups
|
60
|
+
|
61
|
+
populates_from(:create_network_interface) do |resp|
|
62
|
+
resp.network_interface if resp.network_interface.network_interface_id == id
|
63
|
+
end
|
64
|
+
|
65
|
+
populates_from(:describe_network_interfaces) do |resp|
|
66
|
+
resp.network_interface_set.find{|i| i.network_interface_id == id }
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [VPC] Returns the VPC this network interface belongs to.
|
70
|
+
def vpc
|
71
|
+
VPC.new(vpc_id, :config => config)
|
72
|
+
end
|
73
|
+
|
74
|
+
# @return [Subnet] Returns the Subnet this network interface
|
75
|
+
# belongs to.
|
76
|
+
def subnet
|
77
|
+
Subnet.new(subnet_id, :vpc_id => vpc_id, :config => config)
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [Array<SecurityGroup>]
|
81
|
+
def security_groups
|
82
|
+
groups.collect do |g|
|
83
|
+
SecurityGroup.new(g.group_id, :name => g.group_name, :config => config)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# @param [Array<SecurityGroup>,Array<String>] groups A list of
|
88
|
+
# security groups objects or security group ids. This replaces
|
89
|
+
# the security group set on this network interface.
|
90
|
+
#
|
91
|
+
# @return [nil]
|
92
|
+
#
|
93
|
+
def set_security_groups *groups
|
94
|
+
self.groups = [groups].flatten.collect do |g|
|
95
|
+
g.is_a?(SecurityGroup) ? g.security_group_id : g
|
96
|
+
end
|
97
|
+
nil
|
98
|
+
end
|
99
|
+
alias_method :security_groups=, :set_security_groups
|
100
|
+
|
101
|
+
# @return [Instance,nil] Returns the instance this network interface
|
102
|
+
# is attached to. If it has not been attached, then nil is
|
103
|
+
# returned.
|
104
|
+
def instance
|
105
|
+
if attachment = self.attachment
|
106
|
+
attachment.instance
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def attachment
|
111
|
+
if details = attachment_details
|
112
|
+
Attachment.new(self, details)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# @param [Instance,String] instance The instance to attach this network
|
117
|
+
# interface to, may be an {Instance} object or an instance id string.
|
118
|
+
#
|
119
|
+
# @param [Hash] options
|
120
|
+
#
|
121
|
+
# @option options [Integer] :device_index (1) The index of the device
|
122
|
+
# for the network interface attachment on the instance. Defaults to 1.
|
123
|
+
#
|
124
|
+
# @return [nil]
|
125
|
+
#
|
126
|
+
def attach instance, options = {}
|
127
|
+
|
128
|
+
instance_id = instance.is_a?(Instance) ? instance.instance_id : instance
|
129
|
+
|
130
|
+
client_opts = {}
|
131
|
+
client_opts[:network_interface_id] = network_interface_id
|
132
|
+
client_opts[:instance_id] = instance_id
|
133
|
+
client_opts[:device_index] = options[:device_index] || 1
|
134
|
+
|
135
|
+
client.attach_network_interface(client_opts)
|
136
|
+
|
137
|
+
nil
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
# Detaches this network interface.
|
142
|
+
# @param [Hash] options
|
143
|
+
# @option (see NetworkInterface::Attachment#detach)
|
144
|
+
# @return (see NetworkInterface::Attachment#detach)
|
145
|
+
def detach options = {}
|
146
|
+
if attachment = self.attachment
|
147
|
+
attachment.detach(options)
|
148
|
+
else
|
149
|
+
raise 'unable to detach network interface, no attachment present'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Deletes this network interface.
|
154
|
+
# @return [nil]
|
155
|
+
def delete
|
156
|
+
client_opts = {}
|
157
|
+
client_opts[:network_interface_id] = network_interface_id
|
158
|
+
client.delete_network_interface(client_opts)
|
159
|
+
nil
|
160
|
+
end
|
161
|
+
|
162
|
+
# @return [Boolean] Returns true if this network interface exists.
|
163
|
+
def exists?
|
164
|
+
begin
|
165
|
+
get_resource
|
166
|
+
true
|
167
|
+
rescue Errors::InvalidNetworkInterfaceID::NotFound
|
168
|
+
false
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
require 'aws/ec2/network_interface/attachment'
|
15
|
+
|
16
|
+
module AWS
|
17
|
+
class EC2
|
18
|
+
class NetworkInterface < Resource
|
19
|
+
class Attachment
|
20
|
+
|
21
|
+
def initialize network_interface, details
|
22
|
+
@network_interface = network_interface
|
23
|
+
@attachment_id = details.attachment_id
|
24
|
+
@instance = Instance.new(details.instance_id,
|
25
|
+
:owner_id => details.instance_owner_id,
|
26
|
+
:config => network_interface.config)
|
27
|
+
@instance_owner_id = details.instance_owner_id
|
28
|
+
@device_index = details.device_index
|
29
|
+
@status = details.status.to_sym
|
30
|
+
@attach_time = details.attach_time
|
31
|
+
@delete_on_termination = details.delete_on_termination?
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [String] Returns the attachment id.
|
35
|
+
attr_reader :attachment_id
|
36
|
+
|
37
|
+
alias_method :id, :attachment_id
|
38
|
+
|
39
|
+
# @return [NetworkInterface] Returns the network interface this
|
40
|
+
# is an attachment for.
|
41
|
+
attr_reader :network_interface
|
42
|
+
|
43
|
+
# @return [Instance] Returns the instance the network interface
|
44
|
+
# is attached to.
|
45
|
+
attr_reader :instance
|
46
|
+
|
47
|
+
# @return [String] Returns the instance owner id.
|
48
|
+
attr_reader :instance_owner_id
|
49
|
+
|
50
|
+
# @return [Integer] The index of the device for the network
|
51
|
+
# interface attachment on the instance.
|
52
|
+
attr_reader :device_index
|
53
|
+
|
54
|
+
# @return [Symbol] Returns the attachment status.
|
55
|
+
attr_reader :status
|
56
|
+
|
57
|
+
# @return [Time]
|
58
|
+
attr_reader :attach_time
|
59
|
+
|
60
|
+
# @return [Boolean]
|
61
|
+
attr_reader :delete_on_termination
|
62
|
+
|
63
|
+
alias_method :delete_on_termination?, :delete_on_termination
|
64
|
+
|
65
|
+
# Allows you to toggle the delete on termination state.
|
66
|
+
#
|
67
|
+
# network_interface.attachment.delete_on_termination = false
|
68
|
+
#
|
69
|
+
# @param [Boolean] state
|
70
|
+
#
|
71
|
+
def delete_on_termination= state
|
72
|
+
opts = {}
|
73
|
+
opts[:network_interface_id] = network_interface.id
|
74
|
+
opts[:attachment] = {}
|
75
|
+
opts[:attachment][:attachment_id] = id
|
76
|
+
opts[:attachment][:delete_on_termination] = state
|
77
|
+
network_interface.client.modify_network_interface_attribute(opts)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Detaches the network interface from the instance.
|
81
|
+
#
|
82
|
+
# @param [Hash] options
|
83
|
+
#
|
84
|
+
# @option options [Boolean] :force (false) Set true to force
|
85
|
+
# a detachment.
|
86
|
+
#
|
87
|
+
# @return [nil]
|
88
|
+
#
|
89
|
+
def detach options = {}
|
90
|
+
client_opts = {}
|
91
|
+
client_opts[:attachment_id] = attachment_id
|
92
|
+
client_opts[:force] = options[:force] == true
|
93
|
+
network_interface.client.detach_network_interface(client_opts)
|
94
|
+
end
|
95
|
+
alias_method :delete, :detach
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class EC2
|
16
|
+
class NetworkInterfaceCollection < Collection
|
17
|
+
|
18
|
+
include TaggedCollection
|
19
|
+
include Core::Collection::Simple
|
20
|
+
|
21
|
+
# Creates a network interface.
|
22
|
+
#
|
23
|
+
# @param [Hash] options
|
24
|
+
#
|
25
|
+
# @option options [Subnet,String] :subnet The subnet or subnet id
|
26
|
+
# to associate with the network interface.
|
27
|
+
#
|
28
|
+
# @option options [String] :private_ip_address The private IP address
|
29
|
+
# of the network interface.
|
30
|
+
#
|
31
|
+
# @option options [String] :description The description of the
|
32
|
+
# network interface.
|
33
|
+
#
|
34
|
+
# @option options [Array<SecurityGroup>,Array<String>] :security_groups
|
35
|
+
# A list of security groups (or security group id strings) that
|
36
|
+
# should be used by this network interface.
|
37
|
+
#
|
38
|
+
# @return [NetworkInterface]
|
39
|
+
#
|
40
|
+
def create options = {}
|
41
|
+
|
42
|
+
client_opts = {}
|
43
|
+
|
44
|
+
client_opts[:subnet_id] = subnet_id_option(options)
|
45
|
+
|
46
|
+
client_opts[:private_ip_address] = options[:private_ip_address] if
|
47
|
+
options.key?(:private_ip_address)
|
48
|
+
|
49
|
+
client_opts[:description] = options[:description] if
|
50
|
+
options.key?(:description)
|
51
|
+
|
52
|
+
groups = groups_options(options)
|
53
|
+
client_opts[:groups] = groups if groups
|
54
|
+
|
55
|
+
resp = client.create_network_interface(client_opts)
|
56
|
+
|
57
|
+
NetworkInterface.new_from(:create_network_interface,
|
58
|
+
resp.network_interface,
|
59
|
+
resp.network_interface.network_interface_id,
|
60
|
+
:config => config)
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
# @param [String] network_interface_id
|
65
|
+
# @return [NetworkInterface]
|
66
|
+
def [] network_interface_id
|
67
|
+
NetworkInterface.new(network_interface_id, :config => config)
|
68
|
+
end
|
69
|
+
|
70
|
+
protected
|
71
|
+
def groups_options options
|
72
|
+
|
73
|
+
# accept this option a variety of different ways
|
74
|
+
groups = options[:security_groups]
|
75
|
+
groups ||= options[:security_group_ids]
|
76
|
+
groups ||= options[:security_group]
|
77
|
+
groups ||= options[:security_group_id]
|
78
|
+
|
79
|
+
if groups
|
80
|
+
[groups].flatten.map{|sg| sg.is_a?(SecurityGroup) ? sg.id : sg }
|
81
|
+
else
|
82
|
+
nil
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
protected
|
88
|
+
def _each_item options = {}, &block
|
89
|
+
resp = filtered_request(:describe_network_interfaces, options, &block)
|
90
|
+
resp.network_interface_set.each do |n|
|
91
|
+
|
92
|
+
network_interface = NetworkInterface.new_from(
|
93
|
+
:describe_network_interfaces, n,
|
94
|
+
n.network_interface_id, :config => config)
|
95
|
+
|
96
|
+
yield(network_interface)
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
data/lib/aws/ec2/region.rb
CHANGED
@@ -66,7 +66,17 @@ module AWS
|
|
66
66
|
:volumes,
|
67
67
|
:snapshots,
|
68
68
|
:reserved_instances,
|
69
|
-
:reserved_instances_offerings
|
69
|
+
:reserved_instances_offerings,
|
70
|
+
:vpcs,
|
71
|
+
:subnets,
|
72
|
+
:network_acls,
|
73
|
+
:route_tables,
|
74
|
+
:network_interfaces,
|
75
|
+
:internet_gateways,
|
76
|
+
:customer_gateways,
|
77
|
+
:vpn_gateways,
|
78
|
+
:dhcp_options,
|
79
|
+
:vpn_connections,
|
70
80
|
]
|
71
81
|
|
72
82
|
PROXIED_METHODS.each do |method|
|