awspec 1.18.5 → 1.20.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57797dd9f900c79068bf2839262679a2c86c62630463b8c365c1a6eb55a76ecf
4
- data.tar.gz: ae19755daba79f58d3d77ff3fb8c4eee0b0906516cd5bf4a033f9928656b6b63
3
+ metadata.gz: 50e4f2db388c2466cf1cc06da613acd875dd5e6cc586087f07372f0a1e7145b1
4
+ data.tar.gz: 336ec6c6a6700edfbb1c66c0b164343a519eaf73d4fb2a6f8ff6a095e19b8640
5
5
  SHA512:
6
- metadata.gz: d8fec4698ec26a49d81f7ecb7a37323ed69e53ac96cedff1a33e98e75f10c824681ed6a248cd2a6e79de27924fc46dc097e8eb0f91106b526d9a1d71fa0a1c2b
7
- data.tar.gz: 6ef0fa1247a1956b82f7a53be2478013269ab7e0e35005fa40f2d537d4763ee1caffbdb35848f9dd1c80b61e86f4f8e168dd865bbe1de98d4f4bdd2f677d9526
6
+ metadata.gz: c357e4f6650a48b03bd1eb3a454526a93dd2a885852de2fb5ee589a2eb468c87a2351512f802718f627587d85948b659b5894adaa12056d97ed1b8ca6419b99c
7
+ data.tar.gz: c091e6ece098aa98600e43e4ae4cd6413516d4a59f20a17d2d5b6d596695037b202b6246dfc5321504c318e3623b5bd3babc3d1dd0c8ef4d9db26f68a528410b
@@ -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,15 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe msk('my-msk') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### should be_active, be_creating, be_updating, be_deleting, be_failed
10
+
11
+ ```ruby
12
+ describe msk('my-msk') do
13
+ it { should be_active }
14
+ end
15
+ ```
@@ -0,0 +1,24 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe tgw('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 tgw('my-tgw') do
21
+ it { should exist }
22
+ its(:transit_gateway_id) { should eq 'tgw-1234567890abcdefg' }
23
+ end
24
+ ```
@@ -50,6 +50,7 @@
50
50
  | [launch_configuration](#launch_configuration)
51
51
  | [launch_template](#launch_template)
52
52
  | [mq](#mq)
53
+ | [msk](#msk)
53
54
  | [nat_gateway](#nat_gateway)
54
55
  | [network_acl](#network_acl)
55
56
  | [network_interface](#network_interface)
@@ -71,6 +72,7 @@
71
72
  | [sqs](#sqs)
72
73
  | [ssm_parameter](#ssm_parameter)
73
74
  | [subnet](#subnet)
75
+ | [transit_gateway](#transit_gateway)
74
76
  | [vpc](#vpc)
75
77
  | [vpn_connection](#vpn_connection)
76
78
  | [vpn_gateway](#vpn_gateway)
@@ -198,7 +200,7 @@ describe alb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:li
198
200
  end
199
201
  ```
200
202
 
201
- ### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy)
203
+ ### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy), its(:alpn_policy)
202
204
  ## <a name="alb_target_group">alb_target_group</a>
203
205
 
204
206
  AlbTargetGroup resource type.
@@ -284,6 +286,14 @@ describe apigateway('my-apigateway') do
284
286
  end
285
287
  ```
286
288
 
289
+ ### have_integration_method
290
+
291
+ ### have_integration_path
292
+
293
+ ### have_method
294
+
295
+ ### have_path
296
+
287
297
  ### 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
298
  ## <a name="autoscaling_group">autoscaling_group</a>
289
299
 
@@ -1319,7 +1329,7 @@ describe eks('my-eks') do
1319
1329
  end
1320
1330
  ```
1321
1331
 
1322
- ### its(:name), its(:arn), its(:created_at), its(:version), its(:endpoint), its(:role_arn), its(:logging), its(:identity), its(:status), its(:client_request_token), its(:platform_version), its(:tags)
1332
+ ### its(:name), its(:arn), its(:created_at), its(:version), its(:endpoint), its(:role_arn), its(:logging), its(:identity), its(:status), its(:client_request_token), its(:platform_version), its(:tags), its(:encryption_config)
1323
1333
  ## <a name="elasticache">elasticache</a>
1324
1334
 
1325
1335
  Elasticache resource type.
@@ -1388,7 +1398,7 @@ describe elasticache('my-rep-group-001') do
1388
1398
  end
1389
1399
  ```
1390
1400
 
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)
1401
+ ### 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
1402
  ## <a name="elasticache_cache_parameter_group">elasticache_cache_parameter_group</a>
1393
1403
 
1394
1404
  ElasticacheCacheParameterGroup resource type.
@@ -1612,7 +1622,7 @@ describe emr('my-emr') do
1612
1622
  end
1613
1623
  ```
1614
1624
 
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(:step_concurrency_level), its(:outpost_arn)
1625
+ ### 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
1626
  ## <a name="firehose">firehose</a>
1617
1627
 
1618
1628
  Firehose resource type.
@@ -2174,7 +2184,7 @@ end
2174
2184
 
2175
2185
  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
2186
 
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)
2187
+ ### 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
2188
  ## <a name="launch_configuration">launch_configuration</a>
2179
2189
 
2180
2190
  LaunchConfiguration resource type.
@@ -2297,6 +2307,30 @@ end
2297
2307
  ```
2298
2308
 
2299
2309
  ### 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)
2310
+ ## <a name="msk">msk</a>
2311
+
2312
+ Msk resource type.
2313
+
2314
+ ### exist
2315
+
2316
+ ```ruby
2317
+ describe msk('my-msk') do
2318
+ it { should exist }
2319
+ end
2320
+ ```
2321
+
2322
+
2323
+ ### be_active
2324
+
2325
+ ### be_creating
2326
+
2327
+ ### be_deleting
2328
+
2329
+ ### be_failed
2330
+
2331
+ ### be_updating
2332
+
2333
+ ### 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
2334
  ## <a name="nat_gateway">nat_gateway</a>
2301
2335
 
2302
2336
  NatGateway resource type.
@@ -2583,7 +2617,7 @@ describe nlb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:li
2583
2617
  end
2584
2618
  ```
2585
2619
 
2586
- ### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy)
2620
+ ### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy), its(:alpn_policy)
2587
2621
  ## <a name="nlb_target_group">nlb_target_group</a>
2588
2622
 
2589
2623
  NlbTargetGroup resource type.
@@ -3192,6 +3226,10 @@ end
3192
3226
 
3193
3227
  ### be_outbound_opened_only
3194
3228
 
3229
+ ### have_inbound_rule
3230
+
3231
+ ### have_outbound_rule
3232
+
3195
3233
  ### have_tag
3196
3234
 
3197
3235
  ```ruby
@@ -3381,7 +3419,7 @@ end
3381
3419
  ```
3382
3420
 
3383
3421
 
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)
3422
+ ### 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
3423
  ### :unlock: Advanced use
3386
3424
 
3387
3425
  ```ruby
@@ -3425,7 +3463,7 @@ end
3425
3463
  ```
3426
3464
 
3427
3465
 
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)
3466
+ ### 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
3467
  ### :unlock: Advanced use
3430
3468
 
3431
3469
  `subnet` can use `Aws::EC2::Subnet` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Subnet.html).
@@ -3444,6 +3482,40 @@ describe subnet('my-subnet') do
3444
3482
  end
3445
3483
  ```
3446
3484
 
3485
+ ## <a name="transit_gateway">transit_gateway</a>
3486
+
3487
+ TransitGateway resource type.
3488
+
3489
+ ### exist
3490
+
3491
+ ```ruby
3492
+ describe tgw('tgw-1234567890abcdefg') do
3493
+ it { should exist }
3494
+ it { should have_tag('Name').value('my-tgw') }
3495
+ it { should have_attachment('tgw-attach-1234567890abcdefg') }
3496
+ its('options.amazon_side_asn') { should eq 64_516 }
3497
+ its('options.auto_accept_shared_attachments') { should eq 'enable' }
3498
+ its('options.default_route_table_association') { should eq 'enable' }
3499
+ its('options.default_route_table_propagation') { should eq 'enable' }
3500
+ its('options.dns_support') { should eq 'enable' }
3501
+ its('options.vpn_ecmp_support') { should eq 'enable' }
3502
+ its('options.association_default_route_table_id') { should eq 'tgw-rtb-0123456789abcdefg' }
3503
+ its('options.propagation_default_route_table_id') { should eq 'tgw-rtb-0123456789abcdefg' }
3504
+ end
3505
+ ```
3506
+
3507
+ ```ruby
3508
+ describe tgw('my-tgw') do
3509
+ it { should exist }
3510
+ its(:transit_gateway_id) { should eq 'tgw-1234567890abcdefg' }
3511
+ end
3512
+ ```
3513
+
3514
+ ### have_attachment
3515
+
3516
+ ### have_tag
3517
+
3518
+ ### its(:transit_gateway_id), its(:transit_gateway_arn), its(:state), its(:owner_id), its(:description), its(:creation_time)
3447
3519
  ## <a name="vpc">vpc</a>
3448
3520
 
3449
3521
  VPC resource type.
@@ -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, :symbol
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
- @symbol = real_client.class.to_s.split('::').shift(2).push('Errors', 'RequestLimitExceeded').join('::').to_sym
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 == symbol.to_s && backoff < backoff_limit
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
@@ -47,6 +47,7 @@ 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/msk'
50
51
 
51
52
  require 'awspec/helper/finder/account_attributes'
52
53
 
@@ -103,6 +104,7 @@ module Awspec::Helper
103
104
  include Awspec::Helper::Finder::Codedeploy
104
105
  include Awspec::Helper::Finder::Mq
105
106
  include Awspec::Helper::Finder::Secretsmanager
107
+ include Awspec::Helper::Finder::Msk
106
108
 
107
109
  CLIENTS = {
108
110
  ec2_client: Aws::EC2::Client,
@@ -147,7 +149,8 @@ module Awspec::Helper
147
149
  redshift_client: Aws::Redshift::Client,
148
150
  codedeploy_client: Aws::CodeDeploy::Client,
149
151
  mq_client: Aws::MQ::Client,
150
- secretsmanager_client: Aws::SecretsManager::Client
152
+ secretsmanager_client: Aws::SecretsManager::Client,
153
+ msk_client: Aws::Kafka::Client
151
154
  }
152
155
 
153
156
  CLIENT_OPTIONS = {
@@ -3,8 +3,8 @@ module Awspec::Helper
3
3
  module Acm
4
4
  def find_certificate(id)
5
5
  selected = []
6
+ req = {}
6
7
  loop do
7
- req = {}
8
8
  res = acm_client.list_certificates(req)
9
9
  selected += res.certificate_summary_list.select do |c|
10
10
  c.certificate_arn == id || c.domain_name == id
@@ -19,8 +19,8 @@ module Awspec::Helper
19
19
 
20
20
  def select_all_certificates
21
21
  certs = []
22
+ req = {}
22
23
  loop do
23
- req = {}
24
24
  res = acm_client.list_certificates(req)
25
25
  res.certificate_summary_list.each do |c|
26
26
  certs << c.certificate_arn
@@ -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
@@ -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
@@ -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
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,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,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
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.18.5'
2
+ VERSION = '1.20.0'
3
3
  end
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.18.5
4
+ version: 1.20.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-03-06 00:00:00.000000000 Z
11
+ date: 2020-06-28 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
@@ -269,6 +283,7 @@ files:
269
283
  - doc/_resource_types/launch_configuration.md
270
284
  - doc/_resource_types/launch_template.md
271
285
  - doc/_resource_types/mq.md
286
+ - doc/_resource_types/msk.md
272
287
  - doc/_resource_types/nat_gateway.md
273
288
  - doc/_resource_types/network_acl.md
274
289
  - doc/_resource_types/network_interface.md
@@ -292,6 +307,7 @@ files:
292
307
  - doc/_resource_types/sqs.md
293
308
  - doc/_resource_types/ssm_parameter.md
294
309
  - doc/_resource_types/subnet.md
310
+ - doc/_resource_types/transit_gateway.md
295
311
  - doc/_resource_types/vpc.md
296
312
  - doc/_resource_types/vpn_connection.md
297
313
  - doc/_resource_types/vpn_gateway.md
@@ -368,6 +384,7 @@ files:
368
384
  - lib/awspec/generator/doc/type/launch_configuration.rb
369
385
  - lib/awspec/generator/doc/type/launch_template.rb
370
386
  - lib/awspec/generator/doc/type/mq.rb
387
+ - lib/awspec/generator/doc/type/msk.rb
371
388
  - lib/awspec/generator/doc/type/nat_gateway.rb
372
389
  - lib/awspec/generator/doc/type/network_acl.rb
373
390
  - lib/awspec/generator/doc/type/network_interface.rb
@@ -391,6 +408,7 @@ files:
391
408
  - lib/awspec/generator/doc/type/sqs.rb
392
409
  - lib/awspec/generator/doc/type/ssm_parameter.rb
393
410
  - lib/awspec/generator/doc/type/subnet.rb
411
+ - lib/awspec/generator/doc/type/transit_gateway.rb
394
412
  - lib/awspec/generator/doc/type/vpc.rb
395
413
  - lib/awspec/generator/doc/type/vpn_connection.rb
396
414
  - lib/awspec/generator/doc/type/vpn_gateway.rb
@@ -473,6 +491,7 @@ files:
473
491
  - lib/awspec/helper/finder/kms.rb
474
492
  - lib/awspec/helper/finder/lambda.rb
475
493
  - lib/awspec/helper/finder/mq.rb
494
+ - lib/awspec/helper/finder/msk.rb
476
495
  - lib/awspec/helper/finder/nlb.rb
477
496
  - lib/awspec/helper/finder/rds.rb
478
497
  - lib/awspec/helper/finder/redshift.rb
@@ -588,6 +607,7 @@ files:
588
607
  - lib/awspec/stub/launch_configuration.rb
589
608
  - lib/awspec/stub/launch_template.rb
590
609
  - lib/awspec/stub/mq.rb
610
+ - lib/awspec/stub/msk.rb
591
611
  - lib/awspec/stub/nat_gateway.rb
592
612
  - lib/awspec/stub/network_acl.rb
593
613
  - lib/awspec/stub/network_interface.rb
@@ -609,6 +629,7 @@ files:
609
629
  - lib/awspec/stub/sqs.rb
610
630
  - lib/awspec/stub/ssm_parameter.rb
611
631
  - lib/awspec/stub/subnet.rb
632
+ - lib/awspec/stub/transit_gateway.rb
612
633
  - lib/awspec/stub/vpc.rb
613
634
  - lib/awspec/stub/vpn_connection.rb
614
635
  - lib/awspec/stub/vpn_gateway.rb
@@ -671,6 +692,7 @@ files:
671
692
  - lib/awspec/type/launch_configuration.rb
672
693
  - lib/awspec/type/launch_template.rb
673
694
  - lib/awspec/type/mq.rb
695
+ - lib/awspec/type/msk.rb
674
696
  - lib/awspec/type/nat_gateway.rb
675
697
  - lib/awspec/type/network_acl.rb
676
698
  - lib/awspec/type/network_interface.rb
@@ -695,6 +717,7 @@ files:
695
717
  - lib/awspec/type/sqs.rb
696
718
  - lib/awspec/type/ssm_parameter.rb
697
719
  - lib/awspec/type/subnet.rb
720
+ - lib/awspec/type/transit_gateway.rb
698
721
  - lib/awspec/type/vpc.rb
699
722
  - lib/awspec/type/vpn_connection.rb
700
723
  - lib/awspec/type/vpn_gateway.rb