aws-sdk-ec2 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aws-sdk-ec2.rb +70 -0
  3. data/lib/aws-sdk-ec2/classic_address.rb +227 -0
  4. data/lib/aws-sdk-ec2/client.rb +14254 -0
  5. data/lib/aws-sdk-ec2/client_api.rb +6182 -0
  6. data/lib/aws-sdk-ec2/customizations.rb +21 -0
  7. data/lib/aws-sdk-ec2/customizations/instance.rb +29 -0
  8. data/lib/aws-sdk-ec2/customizations/resource.rb +18 -0
  9. data/lib/aws-sdk-ec2/dhcp_options.rb +183 -0
  10. data/lib/aws-sdk-ec2/errors.rb +23 -0
  11. data/lib/aws-sdk-ec2/image.rb +462 -0
  12. data/lib/aws-sdk-ec2/instance.rb +1570 -0
  13. data/lib/aws-sdk-ec2/internet_gateway.rb +204 -0
  14. data/lib/aws-sdk-ec2/key_pair.rb +120 -0
  15. data/lib/aws-sdk-ec2/key_pair_info.rb +122 -0
  16. data/lib/aws-sdk-ec2/network_acl.rb +341 -0
  17. data/lib/aws-sdk-ec2/network_interface.rb +474 -0
  18. data/lib/aws-sdk-ec2/network_interface_association.rb +151 -0
  19. data/lib/aws-sdk-ec2/placement_group.rb +426 -0
  20. data/lib/aws-sdk-ec2/plugins/copy_encrypted_snapshot.rb +59 -0
  21. data/lib/aws-sdk-ec2/plugins/region_validation.rb +19 -0
  22. data/lib/aws-sdk-ec2/resource.rb +2684 -0
  23. data/lib/aws-sdk-ec2/route.rb +243 -0
  24. data/lib/aws-sdk-ec2/route_table.rb +277 -0
  25. data/lib/aws-sdk-ec2/route_table_association.rb +177 -0
  26. data/lib/aws-sdk-ec2/security_group.rb +530 -0
  27. data/lib/aws-sdk-ec2/snapshot.rb +478 -0
  28. data/lib/aws-sdk-ec2/subnet.rb +972 -0
  29. data/lib/aws-sdk-ec2/tag.rb +223 -0
  30. data/lib/aws-sdk-ec2/types.rb +20124 -0
  31. data/lib/aws-sdk-ec2/volume.rb +555 -0
  32. data/lib/aws-sdk-ec2/vpc.rb +1698 -0
  33. data/lib/aws-sdk-ec2/vpc_address.rb +219 -0
  34. data/lib/aws-sdk-ec2/vpc_peering_connection.rb +265 -0
  35. data/lib/aws-sdk-ec2/waiters.rb +1334 -0
  36. metadata +107 -0
