awspec 1.28.0 → 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: a7d1b88af80d3b1bf908f34ad1f537505881bfb258f88ff56db14ab63d37afb8
4
- data.tar.gz: 4da3943ff6e94748d3816823e91134d58a9a7ee522159534c1728ac0dbdc3afb
3
+ metadata.gz: b6f1ca2cbd7fc6f8da6c63b21580d6541b0537991e70b4fe6355206b4220d596
4
+ data.tar.gz: 6a63cd43a83035df50cde9861b13390807ed23e719e8823c1171b55f62c94491
5
5
  SHA512:
6
- metadata.gz: 4dd50e4e4c5d3c3afb5a2c8c45de378fcc8b90bdf3cd0f2d8e47e951713d4022d084621a47fc0c32853cfa86ebec335a6e302acc8cb35513d240ecb2d56de1e4
7
- data.tar.gz: ed8efb4183559c1ac70c8b801e2545a9fff732c2584f9fb34b2878e5275a0ba91a1fcafd9be469f33f78bbe2143a2f2555e433ea6be7b9d90ed9015bf103c7d1
6
+ metadata.gz: 241b78c9bd20ad9adba886717e3f95133c632e25b0dcedc2b86ec9c14f98a5a0c1a7f6a2cd1539ab63465e99490081b6e83c19847bb022280523f01231e5dfa0
7
+ data.tar.gz: 6b556cf9de7bc9c7ff171fe77ca28b7e21ee9d3ec3ee6428dc20205cea8fb85fde05f3307a8a8fc8a20cfdf47a980920b8fa0890a7736585070bc8fc2e1a6bd2
@@ -6,3 +6,11 @@ describe cloudformation_stack('my-cloudformation-stack') do
6
6
  its(:stack_status) { should eq 'UPDATE_COMPLETE' }
7
7
  end
8
8
  ```
9
+
10
+ ### have_tag
11
+
12
+ ```ruby
13
+ describe cloudformation_stack('my-cloudformation-stack') do
14
+ it { should have_tag('env').value('dev') }
15
+ end
16
+ ```
@@ -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' }],
@@ -1,11 +1,6 @@
1
- ### exist
1
+ ### first
2
2
 
3
3
  ```ruby
4
- describe vpc_endpoints('my-vpc-endpoint') do
5
- it { should exist }
6
- end
7
- ```
8
-
9
4
  describe vpc_endpoints('vpce-05907f23265b25f20'), region: $tfvars["region"]["value"] do
10
5
  it { should exist }
11
6
  it { should be_available }
@@ -15,11 +10,20 @@ describe vpc_endpoints('vpce-05907f23265b25f20'), region: $tfvars["region"]["val
15
10
  its(:vpc_endpoint_type) { should eq 'Interface' }
16
11
  its(:service_name) { should eq 'com.amazonaws.eu-west-1.codebuild' }
17
12
  end
13
+ ```
14
+
15
+ ### exist
16
+
17
+ ```ruby
18
+ describe vpc_endpoints('my-vpc-endpoint') do
19
+ it { should exist }
20
+ end
21
+ ```
18
22
 
19
23
  ### be_pendingacceptance, be_pending, be_available, be_deleting, be_deleted, be_rejected, be_failed, be_expired
20
24
 
21
25
  ```ruby
22
- describe ami('my-ami') do
26
+ describe vpc_endpoints('my-vpc-endpoint') do
23
27
  it { should be_available }
24
28
  end
25
29
  ```
@@ -45,6 +49,7 @@ end
45
49
  ```ruby
46
50
  describe vpc_endpoints('my-vpc-endpoint') do
47
51
  it { should have_subnet('subnet-abc123') }
52
+ it { should have_subnet('my-subnet') }
48
53
  end
49
54
  ```
50
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).
@@ -457,6 +457,15 @@ describe cloudformation_stack('my-cloudformation-stack') do
457
457
  end
458
458
  ```
459
459
 
460
+
461
+ ### have_tag
462
+
463
+ ```ruby
464
+ describe cloudformation_stack('my-cloudformation-stack') do
465
+ it { should have_tag('env').value('dev') }
466
+ end
467
+ ```
468
+
460
469
  ### its(:stack_id), its(:stack_name), its(:change_set_id), its(:description), its(:parameters), its(:creation_time), its(:deletion_time), its(:last_updated_time), its(:rollback_configuration), its(:stack_status), its(:stack_status_reason), its(:disable_rollback), its(:notification_arns), its(:timeout_in_minutes), its(:capabilities), its(:role_arn), its(:enable_termination_protection), its(:parent_id), its(:root_id), its(:drift_information)
461
470
  ## <a name="cloudfront_distribution">cloudfront_distribution</a>
462
471
 
@@ -1350,7 +1359,7 @@ describe eip('123.0.456.789') do
1350
1359
  end
1351
1360
  ```
