aws-sdk-ec2 1.431.0 → 1.522.0

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +465 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-ec2/classic_address.rb +26 -16
  5. data/lib/aws-sdk-ec2/client.rb +10867 -4155
  6. data/lib/aws-sdk-ec2/client_api.rb +2924 -510
  7. data/lib/aws-sdk-ec2/customizations/instance.rb +18 -1
  8. data/lib/aws-sdk-ec2/customizations/resource.rb +46 -3
  9. data/lib/aws-sdk-ec2/customizations/tag.rb +13 -0
  10. data/lib/aws-sdk-ec2/customizations.rb +0 -22
  11. data/lib/aws-sdk-ec2/dhcp_options.rb +12 -12
  12. data/lib/aws-sdk-ec2/endpoint_parameters.rb +9 -6
  13. data/lib/aws-sdk-ec2/endpoint_provider.rb +14 -18
  14. data/lib/aws-sdk-ec2/endpoints.rb +2 -8608
  15. data/lib/aws-sdk-ec2/image.rb +166 -95
  16. data/lib/aws-sdk-ec2/instance.rb +425 -356
  17. data/lib/aws-sdk-ec2/internet_gateway.rb +7 -7
  18. data/lib/aws-sdk-ec2/key_pair.rb +14 -14
  19. data/lib/aws-sdk-ec2/key_pair_info.rb +30 -30
  20. data/lib/aws-sdk-ec2/nat_gateway.rb +7 -8
  21. data/lib/aws-sdk-ec2/network_acl.rb +70 -70
  22. data/lib/aws-sdk-ec2/network_interface.rb +94 -78
  23. data/lib/aws-sdk-ec2/network_interface_association.rb +3 -3
  24. data/lib/aws-sdk-ec2/placement_group.rb +37 -19
  25. data/lib/aws-sdk-ec2/plugins/endpoints.rb +20 -1242
  26. data/lib/aws-sdk-ec2/resource.rb +944 -811
  27. data/lib/aws-sdk-ec2/route.rb +34 -34
  28. data/lib/aws-sdk-ec2/route_table.rb +44 -44
  29. data/lib/aws-sdk-ec2/route_table_association.rb +3 -3
  30. data/lib/aws-sdk-ec2/security_group.rb +212 -201
  31. data/lib/aws-sdk-ec2/snapshot.rb +169 -105
  32. data/lib/aws-sdk-ec2/subnet.rb +391 -359
  33. data/lib/aws-sdk-ec2/tag.rb +7 -4
  34. data/lib/aws-sdk-ec2/types.rb +13807 -4774
  35. data/lib/aws-sdk-ec2/volume.rb +157 -119
  36. data/lib/aws-sdk-ec2/vpc.rb +278 -224
  37. data/lib/aws-sdk-ec2/vpc_address.rb +31 -21
  38. data/lib/aws-sdk-ec2/vpc_peering_connection.rb +6 -6
  39. data/lib/aws-sdk-ec2.rb +40 -36
  40. data/sig/classic_address.rbs +105 -0
  41. data/sig/client.rbs +14622 -0
  42. data/sig/dhcp_options.rbs +84 -0
  43. data/sig/errors.rbs +16 -0
  44. data/sig/image.rbs +228 -0
  45. data/sig/instance.rbs +564 -0
  46. data/sig/internet_gateway.rbs +91 -0
  47. data/sig/key_pair.rbs +54 -0
  48. data/sig/key_pair_info.rbs +63 -0
  49. data/sig/nat_gateway.rbs +107 -0
  50. data/sig/network_acl.rbs +144 -0
  51. data/sig/network_interface.rbs +239 -0
  52. data/sig/network_interface_association.rbs +62 -0
  53. data/sig/placement_group.rbs +78 -0
  54. data/sig/resource.rbs +1042 -0
  55. data/sig/route.rbs +113 -0
  56. data/sig/route_table.rbs +117 -0
  57. data/sig/route_table_association.rbs +69 -0
  58. data/sig/security_group.rbs +311 -0
  59. data/sig/snapshot.rbs +204 -0
  60. data/sig/subnet.rbs +436 -0
  61. data/sig/tag.rbs +63 -0
  62. data/sig/types.rbs +16812 -0
  63. data/sig/volume.rbs +210 -0
  64. data/sig/vpc.rbs +404 -0
  65. data/sig/vpc_address.rbs +101 -0
  66. data/sig/vpc_peering_connection.rbs +84 -0
  67. data/sig/waiters.rbs +664 -0
  68. metadata +44 -18
