awspec 1.27.0 → 1.28.1

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 +4 -4
  2. data/doc/_resource_types/cloudformation_stack.md +8 -0
  3. data/doc/_resource_types/eip.md +1 -1
  4. data/doc/_resource_types/rds_db_cluster.md +47 -0
  5. data/doc/_resource_types/rds_db_subnet_group.md +25 -0
  6. data/doc/_resource_types/rds_global_cluster.md +37 -0
  7. data/doc/_resource_types/vpc_endpoints.md +11 -7
  8. data/doc/resource_types.md +168 -19
  9. data/lib/awspec/command/generate.rb +12 -0
  10. data/lib/awspec/generator/doc/type/rds_db_cluster.rb +21 -0
  11. data/lib/awspec/generator/doc/type/rds_db_subnet_group.rb +19 -0
  12. data/lib/awspec/generator/doc/type/rds_global_cluster.rb +21 -0
  13. data/lib/awspec/generator/doc/type/vpc_endpoints.rb +5 -2
  14. data/lib/awspec/generator/spec/rds_db_cluster.rb +46 -0
  15. data/lib/awspec/generator/spec/rds_global_cluster.rb +40 -0
  16. data/lib/awspec/generator/template.rb +1 -1
  17. data/lib/awspec/generator.rb +2 -0
  18. data/lib/awspec/helper/finder/ec2.rb +0 -14
  19. data/lib/awspec/helper/finder/eip.rb +26 -0
  20. data/lib/awspec/helper/finder/rds.rb +21 -0
  21. data/lib/awspec/helper/finder.rb +2 -0
  22. data/lib/awspec/helper/type.rb +3 -2
  23. data/lib/awspec/matcher/belong_to_subnet.rb +21 -0
  24. data/lib/awspec/matcher/have_cluster_member.rb +11 -0
  25. data/lib/awspec/matcher.rb +1 -0
  26. data/lib/awspec/stub/eip.rb +7 -1
  27. data/lib/awspec/stub/rds_db_cluster.rb +119 -0
  28. data/lib/awspec/stub/rds_db_subnet_group.rb +81 -0
  29. data/lib/awspec/stub/rds_global_cluster.rb +39 -0
  30. data/lib/awspec/type/cloudformation_stack.rb +3 -0
  31. data/lib/awspec/type/eip.rb +1 -1
  32. data/lib/awspec/type/rds_db_cluster.rb +75 -0
  33. data/lib/awspec/type/rds_db_subnet_group.rb +19 -0
  34. data/lib/awspec/type/rds_global_cluster.rb +36 -0
  35. data/lib/awspec/version.rb +1 -1
  36. metadata +18 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 733ec333dd6c4035c558544facf4cf168c74f528c2fd133aa2b89532dcc95a0f
4
- data.tar.gz: 7f31ead68d437f29da2948decfd77ac92c8ce9b2e97c60fe5d6346d1a8889f72
3
+ metadata.gz: 9c039a40af7b57d9dff480f291fc73b2320c61a34e155ccf962b5bd77b92ade9
4
+ data.tar.gz: cc1b06bb52308839f57b0216497d762ba29e75be9586b781e488cfbb92b905d9
5
5
  SHA512:
6
- metadata.gz: fcd55db64d1b79dd6c81cb8afab7196b6bacc59a0739530192ee3fc38ecef812873d7ab7c9def4fc91991a2e0e8aba70bda5d79b6781f1bd548df6ef168d85ec
7
- data.tar.gz: a767de714ea4be5c6e8fbaf5bfd9d520f759750129fe35bae3915cf5811526cbd090d69c93d321856164a053c71c65ad4d115030591c41f6e45a506a5a60f92f
6
+ metadata.gz: 3c23f6c2fc84093a7fed2a96117036227a7d6006d225d094ad91487fceec2e6cf224fd0c3ae19a5ea695b1eaedbe070c829bf2d9275c390ab6d1a257e17bd399
7
+ data.tar.gz: f8e0ef447b854ed2ae4c935aa0d2c463a2145c65ced5533006da2dc4f39806b1eb81d234311ebf1d619acc8747811f47299a4703895795d5d287759878c9665b
@@ -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
+ ```
@@ -1,7 +1,7 @@
1
1
  ### exist
2
2
 
3
3
  ```ruby