1352
1361
 
1353
-
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)
1354
1363
  ## <a name="eks">eks</a>
1355
1364
 
1356
1365
  Eks resource type.
@@ -1371,7 +1380,7 @@ describe eks('my-eks') do
1371
1380
  end
1372
1381
  ```
1373
1382
 
1374
- ### 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)
1375
1384
  ## <a name="eks_nodegroup">eks_nodegroup</a>
1376
1385
 
1377
1386
  EksNodegroup resource type.
@@ -2932,7 +2941,7 @@ describe rds_db_cluster('my-rds-db-cluster') do
2932
2941
  end
2933
2942
  ```
2934
2943
 
2935
- ### its(:allocated_storage), its(:availability_zones), its(:backup_retention_period), its(:character_set_name), its(:database_name), its(:db_cluster_identifier), its(:db_cluster_parameter_group), its(:db_subnet_group), its(:status), its(:automatic_restart_time), its(:percent_progress), its(:earliest_restorable_time), its(:endpoint), its(:reader_endpoint), its(:custom_endpoints), its(:multi_az), its(:engine), its(:engine_version), its(:latest_restorable_time), its(:port), its(:master_username), its(:db_cluster_option_group_memberships), its(:preferred_backup_window), its(:preferred_maintenance_window), its(:replication_source_identifier), its(:read_replica_identifiers), its(:hosted_zone_id), its(:storage_encrypted), its(:kms_key_id), its(:db_cluster_resource_id), its(:db_cluster_arn), its(:associated_roles), its(:iam_database_authentication_enabled), its(:clone_group_id), its(:cluster_create_time), its(:earliest_backtrack_time), its(:backtrack_window), its(:backtrack_consumed_change_records), its(:enabled_cloudwatch_logs_exports), its(:capacity), its(:engine_mode), its(:scaling_configuration_info), its(:deletion_protection), its(:http_endpoint_enabled), its(:activity_stream_mode), its(:activity_stream_status), its(:activity_stream_kms_key_id), its(:activity_stream_kinesis_stream_name), its(:copy_tags_to_snapshot), its(:cross_account_clone), its(:domain_memberships), its(:tag_list), its(:global_write_forwarding_status), its(:global_write_forwarding_requested), its(:pending_modified_values), its(:db_cluster_instance_class), its(:storage_type), its(:iops), its(:publicly_accessible), its(:auto_minor_version_upgrade), its(:monitoring_interval), its(:monitoring_role_arn), its(:performance_insights_enabled), its(:performance_insights_kms_key_id), its(:performance_insights_retention_period), its(:serverless_v2_scaling_configuration)
2944
+ ### its(:allocated_storage), its(:availability_zones), its(:backup_retention_period), its(:character_set_name), its(:database_name), its(:db_cluster_identifier), its(:db_cluster_parameter_group), its(:db_subnet_group), its(:status), its(:automatic_restart_time), its(:percent_progress), its(:earliest_restorable_time), its(:endpoint), its(:reader_endpoint), its(:custom_endpoints), its(:multi_az), its(:engine), its(:engine_version), its(:latest_restorable_time), its(:port), its(:master_username), its(:db_cluster_option_group_memberships), its(:preferred_backup_window), its(:preferred_maintenance_window), its(:replication_source_identifier), its(:read_replica_identifiers), its(:hosted_zone_id), its(:storage_encrypted), its(:kms_key_id), its(:db_cluster_resource_id), its(:db_cluster_arn), its(:associated_roles), its(:iam_database_authentication_enabled), its(:clone_group_id), its(:cluster_create_time), its(:earliest_backtrack_time), its(:backtrack_window), its(:backtrack_consumed_change_records), its(:enabled_cloudwatch_logs_exports), its(:capacity), its(:engine_mode), its(:scaling_configuration_info), its(:deletion_protection), its(:http_endpoint_enabled), its(:activity_stream_mode), its(:activity_stream_status), its(:activity_stream_kms_key_id), its(:activity_stream_kinesis_stream_name), its(:copy_tags_to_snapshot), its(:cross_account_clone), its(:domain_memberships), its(:tag_list), its(:global_write_forwarding_status), its(:global_write_forwarding_requested), its(:pending_modified_values), its(:db_cluster_instance_class), its(:storage_type), its(:iops), its(:publicly_accessible), its(:auto_minor_version_upgrade), its(:monitoring_interval), its(:monitoring_role_arn), its(:performance_insights_enabled), its(:performance_insights_kms_key_id), its(:performance_insights_retention_period), its(:serverless_v2_scaling_configuration), its(:network_type)
2936
2945
  ## <a name="rds_db_cluster_parameter_group">rds_db_cluster_parameter_group</a>
