awspec 1.21.1 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e80f68b8b745754eb273e3826b3c577fec784d55459f94bc169787768ab45a6a
4
- data.tar.gz: 6fc0e5ee0ec92981dd60d8f1fc140e3354ca1b5e3f04b4367633369060509d96
3
+ metadata.gz: 72446a05a02e4d6c9255030d19a09d9cd7d4adf1d98136b34e284572fac17cb2
4
+ data.tar.gz: 2c8a6d67dc3b90491b027acb0540d06feca5fa37347ece6310fe8e0d5e17400a
5
5
  SHA512:
6
- metadata.gz: 0ad3f68adf8e7bdc8664d45d9b63d7252cfcb5ac1dafb3d84acb70b537c79bec3fe86e510052890309509f06e1a5ea1dcc6d943f36f411a059785445126629eb
7
- data.tar.gz: a27df4bf4b9e4dbf71377d4354e69d5be54831d18839fcbde1e7b77b78a69194eacf46fe886042e43948374b237a455578ca040a5543624d8612b6364e20d119
6
+ metadata.gz: 42ea8b83ef2eaf477a485e7ec96b0309f5cf110fc78de87f5b161ea05ab4cdf31ba1652ae3863be2cb6bff3f89f6f0ca39f19433ddc0cb40322468042b8d61dd
7
+ data.tar.gz: cb901cca1c2a8041f1a3fec48cd9c44b77ad13a503fc41d559230d799bfb9f55c309b4c267b6af635b17c0c2c4e872a4b97ba10e2260ec5e5ad27201cbee6e4d
@@ -0,0 +1,70 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe vpc_endpoints('my-vpc-endpoint') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ describe vpc_endpoints('vpce-05907f23265b25f20'), region: $tfvars["region"]["value"] do
10
+ it { should exist }
11
+ it { should be_available }
12
+ it { should have_subnet('subnet-040e19eabf3226f99') }
13
+ it { should belong_to_vpc('vpc-00af9dcc0134b48e0') }
14
+ its(:private_dns_enabled) { should eq true }
15
+ its(:vpc_endpoint_type) { should eq 'Interface' }
16
+ its(:service_name) { should eq 'com.amazonaws.eu-west-1.codebuild' }
17
+ end
18
+
19
+ ### be_pendingacceptance, be_pending, be_available, be_deleting, be_deleted, be_rejected, be_failed, be_expired
20
+
21
+ ```ruby
22
+ describe ami('my-ami') do
23
+ it { should be_available }
24
+ end
25
+ ```
26
+
27
+ ### belong_to_vpc
28
+
29
+ ```ruby
30
+ describe vpc_endpoints('my-vpc-endpoint') do
31
+ it { should belong_to_vpc('my-vpc') }
32
+ end
33
+ ```
34
+
35
+ ### have_route_table
36
+
37
+ ```ruby
38
+ describe vpc_endpoints('my-vpc-endpoint') do
39
+ it { should have_route_table('rtb-abc123') }
40
+ end
41
+ ```
42
+
43
+ ### have_subnet
44
+
45
+ ```ruby
46
+ describe vpc_endpoints('my-vpc-endpoint') do
47
+ it { should have_subnet('subnet-abc123') }
48
+ end
49
+ ```
50
+
51
+ ### have_tag
52
+
53
+ ```ruby
54
+ describe vpc_endpoints('my-vpc-endpoint') do
55
+ it { should have_tag('env').value('dev') }
56
+ end
57
+ ```
58
+
59
+ ### advanced
60
+
61
+ `vpc_endpoints` can use `Aws::EC2::Types::VpcEndpoint` resource (see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Types/VpcEndpoint.html).
62
+
63
+ ```ruby
64
+ describe vpc_endpoints('my-vpc-endpoint') do
65
+ its(:private_dns_enabled) { should eq true }
66
+ its(:vpc_endpoint_type) { should eq 'Interface' }
67
+ its(:service_name) { should eq 'com.amazonaws.eu-west-1.codebuild' }
68
+ end
69
+ ```
70
+
@@ -76,6 +76,7 @@
76
76
  | [subnet](#subnet)
77
77
  | [transit_gateway](#transit_gateway)
78
78
  | [vpc](#vpc)
79
+ | [vpc_endpoints](#vpc_endpoints)
79
80
  | [vpn_connection](#vpn_connection)
80
81
  | [vpn_gateway](#vpn_gateway)
81
82
  | [waf_web_acl](#waf_web_acl)
@@ -2784,7 +2785,7 @@ end
2784
2785
  ```
2785
2786
 
2786
2787
 
2787
- ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:db_security_groups), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:read_replica_db_instance_identifiers), its(:read_replica_db_cluster_identifiers), its(:license_model), its(:iops), its(: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)
2788
+ ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:db_security_groups), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:read_replica_db_instance_identifiers), its(:read_replica_db_cluster_identifiers), its(:replica_mode), its(:license_model), its(:iops), its(:character_set_name), its(: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)
2788
2789
  ### :unlock: Advanced use
2789
2790
 
2790
2791
  `rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
@@ -3644,6 +3645,86 @@ describe vpc('my-vpc') do
3644
3645
  end
3645
3646
  ```
3646
3647
 
3648
+ ## <a name="vpc_endpoints">vpc_endpoints</a>
3649
+
3650
+ VpcEndpoints resource type.
3651
+
3652
+ ### exist
3653
+
3654
+ ```ruby
3655
+ describe vpc_endpoints('my-vpc-endpoint') do
3656
+ it { should exist }
3657
+ end
3658
+ ```
3659
+
3660
+ describe vpc_endpoints('vpce-05907f23265b25f20'), region: $tfvars["region"]["value"] do
3661
+ it { should exist }
3662
+ it { should be_available }
3663
+ it { should have_subnet('subnet-040e19eabf3226f99') }
3664
+ it { should belong_to_vpc('vpc-00af9dcc0134b48e0') }
3665
+ its(:private_dns_enabled) { should eq true }
3666
+ its(:vpc_endpoint_type) { should eq 'Interface' }
3667
+ its(:service_name) { should eq 'com.amazonaws.eu-west-1.codebuild' }
3668
+ end
3669
+
3670
+
3671
+ ### be_available
3672
+
3673
+ ### be_deleted
3674
+
3675
+ ### be_deleting
3676
+
3677
+ ### be_expired
3678
+
3679
+ ### be_failed
3680
+
3681
+ ### be_pending
3682
+
3683
+ ### be_pendingacceptance
3684
+
3685
+ ### be_rejected
3686
+
3687
+ ### have_route_table
3688
+
3689
+ ```ruby
3690
+ describe vpc_endpoints('my-vpc-endpoint') do
3691
+ it { should have_route_table('rtb-abc123') }
3692
+ end
3693
+ ```
3694
+
3695
+
3696
+ ### have_subnet
3697
+
3698
+ ```ruby
3699
+ describe vpc_endpoints('my-vpc-endpoint') do
3700
+ it { should have_subnet('subnet-abc123') }
3701
+ end
3702
+ ```
3703
+
3704
+
3705
+ ### have_tag
3706
+
3707
+ ```ruby
3708
+ describe vpc_endpoints('my-vpc-endpoint') do
3709
+ it { should have_tag('env').value('dev') }
3710
+ end
3711
+ ```
3712
+
3713
+
3714
+
3715
+ ### :unlock: Advanced use
3716
+
3717
+ `vpc_endpoints` can use `Aws::EC2::Types::VpcEndpoint` resource (see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Types/VpcEndpoint.html).
3718
+
3719
+ ```ruby
3720
+ describe vpc_endpoints('my-vpc-endpoint') do
3721
+ its(:private_dns_enabled) { should eq true }
3722
+ its(:vpc_endpoint_type) { should eq 'Interface' }
3723
+ its(:service_name) { should eq 'com.amazonaws.eu-west-1.codebuild' }
3724
+ end
3725
+ ```
3726
+
3727
+
3647
3728
  ## <a name="vpn_connection">vpn_connection</a>
3648
3729
 
3649
3730
  VpnConnection resource type.
@@ -0,0 +1,17 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class VpcEndpoints < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'VpcEndpoints'
8
+ @type = Awspec::Type::VpcEndpoints.new('my-vpc-endpoint')
9
+ @ret = @type.resource_via_client
10
+ @matchers = []
11
+ @ignore_matchers = []
12
+ @describes = []
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -2,6 +2,7 @@ require 'aws-sdk'
2
2
  require 'awspec/helper/finder/nlb'
3
3
  require 'awspec/helper/finder/alb'
4
4
  require 'awspec/helper/finder/vpc'
5
+ require 'awspec/helper/finder/vpc_endpoints'
5
6
  require 'awspec/helper/finder/subnet'
6
7
  require 'awspec/helper/finder/ec2'
7
8
  require 'awspec/helper/finder/ecr'
@@ -60,6 +61,7 @@ module Awspec::Helper
60
61
  include Awspec::Helper::Finder::Nlb
61
62
  include Awspec::Helper::Finder::Alb
62
63
  include Awspec::Helper::Finder::Vpc
64
+ include Awspec::Helper::Finder::VpcEndpoints
63
65
  include Awspec::Helper::Finder::Subnet
64
66
  include Awspec::Helper::Finder::Ec2
65
67
  include Awspec::Helper::Finder::Ecr
@@ -0,0 +1,15 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module VpcEndpoints
4
+ def find_vpc_endpoint(id)
5
+ res = ec2_client.describe_vpc_endpoints({ vpc_endpoint_ids: [id] })
6
+
7
+ ret = res.vpc_endpoints.select do |vpce|
8
+ vpce.vpc_endpoint_id == id
9
+ end
10
+
11
+ ret.single_resource(id)
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 msk transit_gateway cognito_identity_pool cognito_user_pool
23
+ secretsmanager msk transit_gateway cognito_identity_pool cognito_user_pool vpc_endpoints
24
24
  )
25
25
 
26
26
  ACCOUNT_ATTRIBUTES = %w(
@@ -0,0 +1,64 @@
1
+ Aws.config[:ec2] = {
2
+ stub_responses: {
3
+ describe_vpc_endpoints: {
4
+ vpc_endpoints: [
5
+ {
6
+ vpc_endpoint_id: 'vpce-abc123',
7
+ vpc_endpoint_type: 'Gateway',
8
+ vpc_id: 'vpc-12345678',
9
+ service_name: 'com.amazonaws.us-east-1.s3',
10
+ state: 'available',
11
+ policy_document: '{"Version": "2008-10-17", "Statement": [{' \
12
+ '"Effect": "Allow", "Principal": "*", "Action": "*",' \
13
+ '"Resource": "*"}]}',
14
+ route_table_ids: ['rtb-0123456789abcdefg'],
15
+ subnet_ids: [],
16
+ groups: [],
17
+ private_dns_enabled: false,
18
+ requester_managed: false,
19
+ network_interface_ids: [],
20
+ dns_entries: [],
21
+ creation_timestamp: Time.new(2020, 8, 13, 9, 00, 00, '+00:00'),
22
+ tags: [
23
+ {
24
+ key: 'Name',
25
+ value: 'my_vpc_endpoint'
26
+ }
27
+ ],
28
+ owner_id: '112233445566'
29
+ },
30
+ {
31
+ vpc_endpoint_id: 'vpce-abc124',
32
+ vpc_endpoint_type: 'Interface',
33
+ vpc_id: 'vpc-12345678',
34
+ service_name: 'com.amazonaws.eu-west-1.codebuild',
35
+ state: 'available',
36
+ policy_document: '{"Version": "2008-10-17", "Statement": [{' \
37
+ '"Effect": "Allow", "Principal": "*", "Action": "*",' \
38
+ '"Resource": "*"}]}',
39
+ route_table_ids: [],
40
+ subnet_ids: ['subnet-abc123'],
41
+ groups: [{ group_id: 'sg-abc123', group_name: 'default' }],
42
+ private_dns_enabled: true,
43
+ requester_managed: false,
44
+ network_interface_ids: ['eni-06f28a949cb88b84c'],
45
+ dns_entries: [
46
+ {
47
+ dns_name: 'vpce-05907f23265b25f20-wwafshom.codebuild.eu-west-1.vpce.amazonaws.com',
48
+ hosted_zone_id: 'Z38GZ743OKFT7T'
49
+ }
50
+ ],
51
+ creation_timestamp: Time.new(2020, 8, 13, 9, 00, 00, '+00:00'),
52
+ tags: [
53
+ {
54
+ key: 'Name',
55
+ value: 'my_vpc_endpoint'
56
+ }
57
+ ],
58
+ owner_id: '112233445566'
59
+ }
60
+ ],
61
+ next_token: nil
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,43 @@
1
+ module Awspec::Type
2
+ class VpcEndpoints < ResourceBase
3
+ aws_resource Aws::EC2::Types::VpcEndpoint
4
+ tags_allowed
5
+
6
+ def resource_via_client
7
+ @resource_via_client ||= find_vpc_endpoint(@display_name)
8
+ end
9
+
10
+ def id
11
+ @id ||= resource_via_client.vpc_endpoint_id if resource_via_client
12
+ end
13
+
14
+ STATES = %w(
15
+ pendingacceptance pending available deleting
16
+ deleted rejected failed expired
17
+ )
18
+
19
+ STATES.each do |state|
20
+ define_method state + '?' do
21
+ resource_via_client.state == state
22
+ end
23
+ end
24
+
25
+ def has_route_table?(route_table_id)
26
+ rts = resource_via_client.route_table_ids
27
+
28
+ ret = rts.find do |rt|
29
+ rt == route_table_id
30
+ end
31
+ return true if ret
32
+ end
33
+
34
+ def has_subnet?(subnet_id)
35
+ subnets = resource_via_client.subnet_ids
36
+
37
+ ret = subnets.find do |subnet|
38
+ subnet == subnet_id
39
+ end
40
+ return true if ret
41
+ end
42
+ end
43
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.21.1'
2
+ VERSION = '1.22.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.21.1
4
+ version: 1.22.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-08-01 00:00:00.000000000 Z
11
+ date: 2020-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -311,6 +311,7 @@ files:
311
311
  - doc/_resource_types/subnet.md
312
312
  - doc/_resource_types/transit_gateway.md
313
313
  - doc/_resource_types/vpc.md
314
+ - doc/_resource_types/vpc_endpoints.md
314
315
  - doc/_resource_types/vpn_connection.md
315
316
  - doc/_resource_types/vpn_gateway.md
316
317
  - doc/_resource_types/waf_web_acl.md
@@ -414,6 +415,7 @@ files:
414
415
  - lib/awspec/generator/doc/type/subnet.rb
415
416
  - lib/awspec/generator/doc/type/transit_gateway.rb
416
417
  - lib/awspec/generator/doc/type/vpc.rb
418
+ - lib/awspec/generator/doc/type/vpc_endpoints.rb
417
419
  - lib/awspec/generator/doc/type/vpn_connection.rb
418
420
  - lib/awspec/generator/doc/type/vpn_gateway.rb
419
421
  - lib/awspec/generator/doc/type/waf_web_acl.rb
@@ -511,6 +513,7 @@ files:
511
513
  - lib/awspec/helper/finder/ssm_parameter.rb
512
514
  - lib/awspec/helper/finder/subnet.rb
513
515
  - lib/awspec/helper/finder/vpc.rb
516
+ - lib/awspec/helper/finder/vpc_endpoints.rb
514
517
  - lib/awspec/helper/finder/waf.rb
515
518
  - lib/awspec/helper/finder/wafregional.rb
516
519
  - lib/awspec/helper/type.rb
@@ -639,6 +642,7 @@ files:
639
642
  - lib/awspec/stub/subnet.rb
640
643
  - lib/awspec/stub/transit_gateway.rb
641
644
  - lib/awspec/stub/vpc.rb
645
+ - lib/awspec/stub/vpc_endpoints.rb
642
646
  - lib/awspec/stub/vpn_connection.rb
643
647
  - lib/awspec/stub/vpn_gateway.rb
644
648
  - lib/awspec/stub/waf_web_acl.rb
@@ -729,6 +733,7 @@ files:
729
733
  - lib/awspec/type/subnet.rb
730
734
  - lib/awspec/type/transit_gateway.rb
731
735
  - lib/awspec/type/vpc.rb
736
+ - lib/awspec/type/vpc_endpoints.rb
732
737
  - lib/awspec/type/vpn_connection.rb
733
738
  - lib/awspec/type/vpn_gateway.rb
734
739
  - lib/awspec/type/waf_web_acl.rb