4
- describe eip('123.0.456.789') do
4
+ describe eip('my-eip') do
5
5
  it { should exist }
6
6
  end
7
7
  ```
@@ -0,0 +1,47 @@
1
+ ### first
2
+
3
+ ```ruby
4
+ describe rds_db_cluster('my-rds-db-cluster') do
5
+ its(:db_cluster_parameter_group) { should eq 'default.aurora-mysql5.7' }
6
+ its(:engine) { should eq 'aurora-mysql' }
7
+ its(:engine_version) { should eq '5.7.mysql_aurora.2.10.2' }
8
+ its(:database_name) { should eq 'example_db' }
9
+ its(:storage_encrypted) { should eq false }
10
+ its(:deletion_protection) { should eq false }
11
+ end
12
+ ```
13
+
14
+ ### exist
15
+
16
+ ```ruby
17
+ describe rds_db_cluster('my-rds-db-cluster') do
18
+ it { should exist }
19
+ end
20
+ ```
21
+
22
+ ### be_available, be_creating, be_deleting
23
+
24
+ ```ruby
25
+ describe rds_db_cluster('my-rds-db-cluster') do
26
+ it { should be_available }
27
+ end
28
+ ```
29
+
30
+ ### have_cluster_member
31
+
32
+ ```ruby
33
+ describe rds_db_cluster('my-rds-db-cluster') do
34
+ it { should have_cluster_member('my-rds-db-cluster-instance-1') }
35
+ it { should have_cluster_member('my-rds-db-cluster-instance-1').is_writer(true) }
36
+ it { should have_cluster_member('my-rds-db-cluster-instance-2').is_writer(false) }
37
+ end
38
+ ```
39
+
40
+ ### have_security_group
41
+
42
+ ```ruby
43
+ describe rds_db_cluster('my-rds-db-cluster') do
44
+ it { should have_security_group('sg-5a6b7cd8') }
45
+ it { should have_security_group('my-db-sg') }
46
+ end
47
+ ```
@@ -0,0 +1,25 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe rds_db_subnet_group('my-rds-db-subnet-group') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### belong_to_subnet
10
+
11
+ ```ruby
12
+ describe rds_db_subnet_group('my-rds-db-subnet-group') do
13
+ it { should belong_to_subnet('subnet-1234a567') }
14
+ it { should belong_to_subnet('db-subnet-a') }
15
+ end
16
+ ```
17
+
18
+ ### belong_to_vpc
19
+
20
+ ```ruby
21
+ describe rds_db_subnet_group('my-rds-db-subnet-group') do
22
+ it { should belong_to_vpc('vpc-ab123cde') }
23
+ it { should belong_to_vpc('my-vpc') }
24
+ end
25
+ ```
@@ -0,0 +1,37 @@
1
+ ### first
2
+
3
+ ```ruby
4
+ describe rds_global_cluster('my-rds-global-cluster') do
5
+ its(:engine) { should eq 'aurora-mysql' }
6
+ its(:engine_version) { should eq '5.7.mysql_aurora.2.10.2' }
7
+ its(:database_name) { should eq 'example_db' }
8
+ its(:storage_encrypted) { should eq false }
9
+ its(:deletion_protection) { should eq false }
10
+ end
11
+ ```
12
+
13
+ ### exist
14
+
15
+ ```ruby
16
+ describe rds_global_cluster('my-rds-global-cluster') do
17
+ it { should exist }
18
+ end
19
+ ```
20
+
21
+ ### be_available, be_creating, be_deleting
22
+
23
+ ```ruby
24
+ describe rds_global_cluster('my-rds-global-cluster') do
25
+ it { should be_available }
26
+ end
27
+ ```
28
+
29
+ ### have_cluster_member
30
+
31
+ ```ruby
32
+ describe rds_global_cluster('my-rds-global-cluster') do
33
+ it { should have_cluster_member('arn:aws:rds:ap-northeast-1:123456789012:cluster:my-primary-cluster') }
34
+ it { should have_cluster_member('arn:aws:rds:ap-northeast-1:123456789012:cluster:my-primary-cluster').is_writer(true) }
35
+ it { should have_cluster_member('arn:aws:rds:ap-northeast-3:123456789012:cluster:my-secondary-cluster').is_writer(false) }
36
+ end
37
+ ```
@@ -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
  ```
