awspec 1.22.1 → 1.24.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.md +1 -1
- data/doc/_resource_types/eks_nodegroup.md +14 -0
- data/doc/_resource_types/s3_bucket.md +8 -0
- data/doc/resource_types.md +44 -19
- data/lib/awspec/command/generate.rb +1 -1
- data/lib/awspec/generator.rb +1 -0
- data/lib/awspec/generator/doc/type/eks_nodegroup.rb +19 -0
- data/lib/awspec/generator/spec/elasticache.rb +43 -0
- data/lib/awspec/generator/spec/iam_group.rb +1 -1
- data/lib/awspec/generator/spec/iam_role.rb +1 -1
- data/lib/awspec/generator/spec/iam_user.rb +1 -1
- data/lib/awspec/generator/spec/s3_bucket.rb +4 -0
- data/lib/awspec/helper/finder.rb +6 -0
- data/lib/awspec/helper/finder/ec2.rb +5 -4
- data/lib/awspec/helper/finder/eks.rb +5 -0
- data/lib/awspec/helper/finder/s3.rb +11 -0
- data/lib/awspec/helper/states.rb +16 -0
- data/lib/awspec/helper/type.rb +1 -1
- data/lib/awspec/stub/ec2_non_existing.rb +7 -0
- data/lib/awspec/stub/eks_nodegroup.rb +16 -0
- data/lib/awspec/stub/s3_bucket.rb +3 -0
- data/lib/awspec/type/ec2.rb +21 -16
- data/lib/awspec/type/eks_nodegroup.rb +30 -0
- data/lib/awspec/type/iam_group.rb +1 -1
- data/lib/awspec/type/iam_role.rb +1 -1
- data/lib/awspec/type/iam_user.rb +1 -1
- data/lib/awspec/type/kms.rb +1 -1
- data/lib/awspec/type/s3_bucket.rb +5 -0
- data/lib/awspec/version.rb +1 -1
- metadata +13 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ac14ec851ce396f40316106c3784538793a8522009cc6d2172b71d01bc16691
|
4
|
+
data.tar.gz: 291660659e3c9223777f70e779c1d2ab34a591a4bfd83590002764977a70e73d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 411f890f896ba013a75805159318bca637f0c43f0cc2b62c9e745d3b3386a31ba24d2080c1f4821f6fd68d5392bd1003a03838f119fa156b28f1959d4016ef98
|
7
|
+
data.tar.gz: f9ee6a4015f25bb56b85ae3a741a628bc5985b4e85f04e92099faaa9fb14caf02d7e8a13ef6ec86e3e5cd51455fe0b1d7d6fcc6feed3853d88661233f4079afd
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -32,7 +32,7 @@ If you're starting on a fresh RSpec project, you can use awspec to generate your
|
|
32
32
|
|
33
33
|
$ awspec init
|
34
34
|
|
35
|
-
If you're working on an
|
35
|
+
If you're working on an existing RSpec project, you will need to add the following lines to your `spec_helper.rb` file:
|
36
36
|
|
37
37
|
```ruby
|
38
38
|
require 'awspec'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
### exist
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
describe eks_nodegroup('my-eks-nodegroup'), cluster: 'my-cluster' do
|
5
|
+
it { should exist }
|
6
|
+
end
|
7
|
+
```
|
8
|
+
### be_active, be_creating
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
describe eks('my-eks-nodegroup'), cluster: 'my-cluster' do
|
12
|
+
it { should be_active }
|
13
|
+
end
|
14
|
+
```
|
data/doc/resource_types.md
CHANGED
@@ -34,6 +34,7 @@
|
|
34
34
|
| [efs](#efs)
|
35
35
|
| [eip](#eip)
|
36
36
|
| [eks](#eks)
|
37
|
+
| [eks_nodegroup](#eks_nodegroup)
|
37
38
|
| [elasticache](#elasticache)
|
38
39
|
| [elasticache_cache_parameter_group](#elasticache_cache_parameter_group)
|
39
40
|
| [elasticsearch](#elasticsearch)
|
@@ -272,7 +273,7 @@ end
|
|
272
273
|
|
273
274
|
### have_tag
|
274
275
|
|
275
|
-
### 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)
|
276
|
+
### 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(:deprecation_time)
|
276
277
|
### :unlock: Advanced use
|
277
278
|
|
278
279
|
`ami` can use `Aws::EC2::Image` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Image.html).
|
@@ -359,7 +360,7 @@ describe autoscaling_group('my-auto-scaling-group') do
|
|
359
360
|
end
|
360
361
|
```
|
361
362
|
|
362
|
-
### its(:auto_scaling_group_name), its(:auto_scaling_group_arn), its(:launch_configuration_name), its(:launch_template), its(:mixed_instances_policy), its(:min_size), its(:max_size), its(:desired_capacity), its(:default_cooldown), its(:availability_zones), its(:load_balancer_names), its(:target_group_arns), its(:health_check_type), its(:health_check_grace_period), its(:created_time), its(:placement_group), its(:vpc_zone_identifier), its(:enabled_metrics), its(:status), its(:termination_policies), its(:new_instances_protected_from_scale_in), its(:service_linked_role_arn), its(:max_instance_lifetime), its(:capacity_rebalance)
|
363
|
+
### its(:auto_scaling_group_name), its(:auto_scaling_group_arn), its(:launch_configuration_name), its(:launch_template), its(:mixed_instances_policy), its(:min_size), its(:max_size), its(:desired_capacity), its(:predicted_capacity), its(:default_cooldown), its(:availability_zones), its(:load_balancer_names), its(:target_group_arns), its(:health_check_type), its(:health_check_grace_period), its(:created_time), its(:placement_group), its(:vpc_zone_identifier), its(:enabled_metrics), its(:status), its(:termination_policies), its(:new_instances_protected_from_scale_in), its(:service_linked_role_arn), its(:max_instance_lifetime), its(:capacity_rebalance), its(:warm_pool_configuration), its(:warm_pool_size), its(:context)
|
363
364
|
## <a name="batch_compute_environment">batch_compute_environment</a>
|
364
365
|
|
365
366
|
BatchComputeEnvironment resource type.
|
@@ -411,7 +412,7 @@ describe batch_job_definition('my-batch-job-definition') do
|
|
411
412
|
end
|
412
413
|
```
|
413
414
|
|
414
|
-
### its(:job_definition_name), its(:job_definition_arn), its(:revision), its(:status), its(:type), its(:parameters), its(:retry_strategy), its(:timeout), its(:node_properties), its(:tags)
|
415
|
+
### its(:job_definition_name), its(:job_definition_arn), its(:revision), its(:status), its(:type), its(:parameters), its(:retry_strategy), its(:timeout), its(:node_properties), its(:tags), its(:propagate_tags), its(:platform_capabilities)
|
415
416
|
## <a name="batch_job_queue">batch_job_queue</a>
|
416
417
|
|
417
418
|
BatchJobQueue resource type.
|
@@ -743,7 +744,7 @@ describe codedeploy_deployment_group('my-codedeploy-deployment-group'), applicat
|
|
743
744
|
end
|
744
745
|
```
|
745
746
|
|
746
|
-
### its(:application_name), its(:deployment_group_id), its(:deployment_group_name), its(:deployment_config_name), its(:on_premises_instance_tag_filters), its(:service_role_arn), its(:target_revision), its(:trigger_configurations), its(:alarm_configuration), its(:deployment_style), its(:load_balancer_info), its(:last_successful_deployment), its(:last_attempted_deployment), its(:ec2_tag_set), its(:on_premises_tag_set), its(:compute_platform), its(:ecs_services)
|
747
|
+
### its(:application_name), its(:deployment_group_id), its(:deployment_group_name), its(:deployment_config_name), its(:on_premises_instance_tag_filters), its(:service_role_arn), its(:target_revision), its(:trigger_configurations), its(:alarm_configuration), its(:deployment_style), its(:outdated_instances_strategy), its(:load_balancer_info), its(:last_successful_deployment), its(:last_attempted_deployment), its(:ec2_tag_set), its(:on_premises_tag_set), its(:compute_platform), its(:ecs_services)
|
747
748
|
## <a name="cognito_identity_pool">cognito_identity_pool</a>
|
748
749
|
|
749
750
|
CognitoIdentityPool resource type.
|
@@ -931,7 +932,7 @@ end
|
|
931
932
|
```
|
932
933
|
|
933
934
|
|
934
|
-
### its(:availability_zone), its(:create_time), its(:encrypted), its(:kms_key_id), its(:outpost_arn), its(:size), its(:snapshot_id), its(:state), its(:volume_id), its(:iops), its(:volume_type), its(:fast_restored), its(:multi_attach_enabled)
|
935
|
+
### its(:availability_zone), its(:create_time), its(:encrypted), its(:kms_key_id), its(:outpost_arn), its(:size), its(:snapshot_id), its(:state), its(:volume_id), its(:iops), its(:volume_type), its(:fast_restored), its(:multi_attach_enabled), its(:throughput)
|
935
936
|
### :unlock: Advanced use
|
936
937
|
|
937
938
|
`ebs` can use `Aws::EC2::Volume` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Volume.html).
|
@@ -1117,7 +1118,7 @@ end
|
|
1117
1118
|
```
|
1118
1119
|
|
1119
1120
|
|
1120
|
-
### its(:ami_launch_index), its(:image_id), its(:instance_id), its(:instance_type), its(:kernel_id), its(:key_name), its(:launch_time), its(:monitoring), its(:placement), its(:platform), its(:private_dns_name), its(:private_ip_address), its(:product_codes), its(:public_dns_name), its(:public_ip_address), its(:ramdisk_id), its(:state_transition_reason), its(:subnet_id), its(:vpc_id), its(:architecture), its(:client_token), its(:ebs_optimized), its(:ena_support), its(:hypervisor), its(:instance_lifecycle), its(:elastic_gpu_associations), its(:elastic_inference_accelerator_associations), its(:outpost_arn), its(:root_device_name), its(:root_device_type), its(:source_dest_check), its(:spot_instance_request_id), its(:sriov_net_support), its(:state_reason), its(:virtualization_type), its(:cpu_options), its(:capacity_reservation_id), its(:capacity_reservation_specification), its(:hibernation_options), its(:licenses), its(:metadata_options), its(:enclave_options)
|
1121
|
+
### its(:ami_launch_index), its(:image_id), its(:instance_id), its(:instance_type), its(:kernel_id), its(:key_name), its(:launch_time), its(:monitoring), its(:placement), its(:platform), its(:private_dns_name), its(:private_ip_address), its(:product_codes), its(:public_dns_name), its(:public_ip_address), its(:ramdisk_id), its(:state_transition_reason), its(:subnet_id), its(:vpc_id), its(:architecture), its(:client_token), its(:ebs_optimized), its(:ena_support), its(:hypervisor), its(:instance_lifecycle), its(:elastic_gpu_associations), its(:elastic_inference_accelerator_associations), its(:outpost_arn), its(:root_device_name), its(:root_device_type), its(:source_dest_check), its(:spot_instance_request_id), its(:sriov_net_support), its(:state_reason), its(:virtualization_type), its(:cpu_options), its(:capacity_reservation_id), its(:capacity_reservation_specification), its(:hibernation_options), its(:licenses), its(:metadata_options), its(:enclave_options), its(:boot_mode)
|
1121
1122
|
### :unlock: Advanced use
|
1122
1123
|
|
1123
1124
|
`ec2` can use `Aws::EC2::Instance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Instance.html).
|
@@ -1213,7 +1214,7 @@ describe ecs_cluster('my-ecs-cluster') do
|
|
1213
1214
|
end
|
1214
1215
|
```
|
1215
1216
|
|
1216
|
-
### its(:cluster_arn), its(:cluster_name), its(:status), its(:registered_container_instances_count), its(:running_tasks_count), its(:pending_tasks_count), its(:active_services_count), its(:statistics), its(:tags), its(:settings), its(:capacity_providers), its(:default_capacity_provider_strategy), its(:attachments), its(:attachments_status)
|
1217
|
+
### its(:cluster_arn), its(:cluster_name), its(:configuration), its(:status), its(:registered_container_instances_count), its(:running_tasks_count), its(:pending_tasks_count), its(:active_services_count), its(:statistics), its(:tags), its(:settings), its(:capacity_providers), its(:default_capacity_provider_strategy), its(:attachments), its(:attachments_status)
|
1217
1218
|
## <a name="ecs_container_instance">ecs_container_instance</a>
|
1218
1219
|
|
1219
1220
|
ECS Container Instance resource type.
|
@@ -1260,7 +1261,7 @@ describe ecs_service('my-ecs-service') do
|
|
1260
1261
|
end
|
1261
1262
|
```
|
1262
1263
|
|
1263
|
-
### its(:service_arn), its(:service_name), its(:cluster_arn), its(:load_balancers), its(:service_registries), its(:status), its(:desired_count), its(:running_count), its(:pending_count), its(:launch_type), its(:capacity_provider_strategy), its(:platform_version), its(:task_definition), its(:task_sets), its(:role_arn), its(:created_at), its(:placement_constraints), its(:placement_strategy), its(:network_configuration), its(:health_check_grace_period_seconds), its(:scheduling_strategy), its(:deployment_controller), its(:tags), its(:created_by), its(:enable_ecs_managed_tags), its(:propagate_tags)
|
1264
|
+
### its(:service_arn), its(:service_name), its(:cluster_arn), its(:load_balancers), its(:service_registries), its(:status), its(:desired_count), its(:running_count), its(:pending_count), its(:launch_type), its(:capacity_provider_strategy), its(:platform_version), its(:task_definition), its(:task_sets), its(:role_arn), its(:created_at), its(:placement_constraints), its(:placement_strategy), its(:network_configuration), its(:health_check_grace_period_seconds), its(:scheduling_strategy), its(:deployment_controller), its(:tags), its(:created_by), its(:enable_ecs_managed_tags), its(:propagate_tags), its(:enable_execute_command)
|
1264
1265
|
## <a name="ecs_task_definition">ecs_task_definition</a>
|
1265
1266
|
|
1266
1267
|
ECS Task Definition resource type.
|
@@ -1282,7 +1283,7 @@ describe ecs_task_definition('my-ecs-task-definition') do
|
|
1282
1283
|
end
|
1283
1284
|
```
|
1284
1285
|
|
1285
|
-
### its(:task_definition_arn), its(:family), its(:task_role_arn), its(:execution_role_arn), its(:network_mode), its(:revision), its(:volumes), its(:status), its(:requires_attributes), its(:placement_constraints), its(:compatibilities), its(:requires_compatibilities), its(:cpu), its(:memory), its(:inference_accelerators), its(:pid_mode), its(:ipc_mode), its(:proxy_configuration)
|
1286
|
+
### its(:task_definition_arn), its(:family), its(:task_role_arn), its(:execution_role_arn), its(:network_mode), its(:revision), its(:volumes), its(:status), its(:requires_attributes), its(:placement_constraints), its(:compatibilities), its(:requires_compatibilities), its(:cpu), its(:memory), its(:inference_accelerators), its(:pid_mode), its(:ipc_mode), its(:proxy_configuration), its(:registered_at), its(:deregistered_at), its(:registered_by), its(:ephemeral_storage)
|
1286
1287
|
## <a name="efs">efs</a>
|
1287
1288
|
|
1288
1289
|
EFS resource type.
|
@@ -1304,7 +1305,7 @@ describe efs('my-efs') do
|
|
1304
1305
|
end
|
1305
1306
|
```
|
1306
1307
|
|
1307
|
-
### its(:owner_id), its(:creation_token), its(:file_system_id), its(:file_system_arn), its(:creation_time), its(:life_cycle_state), its(:name), its(:number_of_mount_targets), its(:performance_mode), its(:encrypted), its(:kms_key_id), its(:throughput_mode), its(:provisioned_throughput_in_mibps)
|
1308
|
+
### its(:owner_id), its(:creation_token), its(:file_system_id), its(:file_system_arn), its(:creation_time), its(:life_cycle_state), its(:name), its(:number_of_mount_targets), its(:performance_mode), its(:encrypted), its(:kms_key_id), its(:throughput_mode), its(:provisioned_throughput_in_mibps), its(:availability_zone_name), its(:availability_zone_id)
|
1308
1309
|
## <a name="elastic_ip">elastic_ip</a>
|
1309
1310
|
|
1310
1311
|
Elastic IP resource type.
|
@@ -1357,6 +1358,21 @@ end
|
|
1357
1358
|
```
|
1358
1359
|
|
1359
1360
|
### 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)
|
1361
|
+
## <a name="eks_nodegroup">eks_nodegroup</a>
|
1362
|
+
|
1363
|
+
EksNodegroup resource type.
|
1364
|
+
|
1365
|
+
### exist
|
1366
|
+
|
1367
|
+
```ruby
|
1368
|
+
describe eks_nodegroup('my-eks-nodegroup'), cluster: 'my-cluster' do
|
1369
|
+
it { should exist }
|
1370
|
+
end
|
1371
|
+
```
|
1372
|
+
|
1373
|
+
### be_active, be_inactive
|
1374
|
+
|
1375
|
+
### its(:nodegroup_name), its(:nodegroup_arn), its(:cluster_name), its(:version), its(:release_version), its(:created_at), its(:modified_at), its(:status), its(:capacity_type), its(:scaling_config), its(:instance_types), its(:subnets), its(:remote_access), its(:ami_type), its(:node_role), its(:labels), its(:taints), its(:resources), its(:disk_size), its(:health), its(:update_config), its(:launch_template), its(:tags)
|
1360
1376
|
## <a name="elasticache">elasticache</a>
|
1361
1377
|
|
1362
1378
|
Elasticache resource type.
|
@@ -1425,7 +1441,7 @@ describe elasticache('my-rep-group-001') do
|
|
1425
1441
|
end
|
1426
1442
|
```
|
1427
1443
|
|
1428
|
-
### its(:cache_cluster_id), its(:configuration_endpoint), its(:client_download_landing_page), its(:cache_node_type), its(:engine), its(:engine_version), its(:cache_cluster_status), its(:num_cache_nodes), its(:preferred_availability_zone), its(:preferred_outpost_arn), its(:cache_cluster_create_time), its(:preferred_maintenance_window), its(:notification_configuration), its(:cache_security_groups), its(:cache_subnet_group_name), its(:cache_nodes), its(:auto_minor_version_upgrade), its(:replication_group_id), its(:snapshot_retention_limit), its(:snapshot_window), its(:auth_token_enabled), its(:auth_token_last_modified_date), its(:transit_encryption_enabled), its(:at_rest_encryption_enabled), its(:arn)
|
1444
|
+
### its(:cache_cluster_id), its(:configuration_endpoint), its(:client_download_landing_page), its(:cache_node_type), its(:engine), its(:engine_version), its(:cache_cluster_status), its(:num_cache_nodes), its(:preferred_availability_zone), its(:preferred_outpost_arn), its(:cache_cluster_create_time), its(:preferred_maintenance_window), its(:notification_configuration), its(:cache_security_groups), its(:cache_subnet_group_name), its(:cache_nodes), its(:auto_minor_version_upgrade), its(:replication_group_id), its(:snapshot_retention_limit), its(:snapshot_window), its(:auth_token_enabled), its(:auth_token_last_modified_date), its(:transit_encryption_enabled), its(:at_rest_encryption_enabled), its(:arn), its(:replication_group_log_delivery_enabled), its(:log_delivery_configurations)
|
1429
1445
|
## <a name="elasticache_cache_parameter_group">elasticache_cache_parameter_group</a>
|
1430
1446
|
|
1431
1447
|
ElasticacheCacheParameterGroup resource type.
|
@@ -1504,7 +1520,7 @@ end
|
|
1504
1520
|
```
|
1505
1521
|
|
1506
1522
|
|
1507
|
-
### 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)
|
1523
|
+
### 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)
|
1508
1524
|
## <a name="elastictranscoder_pipeline">elastictranscoder_pipeline</a>
|
1509
1525
|
|
1510
1526
|
ElastictranscoderPipeline resource type.
|
@@ -1847,7 +1863,7 @@ describe iam_policy('my-iam-user') do
|
|
1847
1863
|
end
|
1848
1864
|
```
|
1849
1865
|
|
1850
|
-
### its(:policy_name), its(:policy_id), its(:arn), its(:path), its(:default_version_id), its(:attachment_count), its(:permissions_boundary_usage_count), its(:is_attachable), its(:description), its(:create_date), its(:update_date)
|
1866
|
+
### its(:policy_name), its(:policy_id), its(:arn), its(:path), its(:default_version_id), its(:attachment_count), its(:permissions_boundary_usage_count), its(:is_attachable), its(:description), its(:create_date), its(:update_date), its(:tags)
|
1851
1867
|
## <a name="iam_role">iam_role</a>
|
1852
1868
|
|
1853
1869
|
IamRole resource type.
|
@@ -2162,7 +2178,7 @@ DOC
|
|
2162
2178
|
end
|
2163
2179
|
```
|
2164
2180
|
|
2165
|
-
### its(:aws_account_id), its(:key_id), its(:arn), its(:creation_date), its(:enabled), its(:description), its(:key_usage), its(:key_state), its(:deletion_date), its(:valid_to), its(:origin), its(:custom_key_store_id), its(:cloud_hsm_cluster_id), its(:expiration_model), its(:key_manager), its(:customer_master_key_spec), its(:encryption_algorithms), its(:signing_algorithms)
|
2181
|
+
### its(:aws_account_id), its(:key_id), its(:arn), its(:creation_date), its(:enabled), its(:description), its(:key_usage), its(:key_state), its(:deletion_date), its(:valid_to), its(:origin), its(:custom_key_store_id), its(:cloud_hsm_cluster_id), its(:expiration_model), its(:key_manager), its(:customer_master_key_spec), its(:encryption_algorithms), its(:signing_algorithms), its(:multi_region), its(:multi_region_configuration), its(:pending_deletion_window_in_days)
|
2166
2182
|
## <a name="lambda">lambda</a>
|
2167
2183
|
|
2168
2184
|
Lambda resource type.
|
@@ -2211,7 +2227,7 @@ end
|
|
2211
2227
|
|
2212
2228
|
This matcher does not support Amazon S3 event sources ([see SDK doc](http://docs.aws.amazon.com/sdkforruby/api/Aws/Lambda/Client.html#list_event_source_mappings-instance_method)).
|
2213
2229
|
|
2214
|
-
### its(:function_name), its(:function_arn), its(:runtime), its(:role), its(:handler), its(:code_size), its(:description), its(:timeout), its(:memory_size), its(:last_modified), its(:code_sha_256), its(:version), its(:vpc_config), its(:dead_letter_config), its(:kms_key_arn), its(:master_arn), its(:revision_id), its(:layers), its(:state), its(:state_reason), its(:state_reason_code), its(:last_update_status), its(:last_update_status_reason), its(:last_update_status_reason_code), its(:file_system_configs)
|
2230
|
+
### its(:function_name), its(:function_arn), its(:runtime), its(:role), its(:handler), its(:code_size), its(:description), its(:timeout), its(:memory_size), its(:last_modified), its(:code_sha_256), its(:version), its(:vpc_config), its(:dead_letter_config), its(:kms_key_arn), its(:master_arn), its(:revision_id), its(:layers), its(:state), its(:state_reason), its(:state_reason_code), its(:last_update_status), its(:last_update_status_reason), its(:last_update_status_reason_code), its(:file_system_configs), its(:package_type), its(:image_config_response), its(:signing_profile_version_arn), its(:signing_job_arn)
|
2215
2231
|
## <a name="launch_configuration">launch_configuration</a>
|
2216
2232
|
|
2217
2233
|
LaunchConfiguration resource type.
|
@@ -2406,7 +2422,7 @@ end
|
|
2406
2422
|
```
|
2407
2423
|
|
2408
2424
|
|
2409
|
-
### its(:create_time), its(:delete_time), its(:failure_code), its(:failure_message), its(:nat_gateway_id), its(:provisioned_bandwidth), its(:state), its(:subnet_id), its(:vpc_id)
|
2425
|
+
### its(:create_time), its(:delete_time), its(:failure_code), its(:failure_message), its(:nat_gateway_id), its(:provisioned_bandwidth), its(:state), its(:subnet_id), its(:vpc_id), its(:connectivity_type)
|
2410
2426
|
## <a name="network_acl">network_acl</a>
|
2411
2427
|
|
2412
2428
|
NetworkAcl resource type.
|
@@ -2785,7 +2801,7 @@ end
|
|
2785
2801
|
```
|
2786
2802
|
|
2787
2803
|
|
2788
|
-
### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), 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)
|
2804
|
+
### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), 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)
|
2789
2805
|
### :unlock: Advanced use
|
2790
2806
|
|
2791
2807
|
`rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
|
@@ -2917,7 +2933,7 @@ describe redshift('my-redshift') do
|
|
2917
2933
|
end
|
2918
2934
|
```
|
2919
2935
|
|
2920
|
-
### its(:vpc_id), its(:cluster_identifier), its(:node_type), its(:cluster_status), its(:cluster_availability_status), its(:modify_status), its(:master_username), its(:db_name), its(:endpoint), its(:cluster_create_time), its(:automated_snapshot_retention_period), its(:manual_snapshot_retention_period), its(:cluster_security_groups), its(:cluster_subnet_group_name), its(:vpc_id), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:cluster_version), its(:allow_version_upgrade), its(:number_of_nodes), its(:publicly_accessible), its(:encrypted), its(:restore_status), its(:data_transfer_progress), its(:hsm_status), its(:cluster_snapshot_copy_status), its(:cluster_public_key), its(:cluster_nodes), its(:elastic_ip_status), its(:cluster_revision_number), its(:kms_key_id), its(:enhanced_vpc_routing), its(:iam_roles), its(:pending_actions), its(:maintenance_track_name), its(:elastic_resize_number_of_node_options), its(:deferred_maintenance_windows), its(:snapshot_schedule_identifier), its(:snapshot_schedule_state), its(:expected_next_snapshot_schedule_time), its(:expected_next_snapshot_schedule_time_status), its(:next_maintenance_window_start_time), its(:resize_info)
|
2936
|
+
### its(:vpc_id), its(:cluster_identifier), its(:node_type), its(:cluster_status), its(:cluster_availability_status), its(:modify_status), its(:master_username), its(:db_name), its(:endpoint), its(:cluster_create_time), its(:automated_snapshot_retention_period), its(:manual_snapshot_retention_period), its(:cluster_security_groups), its(:cluster_subnet_group_name), its(:vpc_id), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:cluster_version), its(:allow_version_upgrade), its(:number_of_nodes), its(:publicly_accessible), its(:encrypted), its(:restore_status), its(:data_transfer_progress), its(:hsm_status), its(:cluster_snapshot_copy_status), its(:cluster_public_key), its(:cluster_nodes), its(:elastic_ip_status), its(:cluster_revision_number), its(:kms_key_id), its(:enhanced_vpc_routing), its(:iam_roles), its(:pending_actions), its(:maintenance_track_name), its(:elastic_resize_number_of_node_options), its(:deferred_maintenance_windows), its(:snapshot_schedule_identifier), its(:snapshot_schedule_state), its(:expected_next_snapshot_schedule_time), its(:expected_next_snapshot_schedule_time_status), its(:next_maintenance_window_start_time), its(:resize_info), its(:availability_zone_relocation_status), its(:cluster_namespace_arn), its(:total_storage_capacity_in_mega_bytes), its(:aqua_configuration)
|
2921
2937
|
## <a name="redshift_cluster_parameter_group">redshift_cluster_parameter_group</a>
|
2922
2938
|
|
2923
2939
|
RedshiftClusterParameterGroup resource type.
|
@@ -3114,6 +3130,15 @@ end
|
|
3114
3130
|
```
|
3115
3131
|
|
3116
3132
|
|
3133
|
+
### have_location
|
3134
|
+
|
3135
|
+
```ruby
|
3136
|
+
describe s3_bucket('my-bucket') do
|
3137
|
+
it { should have_location('us-east-1') }
|
3138
|
+
end
|
3139
|
+
```
|
3140
|
+
|
3141
|
+
|
3117
3142
|
### have_logging_enabled
|
3118
3143
|
|
3119
3144
|
```ruby
|
@@ -3233,7 +3258,7 @@ describe secretsmanager('my-secret') do
|
|
3233
3258
|
end
|
3234
3259
|
```
|
3235
3260
|
|
3236
|
-
### its(:arn), its(:name), its(:description), its(:kms_key_id), its(:rotation_enabled), its(:rotation_lambda_arn), its(:last_rotated_date), its(:last_changed_date), its(:last_accessed_date), its(:deleted_date), its(:owning_service), its(:created_date)
|
3261
|
+
### its(:arn), its(:name), its(:description), its(:kms_key_id), its(:rotation_enabled), its(:rotation_lambda_arn), its(:last_rotated_date), its(:last_changed_date), its(:last_accessed_date), its(:deleted_date), its(:owning_service), its(:created_date), its(:primary_region), its(:replication_status)
|
3237
3262
|
## <a name="security_group">security_group</a>
|
3238
3263
|
|
3239
3264
|
SecurityGroup resource type.
|
@@ -51,7 +51,7 @@ module Awspec
|
|
51
51
|
types_for_generate_all = %w(
|
52
52
|
cloudwatch_alarm cloudwatch_event directconnect ebs efs
|
53
53
|
elasticsearch iam_group iam_policy iam_role iam_user kms lambda
|
54
|
-
acm cloudwatch_logs eip codebuild
|
54
|
+
acm cloudwatch_logs eip codebuild elasticache
|
55
55
|
)
|
56
56
|
|
57
57
|
types_for_generate_all.each do |type|
|
data/lib/awspec/generator.rb
CHANGED
@@ -27,6 +27,7 @@ require 'awspec/generator/spec/cloudwatch_logs'
|
|
27
27
|
require 'awspec/generator/spec/alb'
|
28
28
|
require 'awspec/generator/spec/nlb'
|
29
29
|
require 'awspec/generator/spec/internet_gateway'
|
30
|
+
require 'awspec/generator/spec/elasticache'
|
30
31
|
require 'awspec/generator/spec/elasticsearch'
|
31
32
|
require 'awspec/generator/spec/eip'
|
32
33
|
require 'awspec/generator/spec/rds_db_parameter_group'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Awspec::Generator
|
2
|
+
module Doc
|
3
|
+
module Type
|
4
|
+
class EksNodegroup < Base
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
@type_name = 'EksNodegroup'
|
8
|
+
@type = Awspec::Type::EksNodegroup.new('my-eks-nodegroup')
|
9
|
+
@ret = @type.resource_via_client
|
10
|
+
@matchers = [
|
11
|
+
Awspec::Type::EksNodegroup::STATES.map { |state| 'be_' + state.downcase }.join(', ')
|
12
|
+
]
|
13
|
+
@ignore_matchers = Awspec::Type::EksNodegroup::STATES.map { |state| 'be_' + state.downcase }
|
14
|
+
@describes = []
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Awspec::Generator
|
2
|
+
module Spec
|
3
|
+
class Elasticache
|
4
|
+
include Awspec::Helper::Finder
|
5
|
+
def generate_all
|
6
|
+
opt = {}
|
7
|
+
clusters = []
|
8
|
+
loop do
|
9
|
+
res = elasticache_client.describe_cache_clusters(opt)
|
10
|
+
clusters.push(*res.cache_clusters)
|
11
|
+
break if res.marker.nil?
|
12
|
+
opt = { marker: res.marker }
|
13
|
+
end
|
14
|
+
raise 'Not Found Cache Clusters' if clusters.empty?
|
15
|
+
ERB.new(cache_clusters_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
16
|
+
end
|
17
|
+
|
18
|
+
def cache_clusters_spec_template
|
19
|
+
template = <<-'EOF'
|
20
|
+
<% clusters.each do |cluster| %>
|
21
|
+
describe elasticache('<%= cluster.cache_cluster_id %>') do
|
22
|
+
it { should exist }
|
23
|
+
it { should be_available }
|
24
|
+
it { should have_cache_parameter_group('<%= cluster.cache_parameter_group.cache_parameter_group_name %>') }
|
25
|
+
it { should belong_to_cache_subnet_group('<%= cluster.cache_subnet_group_name %>') }
|
26
|
+
<% unless cluster.replication_group_id.nil? %>
|
27
|
+
its(:replication_group_id) { should eq '<%= cluster.replication_group_id %>' }
|
28
|
+
<% end %>
|
29
|
+
its(:engine) { should eq '<%= cluster.engine %>' }
|
30
|
+
its(:engine_version) { should eq '<%= cluster.engine_version %>' }
|
31
|
+
its(:cache_node_type) { should eq '<%= cluster.cache_node_type %>' }
|
32
|
+
<% unless cluster.snapshot_retention_limit.nil? %>
|
33
|
+
its(:snapshot_retention_limit) { should eq <%= cluster.snapshot_retention_limit %> }
|
34
|
+
its(:snapshot_window) { should eq '<%= cluster.snapshot_window %>' }
|
35
|
+
<% end %>
|
36
|
+
end
|
37
|
+
<% end %>
|
38
|
+
EOF
|
39
|
+
template
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -11,7 +11,7 @@ module Awspec::Generator
|
|
11
11
|
group_name: group.group_name,
|
12
12
|
policy_name: policy_name
|
13
13
|
})
|
14
|
-
document = JSON.generate(JSON.parse(URI.
|
14
|
+
document = JSON.generate(JSON.parse(URI.decode_www_form_component(res.policy_document)))
|
15
15
|
"it { should have_inline_policy('#{policy_name}').policy_document('#{document}') }"
|
16
16
|
end
|
17
17
|
content = ERB.new(iam_group_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
@@ -11,7 +11,7 @@ module Awspec::Generator
|
|
11
11
|
role_name: role.role_name,
|
12
12
|
policy_name: policy_name
|
13
13
|
})
|
14
|
-
document = JSON.generate(JSON.parse(URI.
|
14
|
+
document = JSON.generate(JSON.parse(URI.decode_www_form_component(res.policy_document)))
|
15
15
|
"it { should have_inline_policy('#{policy_name}').policy_document('#{document}') }"
|
16
16
|
end
|
17
17
|
content = ERB.new(iam_role_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
@@ -11,7 +11,7 @@ module Awspec::Generator
|
|
11
11
|
user_name: user.user_name,
|
12
12
|
policy_name: policy_name
|
13
13
|
})
|
14
|
-
document = JSON.generate(JSON.parse(URI.
|
14
|
+
document = JSON.generate(JSON.parse(URI.decode_www_form_component(res.policy_document)))
|
15
15
|
"it { should have_inline_policy('#{policy_name}').policy_document('#{document}') }"
|
16
16
|
end
|
17
17
|
content = ERB.new(iam_user_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
@@ -102,6 +102,9 @@ describe s3_bucket('<%= bucket.name %>') do
|
|
102
102
|
<%= line %>
|
103
103
|
<% end %>
|
104
104
|
<%- end -%>
|
105
|
+
<%- if location -%>
|
106
|
+
it { should have_location('<%= location %>') }
|
107
|
+
<%- end -%>
|
105
108
|
end
|
106
109
|
EOF
|
107
110
|
template
|
@@ -117,6 +120,7 @@ EOF
|
|
117
120
|
bucket_policy = policy.policy.read if policy
|
118
121
|
lifecycle_rule = find_bucket_lifecycle_configuration(bucket.name)
|
119
122
|
lifecycle_specs = generate_lifecycle_rule_specs(lifecycle_rule) if lifecycle_rule
|
123
|
+
location = find_bucket_location(bucket.name)
|
120
124
|
ERB.new(bucket_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
121
125
|
end
|
122
126
|
end
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -166,6 +166,12 @@ module Awspec::Helper
|
|
166
166
|
http_wire_trace: ENV['http_wire_trace'] || false
|
167
167
|
}
|
168
168
|
|
169
|
+
check_configuration = ENV['DISABLE_AWS_CLIENT_CHECK'] != 'true' if ENV.key?('DISABLE_AWS_CLIENT_CHECK')
|
170
|
+
|
171
|
+
# define_method below will "hide" any exception that comes from bad
|
172
|
+
# setup of AWS client, so let's try first to create a instance
|
173
|
+
Awsecrets.load if check_configuration
|
174
|
+
|
169
175
|
CLIENTS.each do |method_name, client|
|
170
176
|
define_method method_name do
|
171
177
|
unless self.methods.include? "@#{method_name}"
|
@@ -7,15 +7,16 @@ module Awspec::Helper
|
|
7
7
|
res = ec2_client.describe_instances({
|
8
8
|
instance_ids: [id]
|
9
9
|
})
|
10
|
-
rescue
|
11
|
-
# Aws::EC2::Errors::InvalidInstanceIDMalformed
|
12
|
-
# Aws::EC2::Errors::InvalidInstanceIDNotFound
|
10
|
+
rescue Aws::EC2::Errors::InvalidInstanceIDNotFound, Aws::EC2::Errors::InvalidInstanceIDMalformed => e
|
13
11
|
res = ec2_client.describe_instances({
|
14
12
|
filters: [{ name: 'tag:Name', values: [id] }]
|
15
13
|
})
|
16
14
|
end
|
17
15
|
# rubocop:enable Style/GuardClause
|
18
|
-
|
16
|
+
|
17
|
+
if res.reservations.count == 0
|
18
|
+
nil
|
19
|
+
elsif res.reservations.count == 1
|
19
20
|
res.reservations.first.instances.single_resource(id)
|
20
21
|
elsif res.reservations.count > 1
|
21
22
|
raise Awspec::DuplicatedResourceTypeError, "Duplicate instances matching id or tag #{id}"
|
@@ -5,6 +5,11 @@ module Awspec::Helper
|
|
5
5
|
res = eks_client.describe_cluster({ name: name })
|
6
6
|
res.cluster
|
7
7
|
end
|
8
|
+
|
9
|
+
def find_eks_nodegroup(cluster_name, group_name)
|
10
|
+
res = eks_client.describe_nodegroup({ cluster_name: cluster_name, nodegroup_name: group_name })
|
11
|
+
res.nodegroup
|
12
|
+
end
|
8
13
|
end
|
9
14
|
end
|
10
15
|
end
|
@@ -35,6 +35,17 @@ module Awspec::Helper
|
|
35
35
|
nil
|
36
36
|
end
|
37
37
|
|
38
|
+
def find_bucket_location(id)
|
39
|
+
bucket_location = s3_client.get_bucket_location(bucket: id)
|
40
|
+
if bucket_location.location_constraint.nil? || bucket_location.location_constraint.empty?
|
41
|
+
'us-east-1'
|
42
|
+
else
|
43
|
+
bucket_location.location_constraint
|
44
|
+
end
|
45
|
+
rescue Aws::S3::Errors::ServiceError
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
|
38
49
|
def find_bucket_logging(id)
|
39
50
|
s3_client.get_bucket_logging(bucket: id)
|
40
51
|
rescue Aws::S3::Errors::ServiceError
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Awspec::Helper
|
2
|
+
module States
|
3
|
+
EC2_STATES = %w(pending running shutting-down terminated stopping stopped)
|
4
|
+
|
5
|
+
def self.ec2_states_checks
|
6
|
+
Enumerator.new do |yielder|
|
7
|
+
n = 0
|
8
|
+
while n < EC2_STATES.size
|
9
|
+
method_name = EC2_STATES[n].tr('-', '_') + '?'
|
10
|
+
yielder.yield(method_name, EC2_STATES[n])
|
11
|
+
n += 1
|
12
|
+
end
|
13
|
+
end.lazy
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/awspec/helper/type.rb
CHANGED
@@ -12,7 +12,7 @@ module Awspec
|
|
12
12
|
batch_compute_environment batch_job_definition batch_job_queue cloudtrail
|
13
13
|
cloudwatch_alarm cloudwatch_event directconnect_virtual_interface
|
14
14
|
ebs ec2 ecr_repository ecs_cluster ecs_container_instance ecs_service ecs_task_definition
|
15
|
-
efs eks elasticache elasticache_cache_parameter_group elasticsearch elb emr firehose iam_group
|
15
|
+
efs eks eks_nodegroup elasticache elasticache_cache_parameter_group elasticsearch elb emr firehose iam_group
|
16
16
|
iam_policy iam_role iam_user kinesis kms lambda launch_configuration launch_template mq nat_gateway
|
17
17
|
network_acl network_interface nlb nlb_listener nlb_target_group
|
18
18
|
rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Aws.config[:eks] = {
|
2
|
+
stub_responses: {
|
3
|
+
describe_nodegroup: {
|
4
|
+
nodegroup: {
|
5
|
+
version: '1.17',
|
6
|
+
release_version: '1.17.12-20210322',
|
7
|
+
cluster_name: 'my-cluster',
|
8
|
+
nodegroup_name: 'my-nodegroup',
|
9
|
+
nodegroup_arn: 'arn:aws:eks:us-west-2:012345678910:nodegroup/my-cluster/my-nodegroup/08bd000a',
|
10
|
+
created_at: Time.parse('2018-10-28 00:23:32 -0400'),
|
11
|
+
node_role: 'arn:aws:iam::012345678910:role/eks-nodegroup-role',
|
12
|
+
status: 'ACTIVE'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
data/lib/awspec/type/ec2.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'awspec/helper/states'
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Ec2 < ResourceBase
|
3
5
|
aws_resource Aws::EC2::Instance
|
@@ -8,6 +10,16 @@ module Awspec::Type
|
|
8
10
|
@display_name = name
|
9
11
|
end
|
10
12
|
|
13
|
+
# required by Awspec::Generator::Doc::Type
|
14
|
+
STATES = Awspec::Helper::States::EC2_STATES
|
15
|
+
|
16
|
+
Awspec::Helper::States.ec2_states_checks.each do |method_name, state|
|
17
|
+
define_method method_name do
|
18
|
+
check_existence
|
19
|
+
resource_via_client.state.name == state
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
11
23
|
def resource_via_client
|
12
24
|
@resource_via_client ||= find_ec2(@display_name)
|
13
25
|
end
|
@@ -17,20 +29,10 @@ module Awspec::Type
|
|
17
29
|
end
|
18
30
|
|
19
31
|
def security_group_count
|
32
|
+
check_existence
|
20
33
|
resource_via_client.security_groups.count
|
21
34
|
end
|
22
35
|
|
23
|
-
STATES = %w(
|
24
|
-
pending running shutting-down
|
25
|
-
terminated stopping stopped
|
26
|
-
)
|
27
|
-
|
28
|
-
STATES.each do |state|
|
29
|
-
define_method state.tr('-', '_') + '?' do
|
30
|
-
resource_via_client.state.name == state
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
36
|
def disabled_api_termination?
|
35
37
|
ret = find_ec2_attribute(id, 'disableApiTermination')
|
36
38
|
ret.disable_api_termination.value
|
@@ -48,7 +50,6 @@ module Awspec::Type
|
|
48
50
|
|
49
51
|
def has_security_groups?(sg_ids)
|
50
52
|
return true if match_group_ids?(sg_ids) || match_group_names?(sg_ids)
|
51
|
-
|
52
53
|
group_ids = resource_security_groups.map { |sg| sg.group_id }
|
53
54
|
tags = select_security_group_by_group_id(group_ids).map { |sg| sg.tags }.flatten
|
54
55
|
group_names = tags.select { |tag| tag.key == 'Name' }.map { |tag| tag.value }
|
@@ -56,6 +57,7 @@ module Awspec::Type
|
|
56
57
|
end
|
57
58
|
|
58
59
|
def has_security_group?(sg_id)
|
60
|
+
check_existence
|
59
61
|
sgs = resource_via_client.security_groups
|
60
62
|
ret = sgs.find do |sg|
|
61
63
|
sg.group_id == sg_id || sg.group_name == sg_id
|
@@ -69,12 +71,14 @@ module Awspec::Type
|
|
69
71
|
end
|
70
72
|
|
71
73
|
def has_iam_instance_profile?(iam_instance_profile_name)
|
74
|
+
check_existence
|
72
75
|
iam = resource_via_client.iam_instance_profile
|
73
76
|
ret = iam.arn.split('/').last == iam_instance_profile_name
|
74
77
|
return true if ret
|
75
78
|
end
|
76
79
|
|
77
80
|
def has_ebs?(volume_id)
|
81
|
+
check_existence
|
78
82
|
blocks = resource_via_client.block_device_mappings
|
79
83
|
ret = blocks.find do |block|
|
80
84
|
next false unless block.ebs
|
@@ -89,8 +93,9 @@ module Awspec::Type
|
|
89
93
|
|
90
94
|
def has_network_interface?(network_interface_id, device_index = nil)
|
91
95
|
res = find_network_interface(network_interface_id)
|
96
|
+
check_existence
|
92
97
|
interfaces = resource_via_client.network_interfaces
|
93
|
-
interfaces.find do |interface|
|
98
|
+
ret = interfaces.find do |interface|
|
94
99
|
next false if device_index && interface.attachment.device_index != device_index
|
95
100
|
interface.network_interface_id == res.network_interface_id
|
96
101
|
end
|
@@ -98,7 +103,7 @@ module Awspec::Type
|
|
98
103
|
|
99
104
|
def has_event?(event_code)
|
100
105
|
status = find_ec2_status(id)
|
101
|
-
status.events.find do |event|
|
106
|
+
ret = status.events.find do |event|
|
102
107
|
event.code == event_code
|
103
108
|
end
|
104
109
|
end
|
@@ -133,8 +138,7 @@ module Awspec::Type
|
|
133
138
|
end
|
134
139
|
|
135
140
|
def has_credit_specification?(cpu_credits)
|
136
|
-
|
137
|
-
ret.cpu_credits == cpu_credits
|
141
|
+
find_ec2_credit_specifications(id).cpu_credits == cpu_credits
|
138
142
|
end
|
139
143
|
|
140
144
|
private
|
@@ -148,6 +152,7 @@ module Awspec::Type
|
|
148
152
|
end
|
149
153
|
|
150
154
|
def resource_security_groups
|
155
|
+
check_existence
|
151
156
|
resource_via_client.security_groups
|
152
157
|
end
|
153
158
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Awspec::Type
|
2
|
+
class EksNodegroup < ResourceBase
|
3
|
+
attr_accessor :cluster
|
4
|
+
|
5
|
+
def initialize(group_name)
|
6
|
+
super
|
7
|
+
@group_name = group_name
|
8
|
+
end
|
9
|
+
|
10
|
+
def resource_via_client
|
11
|
+
@resource_via_client ||= find_eks_nodegroup(cluster, @group_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
def id
|
15
|
+
@id ||= resource_via_client.nodegroup_arn if resource_via_client
|
16
|
+
end
|
17
|
+
|
18
|
+
def cluster
|
19
|
+
@cluster || 'default'
|
20
|
+
end
|
21
|
+
|
22
|
+
STATES = %w(ACTIVE INACTIVE)
|
23
|
+
|
24
|
+
STATES.each do |state|
|
25
|
+
define_method state.downcase + '?' do
|
26
|
+
resource_via_client.status == state
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -34,7 +34,7 @@ module Awspec::Type
|
|
34
34
|
group_name: id,
|
35
35
|
policy_name: policy_name
|
36
36
|
})
|
37
|
-
return JSON.parse(URI.
|
37
|
+
return JSON.parse(URI.decode_www_form_component(res.policy_document)) == JSON.parse(document) if document
|
38
38
|
res
|
39
39
|
end
|
40
40
|
|
data/lib/awspec/type/iam_role.rb
CHANGED
@@ -24,7 +24,7 @@ module Awspec::Type
|
|
24
24
|
role_name: resource_via_client.role_name,
|
25
25
|
policy_name: policy_name
|
26
26
|
})
|
27
|
-
return JSON.parse(URI.
|
27
|
+
return JSON.parse(URI.decode_www_form_component(res.policy_document)) == JSON.parse(document) if document
|
28
28
|
res
|
29
29
|
end
|
30
30
|
|
data/lib/awspec/type/iam_user.rb
CHANGED
@@ -24,7 +24,7 @@ module Awspec::Type
|
|
24
24
|
user_name: resource_via_client.user_name,
|
25
25
|
policy_name: policy_name
|
26
26
|
})
|
27
|
-
return JSON.parse(URI.
|
27
|
+
return JSON.parse(URI.decode_www_form_component(res.policy_document)) == JSON.parse(document) if document
|
28
28
|
res
|
29
29
|
end
|
30
30
|
|
data/lib/awspec/type/kms.rb
CHANGED
@@ -14,7 +14,7 @@ module Awspec::Type
|
|
14
14
|
|
15
15
|
def has_key_policy?(policy_name, document = nil)
|
16
16
|
res = kms_client.get_key_policy(key_id: id, policy_name: policy_name)
|
17
|
-
return JSON.parse(URI.
|
17
|
+
return JSON.parse(URI.decode_www_form_component(res.policy)) == JSON.parse(document) if document
|
18
18
|
res
|
19
19
|
end
|
20
20
|
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.24.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -266,6 +266,7 @@ files:
|
|
266
266
|
- doc/_resource_types/efs.md
|
267
267
|
- doc/_resource_types/eip.md
|
268
268
|
- doc/_resource_types/eks.md
|
269
|
+
- doc/_resource_types/eks_nodegroup.md
|
269
270
|
- doc/_resource_types/elasticache.md
|
270
271
|
- doc/_resource_types/elasticache_cache_parameter_group.md
|
271
272
|
- doc/_resource_types/elasticsearch.md
|
@@ -370,6 +371,7 @@ files:
|
|
370
371
|
- lib/awspec/generator/doc/type/efs.rb
|
371
372
|
- lib/awspec/generator/doc/type/eip.rb
|
372
373
|
- lib/awspec/generator/doc/type/eks.rb
|
374
|
+
- lib/awspec/generator/doc/type/eks_nodegroup.rb
|
373
375
|
- lib/awspec/generator/doc/type/elasticache.rb
|
374
376
|
- lib/awspec/generator/doc/type/elasticache_cache_parameter_group.rb
|
375
377
|
- lib/awspec/generator/doc/type/elasticsearch.rb
|
@@ -433,6 +435,7 @@ files:
|
|
433
435
|
- lib/awspec/generator/spec/ec2.rb
|
434
436
|
- lib/awspec/generator/spec/efs.rb
|
435
437
|
- lib/awspec/generator/spec/eip.rb
|
438
|
+
- lib/awspec/generator/spec/elasticache.rb
|
436
439
|
- lib/awspec/generator/spec/elasticsearch.rb
|
437
440
|
- lib/awspec/generator/spec/elb.rb
|
438
441
|
- lib/awspec/generator/spec/iam_group.rb
|
@@ -516,6 +519,7 @@ files:
|
|
516
519
|
- lib/awspec/helper/finder/vpc_endpoints.rb
|
517
520
|
- lib/awspec/helper/finder/waf.rb
|
518
521
|
- lib/awspec/helper/finder/wafregional.rb
|
522
|
+
- lib/awspec/helper/states.rb
|
519
523
|
- lib/awspec/helper/type.rb
|
520
524
|
- lib/awspec/matcher.rb
|
521
525
|
- lib/awspec/matcher/be_allowed.rb
|
@@ -591,6 +595,7 @@ files:
|
|
591
595
|
- lib/awspec/stub/ebs.rb
|
592
596
|
- lib/awspec/stub/ec2.rb
|
593
597
|
- lib/awspec/stub/ec2_has_multi_security_groups.rb
|
598
|
+
- lib/awspec/stub/ec2_non_existing.rb
|
594
599
|
- lib/awspec/stub/ecr_repository.rb
|
595
600
|
- lib/awspec/stub/ecs.rb
|
596
601
|
- lib/awspec/stub/ecs_cluster.rb
|
@@ -600,6 +605,7 @@ files:
|
|
600
605
|
- lib/awspec/stub/efs.rb
|
601
606
|
- lib/awspec/stub/eip.rb
|
602
607
|
- lib/awspec/stub/eks.rb
|
608
|
+
- lib/awspec/stub/eks_nodegroup.rb
|
603
609
|
- lib/awspec/stub/elasticache.rb
|
604
610
|
- lib/awspec/stub/elasticache_cache_parameter_group.rb
|
605
611
|
- lib/awspec/stub/elasticsearch.rb
|
@@ -687,6 +693,7 @@ files:
|
|
687
693
|
- lib/awspec/type/efs.rb
|
688
694
|
- lib/awspec/type/eip.rb
|
689
695
|
- lib/awspec/type/eks.rb
|
696
|
+
- lib/awspec/type/eks_nodegroup.rb
|
690
697
|
- lib/awspec/type/elasticache.rb
|
691
698
|
- lib/awspec/type/elasticache_cache_parameter_group.rb
|
692
699
|
- lib/awspec/type/elasticsearch.rb
|
@@ -743,7 +750,7 @@ homepage: https://github.com/k1LoW/awspec
|
|
743
750
|
licenses:
|
744
751
|
- MIT
|
745
752
|
metadata: {}
|
746
|
-
post_install_message:
|
753
|
+
post_install_message:
|
747
754
|
rdoc_options: []
|
748
755
|
require_paths:
|
749
756
|
- lib
|
@@ -758,8 +765,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
758
765
|
- !ruby/object:Gem::Version
|
759
766
|
version: '0'
|
760
767
|
requirements: []
|
761
|
-
rubygems_version: 3.
|
762
|
-
signing_key:
|
768
|
+
rubygems_version: 3.1.4
|
769
|
+
signing_key:
|
763
770
|
specification_version: 4
|
764
771
|
summary: RSpec tests for your AWS resources.
|
765
772
|
test_files: []
|