awspec 1.28.1 → 1.28.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c039a40af7b57d9dff480f291fc73b2320c61a34e155ccf962b5bd77b92ade9
4
- data.tar.gz: cc1b06bb52308839f57b0216497d762ba29e75be9586b781e488cfbb92b905d9
3
+ metadata.gz: b6f1ca2cbd7fc6f8da6c63b21580d6541b0537991e70b4fe6355206b4220d596
4
+ data.tar.gz: 6a63cd43a83035df50cde9861b13390807ed23e719e8823c1171b55f62c94491
5
5
  SHA512:
6
- metadata.gz: 3c23f6c2fc84093a7fed2a96117036227a7d6006d225d094ad91487fceec2e6cf224fd0c3ae19a5ea695b1eaedbe070c829bf2d9275c390ab6d1a257e17bd399
7
- data.tar.gz: f8e0ef447b854ed2ae4c935aa0d2c463a2145c65ced5533006da2dc4f39806b1eb81d234311ebf1d619acc8747811f47299a4703895795d5d287759878c9665b
6
+ metadata.gz: 241b78c9bd20ad9adba886717e3f95133c632e25b0dcedc2b86ec9c14f98a5a0c1a7f6a2cd1539ab63465e99490081b6e83c19847bb022280523f01231e5dfa0
7
+ data.tar.gz: 6b556cf9de7bc9c7ff171fe77ca28b7e21ee9d3ec3ee6428dc20205cea8fb85fde05f3307a8a8fc8a20cfdf47a980920b8fa0890a7736585070bc8fc2e1a6bd2
@@ -88,7 +88,7 @@ describe s3_bucket('my-bucket') do
88
88
  it do