@@ -61,8 +61,11 @@
61
61
  | [nlb_listener](#nlb_listener)
62
62
  | [nlb_target_group](#nlb_target_group)
63
63
  | [rds](#rds)
64
+ | [rds_db_cluster](#rds_db_cluster)
64
65
  | [rds_db_cluster_parameter_group](#rds_db_cluster_parameter_group)
65
66
  | [rds_db_parameter_group](#rds_db_parameter_group)
67
+ | [rds_db_subnet_group](#rds_db_subnet_group)
68
+ | [rds_global_cluster](#rds_global_cluster)
66
69
  | [rds_proxy](#rds_proxy)
67
70
  | [redshift](#redshift)
68
71
  | [redshift_cluster_parameter_group](#redshift_cluster_parameter_group)
@@ -454,6 +457,15 @@ describe cloudformation_stack('my-cloudformation-stack') do
454
457
  end
455
458
  ```
456
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
+
457
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)
458
470
  ## <a name="cloudfront_distribution">cloudfront_distribution</a>
459
471
 
@@ -1324,7 +1336,7 @@ Elastic IP resource type.
1324
1336
  ### exist
1325
1337
 
1326
1338
  ```ruby
1327
- describe eip('123.0.456.789') do
1339
+ describe eip('my-eip') do
1328
1340
  it { should exist }
1329
1341
  end
1330
1342
  ```
@@ -2856,7 +2868,7 @@ end
2856
2868
  ```
2857
2869
 
2858
2870
 
2859
- ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:automatic_restart_time), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:db_security_groups), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:read_replica_db_instance_identifiers), its(:read_replica_db_cluster_identifiers), its(:replica_mode), its(:license_model), its(:iops), its(:character_set_name), its(:nchar_character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:status_infos), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:domain_memberships), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn), its(:promotion_tier), its(:db_instance_arn), its(:timezone), its(:iam_database_authentication_enabled), its(:performance_insights_enabled), its(:performance_insights_kms_key_id), its(:performance_insights_retention_period), its(:enabled_cloudwatch_logs_exports), its(:processor_features), its(:deletion_protection), its(:associated_roles), its(:listener_endpoint), its(:max_allocated_storage), its(:tag_list), its(:db_instance_automated_backups_replications), its(:customer_owned_ip_enabled), its(:aws_backup_recovery_point_arn), its(:activity_stream_status), its(:activity_stream_kms_key_id), its(:activity_stream_kinesis_stream_name), its(:activity_stream_mode), its(:activity_stream_engine_native_audit_fields_included), its(:automation_mode), its(:resume_full_automation_mode_time), its(:custom_iam_instance_profile), its(:backup_target), its(:network_type)
2871
+ ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:automatic_restart_time), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:db_security_groups), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:read_replica_db_instance_identifiers), its(:read_replica_db_cluster_identifiers), its(:replica_mode), its(:license_model), its(:iops), its(:character_set_name), its(:nchar_character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:status_infos), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:domain_memberships), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn), its(:promotion_tier), its(:db_instance_arn), its(:timezone), its(:iam_database_authentication_enabled), its(:performance_insights_enabled), its(:performance_insights_kms_key_id), its(:performance_insights_retention_period), its(:enabled_cloudwatch_logs_exports), its(:processor_features), its(:deletion_protection), its(:associated_roles), its(:listener_endpoint), its(:max_allocated_storage), its(:tag_list), its(:db_instance_automated_backups_replications), its(:customer_owned_ip_enabled), its(:aws_backup_recovery_point_arn), its(:activity_stream_status), its(:activity_stream_kms_key_id), its(:activity_stream_kinesis_stream_name), its(:activity_stream_mode), its(:activity_stream_engine_native_audit_fields_included), its(:automation_mode), its(:resume_full_automation_mode_time), its(:custom_iam_instance_profile), its(:backup_target), its(:network_type), its(:activity_stream_policy_status)
2860
2872
  ### :unlock: Advanced use
2861
2873
 
2862
2874
  `rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
@@ -2875,6 +2887,61 @@ describe rds('my-rds') do
2875
2887
  end
2876
2888
  ```
2877
2889
 
2890
+ ## <a name="rds_db_cluster">rds_db_cluster</a>
2891
+
2892
+ RdsDbCluster resource type.
2893
+
2894
+ ```ruby
2895
+ describe rds_db_cluster('my-rds-db-cluster') do
2896
+ its(:db_cluster_parameter_group) { should eq 'default.aurora-mysql5.7' }
2897
+ its(:engine) { should eq 'aurora-mysql' }
2898
+ its(:engine_version) { should eq '5.7.mysql_aurora.2.10.2' }
2899
+ its(:database_name) { should eq 'example_db' }
2900
+ its(:storage_encrypted) { should eq false }
2901
+ its(:deletion_protection) { should eq false }
2902
+ end
2903
+ ```
2904
+
2905
+
2906
+ ### exist
2907
+
2908
+ ```ruby
2909
+ describe rds_db_cluster('my-rds-db-cluster') do
2910
+ it { should exist }
2911
+ end
2912
+ ```
2913
+
2914
+
2915
+ ### be_available, be_creating, be_deleting
2916
+
2917
+ ```ruby
2918
+ describe rds_db_cluster('my-rds-db-cluster') do
2919
+ it { should be_available }
2920
+ end
2921
+ ```
2922
+
2923
+
2924
+ ### have_cluster_member
2925
+
2926
+ ```ruby
2927
+ describe rds_db_cluster('my-rds-db-cluster') do
2928
+ it { should have_cluster_member('my-rds-db-cluster-instance-1') }
2929
+ it { should have_cluster_member('my-rds-db-cluster-instance-1').is_writer(true) }
2930
+ it { should have_cluster_member('my-rds-db-cluster-instance-2').is_writer(false) }
2931
+ end
2932
+ ```
2933
+
2934
+
2935
+ ### have_security_group
2936
+
2937
+ ```ruby
2938
+ describe rds_db_cluster('my-rds-db-cluster') do
2939
+ it { should have_security_group('sg-5a6b7cd8') }
2940
+ it { should have_security_group('my-db-sg') }
2941
+ end
2942
+ ```
2943
+
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)
2878
2945
  ## <a name="rds_db_cluster_parameter_group">rds_db_cluster_parameter_group</a>