@@ -15,10 +15,27 @@ module Aws
15
15
  private_key.private_decrypt(decoded)
16
16
  end
17
17
 
18
+ class Collection < Aws::Resources::Collection
19
+ extend Aws::Deprecations
20
+
21
+ {
22
+ create_tags: :batch_create_tags,
23
+ monitor: :batch_create_tags,
24
+ reboot: :batch_reboot,
25
+ start: :batch_start,
26
+ stop: :batch_stop,
27
+ terminate: :batch_terminate!,
28
+ unmonitor: :batch_unmonitor
29
+ }.each do |old_method, new_method|
30
+ alias_method old_method, new_method
31
+ deprecated old_method, use: new_method
32
+ end
33
+ end
34
+
18
35
  private
19
36
 
20
37
  def encrypted_password
21
- bytes = Aws::Plugins::UserAgent.feature('resource') do
38
+ bytes = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
22
39
  client.get_password_data(instance_id: id).password_data
23
40
  end
24
41
  if bytes == ''
@@ -2,10 +2,53 @@
2
2
 
3
3
  module Aws
4
4
  module EC2
5
- class Resource
6
5
 
6
+ # 5 of EC2's old APIs DescribeInstances, DescribeImages, DescribeSnapshots, DescribeVolumes and DescribeTag
7
+ # support paginated calls and will not paginate server side unless max_results is set to a non-nil value.
8
+ # This module customizes the resource association methods by adding a default value of 1000 to max_results
9
+ # to ensure results are paginated.
10
+ module ResourcePaginationFix
11
+ def images(options = {})
12
+ # Prevent the error:
13
+ # The parameter imageIdsSet cannot be used with the parameter maxResults
14
+ if options[:image_ids].nil? || options[:image_ids].empty?
15
+ options[:max_results] ||= 1000
16
+ end
17
+ super(options)
18
+ end
19
+
20
+ def instances(options = {})
21
+ # Prevent the error:
22
+ # The parameter instancesSet cannot be used with the parameter maxResults
23
+ if options[:instance_ids].nil? || options[:instance_ids].empty?
24
+ options[:max_results] ||= 1000
25
+ end
26
+ super(options)
27
+ end
28
+
29
+ def snapshots(options = {})
30
+ # Prevent the error:
31
+ # The parameter snapshotSet cannot be used with the parameter maxResults
32
+ if options[:snapshot_ids].nil? || options[:snapshot_ids].empty?
33
+ options[:max_results] ||= 1000
34
+ end
35
+ super(options)
36
+ end
37
+
38
+ def volumes(options = {})
39
+ # Prevent the error:
40
+ # The parameter volumeIdsSet cannot be used with the parameter maxResults
41
+ if options[:volume_ids].nil? || options[:volume_ids].empty?
42
+ options[:max_results] ||= 1000
43
+ end
44
+ super(options)
45
+ end
46
+ end
47
+
48
+ class Resource
49
+ prepend ResourcePaginationFix
7
50
  def create_tags(options)
8
- resp = Aws::Plugins::UserAgent.feature('resource') do
51
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
9
52
  @client.create_tags(options)
10
53
  end
11
54
  tags = []
@@ -16,7 +59,7 @@ module Aws
16
59
  end
17
60
  Tag::Collection.new([tags], size: tags.size)
18
61
  end
19
-
20
62
  end
63
+
21
64
  end
