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,151 @@
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 NetworkInterfaceAssociation
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
+
34
+ # The public IP address or Elastic IP address bound to the network
35
+ # interface.
36
+ # @return [String]
37
+ def public_ip
38
+ data.public_ip
39
+ end
40
+
41
+ # The public DNS name.
42
+ # @return [String]
43
+ def public_dns_name
44
+ data.public_dns_name
45
+ end
46
+
47
+ # The ID of the owner of the Elastic IP address.
48
+ # @return [String]
49
+ def ip_owner_id
50
+ data.ip_owner_id
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 {NetworkInterfaceAssociation}.
61
+ # Returns `self` making it possible to chain methods.
62
+ #
63
+ # network_interface_association.reload.data
64
+ #
65
+ # @return [self]
66
+ def load
67
+ resp = @client.describe_network_interfaces(filters: [{
68
+ name: "association.association-id",
69
+ values: [@id]
70
+ }])
71
+ @data = resp.networkinterfaces[0].association
72
+ self
73
+ end
74
+ alias :reload :load
75
+
76
+ # @return [Types::InstanceNetworkInterfaceAssociation]
77
+ # Returns the data for this {NetworkInterfaceAssociation}. Calls
78
+ # {Client#describe_network_interfaces} if {#data_loaded?} is `false`.
79
+ def data
80
+ load unless @data
81
+ @data
82
+ end
83
+
84
+ # @return [Boolean]
85
+ # Returns `true` if this resource is loaded. Accessing attributes or
86
+ # {#data} on an unloaded resource will trigger a call to {#load}.
87
+ def data_loaded?
88
+ !!@data
89
+ end
90
+
91
+ # @!group Actions
92
+
93
+ # @example Request syntax with placeholder values
94
+ #
95
+ # network_interface_association.delete({
96
+ # dry_run: false,
97
+ # public_ip: "String",
98
+ # })
99
+ # @param [Hash] options ({})
100
+ # @option options [Boolean] :dry_run
101
+ # Checks whether you have the required permissions for the action,
102
+ # without actually making the request, and provides an error response.
103
+ # If you have the required permissions, the error response is
104
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
105
+ # @option options [String] :public_ip
106
+ # \[EC2-Classic\] The Elastic IP address. Required for EC2-Classic.
107
+ # @return [EmptyStructure]
108
+ def delete(options = {})
109
+ options = options.merge(association_id: @id)
110
+ resp = @client.disassociate_address(options)
111
+ resp.data
112
+ end
113
+
114
+ # @!group Associations
115
+
116
+ # @return [VpcAddress, nil]
117
+ def address
118
+ if data.allocation_id
119
+ VpcAddress.new(
120
+ allocation_id: data.allocation_id,
121
+ client: @client
122
+ )
123
+ else
124
+ nil
125
+ end
126
+ end
127
+
128
+ # @deprecated
129
+ # @api private
130
+ def identifiers
131
+ { id: @id }
132
+ end
133
+ deprecated(:identifiers)
134
+
135
+ private
136
+
137
+ def extract_id(args, options)
138
+ value = args[0] || options.delete(:id)
139
+ case value
140
+ when String then value
141
+ when nil then raise ArgumentError, "missing required option :id"
142
+ else
143
+ msg = "expected :id to be a String, got #{value.class}"
144
+ raise ArgumentError, msg
145
+ end
146
+ end
147
+
148
+ class Collection < Aws::Resources::Collection; end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,426 @@
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 PlacementGroup
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(name, options = {})
15
+ # @param [String] name
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :name
19
+ # @option options [Client] :client
20
+ def initialize(*args)
21
+ options = Hash === args.last ? args.pop.dup : {}
22
+ @name = extract_name(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 name
31
+ @name
32
+ end
33
+ alias :group_name :name
34
+
35
+ # The placement strategy.
36
+ # @return [String]
37
+ def strategy
38
+ data.strategy
39
+ end
40
+
41
+ # The state of the placement group.
42
+ # @return [String]
43
+ def state
44
+ data.state
45
+ end
46
+
47
+ # @!endgroup
48
+
49
+ # @return [Client]
50
+ def client
51
+ @client
52
+ end
53
+
54
+ # Loads, or reloads {#data} for the current {PlacementGroup}.
55
+ # Returns `self` making it possible to chain methods.
56
+ #
57
+ # placement_group.reload.data
58
+ #
59
+ # @return [self]
60
+ def load
61
+ resp = @client.describe_placement_groups(group_names: [@name])
62
+ @data = resp.placementgroups[0]
63
+ self
64
+ end
65
+ alias :reload :load
66
+
67
+ # @return [Types::PlacementGroup]
68
+ # Returns the data for this {PlacementGroup}. Calls
69
+ # {Client#describe_placement_groups} if {#data_loaded?} is `false`.
70
+ def data
71
+ load unless @data
72
+ @data
73
+ end
74
+
75
+ # @return [Boolean]
76
+ # Returns `true` if this resource is loaded. Accessing attributes or
77
+ # {#data} on an unloaded resource will trigger a call to {#load}.
78
+ def data_loaded?
79
+ !!@data
80
+ end
81
+
82
+ # @!group Actions
83
+
84
+ # @example Request syntax with placeholder values
85
+ #
86
+ # placement_group.delete({
87
+ # dry_run: false,
88
+ # })
89
+ # @param [Hash] options ({})
90
+ # @option options [Boolean] :dry_run
91
+ # Checks whether you have the required permissions for the action,
92
+ # without actually making the request, and provides an error response.
93
+ # If you have the required permissions, the error response is
94
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
95
+ # @return [EmptyStructure]
96
+ def delete(options = {})
97
+ options = options.merge(group_name: @name)
98
+ resp = @client.delete_placement_group(options)
99
+ resp.data
100
+ end
101
+
102
+ # @!group Associations
103
+
104
+ # @example Request syntax with placeholder values
105
+ #
106
+ # instances = placement_group.instances({
107
+ # dry_run: false,
108
+ # instance_ids: ["String"],
109
+ # filters: [
110
+ # {
111
+ # name: "String",
112
+ # values: ["String"],
113
+ # },
114
+ # ],
115
+ # })
116
+ # @param [Hash] options ({})
117
+ # @option options [Boolean] :dry_run
118
+ # Checks whether you have the required permissions for the action,
119
+ # without actually making the request, and provides an error response.
120
+ # If you have the required permissions, the error response is
121
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
122
+ # @option options [Array<String>] :instance_ids
123
+ # One or more instance IDs.
124
+ #
125
+ # Default: Describes all your instances.
126
+ # @option options [Array<Types::Filter>] :filters
127
+ # One or more filters.
128
+ #
129
+ # * `affinity` - The affinity setting for an instance running on a
130
+ # Dedicated Host (`default` \| `host`).
131
+ #
132
+ # * `architecture` - The instance architecture (`i386` \| `x86_64`).
133
+ #
134
+ # * `availability-zone` - The Availability Zone of the instance.
135
+ #
136
+ # * `block-device-mapping.attach-time` - The attach time for an EBS
137
+ # volume mapped to the instance, for example,
138
+ # `2010-09-15T17:15:20.000Z`.
139
+ #
140
+ # * `block-device-mapping.delete-on-termination` - A Boolean that
141
+ # indicates whether the EBS volume is deleted on instance termination.
142
+ #
143
+ # * `block-device-mapping.device-name` - The device name for the EBS
144
+ # volume (for example, `/dev/sdh` or `xvdh`).
145
+ #
146
+ # * `block-device-mapping.status` - The status for the EBS volume
147
+ # (`attaching` \| `attached` \| `detaching` \| `detached`).
148
+ #
149
+ # * `block-device-mapping.volume-id` - The volume ID of the EBS volume.
150
+ #
151
+ # * `client-token` - The idempotency token you provided when you
152
+ # launched the instance.
153
+ #
154
+ # * `dns-name` - The public DNS name of the instance.
155
+ #
156
+ # * `group-id` - The ID of the security group for the instance.
157
+ # EC2-Classic only.
158
+ #
159
+ # * `group-name` - The name of the security group for the instance.
160
+ # EC2-Classic only.
161
+ #
162
+ # * `host-id` - The ID of the Dedicated Host on which the instance is
163
+ # running, if applicable.
164
+ #
165
+ # * `hypervisor` - The hypervisor type of the instance (`ovm` \| `xen`).
166
+ #
167
+ # * `iam-instance-profile.arn` - The instance profile associated with
168
+ # the instance. Specified as an ARN.
169
+ #
170
+ # * `image-id` - The ID of the image used to launch the instance.
171
+ #
172
+ # * `instance-id` - The ID of the instance.
173
+ #
174
+ # * `instance-lifecycle` - Indicates whether this is a Spot Instance or
175
+ # a Scheduled Instance (`spot` \| `scheduled`).
176
+ #
177
+ # * `instance-state-code` - The state of the instance, as a 16-bit
178
+ # unsigned integer. The high byte is an opaque internal value and
179
+ # should be ignored. The low byte is set based on the state
180
+ # represented. The valid values are: 0 (pending), 16 (running), 32
181
+ # (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).
182
+ #
183
+ # * `instance-state-name` - The state of the instance (`pending` \|
184
+ # `running` \| `shutting-down` \| `terminated` \| `stopping` \|
185
+ # `stopped`).
186
+ #
187
+ # * `instance-type` - The type of instance (for example, `t2.micro`).
188
+ #
189
+ # * `instance.group-id` - The ID of the security group for the instance.
190
+ #
191
+ # * `instance.group-name` - The name of the security group for the
192
+ # instance.
193
+ #
194
+ # * `ip-address` - The public IP address of the instance.
195
+ #
196
+ # * `kernel-id` - The kernel ID.
197
+ #
198
+ # * `key-name` - The name of the key pair used when the instance was
199
+ # launched.
200
+ #
201
+ # * `launch-index` - When launching multiple instances, this is the
202
+ # index for the instance in the launch group (for example, 0, 1, 2,
203
+ # and so on).
204
+ #
205
+ # * `launch-time` - The time when the instance was launched.
206
+ #
207
+ # * `monitoring-state` - Indicates whether monitoring is enabled for the
208
+ # instance (`disabled` \| `enabled`).
209
+ #
210
+ # * `owner-id` - The AWS account ID of the instance owner.
211
+ #
212
+ # * `placement-group-name` - The name of the placement group for the
213
+ # instance.
214
+ #
215
+ # * `platform` - The platform. Use `windows` if you have Windows
216
+ # instances; otherwise, leave blank.
217
+ #
218
+ # * `private-dns-name` - The private DNS name of the instance.
219
+ #
220
+ # * `private-ip-address` - The private IP address of the instance.
221
+ #
222
+ # * `product-code` - The product code associated with the AMI used to
223
+ # launch the instance.
224
+ #
225
+ # * `product-code.type` - The type of product code (`devpay` \|
226
+ # `marketplace`).
227
+ #
228
+ # * `ramdisk-id` - The RAM disk ID.
229
+ #
230
+ # * `reason` - The reason for the current state of the instance (for
231
+ # example, shows "User Initiated \[date\]" when you stop or
232
+ # terminate the instance). Similar to the state-reason-code filter.
233
+ #
234
+ # * `requester-id` - The ID of the entity that launched the instance on
235
+ # your behalf (for example, AWS Management Console, Auto Scaling, and
236
+ # so on).
237
+ #
238
+ # * `reservation-id` - The ID of the instance's reservation. A
239
+ # reservation ID is created any time you launch an instance. A
240
+ # reservation ID has a one-to-one relationship with an instance launch
241
+ # request, but can be associated with more than one instance if you
242
+ # launch multiple instances using the same launch request. For
243
+ # example, if you launch one instance, you'll get one reservation ID.
244
+ # If you launch ten instances using the same launch request, you'll
245
+ # also get one reservation ID.
246
+ #
247
+ # * `root-device-name` - The name of the root device for the instance
248
+ # (for example, `/dev/sda1` or `/dev/xvda`).
249
+ #
250
+ # * `root-device-type` - The type of root device that the instance uses
251
+ # (`ebs` \| `instance-store`).
252
+ #
253
+ # * `source-dest-check` - Indicates whether the instance performs
254
+ # source/destination checking. A value of `true` means that checking
255
+ # is enabled, and `false` means checking is disabled. The value must
256
+ # be `false` for the instance to perform network address translation
257
+ # (NAT) in your VPC.
258
+ #
259
+ # * `spot-instance-request-id` - The ID of the Spot instance request.
260
+ #
261
+ # * `state-reason-code` - The reason code for the state change.
262
+ #
263
+ # * `state-reason-message` - A message that describes the state change.
264
+ #
265
+ # * `subnet-id` - The ID of the subnet for the instance.
266
+ #
267
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
268
+ # to the resource, where `tag`\:*key* is the tag's key.
269
+ #
270
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
271
+ # is independent of the `tag-value` filter. For example, if you use
272
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
273
+ # you get any resources assigned both the tag key Purpose (regardless
274
+ # of what the tag's value is), and the tag value X (regardless of
275
+ # what the tag's key is). If you want to list only resources where
276
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
277
+ #
278
+ # * `tag-value` - The value of a tag assigned to the resource. This
279
+ # filter is independent of the `tag-key` filter.
280
+ #
281
+ # * `tenancy` - The tenancy of an instance (`dedicated` \| `default` \|
282
+ # `host`).
283
+ #
284
+ # * `virtualization-type` - The virtualization type of the instance
285
+ # (`paravirtual` \| `hvm`).
286
+ #
287
+ # * `vpc-id` - The ID of the VPC that the instance is running in.
288
+ #
289
+ # * `network-interface.description` - The description of the network
290
+ # interface.
291
+ #
292
+ # * `network-interface.subnet-id` - The ID of the subnet for the network
293
+ # interface.
294
+ #
295
+ # * `network-interface.vpc-id` - The ID of the VPC for the network
296
+ # interface.
297
+ #
298
+ # * `network-interface.network-interface-id` - The ID of the network
299
+ # interface.
300
+ #
301
+ # * `network-interface.owner-id` - The ID of the owner of the network
302
+ # interface.
303
+ #
304
+ # * `network-interface.availability-zone` - The Availability Zone for
305
+ # the network interface.
306
+ #
307
+ # * `network-interface.requester-id` - The requester ID for the network
308
+ # interface.
309
+ #
310
+ # * `network-interface.requester-managed` - Indicates whether the
311
+ # network interface is being managed by AWS.
312
+ #
313
+ # * `network-interface.status` - The status of the network interface
314
+ # (`available`) \| `in-use`).
315
+ #
316
+ # * `network-interface.mac-address` - The MAC address of the network
317
+ # interface.
318
+ #
319
+ # * `network-interface.private-dns-name` - The private DNS name of the
320
+ # network interface.
321
+ #
322
+ # * `network-interface.source-dest-check` - Whether the network
323
+ # interface performs source/destination checking. A value of `true`
324
+ # means checking is enabled, and `false` means checking is disabled.
325
+ # The value must be `false` for the network interface to perform
326
+ # network address translation (NAT) in your VPC.
327
+ #
328
+ # * `network-interface.group-id` - The ID of a security group associated
329
+ # with the network interface.
330
+ #
331
+ # * `network-interface.group-name` - The name of a security group
332
+ # associated with the network interface.
333
+ #
334
+ # * `network-interface.attachment.attachment-id` - The ID of the
335
+ # interface attachment.
336
+ #
337
+ # * `network-interface.attachment.instance-id` - The ID of the instance
338
+ # to which the network interface is attached.
339
+ #
340
+ # * `network-interface.attachment.instance-owner-id` - The owner ID of
341
+ # the instance to which the network interface is attached.
342
+ #
343
+ # * `network-interface.addresses.private-ip-address` - The private IP
344
+ # address associated with the network interface.
345
+ #
346
+ # * `network-interface.attachment.device-index` - The device index to
347
+ # which the network interface is attached.
348
+ #
349
+ # * `network-interface.attachment.status` - The status of the attachment
350
+ # (`attaching` \| `attached` \| `detaching` \| `detached`).
351
+ #
352
+ # * `network-interface.attachment.attach-time` - The time that the
353
+ # network interface was attached to an instance.
354
+ #
355
+ # * `network-interface.attachment.delete-on-termination` - Specifies
356
+ # whether the attachment is deleted when an instance is terminated.
357
+ #
358
+ # * `network-interface.addresses.primary` - Specifies whether the IP
359
+ # address of the network interface is the primary private IP address.
360
+ #
361
+ # * `network-interface.addresses.association.public-ip` - The ID of the
362
+ # association of an Elastic IP address with a network interface.
363
+ #
364
+ # * `network-interface.addresses.association.ip-owner-id` - The owner ID
365
+ # of the private IP address associated with the network interface.
366
+ #
367
+ # * `association.public-ip` - The address of the Elastic IP address
368
+ # bound to the network interface.
369
+ #
370
+ # * `association.ip-owner-id` - The owner of the Elastic IP address
371
+ # associated with the network interface.
372
+ #
373
+ # * `association.allocation-id` - The allocation ID returned when you
374
+ # allocated the Elastic IP address for your network interface.
375
+ #
376
+ # * `association.association-id` - The association ID returned when the
377
+ # network interface was associated with an IP address.
378
+ # @return [Instance::Collection]
379
+ def instances(options = {})
380
+ batches = Enumerator.new do |y|
381
+ options = Aws::Util.deep_merge(options, filters: [{
382
+ name: "placement-group-name",
383
+ values: [@name]
384
+ }])
385
+ resp = @client.describe_instances(options)
386
+ resp.each_page do |page|
387
+ batch = []
388
+ page.data.reservations.each do |r|
389
+ r.instances.each do |i|
390
+ batch << Instance.new(
391
+ id: i.instance_id,
392
+ data: i,
393
+ client: @client
394
+ )
395
+ end
396
+ end
397
+ y.yield(batch)
398
+ end
399
+ end
400
+ Instance::Collection.new(batches)
401
+ end
402
+
403
+ # @deprecated
404
+ # @api private
405
+ def identifiers
406
+ { name: @name }
407
+ end
408
+ deprecated(:identifiers)
409
+
410
+ private
411
+
412
+ def extract_name(args, options)
413
+ value = args[0] || options.delete(:name)
414
+ case value
415
+ when String then value
416
+ when nil then raise ArgumentError, "missing required option :name"
417
+ else
418
+ msg = "expected :name to be a String, got #{value.class}"
419
+ raise ArgumentError, msg
420
+ end
421
+ end
422
+
423
+ class Collection < Aws::Resources::Collection; end
424
+ end
425
+ end
426
+ end