2879
2946
 
2880
2947
  RdsDbClusterParameterGroup resource type.
@@ -2916,6 +2983,83 @@ end
2916
2983
  ```
2917
2984
 
2918
2985
 
2986
+ ## <a name="rds_db_subnet_group">rds_db_subnet_group</a>
2987
+
2988
+ RdsDbSubnetGroup resource type.
2989
+
2990
+ ### exist
2991
+
2992
+ ```ruby
2993
+ describe rds_db_subnet_group('my-rds-db-subnet-group') do
2994
+ it { should exist }
2995
+ end
2996
+ ```
2997
+
2998
+
2999
+ ### belong_to_subnet
3000
+
3001
+ ```ruby
3002
+ describe rds_db_subnet_group('my-rds-db-subnet-group') do
3003
+ it { should belong_to_subnet('subnet-1234a567') }
3004
+ it { should belong_to_subnet('db-subnet-a') }
3005
+ end
3006
+ ```
3007
+
3008
+
3009
+ ### belong_to_vpc
3010
+
3011
+ ```ruby
3012
+ describe rds_db_subnet_group('my-rds-db-subnet-group') do
3013
+ it { should belong_to_vpc('vpc-ab123cde') }
3014
+ it { should belong_to_vpc('my-vpc') }
3015
+ end
3016
+ ```
3017
+
3018
+ ### its(:vpc_id), its(:db_subnet_group_name), its(:db_subnet_group_description), its(:vpc_id), its(:subnet_group_status), its(:db_subnet_group_arn), its(:supported_network_types)
3019
+ ## <a name="rds_global_cluster">rds_global_cluster</a>
3020
+
3021
+ RdsGlobalCluster resource type.
3022
+
3023
+ ```ruby
3024
+ describe rds_global_cluster('my-rds-global-cluster') do
3025
+ its(:engine) { should eq 'aurora-mysql' }
3026
+ its(:engine_version) { should eq '5.7.mysql_aurora.2.10.2' }
3027
+ its(:database_name) { should eq 'example_db' }
3028
+ its(:storage_encrypted) { should eq false }
3029
+ its(:deletion_protection) { should eq false }
3030
+ end
3031
+ ```
3032
+
3033
+
3034
+ ### exist
3035
+
3036
+ ```ruby
3037
+ describe rds_global_cluster('my-rds-global-cluster') do
3038
+ it { should exist }
3039
+ end
3040
+ ```
3041
+
3042
+
3043
+ ### be_available, be_creating, be_deleting
3044
+
3045
+ ```ruby
3046
+ describe rds_global_cluster('my-rds-global-cluster') do
3047
+ it { should be_available }
3048
+ end
3049
+ ```
3050
+
3051
+
3052
+ ### have_cluster_member
3053
+
3054
+ ```ruby
3055
+ describe rds_global_cluster('my-rds-global-cluster') do
3056
+ it { should have_cluster_member('arn:aws:rds:ap-northeast-1:123456789012:cluster:my-primary-cluster') }
3057
+ it { should have_cluster_member('arn:aws:rds:ap-northeast-1:123456789012:cluster:my-primary-cluster').is_writer(true) }
3058
+ it { should have_cluster_member('arn:aws:rds:ap-northeast-3:123456789012:cluster:my-secondary-cluster').is_writer(false) }
3059
+ end
3060
+ ```
3061
+
3062
+ ### its(:global_cluster_identifier), its(:global_cluster_resource_id), its(:global_cluster_arn), its(:status), its(:engine), its(:engine_version), its(:database_name), its(:storage_encrypted), its(:deletion_protection), its(:failover_state)
2919
3063
  ## <a name="rds_proxy">rds_proxy</a>
2920
3064
 
2921
3065
  RdsProxy resource type.
@@ -3812,14 +3956,7 @@ end
3812
3956
 
3813
3957
  VpcEndpoints resource type.
3814
3958
 
3815
- ### exist
3816
-
3817
3959
  ```ruby