2937
2946
 
2938
2947
  RdsDbClusterParameterGroup resource type.
@@ -3361,7 +3370,7 @@ describe s3_bucket('my-bucket') do
3361
3370
  it do
3362
3371
  should have_lifecycle_rule(
3363
3372
  id: 'MyRuleName2',
3364
- prefix: '123/',
3373
+ filter: { prefix: '123/' },
3365
3374
  noncurrent_version_expiration: { noncurrent_days: 2 },
3366
3375
  expiration: { days: 3 },
3367
3376
  transitions: [{ days: 5, storage_class: 'STANDARD_IA' }, { days: 10, storage_class: 'GLACIER' }],
@@ -3947,14 +3956,7 @@ end
3947
3956
 
3948
3957
  VpcEndpoints resource type.
3949
3958
 
3950
- ### exist
3951
-
3952
3959
  ```ruby
3953
- describe vpc_endpoints('my-vpc-endpoint') do
3954
- it { should exist }
3955
- end
3956
- ```
3957
-
3958
3960
  describe vpc_endpoints('vpce-05907f23265b25f20'), region: $tfvars["region"]["value"] do
3959
3961
  it { should exist }
3960
3962
  it { should be_available }
@@ -3964,23 +3966,26 @@ describe vpc_endpoints('vpce-05907f23265b25f20'), region: $tfvars["region"]["val
3964
3966
  its(:vpc_endpoint_type) { should eq 'Interface' }
3965
3967
  its(:service_name) { should eq 'com.amazonaws.eu-west-1.codebuild' }
3966
3968
  end
3969
+ ```
3967
3970
 
3968
3971
 
3969
- ### be_available
3970
-
3971
- ### be_deleted
3972
-
3973
- ### be_deleting
3972
+ ### exist
3974
3973
 
3975
- ### be_expired
3974
+ ```ruby
3975
+ describe vpc_endpoints('my-vpc-endpoint') do
3976
+ it { should exist }
3977
+ end
3978
+ ```
3976
3979
 
3977
- ### be_failed
3978
3980
 
3979
- ### be_pending
3981
+ ### be_pendingacceptance, be_pending, be_available, be_deleting, be_deleted, be_rejected, be_failed, be_expired
3980
3982
 
3981
- ### be_pendingacceptance
3983
+ ```ruby
3984
+ describe vpc_endpoints('my-vpc-endpoint') do
3985
+ it { should be_available }
3986
+ end
3987
+ ```
3982
3988
 
3983
- ### be_rejected
3984
3989
 
3985
3990
  ### have_route_table
3986
3991
 
@@ -3996,6 +4001,7 @@ end
3996
4001
  ```ruby
3997
4002
  describe vpc_endpoints('my-vpc-endpoint') do
3998
4003
  it { should have_subnet('subnet-abc123') }
4004
+ it { should have_subnet('my-subnet') }
3999
4005
  end
4000
4006
  ```
4001
4007
 
@@ -4009,7 +4015,16 @@ end
4009
4015
  ```
4010
4016
 
4011
4017
 
4018
+ ### belong_to_vpc
4019
+
4020
+ ```ruby
4021
+ describe vpc_endpoints('my-vpc-endpoint') do
4022
+ it { should belong_to_vpc('my-vpc') }
4023
+ end
4024
+ ```
4025
+
4012
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)
4013
4028
  ### :unlock: Advanced use
4014
4029
 
4015
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).
@@ -4086,7 +4101,16 @@ end
4086
4101
  ```
4087
4102
 
4088
4103
 
4089
- ### 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)
4090
4114
  ## <a name="waf_web_acl">waf_web_acl</a>
4091
4115
 
4092
4116
  WafWebAcl resource type.
@@ -7,10 +7,13 @@ 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
- @matchers = []
13
- @ignore_matchers = []
12
+ @matchers = [
13
+ Awspec::Type::VpcEndpoints::STATES.map { |state| "be_#{state.tr('-', '_')}" }.join(', '),
14
+ 'belong_to_vpc'
15
+ ]
16
+ @ignore_matchers = Awspec::Type::VpcEndpoints::STATES.map { |state| "be_#{state.tr('-', '_')}" }
14
17
  @describes = []
15
18
  end
16
19
  end
@@ -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,6 +2,9 @@
2
2
 
3
3
  module Awspec::Type
4
4
  class CloudformationStack < ResourceBase
5
+ aws_resource Aws::CloudFormation::Stack
6
+ tags_allowed
7
+
5
8
  def resource_via_client
6
9
  @resource_via_client ||= find_cloudformation_stack(@display_name)
7
10
  end
@@ -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.0'
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.0
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-16 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