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,219 @@
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 VpcAddress
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(allocation_id, options = {})
15
+ # @param [String] allocation_id
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :allocation_id
19
+ # @option options [Client] :client
20
+ def initialize(*args)
21
+ options = Hash === args.last ? args.pop.dup : {}
22
+ @allocation_id = extract_allocation_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 allocation_id
31
+ @allocation_id
32
+ end
33
+
34
+ # The ID of the instance that the address is associated with (if any).
35
+ # @return [String]
36
+ def instance_id
37
+ data.instance_id
38
+ end
39
+
40
+ # The Elastic IP address.
41
+ # @return [String]
42
+ def public_ip
43
+ data.public_ip
44
+ end
45
+
46
+ # The ID representing the association of the address with an instance in
47
+ # a VPC.
48
+ # @return [String]
49
+ def association_id
50
+ data.association_id
51
+ end
52
+
53
+ # Indicates whether this Elastic IP address is for use with instances in
54
+ # EC2-Classic (`standard`) or instances in a VPC (`vpc`).
55
+ # @return [String]
56
+ def domain
57
+ data.domain
58
+ end
59
+
60
+ # The ID of the network interface.
61
+ # @return [String]
62
+ def network_interface_id
63
+ data.network_interface_id
64
+ end
65
+
66
+ # The ID of the AWS account that owns the network interface.
67
+ # @return [String]
68
+ def network_interface_owner_id
69
+ data.network_interface_owner_id
70
+ end
71
+
72
+ # The private IP address associated with the Elastic IP address.
73
+ # @return [String]
74
+ def private_ip_address
75
+ data.private_ip_address
76
+ end
77
+
78
+ # @!endgroup
79
+
80
+ # @return [Client]
81
+ def client
82
+ @client
83
+ end
84
+
85
+ # Loads, or reloads {#data} for the current {VpcAddress}.
86
+ # Returns `self` making it possible to chain methods.
87
+ #
88
+ # vpc_address.reload.data
89
+ #
90
+ # @return [self]
91
+ def load
92
+ resp = @client.describe_addresses(allocation_ids: [@allocation_id])
93
+ @data = resp.addresses[0]
94
+ self
95
+ end
96
+ alias :reload :load
97
+
98
+ # @return [Types::Address]
99
+ # Returns the data for this {VpcAddress}. Calls
100
+ # {Client#describe_addresses} if {#data_loaded?} is `false`.
101
+ def data
102
+ load unless @data
103
+ @data
104
+ end
105
+
106
+ # @return [Boolean]
107
+ # Returns `true` if this resource is loaded. Accessing attributes or
108
+ # {#data} on an unloaded resource will trigger a call to {#load}.
109
+ def data_loaded?
110
+ !!@data
111
+ end
112
+
113
+ # @!group Actions
114
+
115
+ # @example Request syntax with placeholder values
116
+ #
117
+ # vpc_address.associate({
118
+ # dry_run: false,
119
+ # instance_id: "String",
120
+ # public_ip: "String",
121
+ # network_interface_id: "String",
122
+ # private_ip_address: "String",
123
+ # allow_reassociation: false,
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 [String] :instance_id
132
+ # The ID of the instance. This is required for EC2-Classic. For EC2-VPC,
133
+ # you can specify either the instance ID or the network interface ID,
134
+ # but not both. The operation fails if you specify an instance ID unless
135
+ # exactly one network interface is attached.
136
+ # @option options [String] :public_ip
137
+ # The Elastic IP address. This is required for EC2-Classic.
138
+ # @option options [String] :network_interface_id
139
+ # \[EC2-VPC\] The ID of the network interface. If the instance has more
140
+ # than one network interface, you must specify a network interface ID.
141
+ # @option options [String] :private_ip_address
142
+ # \[EC2-VPC\] The primary or secondary private IP address to associate
143
+ # with the Elastic IP address. If no private IP address is specified,
144
+ # the Elastic IP address is associated with the primary private IP
145
+ # address.
146
+ # @option options [Boolean] :allow_reassociation
147
+ # \[EC2-VPC\] For a VPC in an EC2-Classic account, specify true to allow
148
+ # an Elastic IP address that is already associated with an instance or
149
+ # network interface to be reassociated with the specified instance or
150
+ # network interface. Otherwise, the operation fails. In a VPC in an
151
+ # EC2-VPC-only account, reassociation is automatic, therefore you can
152
+ # specify false to ensure the operation fails if the Elastic IP address
153
+ # is already associated with another resource.
154
+ # @return [Types::AssociateAddressResult]
155
+ def associate(options = {})
156
+ options = options.merge(allocation_id: @allocation_id)
157
+ resp = @client.associate_address(options)
158
+ resp.data
159
+ end
160
+
161
+ # @example Request syntax with placeholder values
162
+ #
163
+ # vpc_address.release({
164
+ # dry_run: false,
165
+ # public_ip: "String",
166
+ # })
167
+ # @param [Hash] options ({})
168
+ # @option options [Boolean] :dry_run
169
+ # Checks whether you have the required permissions for the action,
170
+ # without actually making the request, and provides an error response.
171
+ # If you have the required permissions, the error response is
172
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
173
+ # @option options [String] :public_ip
174
+ # \[EC2-Classic\] The Elastic IP address. Required for EC2-Classic.
175
+ # @return [EmptyStructure]
176
+ def release(options = {})
177
+ options = options.merge(allocation_id: data.allocation_id)
178
+ resp = @client.release_address(options)
179
+ resp.data
180
+ end
181
+
182
+ # @!group Associations
183
+
184
+ # @return [NetworkInterfaceAssociation, nil]
185
+ def association
186
+ if data.association_id
187
+ NetworkInterfaceAssociation.new(
188
+ id: data.association_id,
189
+ client: @client
190
+ )
191
+ else
192
+ nil
193
+ end
194
+ end
195
+
196
+ # @deprecated
197
+ # @api private
198
+ def identifiers
199
+ { allocation_id: @allocation_id }
200
+ end
201
+ deprecated(:identifiers)
202
+
203
+ private
204
+
205
+ def extract_allocation_id(args, options)
206
+ value = args[0] || options.delete(:allocation_id)
207
+ case value
208
+ when String then value
209
+ when nil then raise ArgumentError, "missing required option :allocation_id"
210
+ else
211
+ msg = "expected :allocation_id to be a String, got #{value.class}"
212
+ raise ArgumentError, msg
213
+ end
214
+ end
215
+
216
+ class Collection < Aws::Resources::Collection; end
217
+ end
218
+ end
219
+ end
@@ -0,0 +1,265 @@
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 VpcPeeringConnection
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 :vpc_peering_connection_id :id
34
+
35
+ # Information about the accepter VPC. CIDR block information is not
36
+ # returned when creating a VPC peering connection, or when describing a
37
+ # VPC peering connection that's in the `initiating-request` or
38
+ # `pending-acceptance` state.
39
+ # @return [Types::VpcPeeringConnectionVpcInfo]
40
+ def accepter_vpc_info
41
+ data.accepter_vpc_info
42
+ end
43
+
44
+ # The time that an unaccepted VPC peering connection will expire.
45
+ # @return [Time]
46
+ def expiration_time
47
+ data.expiration_time
48
+ end
49
+
50
+ # Information about the requester VPC.
51
+ # @return [Types::VpcPeeringConnectionVpcInfo]
52
+ def requester_vpc_info
53
+ data.requester_vpc_info
54
+ end
55
+
56
+ # The status of the VPC peering connection.
57
+ # @return [Types::VpcPeeringConnectionStateReason]
58
+ def status
59
+ data.status
60
+ end
61
+
62
+ # Any tags assigned to the resource.
63
+ # @return [Array<Types::Tag>]
64
+ def tags
65
+ data.tags
66
+ end
67
+
68
+ # @!endgroup
69
+
70
+ # @return [Client]
71
+ def client
72
+ @client
73
+ end
74
+
75
+ # Loads, or reloads {#data} for the current {VpcPeeringConnection}.
76
+ # Returns `self` making it possible to chain methods.
77
+ #
78
+ # vpc_peering_connection.reload.data
79
+ #
80
+ # @return [self]
81
+ def load
82
+ resp = @client.describe_vpc_peering_connections(vpc_peering_connection_ids: [@id])
83
+ @data = resp.vpcpeeringconnections[0]
84
+ self
85
+ end
86
+ alias :reload :load
87
+
88
+ # @return [Types::VpcPeeringConnection]
89
+ # Returns the data for this {VpcPeeringConnection}. Calls
90
+ # {Client#describe_vpc_peering_connections} if {#data_loaded?} is `false`.
91
+ def data
92
+ load unless @data
93
+ @data
94
+ end
95
+
96
+ # @return [Boolean]
97
+ # Returns `true` if this resource is loaded. Accessing attributes or
98
+ # {#data} on an unloaded resource will trigger a call to {#load}.
99
+ def data_loaded?
100
+ !!@data
101
+ end
102
+
103
+ # @param [Hash] options ({})
104
+ # @return [Boolean]
105
+ # Returns `true` if the VpcPeeringConnection exists.
106
+ def exists?(options = {})
107
+ begin
108
+ wait_until_exists(options.merge(max_attempts: 1))
109
+ true
110
+ rescue Aws::Waiters::Errors::UnexpectedError => e
111
+ raise e.error
112
+ rescue Aws::Waiters::Errors::WaiterFailed
113
+ false
114
+ end
115
+ end
116
+
117
+ # @param [Hash] options ({})
118
+ # @option options [Integer] :max_attempts (40)
119
+ # @option options [Float] :delay (15)
120
+ # @option options [Proc] :before_attempt
121
+ # @option options [Proc] :before_wait
122
+ # @return [VpcPeeringConnection]
123
+ def wait_until_exists(options = {})
124
+ options, params = separate_params_and_options(options)
125
+ waiter = Waiters::VpcPeeringConnectionExists.new(options)
126
+ yield_waiter_and_warn(waiter, &Proc.new) if block_given?
127
+ resp = waiter.wait(params.merge(vpc_peering_connection_ids: [@id]))
128
+ VpcPeeringConnection.new({
129
+ id: @id,
130
+ data: resp.data.vpc_peering_connections[0],
131
+ client: @client
132
+ })
133
+ end
134
+
135
+ # @!group Actions
136
+
137
+ # @example Request syntax with placeholder values
138
+ #
139
+ # vpc_peering_connection.accept({
140
+ # dry_run: false,
141
+ # })
142
+ # @param [Hash] options ({})
143
+ # @option options [Boolean] :dry_run
144
+ # Checks whether you have the required permissions for the action,
145
+ # without actually making the request, and provides an error response.
146
+ # If you have the required permissions, the error response is
147
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
148
+ # @return [Types::AcceptVpcPeeringConnectionResult]
149
+ def accept(options = {})
150
+ options = options.merge(vpc_peering_connection_id: @id)
151
+ resp = @client.accept_vpc_peering_connection(options)
152
+ resp.data
153
+ end
154
+
155
+ # @example Request syntax with placeholder values
156
+ #
157
+ # vpc_peering_connection.delete({
158
+ # dry_run: false,
159
+ # })
160
+ # @param [Hash] options ({})
161
+ # @option options [Boolean] :dry_run
162
+ # Checks whether you have the required permissions for the action,
163
+ # without actually making the request, and provides an error response.
164
+ # If you have the required permissions, the error response is
165
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
166
+ # @return [Types::DeleteVpcPeeringConnectionResult]
167
+ def delete(options = {})
168
+ options = options.merge(vpc_peering_connection_id: @id)
169
+ resp = @client.delete_vpc_peering_connection(options)
170
+ resp.data
171
+ end
172
+
173
+ # @example Request syntax with placeholder values
174
+ #
175
+ # vpc_peering_connection.reject({
176
+ # dry_run: false,
177
+ # })
178
+ # @param [Hash] options ({})
179
+ # @option options [Boolean] :dry_run
180
+ # Checks whether you have the required permissions for the action,
181
+ # without actually making the request, and provides an error response.
182
+ # If you have the required permissions, the error response is
183
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
184
+ # @return [Types::RejectVpcPeeringConnectionResult]
185
+ def reject(options = {})
186
+ options = options.merge(vpc_peering_connection_id: @id)
187
+ resp = @client.reject_vpc_peering_connection(options)
188
+ resp.data
189
+ end
190
+
191
+ # @!group Associations
192
+
193
+ # @return [Vpc, nil]
194
+ def accepter_vpc
195
+ if data.accepter_vpc_info.vpc_id
196
+ Vpc.new(
197
+ id: data.accepter_vpc_info.vpc_id,
198
+ client: @client
199
+ )
200
+ else
201
+ nil
202
+ end
203
+ end
204
+
205
+ # @return [Vpc, nil]
206
+ def requester_vpc
207
+ if data.requester_vpc_info.vpc_id
208
+ Vpc.new(
209
+ id: data.requester_vpc_info.vpc_id,
210
+ client: @client
211
+ )
212
+ else
213
+ nil
214
+ end
215
+ end
216
+
217
+ # @deprecated
218
+ # @api private
219
+ def identifiers
220
+ { id: @id }
221
+ end
222
+ deprecated(:identifiers)
223
+
224
+ private
225
+
226
+ def extract_id(args, options)
227
+ value = args[0] || options.delete(:id)
228
+ case value
229
+ when String then value
230
+ when nil then raise ArgumentError, "missing required option :id"
231
+ else
232
+ msg = "expected :id to be a String, got #{value.class}"
233
+ raise ArgumentError, msg
234
+ end
235
+ end
236
+
237
+ def yield_waiter_and_warn(waiter, &block)
238
+ if !@waiter_block_warned
239
+ msg = "pass options to configure the waiter; "
240
+ msg << "yielding the waiter is deprecated"
241
+ warn(msg)
242
+ @waiter_block_warned = true
243
+ end
244
+ yield(waiter.waiter)
245
+ end
246
+
247
+ def separate_params_and_options(options)
248
+ opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
249
+ waiter_opts = {}
250
+ waiter_params = {}
251
+ options.each_pair do |key, value|
252
+ if opts.include?(key)
253
+ waiter_opts[key] = value
254
+ else
255
+ waiter_params[key] = value
256
+ end
257
+ end
258
+ waiter_opts[:client] ||= @client
259
+ [waiter_opts, waiter_params]
260
+ end
261
+
262
+ class Collection < Aws::Resources::Collection; end
263
+ end
264
+ end
265
+ end