@@ -0,0 +1,243 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws
9
+ module EC2
10
+ class Route
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(route_table_id, destination_cidr_block, options = {})
15
+ # @param [String] route_table_id
16
+ # @param [String] destination_cidr_block
17
+ # @option options [Client] :client
18
+ # @overload def initialize(options = {})
19
+ # @option options [required, String] :route_table_id
20
+ # @option options [required, String] :destination_cidr_block
21
+ # @option options [Client] :client
22
+ def initialize(*args)
23
+ options = Hash === args.last ? args.pop.dup : {}
24
+ @route_table_id = extract_route_table_id(args, options)
25
+ @destination_cidr_block = extract_destination_cidr_block(args, options)
26
+ @data = options.delete(:data)
27
+ @client = options.delete(:client) || Client.new(options)
28
+ end
29
+
30
+ # @!group Read-Only Attributes
31
+
32
+ # @return [String]
33
+ def route_table_id
34
+ @route_table_id
35
+ end
36
+
37
+ # @return [String]
38
+ def destination_cidr_block
39
+ @destination_cidr_block
40
+ end
41
+
42
+ # The prefix of the AWS service.
43
+ # @return [String]
44
+ def destination_prefix_list_id
45
+ data.destination_prefix_list_id
46
+ end
47
+
48
+ # The ID of a gateway attached to your VPC.
49
+ # @return [String]
50
+ def gateway_id
51
+ data.gateway_id
52
+ end
53
+
54
+ # The ID of a NAT instance in your VPC.
55
+ # @return [String]
56
+ def instance_id
57
+ data.instance_id
58
+ end
59
+
60
+ # The AWS account ID of the owner of the instance.
61
+ # @return [String]
62
+ def instance_owner_id
63
+ data.instance_owner_id
64
+ end
65
+
66
+ # The ID of the network interface.
67
+ # @return [String]
68
+ def network_interface_id
69
+ data.network_interface_id
70
+ end
71
+
72
+ # The ID of the VPC peering connection.
73
+ # @return [String]
74
+ def vpc_peering_connection_id
75
+ data.vpc_peering_connection_id
76
+ end
77
+
78
+ # The ID of a NAT gateway.
79
+ # @return [String]
80
+ def nat_gateway_id
81
+ data.nat_gateway_id
82
+ end
83
+
84
+ # The state of the route. The `blackhole` state indicates that the
85
+ # route's target isn't available (for example, the specified gateway
86
+ # isn't attached to the VPC, or the specified NAT instance has been
87
+ # terminated).
88
+ # @return [String]
89
+ def state
90
+ data.state
91
+ end
92
+
93
+ # Describes how the route was created.
94
+ #
95
+ # * `CreateRouteTable` - The route was automatically created when the
96
+ # route table was created.
97
+ #
98
+ # * `CreateRoute` - The route was manually added to the route table.
99
+ #
100
+ # * `EnableVgwRoutePropagation` - The route was propagated by route
101
+ # propagation.
102
+ # @return [String]
103
+ def origin
104
+ data.origin
105
+ end
106
+
107
+ # @!endgroup
108
+
109
+ # @return [Client]
110
+ def client
111
+ @client
112
+ end
113
+
114
+ # @raise [Errors::ResourceNotLoadable]
115
+ # @api private
116
+ def load
117
+ msg = "#load is not implemented, data only available via enumeration"
118
+ raise Errors::ResourceNotLoadable, msg
119
+ end
120
+ alias :reload :load
121
+
122
+ # @raise [Errors::ResourceNotLoadableError] Raises when {#data_loaded?} is `false`.
123
+ # @return [Types::Route]
124
+ # Returns the data for this {Route}.
125
+ def data
126
+ load unless @data
127
+ @data
128
+ end
129
+
130
+ # @return [Boolean]
131
+ # Returns `true` if this resource is loaded. Accessing attributes or
132
+ # {#data} on an unloaded resource will trigger a call to {#load}.
133
+ def data_loaded?
134
+ !!@data
135
+ end
136
+
137
+ # @!group Actions
138
+
139
+ # @example Request syntax with placeholder values
140
+ #
141
+ # route.delete({
142
+ # dry_run: false,
143
+ # })
144
+ # @param [Hash] options ({})
145
+ # @option options [Boolean] :dry_run
146
+ # Checks whether you have the required permissions for the action,
147
+ # without actually making the request, and provides an error response.
148
+ # If you have the required permissions, the error response is
149
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
150
+ # @return [EmptyStructure]
151
+ def delete(options = {})
152
+ options = options.merge(
153
+ route_table_id: @route_table_id,
154
+ destination_cidr_block: @destination_cidr_block
155
+ )
156
+ resp = @client.delete_route(options)
157
+ resp.data
158
+ end
159
+
160
+ # @example Request syntax with placeholder values
161
+ #
162
+ # route.replace({
163
+ # dry_run: false,
164
+ # gateway_id: "String",
165
+ # instance_id: "String",
166
+ # network_interface_id: "String",
167
+ # vpc_peering_connection_id: "String",
168
+ # nat_gateway_id: "String",
169
+ # })
170
+ # @param [Hash] options ({})
171
+ # @option options [Boolean] :dry_run
172
+ # Checks whether you have the required permissions for the action,
173
+ # without actually making the request, and provides an error response.
174
+ # If you have the required permissions, the error response is
175
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
176
+ # @option options [String] :gateway_id
177
+ # The ID of an Internet gateway or virtual private gateway.
178
+ # @option options [String] :instance_id
179
+ # The ID of a NAT instance in your VPC.
180
+ # @option options [String] :network_interface_id
181
+ # The ID of a network interface.
182
+ # @option options [String] :vpc_peering_connection_id
183
+ # The ID of a VPC peering connection.
184
+ # @option options [String] :nat_gateway_id
185
+ # The ID of a NAT gateway.
186
+ # @return [EmptyStructure]
187
+ def replace(options = {})
188
+ options = options.merge(
189
+ route_table_id: @route_table_id,
190
+ destination_cidr_block: @destination_cidr_block
191
+ )
192
+ resp = @client.replace_route(options)
193
+ resp.data
194
+ end
195
+
196
+ # @!group Associations
197
+
198
+ # @return [RouteTable]
199
+ def route_table
200
+ RouteTable.new(
201
+ id: @route_table_id,
202
+ client: @client
203
+ )
204
+ end
205
+
206
+ # @deprecated
207
+ # @api private
208
+ def identifiers
209
+ {
210
+ route_table_id: @route_table_id,
211
+ destination_cidr_block: @destination_cidr_block
212
+ }
213
+ end
214
+ deprecated(:identifiers)
215
+
216
+ private
217
+
218
+ def extract_route_table_id(args, options)
219
+ value = args[0] || options.delete(:route_table_id)
220
+ case value
221
+ when String then value
222
+ when nil then raise ArgumentError, "missing required option :route_table_id"
223
+ else
224
+ msg = "expected :route_table_id to be a String, got #{value.class}"
225
+ raise ArgumentError, msg
226
+ end
227
+ end
228
+
229
+ def extract_destination_cidr_block(args, options)
230
+ value = args[1] || options.delete(:destination_cidr_block)
231
+ case value
232
+ when String then value
233
+ when nil then raise ArgumentError, "missing required option :destination_cidr_block"
234
+ else
235
+ msg = "expected :destination_cidr_block to be a String, got #{value.class}"
236
+ raise ArgumentError, msg
237
+ end
238
+ end
239
+
240
+ class Collection < Aws::Resources::Collection; end
241
+ end
242
+ end
243
+ end
@@ -0,0 +1,277 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws
9
+ module EC2
10
+ class RouteTable
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(id, options = {})
15
+ # @param [String] id
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :id
19
+ # @option options [Client] :client
20
+ def initialize(*args)
21
+ options = Hash === args.last ? args.pop.dup : {}
22
+ @id = extract_id(args, options)
23
+ @data = options.delete(:data)
24
+ @client = options.delete(:client) || Client.new(options)
25
+ end
26
+
27
+ # @!group Read-Only Attributes
28
+
29
+ # @return [String]
30
+ def id
31
+ @id
32
+ end
33
+ alias :route_table_id :id
34
+
35
+ # The ID of the VPC.
36
+ # @return [String]
37
+ def vpc_id
38
+ data.vpc_id
39
+ end
40
+
41
+ # Any tags assigned to the route table.
42
+ # @return [Array<Types::Tag>]
43
+ def tags
44
+ data.tags
45
+ end
46
+
47
+ # Any virtual private gateway (VGW) propagating routes.
48
+ # @return [Array<Types::PropagatingVgw>]
49
+ def propagating_vgws
50
+ data.propagating_vgws
51
+ end
52
+
53
+ # @!endgroup
54
+
55
+ # @return [Client]
56
+ def client
57
+ @client
58
+ end
59
+
60
+ # Loads, or reloads {#data} for the current {RouteTable}.
61
+ # Returns `self` making it possible to chain methods.
62
+ #
63
+ # route_table.reload.data
64
+ #
65
+ # @return [self]
66
+ def load
67
+ resp = @client.describe_route_tables(route_table_ids: [@id])
68
+ @data = resp.routetables[0]
69
+ self
70
+ end
71
+ alias :reload :load
72
+
73
+ # @return [Types::RouteTable]
74
+ # Returns the data for this {RouteTable}. Calls
75
+ # {Client#describe_route_tables} if {#data_loaded?} is `false`.
76
+ def data
77
+ load unless @data
78
+ @data
79
+ end
80
+
81
+ # @return [Boolean]
82
+ # Returns `true` if this resource is loaded. Accessing attributes or
83
+ # {#data} on an unloaded resource will trigger a call to {#load}.
84
+ def data_loaded?
85
+ !!@data
86
+ end
87
+
88
+ # @!group Actions
89
+
90
+ # @example Request syntax with placeholder values
91
+ #
92
+ # routetableassociation = route_table.associate_with_subnet({
93
+ # dry_run: false,
94
+ # subnet_id: "String", # required
95
+ # })
96
+ # @param [Hash] options ({})
97
+ # @option options [Boolean] :dry_run
98
+ # Checks whether you have the required permissions for the action,
99
+ # without actually making the request, and provides an error response.
100
+ # If you have the required permissions, the error response is
101
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
102
+ # @option options [required, String] :subnet_id
103
+ # The ID of the subnet.
104
+ # @return [RouteTableAssociation]
105
+ def associate_with_subnet(options = {})
106
+ options = options.merge(route_table_id: @id)
107
+ resp = @client.associate_route_table(options)
108
+ RouteTableAssociation.new(
109
+ id: resp.data.association_id,
110
+ client: @client
111
+ )
112
+ end
113
+
114
+ # @example Request syntax with placeholder values
115
+ #
116
+ # route = route_table.create_route({
117
+ # dry_run: false,
118
+ # destination_cidr_block: "String", # required
119
+ # gateway_id: "String",
120
+ # instance_id: "String",
121
+ # network_interface_id: "String",
122
+ # vpc_peering_connection_id: "String",
123
+ # nat_gateway_id: "String",
124
+ # })
125
+ # @param [Hash] options ({})
126
+ # @option options [Boolean] :dry_run
127
+ # Checks whether you have the required permissions for the action,
128
+ # without actually making the request, and provides an error response.
129
+ # If you have the required permissions, the error response is
130
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
131
+ # @option options [required, String] :destination_cidr_block
132
+ # The CIDR address block used for the destination match. Routing
133
+ # decisions are based on the most specific match.
134
+ # @option options [String] :gateway_id
135
+ # The ID of an Internet gateway or virtual private gateway attached to
136
+ # your VPC.
137
+ # @option options [String] :instance_id
138
+ # The ID of a NAT instance in your VPC. The operation fails if you
139
+ # specify an instance ID unless exactly one network interface is
140
+ # attached.
141
+ # @option options [String] :network_interface_id
142
+ # The ID of a network interface.
143
+ # @option options [String] :vpc_peering_connection_id
144
+ # The ID of a VPC peering connection.
145
+ # @option options [String] :nat_gateway_id
146
+ # The ID of a NAT gateway.
147
+ # @return [Route]
148
+ def create_route(options = {})
149
+ options = options.merge(route_table_id: @id)
150
+ resp = @client.create_route(options)
151
+ Route.new(
152
+ route_table_id: @id,
153
+ destination_cidr_block: options[:destination_cidr_block],
154
+ client: @client
155
+ )
156
+ end
157
+
158
+ # @example Request syntax with placeholder values
159
+ #
160
+ # tag = route_table.create_tags({
161
+ # dry_run: false,
162
+ # tags: [ # required
163
+ # {
164
+ # key: "String",
165
+ # value: "String",
166
+ # },
167
+ # ],
168
+ # })
169
+ # @param [Hash] options ({})
170
+ # @option options [Boolean] :dry_run
171
+ # Checks whether you have the required permissions for the action,
172
+ # without actually making the request, and provides an error response.
173
+ # If you have the required permissions, the error response is
174
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
175
+ # @option options [required, Array<Types::Tag>] :tags
176
+ # One or more tags. The `value` parameter is required, but if you don't
177
+ # want the tag to have a value, specify the parameter with no value, and
178
+ # we set the value to an empty string.
179
+ # @return [Tag::Collection]
180
+ def create_tags(options = {})
181
+ batch = []
182
+ options = Aws::Util.deep_merge(options, resources: [@id])
183
+ resp = @client.create_tags(options)
184
+ options[:tags].each do |t|
185
+ batch << Tag.new(
186
+ resource_id: @id,
187
+ key: t[:key],
188
+ value: t[:value],
189
+ client: @client
190
+ )
191
+ end
192
+ Tag::Collection.new([batch], size: batch.size)
193
+ end
194
+
195
+ # @example Request syntax with placeholder values
196
+ #
197
+ # route_table.delete({
198
+ # dry_run: false,
199
+ # })
200
+ # @param [Hash] options ({})
201
+ # @option options [Boolean] :dry_run
202
+ # Checks whether you have the required permissions for the action,
203
+ # without actually making the request, and provides an error response.
204
+ # If you have the required permissions, the error response is
205
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
206
+ # @return [EmptyStructure]
207
+ def delete(options = {})
208
+ options = options.merge(route_table_id: @id)
209
+ resp = @client.delete_route_table(options)
210
+ resp.data
211
+ end
212
+
213
+ # @!group Associations
214
+
215
+ # @return [RouteTableAssociation::Collection]
216
+ def associations
217
+ batch = []
218
+ data.associations.each do |a|
219
+ batch << RouteTableAssociation.new(
220
+ id: a.route_table_association_id,
221
+ data: a,
222
+ client: @client
223
+ )
224
+ end
225
+ RouteTableAssociation::Collection.new([batch], size: batch.size)
226
+ end
227
+
228
+ # @return [Route::Collection]
229
+ def routes
230
+ batch = []
231
+ data.routes.each do |r|
232
+ batch << Route.new(
233
+ route_table_id: @id,
234
+ destination_cidr_block: r.destination_cidr_block,
235
+ data: r,
236
+ client: @client
237
+ )
238
+ end
239
+ Route::Collection.new([batch], size: batch.size)
240
+ end
241
+
242
+ # @return [Vpc, nil]
243
+ def vpc
244
+ if data.vpc_id
245
+ Vpc.new(
246
+ id: data.vpc_id,
247
+ client: @client
248
+ )
249
+ else
250
+ nil
251
+ end
252
+ end
253
+
254
+ # @deprecated
255
+ # @api private
256
+ def identifiers
257
+ { id: @id }
258
+ end
259
+ deprecated(:identifiers)
260
+
261
+ private
262
+
263
+ def extract_id(args, options)
264
+ value = args[0] || options.delete(:id)
265
+ case value
266
+ when String then value
267
+ when nil then raise ArgumentError, "missing required option :id"
268
+ else
269
+ msg = "expected :id to be a String, got #{value.class}"
270
+ raise ArgumentError, msg
271
+ end
272
+ end
273
+
274
+ class Collection < Aws::Resources::Collection; end
275
+ end
276
+ end
277
+ end