89
89
  should have_lifecycle_rule(
90
90
  id: 'MyRuleName2',
91
- prefix: '123/',
91
+ filter: { prefix: '123/' },
92
92
  noncurrent_version_expiration: { noncurrent_days: 2 },
93
93
  expiration: { days: 3 },
94
94
  transitions: [{ days: 5, storage_class: 'STANDARD_IA' }, { days: 10, storage_class: 'GLACIER' }],
@@ -49,6 +49,7 @@ end
49
49
  ```ruby
50
50
  describe vpc_endpoints('my-vpc-endpoint') do
51
51
  it { should have_subnet('subnet-abc123') }
52
+ it { should have_subnet('my-subnet') }
52
53
  end
53
54
  ```
54
55
 
@@ -22,4 +22,11 @@ describe vpn_gateway('my-vpn-gateway') do
22
22
  end
23
23
  ```
24
24
 
25
- ### its(:vpn_gateway_id), its(:state), its(:type), its(:availability_zone)
25
+ ### belong_to_vpc
26
+
27
+ ```ruby
28
+ describe vpn_gateway('my-vpn-gateway') do
29
+ it { should belong_to_vpc('vpc-ab123cde') }
30
+ it { should belong_to_vpc('my-vpc') }
31
+ end
32
+ ```
@@ -278,7 +278,7 @@ end
278
278
 
279
279
  ### have_tag
280
280
 
281
- ### its(:architecture), its(:creation_date), its(:image_id), its(:image_location), its(:image_type), its(:public), its(:kernel_id), its(:owner_id), its(:platform), its(:platform_details), its(:usage_operation), its(:ramdisk_id), its(:state), its(:description), its(:ena_support), its(:hypervisor), its(:image_owner_alias), its(:name), its(:root_device_name), its(:root_device_type), its(:sriov_net_support), its(:state_reason), its(:virtualization_type), its(:boot_mode), its(:tpm_support), its(:deprecation_time)
281
+ ### its(:architecture), its(:creation_date), its(:image_id), its(:image_location), its(:image_type), its(:public), its(:kernel_id), its(:owner_id), its(:platform), its(:platform_details), its(:usage_operation), its(:ramdisk_id), its(:state), its(:description), its(:ena_support), its(:hypervisor), its(:image_owner_alias), its(:name), its(:root_device_name), its(:root_device_type), its(:sriov_net_support), its(:state_reason), its(:virtualization_type), its(:boot_mode), its(:tpm_support), its(:deprecation_time), its(:imds_support)
282
282
  ### :unlock: Advanced use
283
283
 
284
284
  `ami` can use `Aws::EC2::Image` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Image.html).
@@ -1359,7 +1359,7 @@ describe eip('123.0.456.789') do
1359
1359
  end
1360
1360
  ```
1361
1361
 
1362
-
1362
+ ### its(:instance_id), its(:public_ip), its(:allocation_id), its(:association_id), its(:domain), its(:network_interface_id), its(:network_interface_owner_id), its(:private_ip_address), its(:public_ipv_4_pool), its(:network_border_group), its(:customer_owned_ip), its(:customer_owned_ipv_4_pool), its(:carrier_ip)
1363
1363
  ## <a name="eks">eks</a>
1364
1364
 
1365
1365
  Eks resource type.
@@ -1380,7 +1380,7 @@ describe eks('my-eks') do
1380
1380
  end
1381
1381
  ```
1382
1382
 
1383
- ### its(:name), its(:arn), its(:created_at), its(:version), its(:endpoint), its(:role_arn), its(:kubernetes_network_config), its(:logging), its(:identity), its(:status), its(:client_request_token), its(:platform_version), its(:tags), its(:encryption_config), its(:connector_config)
1383
+ ### its(:name), its(:arn), its(:created_at), its(:version), its(:endpoint), its(:role_arn), its(:kubernetes_network_config), its(:logging), its(:identity), its(:status), its(:client_request_token), its(:platform_version), its(:tags), its(:encryption_config), its(:connector_config), its(:id), its(:health), its(:outpost_config)
1384
1384
  ## <a name="eks_nodegroup">eks_nodegroup</a>
1385
1385
 
1386
1386
  EksNodegroup resource type.
@@ -3370,7 +3370,7 @@ describe s3_bucket('my-bucket') do
3370
3370
  it do
3371
3371
  should have_lifecycle_rule(
3372
3372
  id: 'MyRuleName2',
3373
- prefix: '123/',
3373
+ filter: { prefix: '123/' },
3374
3374
  noncurrent_version_expiration: { noncurrent_days: 2 },
3375
3375
  expiration: { days: 3 },
3376
3376
  transitions: [{ days: 5, storage_class: 'STANDARD_IA' }, { days: 10, storage_class: 'GLACIER' }],
@@ -4001,6 +4001,7 @@ end
4001
4001
  ```ruby
4002
4002
  describe vpc_endpoints('my-vpc-endpoint') do
4003
4003
  it { should have_subnet('subnet-abc123') }
4004
+ it { should have_subnet('my-subnet') }
4004
4005
  end
4005
4006
  ```
4006
4007
 
@@ -4023,7 +4024,7 @@ end
4023
4024
  ```
4024
4025
 
4025
4026
 
4026
-
4027
+ ### its(:vpc_endpoint_id), its(:vpc_endpoint_type), its(:vpc_id), its(:service_name), its(:state), its(:policy_document), its(:route_table_ids), its(:subnet_ids), its(:groups), its(:ip_address_type), its(:dns_options), its(:private_dns_enabled), its(:requester_managed), its(:network_interface_ids), its(:dns_entries), its(:creation_timestamp), its(:owner_id), its(:last_error)
4027
4028
  ### :unlock: Advanced use
4028
4029
 
4029
4030
  `vpc_endpoints` can use `Aws::EC2::Types::VpcEndpoint` resource (see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Types/VpcEndpoint.html).
@@ -4100,7 +4101,16 @@ end
4100
4101
  ```
4101
4102
 
4102
4103
 
4103
- ### its(:availability_zone), its(:state), its(:type), its(:vpc_attachments), its(:vpn_gateway_id), its(:amazon_side_asn), its(:tags)
4104
+ ### belong_to_vpc
4105
+
4106
+ ```ruby
4107
+ describe vpn_gateway('my-vpn-gateway') do
4108
+ it { should belong_to_vpc('vpc-ab123cde') }
4109
+ it { should belong_to_vpc('my-vpc') }
4110
+ end
4111
+ ```
4112
+
4113
+ ### its(:availability_zone), its(:state), its(:type), its(:vpn_gateway_id), its(:amazon_side_asn)
4104
4114
  ## <a name="waf_web_acl">waf_web_acl</a>
4105
4115
 
4106
4116
  WafWebAcl resource type.
@@ -7,7 +7,7 @@ module Awspec::Generator
7
7
  def initialize
8
8
  super
9
9
  @type_name = 'VpcEndpoints'
10
- @type = Awspec::Type::VpcEndpoints.new('my-vpc-endpoint')
10
+ @type = Awspec::Type::VpcEndpoints.new('vpce-abc123')
11
11
  @ret = @type.resource_via_client
12
12
  @matchers = [
13
13
  Awspec::Type::VpcEndpoints::STATES.map { |state| "be_#{state.tr('-', '_')}" }.join(', '),
@@ -10,7 +10,8 @@ module Awspec::Generator
10
10
  @type = Awspec::Type::VpnGateway.new('my-vpn-gateway')
11
11
  @ret = @type.resource_via_client
12
12
  @matchers = [
13
- Awspec::Type::VpnGateway::STATES.map { |state| "be_#{state.tr('-', '_')}" }.join(', ')
13
+ Awspec::Type::VpnGateway::STATES.map { |state| "be_#{state.tr('-', '_')}" }.join(', '),
14
+ 'belong_to_vpc'
14
15
  ]
15
16
  @ignore_matchers = Awspec::Type::VpnGateway::STATES.map { |state| "be_#{state.tr('-', '_')}" }
16
17
  @describes = []
@@ -76,12 +76,16 @@ module Awspec::Helper
76
76
  define_method "find_#{type}_gateway" do |*args|
77
77
  gateway_id = args.first
78
78
  method_name = "describe_#{type}_gateways"
79
- res = ec2_client.send(
80
- method_name,
81
- { filters: [{ name: "#{type}-gateway-id", values: [gateway_id] }] }
82
- )
83
- resource = res["#{type}_gateways"].single_resource(gateway_id)
84
- return resource if resource
79
+ begin
80
+ res = ec2_client.send(
81
+ method_name,
82
+ { filters: [{ name: "#{type}-gateway-id", values: [gateway_id] }] }
83
+ )
84
+ resource = res["#{type}_gateways"].single_resource(gateway_id)
85
+ return resource if resource
86
+ rescue StandardError
87
+ resource = nil
88
+ end
85
89
 
86
90
  res = ec2_client.send(
87
91
  method_name,
@@ -14,12 +14,12 @@ module Awspec::Helper
14
14
  res = ec2_client.describe_addresses({
15
15
  filters: [{ name: 'public-ip', values: [id] }]
16
16
  })
17
- return res.addresses unless res.addresses.empty?
17
+ return res.addresses.single_resource(id) unless res.addresses.empty?
18
18
 
19
19
  res = ec2_client.describe_addresses({
20
20
  filters: [{ name: 'tag:Name', values: [id] }]
21
21
  })
22
- res.addresses
22
+ res.addresses.single_resource(id)
23
23
  end
24
24
  end
25
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  RSpec::Matchers.define :belong_to_domain do |domain|
4
4
  match do |type|
5
- return true if type.resource_via_client.last[:domain] == domain
5
+ return true if type.resource_via_client[:domain] == domain
6
6
  end
7
7
  end
@@ -7,7 +7,20 @@ Aws.config[:ec2] = {
7
7
  vpn_gateway_id: 'vgw-cg5692g4',
8
8
  availability_zone: 'us-east-1a',
9
9
  state: 'available',
10
- type: "ipsec.1"
10
+ type: "ipsec.1",
11
+ vpc_attachments: [
12
+ {
13
+ state: 'attached',
14
+ vpc_id: 'vpc-ab123cde'
15
+ }
16
+ ],
17
+ amazon_side_asn: 64512,
18
+ tags: [
19
+ {
20
+ key: 'Name',
21
+ value: 'my-vpn-gateway'
22
+ }
23
+ ]
11
24
  }
12
25
  ]
13
26
  }
@@ -2,18 +2,20 @@
2
2
 
3
3
  module Awspec::Type
4
4
  class Eip < ResourceBase
5
+ aws_resource Aws::EC2::Types::Address
6
+
5
7
  def resource_via_client
6
8
  @resource_via_client ||= select_eip(@display_name)
7
9
  end
8
10
 
9
11
  def id
10
- @id ||= resource_via_client.last.public_ip if resource_via_client
12
+ @id ||= resource_via_client.public_ip if resource_via_client
11
13
  end
12
14
 
13
15
  def associated_to?(instance_id)
14
- return false unless resource_via_client.last.instance_id == instance_id
16
+ return false unless resource_via_client.instance_id == instance_id
15
17
 
16
- resource_via_client.last.instance_id == instance_id
18
+ resource_via_client.instance_id == instance_id
17
19
  end
18
20
  end
19
21
  end
@@ -45,6 +45,12 @@ module Awspec::Type
45
45
  subnet == subnet_id
46
46
  end
47
47
  return true if ret
48
+
49
+ res = find_subnet(subnet_id)
50
+ ret = subnets.find do |subnet|
51
+ subnet == res.subnet_id
52
+ end
53
+ return true if ret
48
54
  end
49
55
  end
50
56
  end
@@ -27,16 +27,8 @@ module Awspec::Type
27
27
  end
28
28
  end
29
29
 
30
- def availability_zone
31
- resource_via_client.availability_zone
32
- end
33
-
34
- def vpc_attachments
35
- resource_via_client.vpc_attachments
36
- end
37
-
38
- def type
39
- resource_via_client.type
30
+ def vpc_id
31
+ resource_via_client.vpc_attachments.first.vpc_id
40
32
  end
41
33
  end
42
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Awspec
4
- VERSION = '1.28.1'
4
+ VERSION = '1.28.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.28.1
4
+ version: 1.28.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-29 00:00:00.000000000 Z
11
+ date: 2022-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable