awspec 1.18.6 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/awspec.gemspec +1 -0
- data/doc/_resource_types/cognito_identity_pool.md +7 -0
- data/doc/_resource_types/cognito_user_pool.md +7 -0
- data/doc/_resource_types/msk.md +15 -0
- data/doc/_resource_types/transit_gateway.md +24 -0
- data/doc/resource_types.md +105 -7
- data/lib/awspec/generator/doc/type/cognito_identity_pool.rb +17 -0
- data/lib/awspec/generator/doc/type/cognito_user_pool.rb +17 -0
- data/lib/awspec/generator/doc/type/msk.rb +17 -0
- data/lib/awspec/generator/doc/type/transit_gateway.rb +17 -0
- data/lib/awspec/helper/client_wrap.rb +4 -3
- data/lib/awspec/helper/finder.rb +10 -1
- data/lib/awspec/helper/finder/apigateway.rb +8 -0
- data/lib/awspec/helper/finder/cognito_identity_pool.rb +15 -0
- data/lib/awspec/helper/finder/cognito_user_pool.rb +15 -0
- data/lib/awspec/helper/finder/ec2.rb +10 -1
- data/lib/awspec/helper/finder/msk.rb +15 -0
- data/lib/awspec/helper/type.rb +1 -1
- data/lib/awspec/stub/apigateway.rb +39 -0
- data/lib/awspec/stub/cognito_identity_pool.rb +16 -0
- data/lib/awspec/stub/cognito_user_pool.rb +47 -0
- data/lib/awspec/stub/msk.rb +84 -0
- data/lib/awspec/stub/transit_gateway.rb +52 -0
- data/lib/awspec/type/apigateway.rb +50 -0
- data/lib/awspec/type/cognito_identity_pool.rb +11 -0
- data/lib/awspec/type/cognito_user_pool.rb +11 -0
- data/lib/awspec/type/msk.rb +27 -0
- data/lib/awspec/type/security_group.rb +44 -0
- data/lib/awspec/type/transit_gateway.rb +24 -0
- data/lib/awspec/version.rb +1 -1
- metadata +36 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 411e9900b039017d4cb1ab067c512728105934125b959b89556c35a6c6f33e7b
|
4
|
+
data.tar.gz: df8150172eae082592be40c90e60b1eff367bb372346fc16e65b3ac71b3e9731
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddca46e882fe9e4ee4bae44cc14e624c7d8843615a5334c90ae3b5b83437b58419d27be4d97b4787161613ebd11abaa4e7d3b98585c8fad37df0b53ced71cdd7
|
7
|
+
data.tar.gz: 80d6f1ea03a390f20f4cb8ff67641aa654a77460dfcd53d5f782d9def3862e3d9186cc9cdd67c1cb312a674a3a81cacd84eb939c383e7ae2afa2de59d9f5a635
|
data/awspec.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_runtime_dependency 'rspec-its'
|
30
30
|
spec.add_runtime_dependency 'term-ansicolor'
|
31
31
|
spec.add_runtime_dependency 'thor'
|
32
|
+
spec.add_runtime_dependency 'addressable'
|
32
33
|
spec.add_development_dependency 'bundler', '>= 1.9', '< 3.0'
|
33
34
|
spec.add_development_dependency 'octorelease'
|
34
35
|
spec.add_development_dependency 'pry'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
### exist
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
describe transit_gateway('tgw-1234567890abcdefg') do
|
5
|
+
it { should exist }
|
6
|
+
it { should have_tag('Name').value('my-tgw') }
|
7
|
+
it { should have_attachment('tgw-attach-1234567890abcdefg') }
|
8
|
+
its('options.amazon_side_asn') { should eq 64_516 }
|
9
|
+
its('options.auto_accept_shared_attachments') { should eq 'enable' }
|
10
|
+
its('options.default_route_table_association') { should eq 'enable' }
|
11
|
+
its('options.default_route_table_propagation') { should eq 'enable' }
|
12
|
+
its('options.dns_support') { should eq 'enable' }
|
13
|
+
its('options.vpn_ecmp_support') { should eq 'enable' }
|
14
|
+
its('options.association_default_route_table_id') { should eq 'tgw-rtb-0123456789abcdefg' }
|
15
|
+
its('options.propagation_default_route_table_id') { should eq 'tgw-rtb-0123456789abcdefg' }
|
16
|
+
end
|
17
|
+
```
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
describe transit_gateway('my-tgw') do
|
21
|
+
it { should exist }
|
22
|
+
its(:transit_gateway_id) { should eq 'tgw-1234567890abcdefg' }
|
23
|
+
end
|
24
|
+
```
|
data/doc/resource_types.md
CHANGED
@@ -19,6 +19,8 @@
|
|
19
19
|
| [codebuild](#codebuild)
|
20
20
|
| [codedeploy](#codedeploy)
|
21
21
|
| [codedeploy_deployment_group](#codedeploy_deployment_group)
|
22
|
+
| [cognito_identity_pool](#cognito_identity_pool)
|
23
|
+
| [cognito_user_pool](#cognito_user_pool)
|
22
24
|
| [customer_gateway](#customer_gateway)
|
23
25
|
| [directconnect_virtual_interface](#directconnect_virtual_interface)
|
24
26
|
| [dynamodb_table](#dynamodb_table)
|
@@ -50,6 +52,7 @@
|
|
50
52
|
| [launch_configuration](#launch_configuration)
|
51
53
|
| [launch_template](#launch_template)
|
52
54
|
| [mq](#mq)
|
55
|
+
| [msk](#msk)
|
53
56
|
| [nat_gateway](#nat_gateway)
|
54
57
|
| [network_acl](#network_acl)
|
55
58
|
| [network_interface](#network_interface)
|
@@ -71,6 +74,7 @@
|
|
71
74
|
| [sqs](#sqs)
|
72
75
|
| [ssm_parameter](#ssm_parameter)
|
73
76
|
| [subnet](#subnet)
|
77
|
+
| [transit_gateway](#transit_gateway)
|
74
78
|
| [vpc](#vpc)
|
75
79
|
| [vpn_connection](#vpn_connection)
|
76
80
|
| [vpn_gateway](#vpn_gateway)
|
@@ -198,7 +202,7 @@ describe alb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:li
|
|
198
202
|
end
|
199
203
|
```
|
200
204
|
|
201
|
-
### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy)
|
205
|
+
### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy), its(:alpn_policy)
|
202
206
|
## <a name="alb_target_group">alb_target_group</a>
|
203
207
|
|
204
208
|
AlbTargetGroup resource type.
|
@@ -284,6 +288,14 @@ describe apigateway('my-apigateway') do
|
|
284
288
|
end
|
285
289
|
```
|
286
290
|
|
291
|
+
### have_integration_method
|
292
|
+
|
293
|
+
### have_integration_path
|
294
|
+
|
295
|
+
### have_method
|
296
|
+
|
297
|
+
### have_path
|
298
|
+
|
287
299
|
### its(:id), its(:name), its(:description), its(:created_date), its(:version), its(:warnings), its(:binary_media_types), its(:minimum_compression_size), its(:api_key_source), its(:policy), its(:tags)
|
288
300
|
## <a name="autoscaling_group">autoscaling_group</a>
|
289
301
|
|
@@ -731,6 +743,30 @@ end
|
|
731
743
|
```
|
732
744
|
|
733
745
|
### 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)
|
746
|
+
## <a name="cognito_identity_pool">cognito_identity_pool</a>
|
747
|
+
|
748
|
+
CognitoIdentityPool resource type.
|
749
|
+
|
750
|
+
### exist
|
751
|
+
|
752
|
+
```ruby
|
753
|
+
describe cognito_identity_pool('my-cognito-identity-pool') do
|
754
|
+
it { should exist }
|
755
|
+
end
|
756
|
+
```
|
757
|
+
### its(:identity_pool_id), its(:identity_pool_name)
|
758
|
+
## <a name="cognito_user_pool">cognito_user_pool</a>
|
759
|
+
|
760
|
+
CognitoUserPool resource type.
|
761
|
+
|
762
|
+
### exist
|
763
|
+
|
764
|
+
```ruby
|
765
|
+
describe cognito_user_pool('my-cognito-user-pool') do
|
766
|
+
it { should exist }
|
767
|
+
end
|
768
|
+
```
|
769
|
+
### its(:id), its(:name), its(:status), its(:last_modified_date), its(:creation_date)
|
734
770
|
## <a name="customer_gateway">customer_gateway</a>
|
735
771
|
|
736
772
|
CustomerGateway resource type.
|
@@ -1388,7 +1424,7 @@ describe elasticache('my-rep-group-001') do
|
|
1388
1424
|
end
|
1389
1425
|
```
|
1390
1426
|
|
1391
|
-
### 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(: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)
|
1427
|
+
### 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(: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)
|
1392
1428
|
## <a name="elasticache_cache_parameter_group">elasticache_cache_parameter_group</a>
|
1393
1429
|
|
1394
1430
|
ElasticacheCacheParameterGroup resource type.
|
@@ -1612,7 +1648,7 @@ describe emr('my-emr') do
|
|
1612
1648
|
end
|
1613
1649
|
```
|
1614
1650
|
|
1615
|
-
### its(:id), its(:name), its(:instance_collection_type), its(:log_uri), 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(:
|
1651
|
+
### 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)
|
1616
1652
|
## <a name="firehose">firehose</a>
|
1617
1653
|
|
1618
1654
|
Firehose resource type.
|
@@ -2174,7 +2210,7 @@ end
|
|
2174
2210
|
|
2175
2211
|
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)).
|
2176
2212
|
|
2177
|
-
### 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)
|
2213
|
+
### 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)
|
2178
2214
|
## <a name="launch_configuration">launch_configuration</a>
|
2179
2215
|
|
2180
2216
|
LaunchConfiguration resource type.
|
@@ -2297,6 +2333,30 @@ end
|
|
2297
2333
|
```
|
2298
2334
|
|
2299
2335
|
### its(:vpc_id), 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(:pending_engine_version), its(:pending_host_instance_type), its(:pending_security_groups), its(:publicly_accessible), its(:security_groups), its(:storage_type), its(:subnet_ids)
|
2336
|
+
## <a name="msk">msk</a>
|
2337
|
+
|
2338
|
+
Msk resource type.
|
2339
|
+
|
2340
|
+
### exist
|
2341
|
+
|
2342
|
+
```ruby
|
2343
|
+
describe msk('my-msk') do
|
2344
|
+
it { should exist }
|
2345
|
+
end
|
2346
|
+
```
|
2347
|
+
|
2348
|
+
|
2349
|
+
### be_active
|
2350
|
+
|
2351
|
+
### be_creating
|
2352
|
+
|
2353
|
+
### be_deleting
|
2354
|
+
|
2355
|
+
### be_failed
|
2356
|
+
|
2357
|
+
### be_updating
|
2358
|
+
|
2359
|
+
### its(:active_operation_arn), its(:client_authentication), its(:cluster_arn), its(:cluster_name), its(:creation_time), its(:current_version), its(:enhanced_monitoring), its(:number_of_broker_nodes), its(:state), its(:zookeeper_connect_string)
|
2300
2360
|
## <a name="nat_gateway">nat_gateway</a>
|
2301
2361
|
|
2302
2362
|
NatGateway resource type.
|
@@ -2583,7 +2643,7 @@ describe nlb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:li
|
|
2583
2643
|
end
|
2584
2644
|
```
|
2585
2645
|
|
2586
|
-
### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy)
|
2646
|
+
### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy), its(:alpn_policy)
|
2587
2647
|
## <a name="nlb_target_group">nlb_target_group</a>
|
2588
2648
|
|
2589
2649
|
NlbTargetGroup resource type.
|
@@ -3192,6 +3252,10 @@ end
|
|
3192
3252
|
|
3193
3253
|
### be_outbound_opened_only
|
3194
3254
|
|
3255
|
+
### have_inbound_rule
|
3256
|
+
|
3257
|
+
### have_outbound_rule
|
3258
|
+
|
3195
3259
|
### have_tag
|
3196
3260
|
|
3197
3261
|
```ruby
|
@@ -3381,7 +3445,7 @@ end
|
|
3381
3445
|
```
|
3382
3446
|
|
3383
3447
|
|
3384
|
-
### its(:name), its(:type), its(:key_id), its(:last_modified_date), its(:last_modified_user), its(:description), its(:allowed_pattern), its(:version), its(:tier), its(:policies)
|
3448
|
+
### its(:name), its(:type), its(:key_id), its(:last_modified_date), its(:last_modified_user), its(:description), its(:allowed_pattern), its(:version), its(:tier), its(:policies), its(:data_type)
|
3385
3449
|
### :unlock: Advanced use
|
3386
3450
|
|
3387
3451
|
```ruby
|
@@ -3425,7 +3489,7 @@ end
|
|
3425
3489
|
```
|
3426
3490
|
|
3427
3491
|
|
3428
|
-
### its(:availability_zone), its(:availability_zone_id), its(:available_ip_address_count), its(:cidr_block), its(:default_for_az), its(:map_public_ip_on_launch), its(:state), its(:subnet_id), its(:vpc_id), its(:owner_id), its(:assign_ipv_6_address_on_creation), its(:ipv_6_cidr_block_association_set), its(:subnet_arn), its(:outpost_arn)
|
3492
|
+
### its(:availability_zone), its(:availability_zone_id), its(:available_ip_address_count), its(:cidr_block), its(:default_for_az), its(:map_public_ip_on_launch), its(:map_customer_owned_ip_on_launch), its(:customer_owned_ipv_4_pool), its(:state), its(:subnet_id), its(:vpc_id), its(:owner_id), its(:assign_ipv_6_address_on_creation), its(:ipv_6_cidr_block_association_set), its(:subnet_arn), its(:outpost_arn)
|
3429
3493
|
### :unlock: Advanced use
|
3430
3494
|
|
3431
3495
|
`subnet` can use `Aws::EC2::Subnet` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Subnet.html).
|
@@ -3444,6 +3508,40 @@ describe subnet('my-subnet') do
|
|
3444
3508
|
end
|
3445
3509
|
```
|
3446
3510
|
|
3511
|
+
## <a name="transit_gateway">transit_gateway</a>
|
3512
|
+
|
3513
|
+
TransitGateway resource type.
|
3514
|
+
|
3515
|
+
### exist
|
3516
|
+
|
3517
|
+
```ruby
|
3518
|
+
describe transit_gateway('tgw-1234567890abcdefg') do
|
3519
|
+
it { should exist }
|
3520
|
+
it { should have_tag('Name').value('my-tgw') }
|
3521
|
+
it { should have_attachment('tgw-attach-1234567890abcdefg') }
|
3522
|
+
its('options.amazon_side_asn') { should eq 64_516 }
|
3523
|
+
its('options.auto_accept_shared_attachments') { should eq 'enable' }
|
3524
|
+
its('options.default_route_table_association') { should eq 'enable' }
|
3525
|
+
its('options.default_route_table_propagation') { should eq 'enable' }
|
3526
|
+
its('options.dns_support') { should eq 'enable' }
|
3527
|
+
its('options.vpn_ecmp_support') { should eq 'enable' }
|
3528
|
+
its('options.association_default_route_table_id') { should eq 'tgw-rtb-0123456789abcdefg' }
|
3529
|
+
its('options.propagation_default_route_table_id') { should eq 'tgw-rtb-0123456789abcdefg' }
|
3530
|
+
end
|
3531
|
+
```
|
3532
|
+
|
3533
|
+
```ruby
|
3534
|
+
describe transit_gateway('my-tgw') do
|
3535
|
+
it { should exist }
|
3536
|
+
its(:transit_gateway_id) { should eq 'tgw-1234567890abcdefg' }
|
3537
|
+
end
|
3538
|
+
```
|
3539
|
+
|
3540
|
+
### have_attachment
|
3541
|
+
|
3542
|
+
### have_tag
|
3543
|
+
|
3544
|
+
### its(:transit_gateway_id), its(:transit_gateway_arn), its(:state), its(:owner_id), its(:description), its(:creation_time)
|
3447
3545
|
## <a name="vpc">vpc</a>
|
3448
3546
|
|
3449
3547
|
VPC resource type.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Awspec::Generator
|
2
|
+
module Doc
|
3
|
+
module Type
|
4
|
+
class CognitoIdentityPool < Base
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
@type_name = 'CognitoIdentityPool'
|
8
|
+
@type = Awspec::Type::CognitoIdentityPool.new('my-cognito-identity-pool')
|
9
|
+
@ret = @type.resource_via_client
|
10
|
+
@matchers = []
|
11
|
+
@ignore_matchers = []
|
12
|
+
@describes = []
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Awspec::Generator
|
2
|
+
module Doc
|
3
|
+
module Type
|
4
|
+
class CognitoUserPool < Base
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
@type_name = 'CognitoUserPool'
|
8
|
+
@type = Awspec::Type::CognitoUserPool.new('my-cognito-user-pool')
|
9
|
+
@ret = @type.resource_via_client
|
10
|
+
@matchers = []
|
11
|
+
@ignore_matchers = []
|
12
|
+
@describes = []
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Awspec::Generator
|
2
|
+
module Doc
|
3
|
+
module Type
|
4
|
+
class Msk < Base
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
@type_name = 'Msk'
|
8
|
+
@type = Awspec::Type::Msk.new('my-msk')
|
9
|
+
@ret = @type.resource_via_client
|
10
|
+
@matchers = []
|
11
|
+
@ignore_matchers = []
|
12
|
+
@describes = []
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Awspec::Generator
|
2
|
+
module Doc
|
3
|
+
module Type
|
4
|
+
class TransitGateway < Base
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
@type_name = 'TransitGateway'
|
8
|
+
@type = Awspec::Type::TransitGateway.new('my-transit-gateway')
|
9
|
+
@ret = @type.resource_via_client
|
10
|
+
@matchers = []
|
11
|
+
@ignore_matchers = []
|
12
|
+
@describes = []
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -2,7 +2,7 @@ require 'awspec/config'
|
|
2
2
|
|
3
3
|
module Awspec::Helper
|
4
4
|
class ClientWrap
|
5
|
-
attr_reader :client, :backoff, :iteration, :backoff_limit, :
|
5
|
+
attr_reader :client, :backoff, :iteration, :backoff_limit, :symbol1, :symbol2
|
6
6
|
def initialize(real_client = nil)
|
7
7
|
raise ArgumentError, 'Client can not be nil' if real_client.nil?
|
8
8
|
config = Awspec::Config.instance
|
@@ -14,7 +14,8 @@ module Awspec::Helper
|
|
14
14
|
@backoff_limit = config[:client_backoff_limit]
|
15
15
|
# build the symbol we'll use to compare to any errors caught in method_missing
|
16
16
|
# below.
|
17
|
-
@
|
17
|
+
@symbol1 = real_client.class.to_s.split('::').shift(2).push('Errors', 'RequestLimitExceeded').join('::').to_sym
|
18
|
+
@symbol2 = real_client.class.to_s.split('::').shift(2).push('Errors', 'Throttling').join('::').to_sym
|
18
19
|
end
|
19
20
|
|
20
21
|
protected
|
@@ -28,7 +29,7 @@ module Awspec::Helper
|
|
28
29
|
begin
|
29
30
|
results = client.send(m, *args, &block)
|
30
31
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
31
|
-
raise unless e.class.to_s ==
|
32
|
+
raise unless (e.class.to_s == symbol1.to_s || e.class.to_s == symbol2.to_s) && backoff < backoff_limit
|
32
33
|
|
33
34
|
@backoff = backoff + (iteration * iteration * 0.5)
|
34
35
|
@iteration += 1
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -47,6 +47,9 @@ require 'awspec/helper/finder/redshift'
|
|
47
47
|
require 'awspec/helper/finder/codedeploy'
|
48
48
|
require 'awspec/helper/finder/mq'
|
49
49
|
require 'awspec/helper/finder/secretsmanager'
|
50
|
+
require 'awspec/helper/finder/cognito_user_pool'
|
51
|
+
require 'awspec/helper/finder/msk'
|
52
|
+
require 'awspec/helper/finder/cognito_identity_pool'
|
50
53
|
|
51
54
|
require 'awspec/helper/finder/account_attributes'
|
52
55
|
|
@@ -103,6 +106,9 @@ module Awspec::Helper
|
|
103
106
|
include Awspec::Helper::Finder::Codedeploy
|
104
107
|
include Awspec::Helper::Finder::Mq
|
105
108
|
include Awspec::Helper::Finder::Secretsmanager
|
109
|
+
include Awspec::Helper::Finder::CognitoUserPool
|
110
|
+
include Awspec::Helper::Finder::Msk
|
111
|
+
include Awspec::Helper::Finder::CognitoIdentityPool
|
106
112
|
|
107
113
|
CLIENTS = {
|
108
114
|
ec2_client: Aws::EC2::Client,
|
@@ -147,7 +153,10 @@ module Awspec::Helper
|
|
147
153
|
redshift_client: Aws::Redshift::Client,
|
148
154
|
codedeploy_client: Aws::CodeDeploy::Client,
|
149
155
|
mq_client: Aws::MQ::Client,
|
150
|
-
secretsmanager_client: Aws::SecretsManager::Client
|
156
|
+
secretsmanager_client: Aws::SecretsManager::Client,
|
157
|
+
msk_client: Aws::Kafka::Client,
|
158
|
+
cognito_identity_client: Aws::CognitoIdentity::Client,
|
159
|
+
cognito_identity_provider_client: Aws::CognitoIdentityProvider::Client
|
151
160
|
}
|
152
161
|
|
153
162
|
CLIENT_OPTIONS = {
|
@@ -22,6 +22,14 @@ module Awspec::Helper
|
|
22
22
|
end
|
23
23
|
nil
|
24
24
|
end
|
25
|
+
|
26
|
+
def find_api_resources_by_id(api_id)
|
27
|
+
all_resources = []
|
28
|
+
apigateway_client.get_resources(rest_api_id: api_id, limit: 500, embed: ['methods']).each do |response|
|
29
|
+
all_resources += response.items
|
30
|
+
end
|
31
|
+
all_resources != [] ? all_resources : nil
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Awspec::Helper
|
2
|
+
module Finder
|
3
|
+
module CognitoIdentityPool
|
4
|
+
def find_identitypool_by_name(pool_name)
|
5
|
+
cognito_identity_client.list_identity_pools(max_results: 60).each do |response|
|
6
|
+
pools = response.identity_pools
|
7
|
+
pools.each do |pool|
|
8
|
+
return pool if pool.identity_pool_name == pool_name
|
9
|
+
end
|
10
|
+
end
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Awspec::Helper
|
2
|
+
module Finder
|
3
|
+
module CognitoUserPool
|
4
|
+
def find_userpool_by_name(pool_name)
|
5
|
+
cognito_identity_provider_client.list_user_pools(max_results: 60).each do |response|
|
6
|
+
pools = response.user_pools
|
7
|
+
pools.each do |pool|
|
8
|
+
return pool if pool.name == pool_name
|
9
|
+
end
|
10
|
+
end
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -43,7 +43,7 @@ module Awspec::Helper
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# find_internet_gateway find_vpn_gateway find_customer_gateway
|
46
|
-
gateway_types = %w(internet vpn customer)
|
46
|
+
gateway_types = %w(internet vpn customer transit)
|
47
47
|
gateway_types.each do |type|
|
48
48
|
define_method 'find_' + type + '_gateway' do |*args|
|
49
49
|
gateway_id = args.first
|
@@ -198,6 +198,15 @@ module Awspec::Helper
|
|
198
198
|
launch_template_name: id
|
199
199
|
})
|
200
200
|
end
|
201
|
+
|
202
|
+
def find_tgw_attachments_by_tgw_id(tgw_id)
|
203
|
+
res = ec2_client.describe_transit_gateway_attachments({
|
204
|
+
filters: [
|
205
|
+
{ name: 'transit-gateway-id', values: [tgw_id] }
|
206
|
+
]
|
207
|
+
})
|
208
|
+
res.transit_gateway_attachments
|
209
|
+
end
|
201
210
|
end
|
202
211
|
end
|
203
212
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Awspec::Helper
|
2
|
+
module Finder
|
3
|
+
module Msk
|
4
|
+
def find_msk_cluster_by_name(cluster_name)
|
5
|
+
res = msk_client.list_clusters(
|
6
|
+
{
|
7
|
+
cluster_name_filter: cluster_name,
|
8
|
+
max_results: 1
|
9
|
+
}
|
10
|
+
)
|
11
|
+
res.cluster_info_list[0]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/awspec/helper/type.rb
CHANGED
@@ -20,7 +20,7 @@ module Awspec
|
|
20
20
|
elastictranscoder_pipeline waf_web_acl wafregional_web_acl customer_gateway vpn_gateway vpn_connection
|
21
21
|
internet_gateway acm cloudwatch_logs dynamodb_table eip sqs ssm_parameter cloudformation_stack
|
22
22
|
codebuild sns_topic redshift redshift_cluster_parameter_group codedeploy codedeploy_deployment_group
|
23
|
-
secretsmanager
|
23
|
+
secretsmanager msk transit_gateway cognito_identity_pool cognito_user_pool
|
24
24
|
)
|
25
25
|
|
26
26
|
ACCOUNT_ATTRIBUTES = %w(
|
@@ -70,6 +70,45 @@ Aws.config[:apigateway] = {
|
|
70
70
|
}
|
71
71
|
}
|
72
72
|
]
|
73
|
+
},
|
74
|
+
get_resources: {
|
75
|
+
position: '1',
|
76
|
+
items: [
|
77
|
+
{
|
78
|
+
path: '/proxy',
|
79
|
+
resource_methods: {
|
80
|
+
'GET' => {
|
81
|
+
http_method: 'GET',
|
82
|
+
method_integration: { http_method: 'POST', uri: 'http://127.0.0.1:8080/hockey' }
|
83
|
+
}
|
84
|
+
}
|
85
|
+
},
|
86
|
+
{
|
87
|
+
path: '/zambonis',
|
88
|
+
resource_methods: {
|
89
|
+
'POST' => {
|
90
|
+
http_method: 'POST',
|
91
|
+
method_integration: { http_method: 'POST',
|
92
|
+
uri: 'http://127.0.0.1:8080/zambonis/{arena}?arena=Saddledome' }
|
93
|
+
}
|
94
|
+
}
|
95
|
+
},
|
96
|
+
{
|
97
|
+
path: '/zambonis/123',
|
98
|
+
resource_methods: {
|
99
|
+
'POST' => {
|
100
|
+
http_method: 'POST',
|
101
|
+
method_integration: { http_method: 'AWS',
|
102
|
+
uri: 'arn:aws:apigateway:us-east-1:cognito-idp:action/ListUsers' }
|
103
|
+
},
|
104
|
+
'GET' => {
|
105
|
+
http_method: 'GET',
|
106
|
+
method_integration: { http_method: 'AWS',
|
107
|
+
uri: 'arn:aws:apigateway:us-east-1:cognito-idp:action/SignUp?username=test' }
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
]
|
73
112
|
}
|
74
113
|
}
|
75
114
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Aws.config[:cognitoidentity] = {
|
2
|
+
stub_responses: {
|
3
|
+
list_identity_pools: {
|
4
|
+
identity_pools: [
|
5
|
+
{
|
6
|
+
identity_pool_id: 'us-east-1:adsfkjaekljnfg234',
|
7
|
+
identity_pool_name: 'my-cognito-identity-pool'
|
8
|
+
},
|
9
|
+
{
|
10
|
+
identity_pool_id: 'us-east-1:gfdksjg87sfna943knbj',
|
11
|
+
identity_pool_name: 'My_Identity_Pool'
|
12
|
+
}
|
13
|
+
], next_token: 'akvjnkjndgoierhteuh7sfdnre9erglkwnroijsdfinewr=='
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Aws.config[:cognitoidentityprovider] = {
|
2
|
+
stub_responses: {
|
3
|
+
list_user_pools: {
|
4
|
+
user_pools: [
|
5
|
+
{
|
6
|
+
id: 'us-east-1_6adfkj4ju',
|
7
|
+
name: 'my-cognito-user-pool',
|
8
|
+
lambda_config: {
|
9
|
+
pre_sign_up: nil,
|
10
|
+
custom_message: nil,
|
11
|
+
post_confirmation: nil,
|
12
|
+
pre_authentication: nil,
|
13
|
+
post_authentication: nil,
|
14
|
+
define_auth_challenge: nil,
|
15
|
+
create_auth_challenge: nil,
|
16
|
+
verify_auth_challenge_response: nil,
|
17
|
+
pre_token_generation: nil,
|
18
|
+
user_migration: nil
|
19
|
+
},
|
20
|
+
status: nil,
|
21
|
+
last_modified_date: Time.new(2016, 5, 5, 5, 00, 00, '+00:00'),
|
22
|
+
creation_date: Time.new(2015, 1, 2, 10, 00, 00, '+00:00')
|
23
|
+
},
|
24
|
+
{
|
25
|
+
id: 'us-east-1_12345adsf',
|
26
|
+
name: 'test-pool',
|
27
|
+
lambda_config: {
|
28
|
+
pre_sign_up: nil,
|
29
|
+
custom_message: nil,
|
30
|
+
post_confirmation: nil,
|
31
|
+
pre_authentication: nil,
|
32
|
+
post_authentication: nil,
|
33
|
+
define_auth_challenge: nil,
|
34
|
+
create_auth_challenge: nil,
|
35
|
+
verify_auth_challenge_response: nil,
|
36
|
+
pre_token_generation: nil,
|
37
|
+
user_migration: nil
|
38
|
+
},
|
39
|
+
status: nil,
|
40
|
+
last_modified_date: Time.new(2019, 1, 2, 10, 00, 00, '+00:00'),
|
41
|
+
creation_date: Time.new(2018, 1, 2, 10, 00, 00, '+00:00')
|
42
|
+
}
|
43
|
+
],
|
44
|
+
next_token: 'aoeijfasdnvakldsjfgoai'
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
Aws.config[:kafka] = {
|
2
|
+
stub_responses: {
|
3
|
+
list_clusters: {
|
4
|
+
cluster_info_list: [
|
5
|
+
{
|
6
|
+
active_operation_arn: nil,
|
7
|
+
broker_node_group_info: {
|
8
|
+
broker_az_distribution: 'DEFAULT',
|
9
|
+
client_subnets: [
|
10
|
+
'subnet-12345678909876543',
|
11
|
+
'subnet-90876543212345678'
|
12
|
+
],
|
13
|
+
instance_type: 'kafka.t3.small',
|
14
|
+
security_groups: [
|
15
|
+
'sg-65432123456789098'
|
16
|
+
],
|
17
|
+
storage_info: {
|
18
|
+
ebs_storage_info: {
|
19
|
+
volume_size: 1
|
20
|
+
}
|
21
|
+
}
|
22
|
+
},
|
23
|
+
client_authentication: nil,
|
24
|
+
cluster_arn: 'arn:aws:kafka:us-east-1:123456789098:cluster/did-inventory/\
|
25
|
+
a12345b6-123c-1de2-1234-f1g23h45i678-9',
|
26
|
+
cluster_name: 'my-msk',
|
27
|
+
creation_time: Time.new(2019, 1, 2, 10, 10, 00, '+00:00'),
|
28
|
+
current_broker_software_info: {
|
29
|
+
configuration_arn: nil,
|
30
|
+
configuration_revision: nil,
|
31
|
+
kafka_version: '2.2.1'
|
32
|
+
},
|
33
|
+
logging_info: {
|
34
|
+
broker_logs: {
|
35
|
+
cloud_watch_logs: {
|
36
|
+
enabled: false,
|
37
|
+
log_group: nil
|
38
|
+
},
|
39
|
+
firehose: {
|
40
|
+
delivery_stream: nil,
|
41
|
+
enabled: false
|
42
|
+
},
|
43
|
+
s3: {
|
44
|
+
bucket: nil,
|
45
|
+
enabled: false,
|
46
|
+
prefix: nil
|
47
|
+
}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
current_version: 'A1BCDEFGHI23JK',
|
51
|
+
encryption_info: {
|
52
|
+
encryption_at_rest: {
|
53
|
+
data_volume_kms_key_id: 'arn:aws:kms:us-east-1:123456789098:key/ab1c2345-6789-01d2-3ee4-f56gh7i890jk'
|
54
|
+
},
|
55
|
+
encryption_in_transit: {
|
56
|
+
client_broker: 'TLS_PLAINTEXT',
|
57
|
+
in_cluster: true
|
58
|
+
}
|
59
|
+
},
|
60
|
+
enhanced_monitoring: 'DEFAULT',
|
61
|
+
number_of_broker_nodes: 2,
|
62
|
+
open_monitoring: {
|
63
|
+
prometheus: {
|
64
|
+
jmx_exporter: {
|
65
|
+
enabled_in_broker: false
|
66
|
+
},
|
67
|
+
node_exporter: {
|
68
|
+
enabled_in_broker: false
|
69
|
+
}
|
70
|
+
}
|
71
|
+
},
|
72
|
+
state: 'ACTIVE',
|
73
|
+
tags: {
|
74
|
+
'Name' => 'my-msk'
|
75
|
+
},
|
76
|
+
zookeeper_connect_string: 'z-3.my-msk.1a23bc.d4.kafka.us-east-1.amazonaws.com:\
|
77
|
+
1234,z-2.my-msk.1a23bc.d4.kafka.us-east-1.amazonaws.com:1234,z-1.my-msk.\
|
78
|
+
1a23bc.d4.kafka.us-east-1.amazonaws.com:1234'
|
79
|
+
}
|
80
|
+
],
|
81
|
+
next_token: nil
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
Aws.config[:ec2] = {
|
2
|
+
stub_responses: {
|
3
|
+
describe_transit_gateways: {
|
4
|
+
transit_gateways: [
|
5
|
+
{
|
6
|
+
transit_gateway_id: 'tgw-1234567890abcdefg',
|
7
|
+
transit_gateway_arn: 'arn:aws:ec2:us-east-2:123456789012:transit-gateway/tgw-1234567890abcdefg',
|
8
|
+
owner_id: '123456789012',
|
9
|
+
options: {
|
10
|
+
amazon_side_asn: 64_516,
|
11
|
+
auto_accept_shared_attachments: 'enable',
|
12
|
+
default_route_table_association: 'enable',
|
13
|
+
default_route_table_propagation: 'enable',
|
14
|
+
dns_support: 'enable',
|
15
|
+
vpn_ecmp_support: 'enable',
|
16
|
+
association_default_route_table_id: 'tgw-rtb-0123456789abcdefg',
|
17
|
+
propagation_default_route_table_id: 'tgw-rtb-0123456789abcdefg'
|
18
|
+
},
|
19
|
+
tags: [
|
20
|
+
{
|
21
|
+
key: 'Name',
|
22
|
+
value: 'my-transit-gateway'
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
26
|
+
]
|
27
|
+
},
|
28
|
+
describe_transit_gateway_attachments: {
|
29
|
+
transit_gateway_attachments: [
|
30
|
+
{
|
31
|
+
transit_gateway_attachment_id: 'tgw-attach-1234567890abcdefg',
|
32
|
+
transit_gateway_id: 'tgw-1234567890abcdefg',
|
33
|
+
transit_gateway_owner_id: '123456789012',
|
34
|
+
resource_owner_id: '123456789012',
|
35
|
+
resource_type: 'vpc',
|
36
|
+
resource_id: 'vpc-12345678',
|
37
|
+
state: 'available',
|
38
|
+
association: {
|
39
|
+
transit_gateway_route_table_id: 'tgw-rtb-0123456789abcdefg',
|
40
|
+
state: 'associated'
|
41
|
+
},
|
42
|
+
tags: [
|
43
|
+
{
|
44
|
+
key: 'Name',
|
45
|
+
value: 'my-transit-gateway-attachment'
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
]
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'addressable/uri'
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Apigateway < ResourceBase
|
3
5
|
aws_resource Aws::APIGateway::Client
|
@@ -11,5 +13,53 @@ module Awspec::Type
|
|
11
13
|
def id
|
12
14
|
@id ||= resource_via_client.id if resource_via_client
|
13
15
|
end
|
16
|
+
|
17
|
+
def api_resources
|
18
|
+
@api_resources.nil? ? @api_resources = find_api_resources_by_id(@id) : @api_resources
|
19
|
+
end
|
20
|
+
|
21
|
+
def has_path?(path)
|
22
|
+
check_existence
|
23
|
+
self.api_resources.each do |resource|
|
24
|
+
return resource if resource.path == path
|
25
|
+
end
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def has_integration_path?(path)
|
30
|
+
check_existence
|
31
|
+
self.api_resources.each do |resource|
|
32
|
+
next if resource.resource_methods.nil?
|
33
|
+
resource.resource_methods.each do |_, method|
|
34
|
+
if method.method_integration.http_method == 'AWS'
|
35
|
+
aws_path = method.method_integration.uri.match(%r{(\/[^\?]+)\??.*$}).captures[0] # Matches for ARN type path
|
36
|
+
return resource if aws_path == path
|
37
|
+
end
|
38
|
+
uri = Addressable::URI.parse(method.method_integration.uri)
|
39
|
+
return resource if uri.path == path
|
40
|
+
end
|
41
|
+
end
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def has_method?(path, http_method)
|
46
|
+
check_existence
|
47
|
+
resource_to_check = has_path?(path)
|
48
|
+
return nil if resource_to_check.nil?
|
49
|
+
resource_to_check.resource_methods.each do |_, method|
|
50
|
+
return resource_to_check if method.http_method == http_method
|
51
|
+
end
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
|
55
|
+
def has_integration_method?(integration_path, http_method)
|
56
|
+
check_existence
|
57
|
+
integration_resource_to_check = has_integration_path?(integration_path)
|
58
|
+
return nil if integration_resource_to_check.nil?
|
59
|
+
integration_resource_to_check.resource_methods.each do |_, method|
|
60
|
+
return integration_resource_to_check if method.method_integration.http_method == http_method
|
61
|
+
end
|
62
|
+
nil
|
63
|
+
end
|
14
64
|
end
|
15
65
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Awspec::Type
|
2
|
+
class CognitoIdentityPool < ResourceBase
|
3
|
+
def resource_via_client
|
4
|
+
@resource_via_client ||= find_identitypool_by_name(@display_name)
|
5
|
+
end
|
6
|
+
|
7
|
+
def id
|
8
|
+
@id ||= resource_via_client.identity_pool_id if resource_via_client
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Awspec::Type
|
2
|
+
class Msk < ResourceBase
|
3
|
+
def initialize(name)
|
4
|
+
super
|
5
|
+
@desplay_name = name
|
6
|
+
end
|
7
|
+
|
8
|
+
def resource_via_client
|
9
|
+
@resource_via_client ||= find_msk_cluster_by_name(@display_name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def id
|
13
|
+
@id ||= resource_via_client.cluster_arn if resource_via_client
|
14
|
+
end
|
15
|
+
|
16
|
+
STATES = %w(
|
17
|
+
active creating updating
|
18
|
+
deleting failed
|
19
|
+
)
|
20
|
+
|
21
|
+
STATES.each do |state|
|
22
|
+
define_method state + '?' do
|
23
|
+
resource_via_client.state == state.upcase
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module Awspec::Type
|
2
|
+
# rubocop:disable Metrics/ClassLength
|
2
3
|
class SecurityGroup < ResourceBase
|
3
4
|
aws_resource Aws::EC2::SecurityGroup
|
4
5
|
tags_allowed
|
@@ -75,12 +76,24 @@ module Awspec::Type
|
|
75
76
|
end
|
76
77
|
alias_method :outbound_permissions_count, :ip_permissions_egress_count
|
77
78
|
|
79
|
+
def has_inbound_rule?(rule)
|
80
|
+
resource_via_client.ip_permissions.find do |permission|
|
81
|
+
sg_rule_match?(permission, rule)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
78
85
|
def inbound_rule_count
|
79
86
|
resource_via_client.ip_permissions.reduce(0) do |sum, permission|
|
80
87
|
sum += permission.ip_ranges.count + permission.user_id_group_pairs.count
|
81
88
|
end
|
82
89
|
end
|
83
90
|
|
91
|
+
def has_outbound_rule?(rule)
|
92
|
+
resource_via_client.ip_permissions_egress.find do |permission|
|
93
|
+
sg_rule_match?(permission, rule)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
84
97
|
def outbound_rule_count
|
85
98
|
resource_via_client.ip_permissions_egress.reduce(0) do |sum, permission|
|
86
99
|
sum += permission.ip_ranges.count + permission.user_id_group_pairs.count
|
@@ -144,5 +157,36 @@ module Awspec::Type
|
|
144
157
|
port.between?(from_port, to_port)
|
145
158
|
end
|
146
159
|
end
|
160
|
+
|
161
|
+
def sg_rule_match?(permission, rule)
|
162
|
+
rule[:ip_protocol] = '-1' if rule[:ip_protocol] == 'all'
|
163
|
+
return false unless permission.ip_protocol == rule[:ip_protocol]
|
164
|
+
return false unless permission.ip_protocol == '-1' || permission.from_port == rule[:from_port]
|
165
|
+
return false unless permission.ip_protocol == '-1' || permission.to_port == rule[:to_port]
|
166
|
+
|
167
|
+
if rule[:ip_range]
|
168
|
+
return false unless permission.ip_ranges.find do |ip_range|
|
169
|
+
ip_range.cidr_ip == rule[:ip_range]
|
170
|
+
end
|
171
|
+
elsif rule[:group_pair]
|
172
|
+
return false unless permission.user_id_group_pairs.find do |pair|
|
173
|
+
group_pair_match?(pair, rule[:group_pair])
|
174
|
+
end
|
175
|
+
end
|
176
|
+
true
|
177
|
+
end
|
178
|
+
|
179
|
+
def group_pair_match?(actual_pair, rule_pair)
|
180
|
+
return false unless actual_pair.group_id == rule_pair[:group_id] || rule_pair[:group_id].nil?
|
181
|
+
return false unless actual_pair.group_name == rule_pair[:group_name] || rule_pair[:group_name].nil?
|
182
|
+
return false unless actual_pair.user_id == rule_pair[:user_id] || rule_pair[:user_id].nil?
|
183
|
+
return false unless actual_pair.vpc_id == rule_pair[:vpc_id] || rule_pair[:vpc_id].nil?
|
184
|
+
return false unless
|
185
|
+
actual_pair.vpc_peering_connection_id == rule_pair[:vpc_peering_connection_id] ||
|
186
|
+
rule_pair[:vpc_peering_connection_id].nil?
|
187
|
+
return false unless actual_pair.peering_status == rule_pair[:peering_status] || rule_pair[:peering_status].nil?
|
188
|
+
true
|
189
|
+
end
|
147
190
|
end
|
191
|
+
# rubocop:enable Metrics/ClassLength
|
148
192
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Awspec::Type
|
2
|
+
class TransitGateway < ResourceBase
|
3
|
+
aws_resource Aws::EC2::Types::TransitGateway
|
4
|
+
tags_allowed
|
5
|
+
|
6
|
+
def resource_via_client
|
7
|
+
@resource_via_client ||= find_transit_gateway(@display_name)
|
8
|
+
end
|
9
|
+
|
10
|
+
def id
|
11
|
+
@id ||= resource_via_client.transit_gateway_id if resource_via_client
|
12
|
+
end
|
13
|
+
|
14
|
+
def options
|
15
|
+
resource_via_client.options
|
16
|
+
end
|
17
|
+
|
18
|
+
def has_attachment?(att_id)
|
19
|
+
atts = find_tgw_attachments_by_tgw_id(@id)
|
20
|
+
ret = atts.find_all { |att| att.transit_gateway_attachment_id == att_id }
|
21
|
+
ret.any?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
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.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: addressable
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: bundler
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -237,6 +251,8 @@ files:
|
|
237
251
|
- doc/_resource_types/codebuild.md
|
238
252
|
- doc/_resource_types/codedeploy.md
|
239
253
|
- doc/_resource_types/codedeploy_deployment_group.md
|
254
|
+
- doc/_resource_types/cognito_identity_pool.md
|
255
|
+
- doc/_resource_types/cognito_user_pool.md
|
240
256
|
- doc/_resource_types/customer_gateway.md
|
241
257
|
- doc/_resource_types/directconnect_virtual_interface.md
|
242
258
|
- doc/_resource_types/dynamodb_table.md
|
@@ -269,6 +285,7 @@ files:
|
|
269
285
|
- doc/_resource_types/launch_configuration.md
|
270
286
|
- doc/_resource_types/launch_template.md
|
271
287
|
- doc/_resource_types/mq.md
|
288
|
+
- doc/_resource_types/msk.md
|
272
289
|
- doc/_resource_types/nat_gateway.md
|
273
290
|
- doc/_resource_types/network_acl.md
|
274
291
|
- doc/_resource_types/network_interface.md
|
@@ -292,6 +309,7 @@ files:
|
|
292
309
|
- doc/_resource_types/sqs.md
|
293
310
|
- doc/_resource_types/ssm_parameter.md
|
294
311
|
- doc/_resource_types/subnet.md
|
312
|
+
- doc/_resource_types/transit_gateway.md
|
295
313
|
- doc/_resource_types/vpc.md
|
296
314
|
- doc/_resource_types/vpn_connection.md
|
297
315
|
- doc/_resource_types/vpn_gateway.md
|
@@ -335,6 +353,8 @@ files:
|
|
335
353
|
- lib/awspec/generator/doc/type/codebuild.rb
|
336
354
|
- lib/awspec/generator/doc/type/codedeploy.rb
|
337
355
|
- lib/awspec/generator/doc/type/codedeploy_deployment_group.rb
|
356
|
+
- lib/awspec/generator/doc/type/cognito_identity_pool.rb
|
357
|
+
- lib/awspec/generator/doc/type/cognito_user_pool.rb
|
338
358
|
- lib/awspec/generator/doc/type/customer_gateway.rb
|
339
359
|
- lib/awspec/generator/doc/type/directconnect_virtual_interface.rb
|
340
360
|
- lib/awspec/generator/doc/type/dynamodb_table.rb
|
@@ -368,6 +388,7 @@ files:
|
|
368
388
|
- lib/awspec/generator/doc/type/launch_configuration.rb
|
369
389
|
- lib/awspec/generator/doc/type/launch_template.rb
|
370
390
|
- lib/awspec/generator/doc/type/mq.rb
|
391
|
+
- lib/awspec/generator/doc/type/msk.rb
|
371
392
|
- lib/awspec/generator/doc/type/nat_gateway.rb
|
372
393
|
- lib/awspec/generator/doc/type/network_acl.rb
|
373
394
|
- lib/awspec/generator/doc/type/network_interface.rb
|
@@ -391,6 +412,7 @@ files:
|
|
391
412
|
- lib/awspec/generator/doc/type/sqs.rb
|
392
413
|
- lib/awspec/generator/doc/type/ssm_parameter.rb
|
393
414
|
- lib/awspec/generator/doc/type/subnet.rb
|
415
|
+
- lib/awspec/generator/doc/type/transit_gateway.rb
|
394
416
|
- lib/awspec/generator/doc/type/vpc.rb
|
395
417
|
- lib/awspec/generator/doc/type/vpn_connection.rb
|
396
418
|
- lib/awspec/generator/doc/type/vpn_gateway.rb
|
@@ -454,6 +476,8 @@ files:
|
|
454
476
|
- lib/awspec/helper/finder/cloudwatch_logs.rb
|
455
477
|
- lib/awspec/helper/finder/codebuild.rb
|
456
478
|
- lib/awspec/helper/finder/codedeploy.rb
|
479
|
+
- lib/awspec/helper/finder/cognito_identity_pool.rb
|
480
|
+
- lib/awspec/helper/finder/cognito_user_pool.rb
|
457
481
|
- lib/awspec/helper/finder/directconnect.rb
|
458
482
|
- lib/awspec/helper/finder/dynamodb.rb
|
459
483
|
- lib/awspec/helper/finder/ebs.rb
|
@@ -473,6 +497,7 @@ files:
|
|
473
497
|
- lib/awspec/helper/finder/kms.rb
|
474
498
|
- lib/awspec/helper/finder/lambda.rb
|
475
499
|
- lib/awspec/helper/finder/mq.rb
|
500
|
+
- lib/awspec/helper/finder/msk.rb
|
476
501
|
- lib/awspec/helper/finder/nlb.rb
|
477
502
|
- lib/awspec/helper/finder/rds.rb
|
478
503
|
- lib/awspec/helper/finder/redshift.rb
|
@@ -554,6 +579,8 @@ files:
|
|
554
579
|
- lib/awspec/stub/codebuild.rb
|
555
580
|
- lib/awspec/stub/codedeploy.rb
|
556
581
|
- lib/awspec/stub/codedeploy_deployment_group.rb
|
582
|
+
- lib/awspec/stub/cognito_identity_pool.rb
|
583
|
+
- lib/awspec/stub/cognito_user_pool.rb
|
557
584
|
- lib/awspec/stub/customer_gateway.rb
|
558
585
|
- lib/awspec/stub/directconnect_virtual_interface.rb
|
559
586
|
- lib/awspec/stub/duplicated_resource_type.rb
|
@@ -588,6 +615,7 @@ files:
|
|
588
615
|
- lib/awspec/stub/launch_configuration.rb
|
589
616
|
- lib/awspec/stub/launch_template.rb
|
590
617
|
- lib/awspec/stub/mq.rb
|
618
|
+
- lib/awspec/stub/msk.rb
|
591
619
|
- lib/awspec/stub/nat_gateway.rb
|
592
620
|
- lib/awspec/stub/network_acl.rb
|
593
621
|
- lib/awspec/stub/network_interface.rb
|
@@ -609,6 +637,7 @@ files:
|
|
609
637
|
- lib/awspec/stub/sqs.rb
|
610
638
|
- lib/awspec/stub/ssm_parameter.rb
|
611
639
|
- lib/awspec/stub/subnet.rb
|
640
|
+
- lib/awspec/stub/transit_gateway.rb
|
612
641
|
- lib/awspec/stub/vpc.rb
|
613
642
|
- lib/awspec/stub/vpn_connection.rb
|
614
643
|
- lib/awspec/stub/vpn_gateway.rb
|
@@ -638,6 +667,8 @@ files:
|
|
638
667
|
- lib/awspec/type/codebuild.rb
|
639
668
|
- lib/awspec/type/codedeploy.rb
|
640
669
|
- lib/awspec/type/codedeploy_deployment_group.rb
|
670
|
+
- lib/awspec/type/cognito_identity_pool.rb
|
671
|
+
- lib/awspec/type/cognito_user_pool.rb
|
641
672
|
- lib/awspec/type/customer_gateway.rb
|
642
673
|
- lib/awspec/type/directconnect_virtual_interface.rb
|
643
674
|
- lib/awspec/type/dynamodb_table.rb
|
@@ -671,6 +702,7 @@ files:
|
|
671
702
|
- lib/awspec/type/launch_configuration.rb
|
672
703
|
- lib/awspec/type/launch_template.rb
|
673
704
|
- lib/awspec/type/mq.rb
|
705
|
+
- lib/awspec/type/msk.rb
|
674
706
|
- lib/awspec/type/nat_gateway.rb
|
675
707
|
- lib/awspec/type/network_acl.rb
|
676
708
|
- lib/awspec/type/network_interface.rb
|
@@ -695,6 +727,7 @@ files:
|
|
695
727
|
- lib/awspec/type/sqs.rb
|
696
728
|
- lib/awspec/type/ssm_parameter.rb
|
697
729
|
- lib/awspec/type/subnet.rb
|
730
|
+
- lib/awspec/type/transit_gateway.rb
|
698
731
|
- lib/awspec/type/vpc.rb
|
699
732
|
- lib/awspec/type/vpn_connection.rb
|
700
733
|
- lib/awspec/type/vpn_gateway.rb
|
@@ -720,7 +753,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
720
753
|
- !ruby/object:Gem::Version
|
721
754
|
version: '0'
|
722
755
|
requirements: []
|
723
|
-
rubygems_version: 3.0.
|
756
|
+
rubygems_version: 3.0.6
|
724
757
|
signing_key:
|
725
758
|
specification_version: 4
|
726
759
|
summary: RSpec tests for your AWS resources.
|