awspec 1.25.2 → 1.27.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3 -2
- data/Rakefile +14 -1
- data/awspec.gemspec +1 -0
- data/doc/_resource_types/eip.md +1 -1
- data/doc/_resource_types/rds_proxy.md +42 -0
- data/doc/_resource_types/transfer_server.md +23 -0
- data/doc/resource_types.md +96 -11
- data/lib/awspec/command/generate.rb +1 -1
- data/lib/awspec/generator/doc/type/rds_proxy.rb +23 -0
- data/lib/awspec/generator/doc/type/transfer_server.rb +21 -0
- data/lib/awspec/generator/spec/rds_proxy.rb +38 -0
- data/lib/awspec/generator.rb +1 -0
- data/lib/awspec/helper/finder/ec2.rb +0 -14
- data/lib/awspec/helper/finder/eip.rb +26 -0
- data/lib/awspec/helper/finder/rds.rb +14 -0
- data/lib/awspec/helper/finder/transfer.rb +12 -0
- data/lib/awspec/helper/finder/vpc_endpoints.rb +16 -1
- data/lib/awspec/helper/finder.rb +6 -1
- data/lib/awspec/helper/type.rb +2 -1
- data/lib/awspec/matcher/belong_to_subnet.rb +17 -0
- data/lib/awspec/stub/eip.rb +7 -1
- data/lib/awspec/stub/rds_proxy.rb +85 -0
- data/lib/awspec/stub/transfer_server.rb +41 -0
- data/lib/awspec/type/eip.rb +1 -1
- data/lib/awspec/type/rds_proxy.rb +67 -0
- data/lib/awspec/type/transfer_server.rb +28 -0
- data/lib/awspec/type/vpc_endpoints.rb +5 -0
- data/lib/awspec/version.rb +1 -1
- metadata +27 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e438eb5cfb3e76e33ccfe2fb709db146f8334316d7ff7784b0d5286e94bee9f
|
4
|
+
data.tar.gz: 7f6e39251c505d268168172fea2f87e7faa2e255dbf98169df16445a97e079b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c919af8b30166ab362c1e8b3381f215c79ae6fd5498cd32ef1863e4d11505ea4e5992e781a1f483bede011fc9c0a91b898c4ac72ffc0eaa50c1bc44f8910206d
|
7
|
+
data.tar.gz: 6c21d9579d80a52ad797f1b54318fb3ded718ffa9718831cdcd5cfb7c2aacb4c1459385f4b315fba6a0182a51b049d7d989824a9026d469e4e15fa94ab8bc27b
|
data/.github/workflows/ci.yml
CHANGED
@@ -2,7 +2,8 @@ name: CI
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches:
|
5
|
+
branches:
|
6
|
+
- master
|
6
7
|
pull_request:
|
7
8
|
|
8
9
|
jobs:
|
@@ -64,4 +65,4 @@ jobs:
|
|
64
65
|
run: bundle exec bin/toolbox docgen > doc/resource_types.md
|
65
66
|
|
66
67
|
- name: Run tests
|
67
|
-
run: bundle exec rake spec
|
68
|
+
run: bundle exec rake spec:parallel
|
data/Rakefile
CHANGED
@@ -6,7 +6,8 @@ begin
|
|
6
6
|
require 'rspec'
|
7
7
|
require 'rspec/core'
|
8
8
|
require 'rspec/core/rake_task'
|
9
|
-
require 'octorelease'
|
9
|
+
require 'octorelease' unless ENV['CI']
|
10
|
+
require 'parallel'
|
10
11
|
require 'rubocop/rake_task'
|
11
12
|
rescue LoadError
|
12
13
|
end
|
@@ -20,6 +21,18 @@ end
|
|
20
21
|
if defined?(RSpec)
|
21
22
|
task spec: 'spec:all'
|
22
23
|
namespace :spec do
|
24
|
+
task :parallel do
|
25
|
+
Parallel.each(types.concat([
|
26
|
+
'spec:account',
|
27
|
+
'spec:core',
|
28
|
+
'spec:generator_spec',
|
29
|
+
'spec:generator_doc',
|
30
|
+
'spec:helper'
|
31
|
+
])) do |t|
|
32
|
+
puts ''
|
33
|
+
Rake::Task[t].execute
|
34
|
+
end
|
35
|
+
end
|
23
36
|
task all: ['spec:type',
|
24
37
|
'spec:account',
|
25
38
|
'spec:core',
|
data/awspec.gemspec
CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_runtime_dependency 'thor'
|
33
33
|
spec.add_development_dependency 'bundler', '>= 1.9', '< 3.0'
|
34
34
|
spec.add_development_dependency 'octorelease'
|
35
|
+
spec.add_development_dependency 'parallel'
|
35
36
|
spec.add_development_dependency 'pry'
|
36
37
|
spec.add_development_dependency 'rake', '~> 12.0'
|
37
38
|
spec.add_development_dependency 'rubocop'
|
data/doc/_resource_types/eip.md
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
### exist
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
describe rds_proxy('my-rds-proxy') do
|
5
|
+
it { should exist }
|
6
|
+
end
|
7
|
+
```
|
8
|
+
|
9
|
+
### be_available, be_creating, be_deleting, be_incompatible_network, be_insufficient_resource_limits, be_modifying, be_reactivating, be_suspended, be_suspending
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
describe rds_proxy('my-rds-proxy') do
|
13
|
+
it { should be_available }
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
### have_security_group
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
describe rds_proxy('my-rds-proxy') do
|
21
|
+
it { should have_security_group('sg-5a6b7cd8') }
|
22
|
+
it { should have_security_group('my-db-sg') }
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
### belong_to_subnet
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
describe rds_proxy('my-rds-proxy') do
|
30
|
+
it { should belong_to_subnet('subnet-8901b123') }
|
31
|
+
it { should belong_to_subnet('db-subnet-a') }
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
### belong_to_vpc
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
describe rds_proxy('my-rds-proxy') do
|
39
|
+
it { should belong_to_vpc('vpc-ab123cde') }
|
40
|
+
it { should belong_to_vpc('my-vpc') }
|
41
|
+
end
|
42
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
### exist
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
describe transfer_server('s-4dc0a424f0154fa89') do
|
5
|
+
it { should exist }
|
6
|
+
end
|
7
|
+
```
|
8
|
+
|
9
|
+
### be_offline, be_online, be_starting, be_stopping, be_start_failed, be_stop_failed
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
describe transfer_server('s-4dc0a424f0154fa89') do
|
13
|
+
it { should be_online }
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
### have_tag
|
18
|
+
```
|
19
|
+
describe transfer_server('s-4dc0a424f0154fa89') do
|
20
|
+
it { should have_tag('env').value('dev') }
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
data/doc/resource_types.md
CHANGED
@@ -63,6 +63,7 @@
|
|
63
63
|
| [rds](#rds)
|
64
64
|
| [rds_db_cluster_parameter_group](#rds_db_cluster_parameter_group)
|
65
65
|
| [rds_db_parameter_group](#rds_db_parameter_group)
|
66
|
+
| [rds_proxy](#rds_proxy)
|
66
67
|
| [redshift](#redshift)
|
67
68
|
| [redshift_cluster_parameter_group](#redshift_cluster_parameter_group)
|
68
69
|
| [route53_hosted_zone](#route53_hosted_zone)
|
@@ -75,6 +76,7 @@
|
|
75
76
|
| [sqs](#sqs)
|
76
77
|
| [ssm_parameter](#ssm_parameter)
|
77
78
|
| [subnet](#subnet)
|
79
|
+
| [transfer_server](#transfer_server)
|
78
80
|
| [transit_gateway](#transit_gateway)
|
79
81
|
| [vpc](#vpc)
|
80
82
|
| [vpc_endpoints](#vpc_endpoints)
|
@@ -273,7 +275,7 @@ end
|
|
273
275
|
|
274
276
|
### have_tag
|
275
277
|
|
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)
|
278
|
+
### its(:architecture), its(:creation_date), its(:image_id), its(:image_location), its(:image_type), its(:public), its(:kernel_id), its(:owner_id), its(:platform), its(:platform_details), its(:usage_operation), its(:ramdisk_id), its(:state), its(:description), its(:ena_support), its(:hypervisor), its(:image_owner_alias), its(:name), its(:root_device_name), its(:root_device_type), its(:sriov_net_support), its(:state_reason), its(:virtualization_type), its(:boot_mode), its(:tpm_support), its(:deprecation_time)
|
277
279
|
### :unlock: Advanced use
|
278
280
|
|
279
281
|
`ami` can use `Aws::EC2::Image` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Image.html).
|
@@ -360,7 +362,7 @@ describe autoscaling_group('my-auto-scaling-group') do
|
|
360
362
|
end
|
361
363
|
```
|
362
364
|
|
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), its(:desired_capacity_type)
|
365
|
+
### 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), its(:desired_capacity_type), its(:default_instance_warmup)
|
364
366
|
## <a name="batch_compute_environment">batch_compute_environment</a>
|
365
367
|
|
366
368
|
BatchComputeEnvironment resource type.
|
@@ -399,7 +401,7 @@ end
|
|
399
401
|
|
400
402
|
### be_unmanaged
|
401
403
|
|
402
|
-
### its(:compute_environment_name), its(:compute_environment_arn), its(:unmanagedv_cpus), its(:ecs_cluster_arn), its(:tags), its(:type), its(:state), its(:status), its(:status_reason), its(:service_role)
|
404
|
+
### its(:compute_environment_name), its(:compute_environment_arn), its(:unmanagedv_cpus), its(:ecs_cluster_arn), its(:tags), its(:type), its(:state), its(:status), its(:status_reason), its(:service_role), its(:update_policy)
|
403
405
|
## <a name="batch_job_definition">batch_job_definition</a>
|
404
406
|
|
405
407
|
BatchJobDefinition resource type.
|
@@ -1127,7 +1129,7 @@ end
|
|
1127
1129
|
```
|
1128
1130
|
|
1129
1131
|
|
1130
|
-
### 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), its(:platform_details), its(:usage_operation), its(:usage_operation_update_time), its(:private_dns_name_options), its(:ipv_6_address)
|
1132
|
+
### 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), its(:platform_details), its(:usage_operation), its(:usage_operation_update_time), its(:private_dns_name_options), its(:ipv_6_address), its(:tpm_support), its(:maintenance_options)
|
1131
1133
|
### :unlock: Advanced use
|
1132
1134
|
|
1133
1135
|
`ec2` can use `Aws::EC2::Instance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Instance.html).
|
@@ -1322,7 +1324,7 @@ Elastic IP resource type.
|
|
1322
1324
|
### exist
|
1323
1325
|
|
1324
1326
|
```ruby
|
1325
|
-
describe eip('
|
1327
|
+
describe eip('my-eip') do
|
1326
1328
|
it { should exist }
|
1327
1329
|
end
|
1328
1330
|
```
|
@@ -1573,7 +1575,7 @@ end
|
|
1573
1575
|
```
|
1574
1576
|
|
1575
1577
|
|
1576
|
-
### 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)
|
1578
|
+
### 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)
|
1577
1579
|
## <a name="elastictranscoder_pipeline">elastictranscoder_pipeline</a>
|
1578
1580
|
|
1579
1581
|
ElastictranscoderPipeline resource type.
|
@@ -1718,7 +1720,7 @@ describe emr('my-emr') do
|
|
1718
1720
|
end
|
1719
1721
|
```
|
1720
1722
|
|
1721
|
-
### 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)
|
1723
|
+
### 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)
|
1722
1724
|
## <a name="firehose">firehose</a>
|
1723
1725
|
|
1724
1726
|
Firehose resource type.
|
@@ -2231,7 +2233,7 @@ DOC
|
|
2231
2233
|
end
|
2232
2234
|
```
|
2233
2235
|
|
2234
|
-
### 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(:key_spec), its(:encryption_algorithms), its(:signing_algorithms), its(:multi_region), its(:multi_region_configuration), its(:pending_deletion_window_in_days)
|
2236
|
+
### 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(:key_spec), its(:encryption_algorithms), its(:signing_algorithms), its(:multi_region), its(:multi_region_configuration), its(:pending_deletion_window_in_days), its(:mac_algorithms)
|
2235
2237
|
## <a name="lambda">lambda</a>
|
2236
2238
|
|
2237
2239
|
Lambda resource type.
|
@@ -2280,7 +2282,7 @@ end
|
|
2280
2282
|
|
2281
2283
|
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)).
|
2282
2284
|
|
2283
|
-
### 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), its(:architectures)
|
2285
|
+
### 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), its(:architectures), its(:ephemeral_storage)
|
2284
2286
|
## <a name="launch_configuration">launch_configuration</a>
|
2285
2287
|
|
2286
2288
|
LaunchConfiguration resource type.
|
@@ -2402,7 +2404,7 @@ describe mq('my-mq') do
|
|
2402
2404
|
end
|
2403
2405
|
```
|
2404
2406
|
|
2405
|
-
### its(:vpc_id), its(:authentication_strategy), its(:auto_minor_version_upgrade), its(:broker_arn), its(:broker_id), its(:broker_name), its(:broker_state), its(:created), its(:deployment_mode), its(:encryption_options), its(:engine_type), its(:engine_version), its(:host_instance_type), its(:ldap_server_metadata), its(:pending_authentication_strategy), its(:pending_engine_version), its(:pending_host_instance_type), its(:pending_ldap_server_metadata), its(:pending_security_groups), its(:publicly_accessible), its(:security_groups), its(:storage_type), its(:subnet_ids)
|
2407
|
+
### its(:vpc_id), its(:actions_required), its(:authentication_strategy), its(:auto_minor_version_upgrade), its(:broker_arn), its(:broker_id), its(:broker_name), its(:broker_state), its(:created), its(:deployment_mode), its(:encryption_options), its(:engine_type), its(:engine_version), its(:host_instance_type), its(:ldap_server_metadata), its(:pending_authentication_strategy), its(:pending_engine_version), its(:pending_host_instance_type), its(:pending_ldap_server_metadata), its(:pending_security_groups), its(:publicly_accessible), its(:security_groups), its(:storage_type), its(:subnet_ids)
|
2406
2408
|
## <a name="msk">msk</a>
|
2407
2409
|
|
2408
2410
|
Msk resource type.
|
@@ -2854,7 +2856,7 @@ end
|
|
2854
2856
|
```
|
2855
2857
|
|
2856
2858
|
|
2857
|
-
### 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)
|
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)
|
2858
2860
|
### :unlock: Advanced use
|
2859
2861
|
|
2860
2862
|
`rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
|
@@ -2914,6 +2916,58 @@ end
|
|
2914
2916
|
```
|
2915
2917
|
|
2916
2918
|
|
2919
|
+
## <a name="rds_proxy">rds_proxy</a>
|
2920
|
+
|
2921
|
+
RdsProxy resource type.
|
2922
|
+
|
2923
|
+
### exist
|
2924
|
+
|
2925
|
+
```ruby
|
2926
|
+
describe rds_proxy('my-rds-proxy') do
|
2927
|
+
it { should exist }
|
2928
|
+
end
|
2929
|
+
```
|
2930
|
+
|
2931
|
+
|
2932
|
+
### be_available, be_creating, be_deleting, be_incompatible_network, be_insufficient_resource_limits, be_modifying, be_reactivating, be_suspended, be_suspending
|
2933
|
+
|
2934
|
+
```ruby
|
2935
|
+
describe rds_proxy('my-rds-proxy') do
|
2936
|
+
it { should be_available }
|
2937
|
+
end
|
2938
|
+
```
|
2939
|
+
|
2940
|
+
|
2941
|
+
### have_security_group
|
2942
|
+
|
2943
|
+
```ruby
|
2944
|
+
describe rds_proxy('my-rds-proxy') do
|
2945
|
+
it { should have_security_group('sg-5a6b7cd8') }
|
2946
|
+
it { should have_security_group('my-db-sg') }
|
2947
|
+
end
|
2948
|
+
```
|
2949
|
+
|
2950
|
+
|
2951
|
+
### belong_to_subnet
|
2952
|
+
|
2953
|
+
```ruby
|
2954
|
+
describe rds_proxy('my-rds-proxy') do
|
2955
|
+
it { should belong_to_subnet('subnet-8901b123') }
|
2956
|
+
it { should belong_to_subnet('db-subnet-a') }
|
2957
|
+
end
|
2958
|
+
```
|
2959
|
+
|
2960
|
+
|
2961
|
+
### belong_to_vpc
|
2962
|
+
|
2963
|
+
```ruby
|
2964
|
+
describe rds_proxy('my-rds-proxy') do
|
2965
|
+
it { should belong_to_vpc('vpc-ab123cde') }
|
2966
|
+
it { should belong_to_vpc('my-vpc') }
|
2967
|
+
end
|
2968
|
+
```
|
2969
|
+
|
2970
|
+
### its(:vpc_id), its(:db_proxy_name), its(:db_proxy_arn), its(:status), its(:engine_family), its(:vpc_id), its(:vpc_security_group_ids), its(:vpc_subnet_ids), its(:role_arn), its(:endpoint), its(:require_tls), its(:idle_client_timeout), its(:debug_logging), its(:created_date), its(:updated_date)
|
2917
2971
|
## <a name="redshift">redshift</a>
|
2918
2972
|
|
2919
2973
|
Redshift resource type.
|
@@ -3587,6 +3641,37 @@ describe subnet('my-subnet') do
|
|
3587
3641
|
end
|
3588
3642
|
```
|
3589
3643
|
|
3644
|
+
## <a name="transfer_server">transfer_server</a>
|
3645
|
+
|
3646
|
+
TransferServer resource type.
|
3647
|
+
|
3648
|
+
### exist
|
3649
|
+
|
3650
|
+
```ruby
|
3651
|
+
describe transfer_server('s-4dc0a424f0154fa89') do
|
3652
|
+
it { should exist }
|
3653
|
+
end
|
3654
|
+
```
|
3655
|
+
|
3656
|
+
|
3657
|
+
### be_offline, be_online, be_starting, be_stopping, be_start_failed, be_stop_failed
|
3658
|
+
|
3659
|
+
```ruby
|
3660
|
+
describe transfer_server('s-4dc0a424f0154fa89') do
|
3661
|
+
it { should be_online }
|
3662
|
+
end
|
3663
|
+
```
|
3664
|
+
|
3665
|
+
|
3666
|
+
### have_tag
|
3667
|
+
```
|
3668
|
+
describe transfer_server('s-4dc0a424f0154fa89') do
|
3669
|
+
it { should have_tag('env').value('dev') }
|
3670
|
+
end
|
3671
|
+
```
|
3672
|
+
|
3673
|
+
|
3674
|
+
### 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)
|
3590
3675
|
## <a name="transit_gateway">transit_gateway</a>
|
3591
3676
|
|
3592
3677
|
TransitGateway resource type.
|
@@ -11,7 +11,7 @@ module Awspec
|
|
11
11
|
|
12
12
|
types = %w[
|
13
13
|
vpc ec2 rds security_group elb network_acl route_table subnet nat_gateway network_interface alb nlb
|
14
|
-
internet_gateway autoscaling_group alb_listener nlb_listener redshift
|
14
|
+
internet_gateway autoscaling_group alb_listener nlb_listener redshift rds_proxy
|
15
15
|
]
|
16
16
|
|
17
17
|
types.each do |type|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class RdsProxy < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'RdsProxy'
|
10
|
+
@type = Awspec::Type::RdsProxy.new('my-rds-proxy')
|
11
|
+
@ret = @type.resource_via_client
|
12
|
+
@matchers = [
|
13
|
+
Awspec::Type::RdsProxy::STATES.map { |state| "be_#{state.tr('-', '_')}" }.join(', '),
|
14
|
+
'belong_to_vpc',
|
15
|
+
'belong_to_subnet'
|
16
|
+
]
|
17
|
+
@ignore_matchers = Awspec::Type::RdsProxy::STATES.map { |state| "be_#{state.tr('-', '_')}" }
|
18
|
+
@describes = %w[vpc_id]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class TransferServer < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'TransferServer'
|
10
|
+
@type = Awspec::Type::TransferServer.new('s-4dc0a424f0154fa89')
|
11
|
+
@ret = @type.resource_via_client
|
12
|
+
@matchers = [
|
13
|
+
Awspec::Type::TransferServer::STATES.map { |state| "be_#{state.downcase.tr('-', '_')}" }.join(', ')
|
14
|
+
]
|
15
|
+
@ignore_matchers = Awspec::Type::TransferServer::STATES.map { |state| "be_#{state.downcase.tr('-', '_')}" }
|
16
|
+
@describes = []
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Spec
|
5
|
+
class RdsProxy
|
6
|
+
include Awspec::Helper::Finder
|
7
|
+
def generate_by_vpc_id(vpc_id)
|
8
|
+
vpc = find_vpc(vpc_id)
|
9
|
+
raise 'Not Found VPC' unless vpc
|
10
|
+
|
11
|
+
@vpc_id = vpc[:vpc_id]
|
12
|
+
db_proxies = select_rds_proxy_by_vpc_id(@vpc_id)
|
13
|
+
specs = db_proxies.map do |db_proxy|
|
14
|
+
content = ERB.new(rds_proxy_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
15
|
+
end
|
16
|
+
specs.join("\n")
|
17
|
+
end
|
18
|
+
|
19
|
+
# rubocop:disable all
|
20
|
+
def rds_proxy_spec_template
|
21
|
+
template = <<-'EOF'
|
22
|
+
describe rds_proxy('<%= db_proxy.db_proxy_name %>') do
|
23
|
+
it { should exist }
|
24
|
+
it { should be_<%= db_proxy.status %> }
|
25
|
+
it { should belong_to_vpc('<%= @vpc_id %>') }
|
26
|
+
<% db_proxy.vpc_security_group_ids.each do |sg_group_id| %>
|
27
|
+
it { should have_security_group('<%= sg_group_id %>') }
|
28
|
+
<% end %>
|
29
|
+
<% db_proxy.vpc_subnet_ids.each do |subnet_id| %>
|
30
|
+
it { should belong_to_subnet('<%= subnet_id %>') }
|
31
|
+
<% end %>
|
32
|
+
end
|
33
|
+
EOF
|
34
|
+
template
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/awspec/generator.rb
CHANGED
@@ -40,6 +40,7 @@ require 'awspec/generator/spec/alb_listener'
|
|
40
40
|
require 'awspec/generator/spec/nlb_listener'
|
41
41
|
require 'awspec/generator/spec/redshift'
|
42
42
|
require 'awspec/generator/spec/redshift_cluster_parameter_group'
|
43
|
+
require 'awspec/generator/spec/rds_proxy'
|
43
44
|
|
44
45
|
# Doc
|
45
46
|
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] }]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Helper
|
4
|
+
module Finder
|
5
|
+
module Eip
|
6
|
+
def select_eip_by_instance_id(id)
|
7
|
+
res = ec2_client.describe_addresses({
|
8
|
+
filters: [{ name: 'instance-id', values: [id] }]
|
9
|
+
})
|
10
|
+
res.addresses
|
11
|
+
end
|
12
|
+
|
13
|
+
def select_eip(id)
|
14
|
+
res = ec2_client.describe_addresses({
|
15
|
+
filters: [{ name: 'public-ip', values: [id] }]
|
16
|
+
})
|
17
|
+
return res.addresses unless res.addresses.empty?
|
18
|
+
|
19
|
+
res = ec2_client.describe_addresses({
|
20
|
+
filters: [{ name: 'tag:Name', values: [id] }]
|
21
|
+
})
|
22
|
+
res.addresses
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -57,6 +57,20 @@ module Awspec::Helper
|
|
57
57
|
end
|
58
58
|
parameters
|
59
59
|
end
|
60
|
+
|
61
|
+
def find_rds_proxy(db_proxy_name)
|
62
|
+
res = rds_client.describe_db_proxies({
|
63
|
+
db_proxy_name: db_proxy_name
|
64
|
+
})
|
65
|
+
res.db_proxies.single_resource(db_proxy_name)
|
66
|
+
end
|
67
|
+
|
68
|
+
def select_rds_proxy_by_vpc_id(vpc_id)
|
69
|
+
res = rds_client.describe_db_proxies
|
70
|
+
res.db_proxies.select do |db_proxy|
|
71
|
+
db_proxy.vpc_id == vpc_id
|
72
|
+
end
|
73
|
+
end
|
60
74
|
end
|
61
75
|
end
|
62
76
|
end
|
@@ -4,12 +4,27 @@ module Awspec::Helper
|
|
4
4
|
module Finder
|
5
5
|
module VpcEndpoints
|
6
6
|
def find_vpc_endpoint(id)
|
7
|
-
res = ec2_client.describe_vpc_endpoints({
|
7
|
+
res = ec2_client.describe_vpc_endpoints({
|
8
|
+
filters: [{ name: 'vpc-endpoint-id', values: [id] }]
|
9
|
+
})
|
8
10
|
|
9
11
|
ret = res.vpc_endpoints.select do |vpce|
|
10
12
|
vpce.vpc_endpoint_id == id
|
11
13
|
end
|
12
14
|
|
15
|
+
resource = ret.single_resource(id)
|
16
|
+
return resource if resource
|
17
|
+
|
18
|
+
res = ec2_client.describe_vpc_endpoints({
|
19
|
+
filters: [{ name: 'tag:Name', values: [id] }]
|
20
|
+
})
|
21
|
+
|
22
|
+
ret = res.vpc_endpoints.select do |vpce|
|
23
|
+
vpce.tags.find do |tag|
|
24
|
+
tag.key == 'Name' && tag.value == id
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
13
28
|
ret.single_resource(id)
|
14
29
|
end
|
15
30
|
end
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -10,6 +10,7 @@ require 'awspec/helper/finder/ec2'
|
|
10
10
|
require 'awspec/helper/finder/ecr'
|
11
11
|
require 'awspec/helper/finder/ecs'
|
12
12
|
require 'awspec/helper/finder/efs'
|
13
|
+
require 'awspec/helper/finder/eip'
|
13
14
|
require 'awspec/helper/finder/security_group'
|
14
15
|
require 'awspec/helper/finder/rds'
|
15
16
|
require 'awspec/helper/finder/route53'
|
@@ -53,6 +54,7 @@ require 'awspec/helper/finder/secretsmanager'
|
|
53
54
|
require 'awspec/helper/finder/cognito_user_pool'
|
54
55
|
require 'awspec/helper/finder/msk'
|
55
56
|
require 'awspec/helper/finder/cognito_identity_pool'
|
57
|
+
require 'awspec/helper/finder/transfer'
|
56
58
|
|
57
59
|
require 'awspec/helper/finder/account_attributes'
|
58
60
|
|
@@ -69,6 +71,7 @@ module Awspec::Helper
|
|
69
71
|
include Awspec::Helper::Finder::Ecr
|
70
72
|
include Awspec::Helper::Finder::Ecs
|
71
73
|
include Awspec::Helper::Finder::Efs
|
74
|
+
include Awspec::Helper::Finder::Eip
|
72
75
|
include Awspec::Helper::Finder::Firehose
|
73
76
|
include Awspec::Helper::Finder::SecurityGroup
|
74
77
|
include Awspec::Helper::Finder::Rds
|
@@ -113,6 +116,7 @@ module Awspec::Helper
|
|
113
116
|
include Awspec::Helper::Finder::CognitoUserPool
|
114
117
|
include Awspec::Helper::Finder::Msk
|
115
118
|
include Awspec::Helper::Finder::CognitoIdentityPool
|
119
|
+
include Awspec::Helper::Finder::Transfer
|
116
120
|
|
117
121
|
CLIENTS = {
|
118
122
|
ec2_client: Aws::EC2::Client,
|
@@ -160,7 +164,8 @@ module Awspec::Helper
|
|
160
164
|
secretsmanager_client: Aws::SecretsManager::Client,
|
161
165
|
msk_client: Aws::Kafka::Client,
|
162
166
|
cognito_identity_client: Aws::CognitoIdentity::Client,
|
163
|
-
cognito_identity_provider_client: Aws::CognitoIdentityProvider::Client
|
167
|
+
cognito_identity_provider_client: Aws::CognitoIdentityProvider::Client,
|
168
|
+
transfer_client: Aws::Transfer::Client
|
164
169
|
}
|
165
170
|
|
166
171
|
CLIENT_OPTIONS = {
|
data/lib/awspec/helper/type.rb
CHANGED
@@ -17,12 +17,13 @@ module Awspec
|
|
17
17
|
efs eks eks_nodegroup elasticache elasticache_cache_parameter_group elasticsearch elb emr firehose iam_group
|
18
18
|
iam_policy iam_role iam_user kinesis kms lambda launch_configuration launch_template mq nat_gateway
|
19
19
|
network_acl network_interface nlb nlb_listener nlb_target_group
|
20
|
-
rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
|
20
|
+
rds rds_proxy rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
|
21
21
|
route_table s3_bucket security_group ses_identity subnet vpc cloudfront_distribution
|
22
22
|
elastictranscoder_pipeline waf_web_acl wafregional_web_acl customer_gateway vpn_gateway vpn_connection
|
23
23
|
internet_gateway acm cloudwatch_logs dynamodb_table eip sqs ssm_parameter cloudformation_stack
|
24
24
|
codebuild sns_topic redshift redshift_cluster_parameter_group codedeploy codedeploy_deployment_group
|
25
25
|
secretsmanager msk transit_gateway cognito_identity_pool cognito_user_pool vpc_endpoints
|
26
|
+
transfer_server
|
26
27
|
]
|
27
28
|
|
28
29
|
ACCOUNT_ATTRIBUTES = %w[
|
@@ -32,5 +32,22 @@ RSpec::Matchers.define :belong_to_subnet do |subnet_id|
|
|
32
32
|
|
33
33
|
return ret[:subnet_availability_zone][:name] == type.availability_zone if ret
|
34
34
|
end
|
35
|
+
|
36
|
+
# RDS Proxy
|
37
|
+
if type.instance_of?(Awspec::Type::RdsProxy)
|
38
|
+
subnet_ids = type.resource_via_client[:vpc_subnet_ids]
|
39
|
+
return true if subnet_ids.include?(subnet_id)
|
40
|
+
|
41
|
+
res = type.ec2_client.describe_subnets({
|
42
|
+
filters: [{ name: 'tag:Name', values: [subnet_id] }]
|
43
|
+
})
|
44
|
+
return false unless res
|
45
|
+
|
46
|
+
ret = subnet_ids.find do |s|
|
47
|
+
s == res[:subnets][0][:subnet_id]
|
48
|
+
end
|
49
|
+
|
50
|
+
return ret ? true : false
|
51
|
+
end
|
35
52
|
end
|
36
53
|
end
|
data/lib/awspec/stub/eip.rb
CHANGED
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:rds] = {
|
4
|
+
stub_responses: {
|
5
|
+
describe_db_proxies: {
|
6
|
+
db_proxies: [
|
7
|
+
{
|
8
|
+
db_proxy_name: 'my-rds-proxy',
|
9
|
+
db_proxy_arn: 'arn:aws:rds:ap-northeast-1:123456789012:db-proxy:my-rds-proxy',
|
10
|
+
status: 'available',
|
11
|
+
engine_family: 'MYSQL',
|
12
|
+
vpc_id: 'vpc-ab123cde',
|
13
|
+
vpc_security_group_ids: [
|
14
|
+
'sg-5a6b7cd8'
|
15
|
+
],
|
16
|
+
vpc_subnet_ids: [
|
17
|
+
'subnet-8901b123'
|
18
|
+
],
|
19
|
+
auth: [
|
20
|
+
{
|
21
|
+
description: nil,
|
22
|
+
user_name: nil,
|
23
|
+
auth_scheme: 'SECRETS',
|
24
|
+
secret_arn: 'arn:aws:secretsmanager:ap-northeast-1:123456789012:secret:mysql-FShJ8c',
|
25
|
+
iam_auth: 'DISABLED'
|
26
|
+
}
|
27
|
+
],
|
28
|
+
role_arn: 'arn:aws:iam::123456789012:role/service-role/rds-proxy-role-123456789012',
|
29
|
+
endpoint: 'rds-proxy.proxy-abcdefghij12.ap-northeast-1.rds.amazonaws.com',
|
30
|
+
require_tls: true,
|
31
|
+
idle_client_timeout: 5400,
|
32
|
+
debug_logging: false,
|
33
|
+
created_date: Time.local(2022),
|
34
|
+
updated_date: Time.local(2022)
|
35
|
+
}
|
36
|
+
],
|
37
|
+
marker: nil
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
Aws.config[:ec2] = {
|
43
|
+
stub_responses: {
|
44
|
+
describe_vpcs: {
|
45
|
+
vpcs: [
|
46
|
+
{
|
47
|
+
vpc_id: 'vpc-ab123cde',
|
48
|
+
tags: [
|
49
|
+
{
|
50
|
+
key: 'Name',
|
51
|
+
value: 'my-vpc'
|
52
|
+
}
|
53
|
+
]
|
54
|
+
}
|
55
|
+
]
|
56
|
+
},
|
57
|
+
describe_security_groups: {
|
58
|
+
security_groups: [
|
59
|
+
{
|
60
|
+
group_id: 'sg-5a6b7cd8',
|
61
|
+
group_name: 'group-name-sg',
|
62
|
+
tags: [
|
63
|
+
{
|
64
|
+
key: 'Name',
|
65
|
+
value: 'my-db-sg'
|
66
|
+
}
|
67
|
+
]
|
68
|
+
}
|
69
|
+
]
|
70
|
+
},
|
71
|
+
describe_subnets: {
|
72
|
+
subnets: [
|
73
|
+
{
|
74
|
+
subnet_id: 'subnet-8901b123',
|
75
|
+
tags: [
|
76
|
+
{
|
77
|
+
key: 'Name',
|
78
|
+
value: 'db-subnet-a'
|
79
|
+
}
|
80
|
+
]
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:transfer] = {
|
4
|
+
stub_responses: {
|
5
|
+
describe_server: {
|
6
|
+
server: Aws::Transfer::Types::DescribedServer.new(
|
7
|
+
arn: 'arn:aws:transfer:us-east-1:1234567890:server/s-4dc0a424f0154fa89',
|
8
|
+
domain: 'S3',
|
9
|
+
endpoint_details: Aws::Transfer::Types::EndpointDetails.new(
|
10
|
+
address_allocation_ids: %w[
|
11
|
+
eipalloc-00000000000000001
|
12
|
+
eipalloc-00000000000000002
|
13
|
+
eipalloc-00000000000000003
|
14
|
+
],
|
15
|
+
subnet_ids: %w[
|
16
|
+
subnet-0000000000000000a
|
17
|
+
subnet-0000000000000000b
|
18
|
+
subnet-0000000000000000c
|
19
|
+
],
|
20
|
+
vpc_endpoint_id: 'vpce-00000000000000001',
|
21
|
+
vpc_id: 'vpc-0123456789abcdefg'
|
22
|
+
),
|
23
|
+
endpoint_type: 'VPC',
|
24
|
+
host_key_fingerprint: 'SHA256:0pj2UnuoFAKEfHrCZwfPwuFinG3RJEVir/m8bPRINTo=',
|
25
|
+
identity_provider_type: 'SERVICE_MANAGED',
|
26
|
+
logging_role: 'arn:aws:iam::1234567890:role/service-role/AWSTransferLoggingAccess',
|
27
|
+
protocols: ['SFTP'],
|
28
|
+
security_policy_name: 'TransferSecurityPolicy-2018-11',
|
29
|
+
server_id: 's-4dc0a424f0154fa89',
|
30
|
+
state: 'ONLINE',
|
31
|
+
tags: [
|
32
|
+
Aws::Transfer::Types::Tag.new(
|
33
|
+
key: 'env',
|
34
|
+
value: 'dev'
|
35
|
+
)
|
36
|
+
],
|
37
|
+
user_count: 13
|
38
|
+
)
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
data/lib/awspec/type/eip.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class RdsProxy < ResourceBase
|
5
|
+
aws_resource Aws::RDS::Types::DBProxy
|
6
|
+
|
7
|
+
def resource_via_client
|
8
|
+
@resource_via_client ||= find_rds_proxy(@display_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
def id
|
12
|
+
@id ||= resource_via_client.db_proxy_name if resource_via_client
|
13
|
+
end
|
14
|
+
|
15
|
+
STATES = %w[
|
16
|
+
available creating deleting incompatible-network
|
17
|
+
insufficient-resource-limits modifying reactivating
|
18
|
+
suspended suspending
|
19
|
+
]
|
20
|
+
|
21
|
+
STATES.each do |state|
|
22
|
+
define_method "#{state.tr('-', '_')}?" do
|
23
|
+
resource_via_client.status == state
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def vpc_id
|
28
|
+
resource_via_client.vpc_id
|
29
|
+
end
|
30
|
+
|
31
|
+
def has_security_group?(sg_id)
|
32
|
+
return true if has_vpc_security_group_id?(sg_id)
|
33
|
+
return true if has_vpc_security_group_name?(sg_id)
|
34
|
+
return true if has_vpc_security_group_tag_name?(sg_id)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def has_vpc_security_group_id?(sg_id)
|
40
|
+
resource_via_client.vpc_security_group_ids.include?(sg_id)
|
41
|
+
end
|
42
|
+
|
43
|
+
def has_vpc_security_group_name?(sg_id)
|
44
|
+
sgs = resource_via_client.vpc_security_group_ids
|
45
|
+
res = ec2_client.describe_security_groups({
|
46
|
+
filters: [{ name: 'group-name', values: [sg_id] }]
|
47
|
+
})
|
48
|
+
return false unless res.security_groups.count == 1
|
49
|
+
|
50
|
+
sgs.find do |sg|
|
51
|
+
sg == res.security_groups.first.group_id
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def has_vpc_security_group_tag_name?(sg_id)
|
56
|
+
sgs = resource_via_client.vpc_security_group_ids
|
57
|
+
res = ec2_client.describe_security_groups({
|
58
|
+
filters: [{ name: 'tag:Name', values: [sg_id] }]
|
59
|
+
})
|
60
|
+
return false unless res.security_groups.count == 1
|
61
|
+
|
62
|
+
sgs.find do |sg|
|
63
|
+
sg == res.security_groups.first.group_id
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class TransferServer < ResourceBase
|
5
|
+
attr_reader :id
|
6
|
+
|
7
|
+
tags_allowed
|
8
|
+
|
9
|
+
def initialize(id)
|
10
|
+
super
|
11
|
+
@id = id
|
12
|
+
end
|
13
|
+
|
14
|
+
def resource_via_client
|
15
|
+
@resource_via_client ||= find_transfer_server(@id)
|
16
|
+
end
|
17
|
+
|
18
|
+
STATES = %w[
|
19
|
+
OFFLINE ONLINE STARTING STOPPING START_FAILED STOP_FAILED
|
20
|
+
]
|
21
|
+
|
22
|
+
STATES.each do |state|
|
23
|
+
define_method "#{state.downcase.tr('-', '_')}?" do
|
24
|
+
resource_via_client.state == state
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -27,6 +27,11 @@ module Awspec::Type
|
|
27
27
|
def has_route_table?(route_table_id)
|
28
28
|
rts = resource_via_client.route_table_ids
|
29
29
|
|
30
|
+
ret = find_route_table(route_table_id)
|
31
|
+
if ret && rts.include?(ret.route_table_id)
|
32
|
+
return true
|
33
|
+
end
|
34
|
+
|
30
35
|
ret = rts.find do |rt|
|
31
36
|
rt == route_table_id
|
32
37
|
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.27.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -170,6 +170,20 @@ dependencies:
|
|
170
170
|
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: parallel
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
173
187
|
- !ruby/object:Gem::Dependency
|
174
188
|
name: pry
|
175
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -297,6 +311,7 @@ files:
|
|
297
311
|
- doc/_resource_types/rds_account_attributes.md
|
298
312
|
- doc/_resource_types/rds_db_cluster_parameter_group.md
|
299
313
|
- doc/_resource_types/rds_db_parameter_group.md
|
314
|
+
- doc/_resource_types/rds_proxy.md
|
300
315
|
- doc/_resource_types/redshift.md
|
301
316
|
- doc/_resource_types/redshift_cluster_parameter_group.md
|
302
317
|
- doc/_resource_types/route53_hosted_zone.md
|
@@ -310,6 +325,7 @@ files:
|
|
310
325
|
- doc/_resource_types/sqs.md
|
311
326
|
- doc/_resource_types/ssm_parameter.md
|
312
327
|
- doc/_resource_types/subnet.md
|
328
|
+
- doc/_resource_types/transfer_server.md
|
313
329
|
- doc/_resource_types/transit_gateway.md
|
314
330
|
- doc/_resource_types/vpc.md
|
315
331
|
- doc/_resource_types/vpc_endpoints.md
|
@@ -402,6 +418,7 @@ files:
|
|
402
418
|
- lib/awspec/generator/doc/type/rds_account_attributes.rb
|
403
419
|
- lib/awspec/generator/doc/type/rds_db_cluster_parameter_group.rb
|
404
420
|
- lib/awspec/generator/doc/type/rds_db_parameter_group.rb
|
421
|
+
- lib/awspec/generator/doc/type/rds_proxy.rb
|
405
422
|
- lib/awspec/generator/doc/type/redshift.rb
|
406
423
|
- lib/awspec/generator/doc/type/redshift_cluster_parameter_group.rb
|
407
424
|
- lib/awspec/generator/doc/type/route53_hosted_zone.rb
|
@@ -415,6 +432,7 @@ files:
|
|
415
432
|
- lib/awspec/generator/doc/type/sqs.rb
|
416
433
|
- lib/awspec/generator/doc/type/ssm_parameter.rb
|
417
434
|
- lib/awspec/generator/doc/type/subnet.rb
|
435
|
+
- lib/awspec/generator/doc/type/transfer_server.rb
|
418
436
|
- lib/awspec/generator/doc/type/transit_gateway.rb
|
419
437
|
- lib/awspec/generator/doc/type/vpc.rb
|
420
438
|
- lib/awspec/generator/doc/type/vpc_endpoints.rb
|
@@ -453,6 +471,7 @@ files:
|
|
453
471
|
- lib/awspec/generator/spec/rds.rb
|
454
472
|
- lib/awspec/generator/spec/rds_db_cluster_parameter_group.rb
|
455
473
|
- lib/awspec/generator/spec/rds_db_parameter_group.rb
|
474
|
+
- lib/awspec/generator/spec/rds_proxy.rb
|
456
475
|
- lib/awspec/generator/spec/redshift.rb
|
457
476
|
- lib/awspec/generator/spec/redshift_cluster_parameter_group.rb
|
458
477
|
- lib/awspec/generator/spec/route53_hosted_zone.rb
|
@@ -490,6 +509,7 @@ files:
|
|
490
509
|
- lib/awspec/helper/finder/ecr.rb
|
491
510
|
- lib/awspec/helper/finder/ecs.rb
|
492
511
|
- lib/awspec/helper/finder/efs.rb
|
512
|
+
- lib/awspec/helper/finder/eip.rb
|
493
513
|
- lib/awspec/helper/finder/eks.rb
|
494
514
|
- lib/awspec/helper/finder/elasticache.rb
|
495
515
|
- lib/awspec/helper/finder/elasticsearch.rb
|
@@ -515,6 +535,7 @@ files:
|
|
515
535
|
- lib/awspec/helper/finder/sqs.rb
|
516
536
|
- lib/awspec/helper/finder/ssm_parameter.rb
|
517
537
|
- lib/awspec/helper/finder/subnet.rb
|
538
|
+
- lib/awspec/helper/finder/transfer.rb
|
518
539
|
- lib/awspec/helper/finder/vpc.rb
|
519
540
|
- lib/awspec/helper/finder/vpc_endpoints.rb
|
520
541
|
- lib/awspec/helper/finder/waf.rb
|
@@ -636,6 +657,7 @@ files:
|
|
636
657
|
- lib/awspec/stub/rds.rb
|
637
658
|
- lib/awspec/stub/rds_db_cluster_parameter_group.rb
|
638
659
|
- lib/awspec/stub/rds_db_parameter_group.rb
|
660
|
+
- lib/awspec/stub/rds_proxy.rb
|
639
661
|
- lib/awspec/stub/redshift.rb
|
640
662
|
- lib/awspec/stub/redshift_cluster_parameter_group.rb
|
641
663
|
- lib/awspec/stub/route53_hosted_zone.rb
|
@@ -649,6 +671,7 @@ files:
|
|
649
671
|
- lib/awspec/stub/sqs.rb
|
650
672
|
- lib/awspec/stub/ssm_parameter.rb
|
651
673
|
- lib/awspec/stub/subnet.rb
|
674
|
+
- lib/awspec/stub/transfer_server.rb
|
652
675
|
- lib/awspec/stub/transit_gateway.rb
|
653
676
|
- lib/awspec/stub/vpc.rb
|
654
677
|
- lib/awspec/stub/vpc_endpoints.rb
|
@@ -727,6 +750,7 @@ files:
|
|
727
750
|
- lib/awspec/type/rds_account_attributes.rb
|
728
751
|
- lib/awspec/type/rds_db_cluster_parameter_group.rb
|
729
752
|
- lib/awspec/type/rds_db_parameter_group.rb
|
753
|
+
- lib/awspec/type/rds_proxy.rb
|
730
754
|
- lib/awspec/type/redshift.rb
|
731
755
|
- lib/awspec/type/redshift_cluster_parameter_group.rb
|
732
756
|
- lib/awspec/type/resource_base.rb
|
@@ -741,6 +765,7 @@ files:
|
|
741
765
|
- lib/awspec/type/sqs.rb
|
742
766
|
- lib/awspec/type/ssm_parameter.rb
|
743
767
|
- lib/awspec/type/subnet.rb
|
768
|
+
- lib/awspec/type/transfer_server.rb
|
744
769
|
- lib/awspec/type/transit_gateway.rb
|
745
770
|
- lib/awspec/type/vpc.rb
|
746
771
|
- lib/awspec/type/vpc_endpoints.rb
|