awspec 1.29.3 → 1.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/_resource_types/managed_prefix_list.md +32 -0
- data/doc/_resource_types/transit_gateway.md +22 -0
- data/doc/resource_types.md +72 -9
- data/lib/awspec/command/generate.rb +1 -1
- data/lib/awspec/generator/doc/type/managed_prefix_list.rb +19 -0
- data/lib/awspec/generator/spec/managed_prefix_list.rb +54 -0
- data/lib/awspec/generator.rb +1 -0
- data/lib/awspec/helper/finder/ec2.rb +12 -0
- data/lib/awspec/helper/type.rb +1 -1
- data/lib/awspec/matcher/have_cidr.rb +11 -0
- data/lib/awspec/matcher.rb +3 -0
- data/lib/awspec/stub/managed_prefix_list.rb +41 -0
- data/lib/awspec/type/managed_prefix_list.rb +34 -0
- data/lib/awspec/type/transit_gateway.rb +15 -3
- data/lib/awspec/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ac4e770831b2f9127704f76b94a1f99d2adb29e18eb243fa9fc32f7834c4486
|
4
|
+
data.tar.gz: '088995fff7e66a7892804df42ecaf10488cd1239763f3ce140a4c25a1dfd98ed'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60535094ab52fc898f50c8a8cc161e63b77faf6e4999efd0eaf9ca9f0a42353c65af944031ac5bdc724d0ac2e68c3c97e732b8f2a6402e4c47e821c33bbbd753
|
7
|
+
data.tar.gz: 93e44185ee31546e493e6cd2302832a725975a368a013377a7a48a6f8c6201e6d7d27be14a5750ec6950ad886f4c3b04b6b7a1c1c0825959667c7157797f6bab
|
@@ -0,0 +1,32 @@
|
|
1
|
+
### exist
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
describe managed_prefix_list('my-managed-prefix-list') do
|
5
|
+
it { should exist }
|
6
|
+
end
|
7
|
+
```
|
8
|
+
|
9
|
+
### have_cidr
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
describe managed_prefix_list('my-managed-prefix-list') do
|
13
|
+
it { should have_cidr('10.0.0.0/16') }
|
14
|
+
it { should have_cidr('192.168.0.0/24').desc('dev') }
|
15
|
+
end
|
16
|
+
```
|
17
|
+
|
18
|
+
### its(:entries_count)
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
describe managed_prefix_list('my-managed-prefix-list') do
|
22
|
+
its(:entries_count) { should eq 2 }
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
### have_tag
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
describe managed_prefix_list('my-managed-prefix-list') do
|
30
|
+
it { should have_tag('env').value('dev') }
|
31
|
+
end
|
32
|
+
```
|
@@ -22,3 +22,25 @@ describe transit_gateway('my-tgw') do
|
|
22
22
|
its(:transit_gateway_id) { should eq 'tgw-1234567890abcdefg' }
|
23
23
|
end
|
24
24
|
```
|
25
|
+
### have_attachment
|
26
|
+
|
27
|
+
#### using attachment id
|
28
|
+
```ruby
|
29
|
+
describe transit_gateway('tgw-1234567890abcdefg') do
|
30
|
+
it { should have_attachment('tgw-attach-1234567890abcdefg') }
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
#### using attachment name
|
35
|
+
```ruby
|
36
|
+
describe transit_gateway('tgw-1234567890abcdefg') do
|
37
|
+
it { should have_attachment('my-prod-tgw-attachment') }
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
#### using regular expression attachment name
|
42
|
+
```ruby
|
43
|
+
describe transit_gateway('tgw-1234567890abcdefg') do
|
44
|
+
it { should have_attachment(/^my-\w+-tgw-attachment$/) }
|
45
|
+
end
|
46
|
+
```
|
data/doc/resource_types.md
CHANGED
@@ -52,6 +52,7 @@
|
|
52
52
|
| [lambda](#lambda)
|
53
53
|
| [launch_configuration](#launch_configuration)
|
54
54
|
| [launch_template](#launch_template)
|
55
|
+
| [managed_prefix_list](#managed_prefix_list)
|
55
56
|
| [mq](#mq)
|
56
57
|
| [msk](#msk)
|
57
58
|
| [nat_gateway](#nat_gateway)
|
@@ -417,7 +418,7 @@ describe batch_job_definition('my-batch-job-definition') do
|
|
417
418
|
end
|
418
419
|
```
|
419
420
|
|
420
|
-
### its(:job_definition_name), its(:job_definition_arn), its(:revision), its(:status), its(:type), its(:scheduling_priority), its(:parameters), its(:retry_strategy), its(:timeout), its(:node_properties), its(:tags), its(:propagate_tags), its(:platform_capabilities), its(:eks_properties), its(:container_orchestration_type)
|
421
|
+
### its(:job_definition_name), its(:job_definition_arn), its(:revision), its(:status), its(:type), its(:scheduling_priority), its(:parameters), its(:retry_strategy), its(:timeout), its(:node_properties), its(:tags), its(:propagate_tags), its(:platform_capabilities), its(:ecs_properties), its(:eks_properties), its(:container_orchestration_type)
|
421
422
|
## <a name="batch_job_queue">batch_job_queue</a>
|
422
423
|
|
423
424
|
BatchJobQueue resource type.
|
@@ -443,7 +444,7 @@ describe batch_job_queue('my-batch-job-queue') do
|
|
443
444
|
end
|
444
445
|
```
|
445
446
|
|
446
|
-
### its(:job_queue_name), its(:job_queue_arn), its(:state), its(:scheduling_policy_arn), its(:status), its(:status_reason), its(:priority), its(:tags)
|
447
|
+
### its(:job_queue_name), its(:job_queue_arn), its(:state), its(:scheduling_policy_arn), its(:status), its(:status_reason), its(:priority), its(:tags), its(:job_state_time_limit_actions)
|
447
448
|
## <a name="cloudformation_stack">cloudformation_stack</a>
|
448
449
|
|
449
450
|
CloudformationStack resource type.
|
@@ -466,7 +467,7 @@ describe cloudformation_stack('my-cloudformation-stack') do
|
|
466
467
|
end
|
467
468
|
```
|
468
469
|
|
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), its(:retain_except_on_create)
|
470
|
+
### 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), its(:retain_except_on_create), its(:detailed_status)
|
470
471
|
## <a name="cloudfront_distribution">cloudfront_distribution</a>
|
471
472
|
|
472
473
|
CloudfrontDistribution resource type.
|
@@ -729,7 +730,7 @@ describe cloudwatch_logs('my-cloudwatch-logs-group') do
|
|
729
730
|
end
|
730
731
|
```
|
731
732
|
|
732
|
-
### its(:log_group_name), its(:creation_time), its(:retention_in_days), its(:metric_filter_count), its(:arn), its(:stored_bytes), its(:kms_key_id), its(:data_protection_status), its(:inherited_properties), its(:log_group_class)
|
733
|
+
### its(:log_group_name), its(:creation_time), its(:retention_in_days), its(:metric_filter_count), its(:arn), its(:stored_bytes), its(:kms_key_id), its(:data_protection_status), its(:inherited_properties), its(:log_group_class), its(:log_group_arn)
|
733
734
|
## <a name="codebuild">codebuild</a>
|
734
735
|
|
735
736
|
Codebuild resource type.
|
@@ -1595,7 +1596,7 @@ end
|
|
1595
1596
|
```
|
1596
1597
|
|
1597
1598
|
|
1598
|
-
### its(:domain_id), its(:domain_name), its(:arn), its(:created), its(:deleted), its(:endpoint), its(:endpoints), its(:processing), its(:upgrade_processing), its(:elasticsearch_version), its(:access_policies), its(:snapshot_options), its(:vpc_options), its(:cognito_options), its(:encryption_at_rest_options), its(:node_to_node_encryption_options), its(:advanced_options), its(:log_publishing_options), its(:service_software_options), its(:domain_endpoint_options), its(:advanced_security_options), its(:auto_tune_options), its(:change_progress_details)
|
1599
|
+
### its(:domain_id), its(:domain_name), its(:arn), its(:created), its(:deleted), its(:endpoint), its(:endpoints), its(:processing), its(:upgrade_processing), its(:elasticsearch_version), its(:access_policies), its(:snapshot_options), its(:vpc_options), its(:cognito_options), its(:encryption_at_rest_options), its(:node_to_node_encryption_options), its(:advanced_options), its(:log_publishing_options), its(:service_software_options), its(:domain_endpoint_options), its(:advanced_security_options), its(:auto_tune_options), its(:change_progress_details), its(:domain_processing_status), its(:modifying_properties)
|
1599
1600
|
## <a name="elastictranscoder_pipeline">elastictranscoder_pipeline</a>
|
1600
1601
|
|
1601
1602
|
ElastictranscoderPipeline resource type.
|
@@ -1740,7 +1741,7 @@ describe emr('my-emr') do
|
|
1740
1741
|
end
|
1741
1742
|
```
|
1742
1743
|
|
1743
|
-
### its(:id), its(:name), its(:instance_collection_type), its(:log_uri), its(:log_encryption_kms_key_id), its(:requested_ami_version), its(:running_ami_version), its(:release_label), its(:auto_terminate), its(:termination_protected), its(:visible_to_all_users), its(:service_role), its(:normalized_instance_hours), its(:master_public_dns_name), its(:configurations), its(:security_configuration), its(:auto_scaling_role), its(:scale_down_behavior), its(:custom_ami_id), its(:ebs_root_volume_size), its(:repo_upgrade_on_boot), its(:cluster_arn), its(:outpost_arn), its(:step_concurrency_level), its(:placement_groups), its(:os_release_label), its(:ebs_root_volume_iops), its(:ebs_root_volume_throughput)
|
1744
|
+
### its(:id), its(:name), its(:instance_collection_type), its(:log_uri), its(:log_encryption_kms_key_id), its(:requested_ami_version), its(:running_ami_version), its(:release_label), its(:auto_terminate), its(:termination_protected), its(:unhealthy_node_replacement), its(:visible_to_all_users), its(:service_role), its(:normalized_instance_hours), its(:master_public_dns_name), its(:configurations), its(:security_configuration), its(:auto_scaling_role), its(:scale_down_behavior), its(:custom_ami_id), its(:ebs_root_volume_size), its(:repo_upgrade_on_boot), its(:cluster_arn), its(:outpost_arn), its(:step_concurrency_level), its(:placement_groups), its(:os_release_label), its(:ebs_root_volume_iops), its(:ebs_root_volume_throughput)
|
1744
1745
|
## <a name="firehose">firehose</a>
|
1745
1746
|
|
1746
1747
|
Firehose resource type.
|
@@ -2411,6 +2412,47 @@ end
|
|
2411
2412
|
```
|
2412
2413
|
|
2413
2414
|
### its(:launch_template_id), its(:launch_template_name), its(:create_time), its(:created_by), its(:default_version_number), its(:latest_version_number), its(:tags)
|
2415
|
+
## <a name="managed_prefix_list">managed_prefix_list</a>
|
2416
|
+
|
2417
|
+
ManagedPrefixList resource type.
|
2418
|
+
|
2419
|
+
### exist
|
2420
|
+
|
2421
|
+
```ruby
|
2422
|
+
describe managed_prefix_list('my-managed-prefix-list') do
|
2423
|
+
it { should exist }
|
2424
|
+
end
|
2425
|
+
```
|
2426
|
+
|
2427
|
+
|
2428
|
+
### have_cidr
|
2429
|
+
|
2430
|
+
```ruby
|
2431
|
+
describe managed_prefix_list('my-managed-prefix-list') do
|
2432
|
+
it { should have_cidr('10.0.0.0/16') }
|
2433
|
+
it { should have_cidr('192.168.0.0/24').desc('dev') }
|
2434
|
+
end
|
2435
|
+
```
|
2436
|
+
|
2437
|
+
|
2438
|
+
### have_tag
|
2439
|
+
|
2440
|
+
```ruby
|
2441
|
+
describe managed_prefix_list('my-managed-prefix-list') do
|
2442
|
+
it { should have_tag('env').value('dev') }
|
2443
|
+
end
|
2444
|
+
```
|
2445
|
+
|
2446
|
+
### its(:entries_count)
|
2447
|
+
|
2448
|
+
```ruby
|
2449
|
+
describe managed_prefix_list('my-managed-prefix-list') do
|
2450
|
+
its(:entries_count) { should eq 2 }
|
2451
|
+
end
|
2452
|
+
```
|
2453
|
+
|
2454
|
+
|
2455
|
+
### its(:prefix_list_id), its(:address_family), its(:state), its(:state_message), its(:prefix_list_arn), its(:prefix_list_name), its(:max_entries), its(:version), its(:owner_id)
|
2414
2456
|
## <a name="mq">mq</a>
|
2415
2457
|
|
2416
2458
|
MQ resource type.
|
@@ -2978,7 +3020,7 @@ describe rds_db_cluster('my-rds-db-cluster') do
|
|
2978
3020
|
end
|
2979
3021
|
```
|
2980
3022
|
|
2981
|
-
### 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(:status_infos), 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(:rds_custom_cluster_configuration), 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), its(:db_system_id), its(:master_user_secret), its(:io_optimized_next_allowed_modification_time), its(:local_write_forwarding_status), its(:aws_backup_recovery_point_arn)
|
3023
|
+
### 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(:status_infos), 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(:rds_custom_cluster_configuration), 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), its(:db_system_id), its(:master_user_secret), its(:io_optimized_next_allowed_modification_time), its(:local_write_forwarding_status), its(:aws_backup_recovery_point_arn), its(:limitless_database), its(:storage_throughput), its(:certificate_details)
|
2982
3024
|
## <a name="rds_db_cluster_parameter_group">rds_db_cluster_parameter_group</a>
|
2983
3025
|
|
2984
3026
|
RdsDbClusterParameterGroup resource type.
|
@@ -3759,7 +3801,7 @@ end
|
|
3759
3801
|
```
|
3760
3802
|
|
3761
3803
|
|
3762
|
-
### its(:name), its(:type), its(:key_id), its(:last_modified_date), its(:last_modified_user), its(:description), its(:allowed_pattern), its(:version), its(:tier), its(:policies), its(:data_type)
|
3804
|
+
### its(:name), its(:arn), its(:type), its(:key_id), its(:last_modified_date), its(:last_modified_user), its(:description), its(:allowed_pattern), its(:version), its(:tier), its(:policies), its(:data_type)
|
3763
3805
|
### :unlock: Advanced use
|
3764
3806
|
|
3765
3807
|
```ruby
|
@@ -3852,7 +3894,7 @@ end
|
|
3852
3894
|
```
|
3853
3895
|
|
3854
3896
|
|
3855
|
-
### its(:arn), its(:certificate), its(:protocol_details), its(:domain), its(:endpoint_type), its(:host_key_fingerprint), its(:identity_provider_details), its(:identity_provider_type), its(:logging_role), its(:post_authentication_login_banner), its(:pre_authentication_login_banner), its(:protocols), its(:security_policy_name), its(:server_id), its(:state), its(:user_count), its(:workflow_details), its(:structured_log_destinations), its(:s3_storage_options)
|
3897
|
+
### its(:arn), its(:certificate), its(:protocol_details), its(:domain), its(:endpoint_type), its(:host_key_fingerprint), its(:identity_provider_details), its(:identity_provider_type), its(:logging_role), its(:post_authentication_login_banner), its(:pre_authentication_login_banner), its(:protocols), its(:security_policy_name), its(:server_id), its(:state), its(:user_count), its(:workflow_details), its(:structured_log_destinations), its(:s3_storage_options), its(:as_2_service_managed_egress_ip_addresses)
|
3856
3898
|
## <a name="transit_gateway">transit_gateway</a>
|
3857
3899
|
|
3858
3900
|
TransitGateway resource type.
|
@@ -3884,6 +3926,27 @@ end
|
|
3884
3926
|
|
3885
3927
|
### have_attachment
|
3886
3928
|
|
3929
|
+
#### using attachment id
|
3930
|
+
```ruby
|
3931
|
+
describe transit_gateway('tgw-1234567890abcdefg') do
|
3932
|
+
it { should have_attachment('tgw-attach-1234567890abcdefg') }
|
3933
|
+
end
|
3934
|
+
```
|
3935
|
+
|
3936
|
+
#### using attachment name
|
3937
|
+
```ruby
|
3938
|
+
describe transit_gateway('tgw-1234567890abcdefg') do
|
3939
|
+
it { should have_attachment('my-prod-tgw-attachment') }
|
3940
|
+
end
|
3941
|
+
```
|
3942
|
+
|
3943
|
+
#### using regular expression attachment name
|
3944
|
+
```ruby
|
3945
|
+
describe transit_gateway('tgw-1234567890abcdefg') do
|
3946
|
+
it { should have_attachment(/^my-\w+-tgw-attachment$/) }
|
3947
|
+
end
|
3948
|
+
```
|
3949
|
+
|
3887
3950
|
### have_tag
|
3888
3951
|
|
3889
3952
|
### its(:transit_gateway_id), its(:transit_gateway_arn), its(:state), its(:owner_id), its(:description), its(:creation_time)
|
@@ -65,7 +65,7 @@ module Awspec
|
|
65
65
|
types_for_generate_all = %w[
|
66
66
|
cloudwatch_alarm cloudwatch_event directconnect ebs efs
|
67
67
|
elasticsearch iam_group iam_policy iam_role iam_user kms lambda
|
68
|
-
acm cloudwatch_logs eip codebuild elasticache
|
68
|
+
acm cloudwatch_logs eip codebuild elasticache managed_prefix_list
|
69
69
|
]
|
70
70
|
|
71
71
|
types_for_generate_all.each do |type|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class ManagedPrefixList < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'ManagedPrefixList'
|
10
|
+
@type = Awspec::Type::ManagedPrefixList.new('my-managed-prefix-list')
|
11
|
+
@ret = @type.resource_via_client
|
12
|
+
@matchers = ['its(:entries_count)']
|
13
|
+
@ignore_matchers = []
|
14
|
+
@describes = []
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Spec
|
5
|
+
class ManagedPrefixList
|
6
|
+
include Awspec::Helper::Finder
|
7
|
+
def select_all_managed_prefix_lists
|
8
|
+
res = ec2_client.describe_managed_prefix_lists
|
9
|
+
res.prefix_lists
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_all
|
13
|
+
prefix_lists = select_all_managed_prefix_lists
|
14
|
+
raise 'Not Found Managed Prefix List.' if prefix_lists.empty?
|
15
|
+
|
16
|
+
specs = prefix_lists.map do |prefix_list|
|
17
|
+
entries = select_managed_prefix_list_entries(prefix_list.prefix_list_id)
|
18
|
+
content = ERB.new(managed_prefix_list_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
19
|
+
end
|
20
|
+
specs.join("\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
def managed_prefix_list_spec_template
|
24
|
+
<<-'EOF'
|
25
|
+
describe managed_prefix_list('<%= prefix_list.prefix_list_name %>') do
|
26
|
+
it { should exist }
|
27
|
+
<% entries.each do |entry| %>
|
28
|
+
<% if entry.description.nil? %>
|
29
|
+
it { should have_cidr('<%= entry.cidr %>') }
|
30
|
+
<% else %>
|
31
|
+
it { should have_cidr('<%= entry.cidr %>').desc('<%= entry.description %>') }
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
its(:entries_count) { should eq <%= entries.length %> }
|
35
|
+
its(:prefix_list_id) { should eq '<%= prefix_list.prefix_list_id %>' }
|
36
|
+
its(:address_family) { should eq '<%= prefix_list.address_family %>' }
|
37
|
+
its(:state) { should eq '<%= prefix_list.state %>' }
|
38
|
+
its(:prefix_list_arn) { should eq '<%= prefix_list.prefix_list_arn %>' }
|
39
|
+
<% if prefix_list.max_entries %>
|
40
|
+
its(:max_entries) { should eq <%= prefix_list.max_entries %> }
|
41
|
+
<% end %>
|
42
|
+
<% if prefix_list.version %>
|
43
|
+
its(:version) { should eq <%= prefix_list.version %> }
|
44
|
+
<% end %>
|
45
|
+
its(:owner_id) { should eq '<%= prefix_list.owner_id %>' }
|
46
|
+
<% prefix_list.tags.each do |tag| %>
|
47
|
+
it { should have_tag('<%= tag.key %>').value('<%= tag.value %>') }
|
48
|
+
<% end %>
|
49
|
+
end
|
50
|
+
EOF
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/awspec/generator.rb
CHANGED
@@ -43,6 +43,7 @@ require 'awspec/generator/spec/redshift_cluster_parameter_group'
|
|
43
43
|
require 'awspec/generator/spec/rds_proxy'
|
44
44
|
require 'awspec/generator/spec/rds_db_cluster'
|
45
45
|
require 'awspec/generator/spec/rds_global_cluster'
|
46
|
+
require 'awspec/generator/spec/managed_prefix_list'
|
46
47
|
|
47
48
|
# Doc
|
48
49
|
require 'awspec/generator/doc/type'
|
@@ -228,6 +228,18 @@ module Awspec::Helper
|
|
228
228
|
})
|
229
229
|
res.transit_gateway_attachments
|
230
230
|
end
|
231
|
+
|
232
|
+
def find_managed_prefix_list(prefix_list_name)
|
233
|
+
res = ec2_client.describe_managed_prefix_lists({
|
234
|
+
filters: [{ name: 'prefix-list-name',
|
235
|
+
values: [prefix_list_name] }]
|
236
|
+
})
|
237
|
+
res.prefix_lists.single_resource(prefix_list_name)
|
238
|
+
end
|
239
|
+
|
240
|
+
def select_managed_prefix_list_entries(prefix_list_id)
|
241
|
+
ec2_client.get_managed_prefix_list_entries({ prefix_list_id: prefix_list_id }).data.entries
|
242
|
+
end
|
231
243
|
end
|
232
244
|
end
|
233
245
|
end
|
data/lib/awspec/helper/type.rb
CHANGED
@@ -24,7 +24,7 @@ module Awspec
|
|
24
24
|
internet_gateway acm cloudwatch_logs dynamodb_table eip sqs ssm_parameter cloudformation_stack
|
25
25
|
codebuild sns_topic redshift redshift_cluster_parameter_group codedeploy codedeploy_deployment_group
|
26
26
|
secretsmanager msk transit_gateway cognito_identity_pool cognito_user_pool vpc_endpoints
|
27
|
-
transfer_server
|
27
|
+
transfer_server managed_prefix_list
|
28
28
|
]
|
29
29
|
|
30
30
|
ACCOUNT_ATTRIBUTES = %w[
|
data/lib/awspec/matcher.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:ec2] = {
|
4
|
+
stub_responses: {
|
5
|
+
describe_managed_prefix_lists: {
|
6
|
+
next_token: nil,
|
7
|
+
prefix_lists: [
|
8
|
+
{
|
9
|
+
prefix_list_id: 'pl-12345678',
|
10
|
+
address_family: 'IPv4',
|
11
|
+
state: 'create-complete',
|
12
|
+
state_message: nil,
|
13
|
+
prefix_list_arn: 'arn:aws:ec2:ap-northeast-1:aws:prefix-list/pl-12345678',
|
14
|
+
prefix_list_name: 'my-managed-prefix-list',
|
15
|
+
max_entries: 2,
|
16
|
+
version: 1,
|
17
|
+
tags: [
|
18
|
+
{
|
19
|
+
key: 'env',
|
20
|
+
value: 'dev'
|
21
|
+
}
|
22
|
+
],
|
23
|
+
owner_id: '123456789012'
|
24
|
+
}
|
25
|
+
]
|
26
|
+
},
|
27
|
+
get_managed_prefix_list_entries: {
|
28
|
+
next_toke: nil,
|
29
|
+
entries: [
|
30
|
+
{
|
31
|
+
cidr: '10.0.0.0/16',
|
32
|
+
description: 'test'
|
33
|
+
},
|
34
|
+
{
|
35
|
+
cidr: '192.168.0.0/24',
|
36
|
+
description: 'dev'
|
37
|
+
}
|
38
|
+
]
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class ManagedPrefixList < ResourceBase
|
5
|
+
aws_resource Aws::EC2::Types::ManagedPrefixList
|
6
|
+
tags_allowed
|
7
|
+
|
8
|
+
def resource_via_client
|
9
|
+
@resource_via_client ||= find_managed_prefix_list(@display_name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def id
|
13
|
+
@id ||= resource_via_client.prefix_list_id if resource_via_client
|
14
|
+
end
|
15
|
+
|
16
|
+
def entries
|
17
|
+
@entries ||= select_managed_prefix_list_entries(id)
|
18
|
+
end
|
19
|
+
|
20
|
+
def has_cidr?(cidr, description = nil)
|
21
|
+
entries.find do |entry|
|
22
|
+
if description.nil?
|
23
|
+
entry.cidr == cidr
|
24
|
+
else
|
25
|
+
entry.cidr == cidr && entry.description == description
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def entries_count
|
31
|
+
entries.length
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -18,9 +18,21 @@ module Awspec::Type
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def has_attachment?(att_id)
|
21
|
-
atts = find_tgw_attachments_by_tgw_id(
|
22
|
-
|
23
|
-
|
21
|
+
atts = find_tgw_attachments_by_tgw_id(id)
|
22
|
+
|
23
|
+
atts.any? do |att|
|
24
|
+
att.transit_gateway_attachment_id == att_id || attachment_has_name?(att, att_id)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def attachment_has_name?(attachment, name)
|
31
|
+
if name.is_a?(Regexp)
|
32
|
+
attachment.tags.any? { |tag| tag.key == 'Name' && (name =~ tag.value) }
|
33
|
+
else
|
34
|
+
attachment.tags.any? { |tag| tag.key == 'Name' && tag.value == name }
|
35
|
+
end
|
24
36
|
end
|
25
37
|
end
|
26
38
|
end
|
data/lib/awspec/version.rb
CHANGED
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.
|
4
|
+
version: 1.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -300,6 +300,7 @@ files:
|
|
300
300
|
- doc/_resource_types/lambda_account_settings.md
|
301
301
|
- doc/_resource_types/launch_configuration.md
|
302
302
|
- doc/_resource_types/launch_template.md
|
303
|
+
- doc/_resource_types/managed_prefix_list.md
|
303
304
|
- doc/_resource_types/mq.md
|
304
305
|
- doc/_resource_types/msk.md
|
305
306
|
- doc/_resource_types/nat_gateway.md
|
@@ -410,6 +411,7 @@ files:
|
|
410
411
|
- lib/awspec/generator/doc/type/lambda_account_settings.rb
|
411
412
|
- lib/awspec/generator/doc/type/launch_configuration.rb
|
412
413
|
- lib/awspec/generator/doc/type/launch_template.rb
|
414
|
+
- lib/awspec/generator/doc/type/managed_prefix_list.rb
|
413
415
|
- lib/awspec/generator/doc/type/mq.rb
|
414
416
|
- lib/awspec/generator/doc/type/msk.rb
|
415
417
|
- lib/awspec/generator/doc/type/nat_gateway.rb
|
@@ -470,6 +472,7 @@ files:
|
|
470
472
|
- lib/awspec/generator/spec/internet_gateway.rb
|
471
473
|
- lib/awspec/generator/spec/kms.rb
|
472
474
|
- lib/awspec/generator/spec/lambda.rb
|
475
|
+
- lib/awspec/generator/spec/managed_prefix_list.rb
|
473
476
|
- lib/awspec/generator/spec/nat_gateway.rb
|
474
477
|
- lib/awspec/generator/spec/network_acl.rb
|
475
478
|
- lib/awspec/generator/spec/network_interface.rb
|
@@ -572,6 +575,7 @@ files:
|
|
572
575
|
- lib/awspec/matcher/belong_to_subnets.rb
|
573
576
|
- lib/awspec/matcher/belong_to_vpc.rb
|
574
577
|
- lib/awspec/matcher/have_attribute_definition.rb
|
578
|
+
- lib/awspec/matcher/have_cidr.rb
|
575
579
|
- lib/awspec/matcher/have_cluster_member.rb
|
576
580
|
- lib/awspec/matcher/have_cluster_parameter_group.rb
|
577
581
|
- lib/awspec/matcher/have_custom_response_error_code.rb
|
@@ -656,6 +660,7 @@ files:
|
|
656
660
|
- lib/awspec/stub/lambda.rb
|
657
661
|
- lib/awspec/stub/launch_configuration.rb
|
658
662
|
- lib/awspec/stub/launch_template.rb
|
663
|
+
- lib/awspec/stub/managed_prefix_list.rb
|
659
664
|
- lib/awspec/stub/mq.rb
|
660
665
|
- lib/awspec/stub/msk.rb
|
661
666
|
- lib/awspec/stub/nat_gateway.rb
|
@@ -751,6 +756,7 @@ files:
|
|
751
756
|
- lib/awspec/type/lambda_account_settings.rb
|
752
757
|
- lib/awspec/type/launch_configuration.rb
|
753
758
|
- lib/awspec/type/launch_template.rb
|
759
|
+
- lib/awspec/type/managed_prefix_list.rb
|
754
760
|
- lib/awspec/type/mq.rb
|
755
761
|
- lib/awspec/type/msk.rb
|
756
762
|
- lib/awspec/type/nat_gateway.rb
|
@@ -809,7 +815,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
809
815
|
- !ruby/object:Gem::Version
|
810
816
|
version: '0'
|
811
817
|
requirements: []
|
812
|
-
rubygems_version: 3.
|
818
|
+
rubygems_version: 3.4.19
|
813
819
|
signing_key:
|
814
820
|
specification_version: 4
|
815
821
|
summary: RSpec tests for your AWS resources.
|