22
65
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ module EC2
5
+ class Tag
6
+ class Collection < Aws::Resources::Collection
7
+ alias_method :delete, :batch_delete!
8
+ extend Aws::Deprecations
9
+ deprecated :delete, use: :batch_delete!
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,23 +1 @@
1
1
  # frozen_string_literal: true
2
-
3
- # customizations to generated classes
4
- require 'aws-sdk-ec2/customizations/resource'
5
- require 'aws-sdk-ec2/customizations/instance'
6
-
7
- Aws::EC2::Instance::Collection.extend Aws::Deprecations
8
- {
9
- create_tags: :batch_create_tags,
10
- monitor: :batch_create_tags,
11
- reboot: :batch_reboot,
12
- start: :batch_start,
13
- stop: :batch_stop,
14
- terminate: :batch_terminate!,
15
- unmonitor: :batch_unmonitor,
16
- }.each do |old, new|
17
- Aws::EC2::Instance::Collection.send(:alias_method, old, new)
18
- Aws::EC2::Instance::Collection.send(:deprecated, old, use: new)
19
- end
20
-
21
- Aws::EC2::Tag::Collection.send(:alias_method, :delete, :batch_delete!)
22
- Aws::EC2::Tag::Collection.extend Aws::Deprecations
23
- Aws::EC2::Tag::Collection.send(:deprecated, :delete, use: :batch_delete!)
@@ -35,12 +35,6 @@ module Aws::EC2
35
35
  end
36
36
  alias :dhcp_options_id :id
37
37
 
38
- # The DHCP options in the set.
39
- # @return [Array<Types::DhcpConfiguration>]
40
- def dhcp_configurations
41
- data[:dhcp_configurations]
42
- end
43
-
44
38
  # The ID of the Amazon Web Services account that owns the DHCP options
45
39
  # set.
46
40
  # @return [String]
@@ -54,6 +48,12 @@ module Aws::EC2
54
48
  data[:tags]
55
49
  end
56
50
 
51
+ # The DHCP options in the set.
52
+ # @return [Array<Types::DhcpConfiguration>]
53
+ def dhcp_configurations
54
+ data[:dhcp_configurations]
55
+ end
56
+
57
57
  # @!endgroup
58
58
 
59
59
  # @return [Client]
@@ -68,7 +68,7 @@ module Aws::EC2
68
68
  #
69
69
  # @return [self]
70
70
  def load
71
- resp = Aws::Plugins::UserAgent.feature('resource') do
71
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
72
72
  @client.describe_dhcp_options(dhcp_options_ids: [@id])
73
73
  end
74
74
  @data = resp.dhcp_options[0]
@@ -185,7 +185,7 @@ module Aws::EC2
185
185
  :retry
186
186
  end
187
187
  end
188
- Aws::Plugins::UserAgent.feature('resource') do
188
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
189
189
  Aws::Waiters::Waiter.new(options).wait({})
190
190
  end
191
191
  end
@@ -209,7 +209,7 @@ module Aws::EC2
209
209
  # @return [EmptyStructure]
210
210
  def associate_with_vpc(options = {})
211
211
  options = options.merge(dhcp_options_id: @id)
212
- resp = Aws::Plugins::UserAgent.feature('resource') do
212
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
213
213
  @client.associate_dhcp_options(options)
214
214
  end
215
215
  resp.data
@@ -240,7 +240,7 @@ module Aws::EC2
240
240
  def create_tags(options = {})
241
241
  batch = []
242
242
  options = Aws::Util.deep_merge(options, resources: [@id])
243
- resp = Aws::Plugins::UserAgent.feature('resource') do
243
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
244
244
  @client.create_tags(options)
245
245
  end
246
246
  options[:tags].each do |t|
@@ -287,7 +287,7 @@ module Aws::EC2
287
287
  def delete_tags(options = {})
288
288
  batch = []
289
289
  options = Aws::Util.deep_merge(options, resources: [@id])
290
- resp = Aws::Plugins::UserAgent.feature('resource') do
290
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
291
291
  @client.delete_tags(options)