3818
- describe vpc_endpoints('my-vpc-endpoint') do
3819
- it { should exist }
3820
- end
3821
- ```
3822
-
3823
3960
  describe vpc_endpoints('vpce-05907f23265b25f20'), region: $tfvars["region"]["value"] do
3824
3961
  it { should exist }
3825
3962
  it { should be_available }
@@ -3829,23 +3966,26 @@ describe vpc_endpoints('vpce-05907f23265b25f20'), region: $tfvars["region"]["val
3829
3966
  its(:vpc_endpoint_type) { should eq 'Interface' }
3830
3967
  its(:service_name) { should eq 'com.amazonaws.eu-west-1.codebuild' }
3831
3968
  end
3969
+ ```
3832
3970
 
3833
3971
 
3834
- ### be_available
3835
-
3836
- ### be_deleted
3837
-
3838
- ### be_deleting
3972
+ ### exist
3839
3973
 
3840
- ### be_expired
3974
+ ```ruby
3975
+ describe vpc_endpoints('my-vpc-endpoint') do
3976
+ it { should exist }
3977
+ end
3978
+ ```
3841
3979
 
3842
- ### be_failed
3843
3980
 
3844
- ### be_pending
3981
+ ### be_pendingacceptance, be_pending, be_available, be_deleting, be_deleted, be_rejected, be_failed, be_expired
3845
3982
 
3846
- ### be_pendingacceptance
3983
+ ```ruby
3984
+ describe vpc_endpoints('my-vpc-endpoint') do
3985
+ it { should be_available }
3986
+ end
3987
+ ```
3847
3988
 
3848
- ### be_rejected
3849
3989
 
3850
3990
  ### have_route_table
3851
3991
 
