awspec 1.19.2 → 1.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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/vpc_endpoints.md +70 -0
- data/doc/resource_types.md +186 -19
- 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/generator/doc/type/vpc_endpoints.rb +17 -0
- data/lib/awspec/helper/finder.rb +14 -2
- 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/ecr.rb +4 -0
- data/lib/awspec/helper/finder/msk.rb +15 -0
- data/lib/awspec/helper/finder/vpc_endpoints.rb +15 -0
- data/lib/awspec/helper/type.rb +1 -1
- 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/stub/vpc_endpoints.rb +64 -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/ecr_repository.rb +4 -0
- data/lib/awspec/type/msk.rb +27 -0
- data/lib/awspec/type/transit_gateway.rb +24 -0
- data/lib/awspec/type/vpc_endpoints.rb +43 -0
- data/lib/awspec/version.rb +1 -1
- metadata +26 -2
@@ -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
|
@@ -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
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -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'
|
@@ -47,6 +48,9 @@ require 'awspec/helper/finder/redshift'
|
|
47
48
|
require 'awspec/helper/finder/codedeploy'
|
48
49
|
require 'awspec/helper/finder/mq'
|
49
50
|
require 'awspec/helper/finder/secretsmanager'
|
51
|
+
require 'awspec/helper/finder/cognito_user_pool'
|
52
|
+
require 'awspec/helper/finder/msk'
|
53
|
+
require 'awspec/helper/finder/cognito_identity_pool'
|
50
54
|
|
51
55
|
require 'awspec/helper/finder/account_attributes'
|
52
56
|
|
@@ -57,6 +61,7 @@ module Awspec::Helper
|
|
57
61
|
include Awspec::Helper::Finder::Nlb
|
58
62
|
include Awspec::Helper::Finder::Alb
|
59
63
|
include Awspec::Helper::Finder::Vpc
|
64
|
+
include Awspec::Helper::Finder::VpcEndpoints
|
60
65
|
include Awspec::Helper::Finder::Subnet
|
61
66
|
include Awspec::Helper::Finder::Ec2
|
62
67
|
include Awspec::Helper::Finder::Ecr
|
@@ -103,6 +108,9 @@ module Awspec::Helper
|
|
103
108
|
include Awspec::Helper::Finder::Codedeploy
|
104
109
|
include Awspec::Helper::Finder::Mq
|
105
110
|
include Awspec::Helper::Finder::Secretsmanager
|
111
|
+
include Awspec::Helper::Finder::CognitoUserPool
|
112
|
+
include Awspec::Helper::Finder::Msk
|
113
|
+
include Awspec::Helper::Finder::CognitoIdentityPool
|
106
114
|
|
107
115
|
CLIENTS = {
|
108
116
|
ec2_client: Aws::EC2::Client,
|
@@ -147,11 +155,15 @@ module Awspec::Helper
|
|
147
155
|
redshift_client: Aws::Redshift::Client,
|
148
156
|
codedeploy_client: Aws::CodeDeploy::Client,
|
149
157
|
mq_client: Aws::MQ::Client,
|
150
|
-
secretsmanager_client: Aws::SecretsManager::Client
|
158
|
+
secretsmanager_client: Aws::SecretsManager::Client,
|
159
|
+
msk_client: Aws::Kafka::Client,
|
160
|
+
cognito_identity_client: Aws::CognitoIdentity::Client,
|
161
|
+
cognito_identity_provider_client: Aws::CognitoIdentityProvider::Client
|
151
162
|
}
|
152
163
|
|
153
164
|
CLIENT_OPTIONS = {
|
154
|
-
http_proxy: ENV['http_proxy'] || ENV['https_proxy'] || nil
|
165
|
+
http_proxy: ENV['http_proxy'] || ENV['https_proxy'] || nil,
|
166
|
+
http_wire_trace: ENV['http_wire_trace'] || false
|
155
167
|
}
|
156
168
|
|
157
169
|
CLIENTS.each do |method_name, client|
|
@@ -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
|
@@ -5,6 +5,10 @@ module Awspec::Helper
|
|
5
5
|
res = ecr_client.describe_repositories(repository_names: [repository_name])
|
6
6
|
res.repositories.first if res.repositories.count == 1
|
7
7
|
end
|
8
|
+
|
9
|
+
def get_policy_text(repository_name)
|
10
|
+
res = ecr_client.get_repository_policy(repository_name: repository_name)[:policy_text]
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
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
|
@@ -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
|
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 vpc_endpoints
|
24
24
|
)
|
25
25
|
|
26
26
|
ACCOUNT_ATTRIBUTES = %w(
|
@@ -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
|
+
}
|