292
292
  end
293
293
  options[:tags].each do |t|
@@ -315,7 +315,7 @@ module Aws::EC2
315
315
  # @return [EmptyStructure]
316
316
  def delete(options = {})
317
317
  options = options.merge(dhcp_options_id: @id)
318
- resp = Aws::Plugins::UserAgent.feature('resource') do
318
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
319
319
  @client.delete_dhcp_options(options)
320
320
  end
321
321
  resp.data
@@ -52,15 +52,18 @@ module Aws::EC2
52
52
  self[:region] = options[:region]
53
53
  self[:use_dual_stack] = options[:use_dual_stack]
54
54
  self[:use_dual_stack] = false if self[:use_dual_stack].nil?
55
- if self[:use_dual_stack].nil?
56
- raise ArgumentError, "Missing required EndpointParameter: :use_dual_stack"
57
- end
58
55
  self[:use_fips] = options[:use_fips]
59
56
  self[:use_fips] = false if self[:use_fips].nil?
60
- if self[:use_fips].nil?
61
- raise ArgumentError, "Missing required EndpointParameter: :use_fips"
62
- end
63
57
  self[:endpoint] = options[:endpoint]
64
58
  end
59
+
60
+ def self.create(config, options={})
61
+ new({
62
+ region: config.region,
63
+ use_dual_stack: config.use_dualstack_endpoint,
64
+ use_fips: config.use_fips_endpoint,
65
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
66
+ }.merge(options))
67
+ end
65
68
  end
66
69
  end
@@ -10,43 +10,39 @@
10
10
  module Aws::EC2
11
11
  class EndpointProvider
12
12
  def resolve_endpoint(parameters)
13
- region = parameters.region
14
- use_dual_stack = parameters.use_dual_stack
15
- use_fips = parameters.use_fips
16
- endpoint = parameters.endpoint
17
- if Aws::Endpoints::Matchers.set?(endpoint)
18
- if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
13
+ if Aws::Endpoints::Matchers.set?(parameters.endpoint)
14
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
19
15
  raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
20
16
  end
21
- if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
17
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
22
18
  raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
23
19
  end
24
- return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
20
+ return Aws::Endpoints::Endpoint.new(url: parameters.endpoint, headers: {}, properties: {})
25
21
  end
26
- if Aws::Endpoints::Matchers.set?(region)
27
- if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
28
- if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
22
+ if Aws::Endpoints::Matchers.set?(parameters.region)
23
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
24
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
29
25
  if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS")) && Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
30
- return Aws::Endpoints::Endpoint.new(url: "https://ec2-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
26
+ return Aws::Endpoints::Endpoint.new(url: "https://ec2-fips.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
31
27
  end
32
28
  raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
33
29
  end
34
- if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
30
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
35
31
  if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
36
32
  if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "aws-us-gov")
37
- return Aws::Endpoints::Endpoint.new(url: "https://ec2.#{region}.amazonaws.com", headers: {}, properties: {})
33
+ return Aws::Endpoints::Endpoint.new(url: "https://ec2.#{parameters.region}.amazonaws.com", headers: {}, properties: {})
38
34
  end
39
- return Aws::Endpoints::Endpoint.new(url: "https://ec2-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
35
+ return Aws::Endpoints::Endpoint.new(url: "https://ec2-fips.#{parameters.region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
40
36
  end
41
37
  raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
42
38
  end
43
- if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
39
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
44
40
  if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
45
- return Aws::Endpoints::Endpoint.new(url: "https://ec2.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
41
+ return Aws::Endpoints::Endpoint.new(url: "https://ec2.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
46
42
  end
47
43
  raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
48
44
  end
49
- return Aws::Endpoints::Endpoint.new(url: "https://ec2.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
45
+ return Aws::Endpoints::Endpoint.new(url: "https://ec2.#{parameters.region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
50
46
  end
51
47
  end
52
48
  raise ArgumentError, "Invalid Configuration: Missing Region"