@@ -3874,6 +4014,15 @@ end
3874
4014
  ```
3875
4015
 
3876
4016
 
4017
+ ### belong_to_vpc
4018
+
4019
+ ```ruby
4020
+ describe vpc_endpoints('my-vpc-endpoint') do
4021
+ it { should belong_to_vpc('my-vpc') }
4022
+ end
4023
+ ```
4024
+
4025
+
3877
4026
 
3878
4027
  ### :unlock: Advanced use
3879
4028
 
@@ -50,6 +50,18 @@ module Awspec
50
50
  end
51
51
  end
52
52
 
53
+ types = %w[
54
+ rds_db_cluster rds_global_cluster
55
+ ]
56
+
57
+ types.each do |type|
58
+ desc "#{type} [cluster_identifier]", "Generate #{type} spec from cluster identifier."
59
+ define_method type do |_cluster_identifier|
60
+ Awsecrets.load(profile: options[:profile], region: options[:region], secrets_path: options[:secrets_path])
61
+ eval "puts Awspec::Generator::Spec::#{type.camelize}.new.generate(_cluster_identifier)"
62
+ end
63
+ end
64
+
53
65
  types_for_generate_all = %w[
54
66
  cloudwatch_alarm cloudwatch_event directconnect ebs efs
55
67
  elasticsearch iam_group iam_policy iam_role iam_user kms lambda
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Awspec::Generator
4
+ module Doc
5
+ module Type
6
+ class RdsDbCluster < Base
7
+ def initialize
8
+ super
9
+ @type_name = 'RdsDbCluster'
10
+ @type = Awspec::Type::RdsDbCluster.new('my-rds-db-cluster')
11
+ @ret = @type.resource_via_client
12
+ @matchers = [
13
+ Awspec::Type::RdsDbCluster::STATES.map { |state| "be_#{state.tr('-', '_')}" }.join(', ')
14
+ ]
15
+ @ignore_matchers = Awspec::Type::RdsDbCluster::STATES.map { |state| "be_#{state.tr('-', '_')}" }
16
+ @describes = []
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Awspec::Generator
4
+ module Doc
5
+ module Type
6
+ class RdsDbSubnetGroup < Base
7
+ def initialize
8
+ super
9
+ @type_name = 'RdsDbSubnetGroup'
10
+ @type = Awspec::Type::RdsDbSubnetGroup.new('my-rds-db-subnet-group')
11
+ @ret = @type.resource_via_client
12
+ @matchers = %w[belong_to_vpc belong_to_subnet]
13
+ @ignore_matchers = []
14
+ @describes = %w[vpc_id]
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Awspec::Generator
4
+ module Doc
5
+ module Type
6
+ class RdsGlobalCluster < Base
7
+ def initialize
8
+ super
9
+ @type_name = 'RdsGlobalCluster'
10
+ @type = Awspec::Type::RdsGlobalCluster.new('my-rds-global-cluster')
11
+ @ret = @type.resource_via_client
12
+ @matchers = [
13
+ Awspec::Type::RdsGlobalCluster::STATES.map { |state| "be_#{state.tr('-', '_')}" }.join(', ')
14
+ ]
15
+ @ignore_matchers = Awspec::Type::RdsGlobalCluster::STATES.map { |state| "be_#{state.tr('-', '_')}" }
16
+ @describes = []
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -9,8 +9,11 @@ module Awspec::Generator
9
9
  @type_name = 'VpcEndpoints'
10
10
  @type = Awspec::Type::VpcEndpoints.new('my-vpc-endpoint')
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
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Awspec::Generator
4
+ module Spec
5
+ class RdsDbCluster
6
+ include Awspec::Helper::Finder
7
+ def generate(db_cluster_identifier)
8
+ cluster = find_db_cluster(db_cluster_identifier)
9
+ raise 'Not Found RDS DB Cluster' unless cluster
10
+
11
+ content(cluster)
12
+ end
13
+
14
+ # rubocop:disable all
15
+ def rds_db_cluster_spec_template
16
+ template = <<-'EOF'
17
+ describe rds_db_cluster('<%= cluster.db_cluster_identifier %>') do
18
+ it { should exist }
19
+ it { should be_<%= cluster.status %> }
20
+ <% cluster.vpc_security_groups.each do |sg| %>
21
+ it { should have_security_group('<%= sg.vpc_security_group_id %>') }
22
+ <% end %>
23
+ <% cluster.db_cluster_members.each do |member| %>
24
+ it { should have_cluster_member('<%= member.db_instance_identifier %>').is_writer(<%= member.is_cluster_writer %>) }
25
+ <% end %>
26
+ its(:db_cluster_parameter_group) { should eq '<%= cluster.db_cluster_parameter_group %>' }
27
+ its(:engine) { should eq '<%= cluster.engine %>' }
28
+ its(:engine_version) { should eq '<%= cluster.engine_version %>' }
29
+ its(:database_name) { should eq '<%= cluster.database_name %>' }
30
+ its(:storage_encrypted) { should eq <%= cluster.storage_encrypted %> }
31
+ its(:deletion_protection) { should eq <%= cluster.deletion_protection %> }
32
+ its(:port) { should eq <%= cluster.port %> }
33
+ its(:master_username) { should eq '<%= cluster.master_username %>' }
34
+ end
35
+ EOF
36
+ template
37
+ end
38
+
39
+ private
40
+
41
+ def content(cluster)
42
+ ERB.new(rds_db_cluster_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Awspec::Generator
4
+ module Spec
5
+ class RdsGlobalCluster
6
+ include Awspec::Helper::Finder
7
+ def generate(global_cluster_identifier)
8
+ cluster = find_global_cluster(global_cluster_identifier)
9
+ raise 'Not Found RDS Global Cluster' unless cluster
10
+
11
+ content(cluster)
12
+ end
13
+
14
+ # rubocop:disable all
15
+ def rds_global_cluster_spec_template
16
+ template = <<-'EOF'
17
+ describe rds_global_cluster('<%= cluster.global_cluster_identifier %>') do
18
+ it { should exist }
19
+ it { should be_<%= cluster.status %> }
20
+ <% cluster.global_cluster_members.each do |member| %>
21
+ it { should have_cluster_member('<%= member.db_cluster_arn %>').is_writer(<%= member.is_writer %>) }
22
+ <% end %>
23
+ its(:engine) { should eq '<%= cluster.engine %>' }
24
+ its(:engine_version) { should eq '<%= cluster.engine_version %>' }
25
+ its(:database_name) { should eq '<%= cluster.database_name %>' }
26
+ its(:storage_encrypted) { should eq <%= cluster.storage_encrypted %> }
27
+ its(:deletion_protection) { should eq <%= cluster.deletion_protection %> }
28
+ end
29
+ EOF
30
+ template
31
+ end
32
+
33
+ private
34
+
35
+ def content(cluster)
36
+ ERB.new(rds_global_cluster_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
37
+ end
38
+ end
39
+ end
40
+ end
@@ -35,7 +35,7 @@ module Awspec::Type
35
35
  end
36
36
 
37
37
  def id
38
- @id ||= # FIXME
38
+ @id ||= # FIXME
39
39
  end
40
40
  end
41
41
  end
@@ -41,6 +41,8 @@ require 'awspec/generator/spec/nlb_listener'
41
41
  require 'awspec/generator/spec/redshift'
42
42
  require 'awspec/generator/spec/redshift_cluster_parameter_group'
43
43
  require 'awspec/generator/spec/rds_proxy'
44
+ require 'awspec/generator/spec/rds_db_cluster'
45
+ require 'awspec/generator/spec/rds_global_cluster'
44
46
 
45
47
  # Doc
46
48
  require 'awspec/generator/doc/type'
@@ -163,20 +163,6 @@ module Awspec::Helper
163
163
  instances
164
164
  end
165
165
 
166
- def select_eip_by_instance_id(id)
167
- res = ec2_client.describe_addresses({
168
- filters: [{ name: 'instance-id', values: [id] }]
169
- })
170
- res.addresses
171
- end
172
-
173
- def select_eip_by_public_ip(id)
174
- res = ec2_client.describe_addresses({
175
- filters: [{ name: 'public-ip', values: [id] }]
176
- })
177
- res.addresses
178
- end
179
-
180
166
  def select_network_interface_by_instance_id(id)
181
167
  res = ec2_client.describe_network_interfaces({
182
168
  filters: [{ name: 'attachment.instance-id', values: [id] }]