kumogata-template 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -2
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/kumogata-template.gemspec +4 -4
- data/lib/kumogata/template/alb.rb +48 -34
- data/lib/kumogata/template/api-gateway.rb +262 -0
- data/lib/kumogata/template/autoscaling.rb +17 -44
- data/lib/kumogata/template/certificate.rb +11 -8
- data/lib/kumogata/template/cloudfront.rb +67 -60
- data/lib/kumogata/template/cloudwatch.rb +7 -12
- data/lib/kumogata/template/codebuild.rb +4 -8
- data/lib/kumogata/template/codecommit.rb +2 -6
- data/lib/kumogata/template/codedeploy.rb +15 -0
- data/lib/kumogata/template/cognito.rb +203 -0
- data/lib/kumogata/template/const.rb +109 -47
- data/lib/kumogata/template/datapipeline.rb +16 -47
- data/lib/kumogata/template/dynamodb.rb +17 -8
- data/lib/kumogata/template/ec2.rb +61 -10
- data/lib/kumogata/template/ecr.rb +11 -9
- data/lib/kumogata/template/ecs.rb +256 -91
- data/lib/kumogata/template/elasticbeanstalk.rb +6 -9
- data/lib/kumogata/template/elb.rb +9 -24
- data/lib/kumogata/template/emr.rb +184 -51
- data/lib/kumogata/template/events.rb +22 -10
- data/lib/kumogata/template/ext/kumogata.rb +7 -7
- data/lib/kumogata/template/helper.rb +189 -130
- data/lib/kumogata/template/iam.rb +556 -146
- data/lib/kumogata/template/kinesis.rb +282 -0
- data/lib/kumogata/template/lambda.rb +43 -2
- data/lib/kumogata/template/logs.rb +2 -6
- data/lib/kumogata/template/nlb.rb +10 -0
- data/lib/kumogata/template/pinpoint.rb +83 -0
- data/lib/kumogata/template/rds.rb +52 -0
- data/lib/kumogata/template/redshift.rb +15 -6
- data/lib/kumogata/template/role.rb +425 -0
- data/lib/kumogata/template/s3.rb +120 -80
- data/lib/kumogata/template/sns.rb +2 -6
- data/lib/kumogata/template/version.rb +1 -1
- data/lib/kumogata/template.rb +9 -1
- data/template/_template.rb +2 -2
- data/template/alb-load-balancer.rb +5 -4
- data/template/alb-target-group.rb +8 -9
- data/template/api-gateway-account.rb +15 -0
- data/template/api-gateway-api-key.rb +22 -0
- data/template/api-gateway-authorizer.rb +38 -0
- data/template/api-gateway-base-path-mapping.rb +23 -0
- data/template/api-gateway-client-certificate.rb +16 -0
- data/template/api-gateway-deployment.rb +24 -0
- data/template/api-gateway-domain-name.rb +17 -0
- data/template/api-gateway-method.rb +71 -0
- data/template/api-gateway-model.rb +23 -0
- data/template/api-gateway-resource.rb +32 -0
- data/template/api-gateway-rest-api.rb +29 -0
- data/template/api-gateway-stage.rb +33 -0
- data/template/api-gateway-usage-plan-key.rb +19 -0
- data/template/api-gateway-usage-plan.rb +24 -0
- data/template/autoscaling-group.rb +2 -2
- data/template/autoscaling-launch-configuration.rb +7 -4
- data/template/autoscaling-scheduled-action.rb +0 -1
- data/template/certificate.rb +2 -2
- data/template/cloudfront-distribution.rb +4 -0
- data/template/cloudfront-origin-access-identity.rb +19 -0
- data/template/cloudtrail.rb +6 -4
- data/template/cloudwatch-alarm.rb +9 -3
- data/template/codebuild-project.rb +3 -3
- data/template/codecommit-repository.rb +2 -2
- data/template/codedeploy-application.rb +1 -1
- data/template/codedeploy-deployment-config.rb +1 -1
- data/template/codedeploy-deployment-group.rb +2 -0
- data/template/cognito-identity-pool.rb +34 -0
- data/template/cognito-identity-role-attachment.rb +22 -0
- data/template/cognito-user-pool-client.rb +28 -0
- data/template/cognito-user-pool-group.rb +24 -0
- data/template/cognito-user-pool-user-to-group-attachment.rb +20 -0
- data/template/cognito-user-pool-user.rb +28 -0
- data/template/cognito-user-pool.rb +45 -0
- data/template/datapipeline-pipeline.rb +4 -4
- data/template/dynamodb-table.rb +5 -1
- data/template/ec2-eip-association.rb +1 -1
- data/template/ec2-instance.rb +4 -1
- data/template/ec2-nat-gateway.rb +4 -0
- data/template/ec2-route.rb +4 -0
- data/template/ec2-security-group-ingress.rb +1 -1
- data/template/ec2-security-group.rb +2 -2
- data/template/ec2-subnet.rb +8 -4
- data/template/ec2-volume.rb +1 -2
- data/template/ec2-vpc-cidr-block.rb +4 -2
- data/template/ec2-vpc-endpoint.rb +5 -2
- data/template/ecr-repository.rb +2 -2
- data/template/ecs-cluster.rb +1 -1
- data/template/ecs-service.rb +19 -7
- data/template/ecs-task-definition.rb +4 -4
- data/template/elasticache-cache-cluster.rb +1 -1
- data/template/elasticache-parameter-group.rb +1 -1
- data/template/elasticache-replication-group.rb +1 -1
- data/template/elasticache-subnet-group.rb +1 -1
- data/template/elasticbeanstalk-application-version.rb +1 -1
- data/template/elasticbeanstalk-application.rb +1 -1
- data/template/elasticbeanstalk-configuration-template.rb +1 -1
- data/template/elasticbeanstalk-environment.rb +1 -1
- data/template/elb-load-balancer.rb +2 -2
- data/template/emr-cluster.rb +3 -3
- data/template/emr-instance-group-config.rb +4 -2
- data/template/emr-security-configuration.rb +17 -0
- data/template/emr-step.rb +2 -2
- data/template/events-rule.rb +8 -8
- data/template/iam-group.rb +2 -2
- data/template/iam-instance-profile.rb +2 -2
- data/template/iam-managed-policy.rb +1 -1
- data/template/iam-policy.rb +1 -1
- data/template/iam-role.rb +17 -2
- data/template/iam-user.rb +4 -4
- data/template/kinesis-firehose-delivery-stream.rb +36 -0
- data/template/kinesis-stream.rb +21 -0
- data/template/kms-alias.rb +2 -2
- data/template/kms-key.rb +1 -1
- data/template/lambda-alias.rb +2 -2
- data/template/lambda-event-source-mapping.rb +4 -4
- data/template/lambda-function.rb +17 -17
- data/template/lambda-permission.rb +31 -10
- data/template/lambda-version.rb +4 -2
- data/template/logs-destination.rb +1 -1
- data/template/logs-log-group.rb +1 -1
- data/template/logs-log-stream.rb +4 -2
- data/template/logs-metric-filter.rb +1 -1
- data/template/logs-subscription_filter.rb +1 -1
- data/template/mappings-ec2.rb +114 -52
- data/template/output-arn.rb +12 -4
- data/template/output-certificate.rb +11 -0
- data/template/output-distribution.rb +11 -0
- data/template/output-domain-name.rb +11 -0
- data/template/output-ecr-repository.rb +16 -0
- data/template/output-eip.rb +11 -0
- data/template/output-lambda-function.rb +6 -0
- data/template/output-name.rb +7 -2
- data/template/output-origin-access-identity.rb +13 -0
- data/template/output-rds-cluster.rb +17 -0
- data/template/{output-rds.rb → output-rds-instance.rb} +1 -1
- data/template/output-redshift.rb +11 -0
- data/template/output-rest-api.rb +11 -0
- data/template/output-s3.rb +3 -0
- data/template/output-stage.rb +19 -0
- data/template/output-subnet.rb +6 -3
- data/template/output-trail.rb +14 -0
- data/template/output-user-pool-client.rb +14 -0
- data/template/output-user-pool.rb +17 -0
- data/template/output-vpc.rb +13 -3
- data/template/output.rb +3 -2
- data/template/parameter-ec2.rb +10 -4
- data/template/parameter-elasticache.rb +1 -1
- data/template/parameter-rds.rb +51 -4
- data/template/parameter-redshift.rb +31 -1
- data/template/parameter.rb +87 -7
- data/template/rds-db-cluster-parameter-group.rb +18 -4
- data/template/rds-db-cluster.rb +19 -7
- data/template/rds-db-instance.rb +55 -131
- data/template/rds-db-parameter-group.rb +29 -3
- data/template/rds-db-subnet-group.rb +1 -1
- data/template/rds-event-subscription.rb +2 -4
- data/template/rds-option-group.rb +28 -5
- data/template/redshift-cluster-parameter-group.rb +3 -1
- data/template/redshift-cluster-security-group.rb +17 -0
- data/template/redshift-cluster-subnet-group.rb +3 -1
- data/template/redshift-cluster.rb +15 -12
- data/template/s3-bucket.rb +10 -5
- data/template/sns-topic.rb +2 -2
- data/template/sqs-queue.rb +1 -1
- data/test/abstract_unit.rb +2 -9
- data/test/cloudfront_test.rb +57 -28
- data/test/codedeploy_test.rb +21 -0
- data/test/datapipeline_test.rb +0 -22
- data/test/ec2_test.rb +12 -52
- data/test/ecs_test.rb +30 -26
- data/test/emr_test.rb +101 -20
- data/test/events_test.rb +47 -0
- data/test/helper_test.rb +251 -281
- data/test/iam_test.rb +572 -57
- data/test/lambda_test.rb +1 -1
- data/test/s3_test.rb +49 -14
- data/test/template/alb-load-balancer_test.rb +4 -5
- data/test/template/alb-target-group_test.rb +1 -3
- data/test/template/api-gateway-account_test.rb +26 -0
- data/test/template/api-gateway-api-key_test.rb +33 -0
- data/test/template/api-gateway-authorizer_test.rb +62 -0
- data/test/template/api-gateway-base-path-mapping_test.rb +27 -0
- data/test/template/api-gateway-client-certificate_test.rb +21 -0
- data/test/template/api-gateway-deployment_test.rb +27 -0
- data/test/template/api-gateway-domain-name_test.rb +26 -0
- data/test/template/api-gateway-method_test.rb +29 -0
- data/test/template/api-gateway-model_test.rb +37 -0
- data/test/template/api-gateway-resource_test.rb +82 -0
- data/test/template/api-gateway-rest-api_test.rb +33 -0
- data/test/template/api-gateway-stage_test.rb +39 -0
- data/test/template/api-gateway-usage-plan-key_test.rb +25 -0
- data/test/template/api-gateway-usage-plan_test.rb +42 -0
- data/test/template/cloudfront-distribution_test.rb +41 -3
- data/test/template/cloudtrail_test.rb +13 -5
- data/test/template/cloudwatch-alarm_test.rb +14 -2
- data/test/template/codebuild-project_test.rb +2 -11
- data/test/template/codecommit-repository_test.rb +12 -1
- data/test/template/cognito-identity-pool_test.rb +32 -0
- data/test/template/cognito-identity-role-attachment_test.rb +38 -0
- data/test/template/cognito-user-pool-client_test.rb +36 -0
- data/test/template/cognito-user-pool-group_test.rb +36 -0
- data/test/template/cognito-user-pool-user-to-group-attachment_test.rb +29 -0
- data/test/template/cognito-user-pool-user_test.rb +38 -0
- data/test/template/cognito-user-pool_test.rb +99 -0
- data/test/template/datapipeline-pipeline_test.rb +45 -6
- data/test/template/dynamodb-table_test.rb +19 -1
- data/test/template/ec2-instance_test.rb +9 -1
- data/test/template/ec2-nat-gateway_test.rb +29 -1
- data/test/template/ec2-security-group-egress_test.rb +1 -0
- data/test/template/ec2-security-group-ingress_test.rb +1 -0
- data/test/template/ec2-security-group_test.rb +11 -1
- data/test/template/ec2-spot-fleet_test.rb +1 -1
- data/test/template/ec2-subnet_test.rb +62 -1
- data/test/template/ec2-vpc-cidr-block_test.rb +1 -1
- data/test/template/ec2-vpc-endpoint_test.rb +56 -0
- data/test/template/ecr-repository_test.rb +63 -11
- data/test/template/ecs-service_test.rb +13 -2
- data/test/template/ecs-task-definition_test.rb +86 -13
- data/test/template/elasticache-cache-cluster_test.rb +4 -6
- data/test/template/elasticache-replication-group_test.rb +1 -1
- data/test/template/elasticbeanstalk-application-version_test.rb +1 -0
- data/test/template/elasticbeanstalk-application_test.rb +2 -1
- data/test/template/elasticbeanstalk-configuration-template_test.rb +2 -1
- data/test/template/elasticbeanstalk-template_test.rb +1 -0
- data/test/template/elb-load-balancer_test.rb +1 -3
- data/test/template/emr-cluster_test.rb +2 -14
- data/test/template/emr-instance-group-config_test.rb +2 -4
- data/test/template/emr-security-configuration_test.rb +34 -0
- data/test/template/emr-step_test.rb +2 -6
- data/test/template/events-rule_test.rb +3 -3
- data/test/template/iam-group_test.rb +11 -1
- data/test/template/iam-instance-profile_test.rb +11 -1
- data/test/template/iam-managed-policy_test.rb +1 -0
- data/test/template/iam-policy_test.rb +1 -3
- data/test/template/iam-role_test.rb +12 -2
- data/test/template/iam-user_test.rb +11 -17
- data/test/template/kinesis-firehorse-delivery-stream_test.rb +68 -0
- data/test/template/kinesis-stream_test.rb +61 -0
- data/test/template/kms-key_test.rb +1 -0
- data/test/template/lambda-alias_test.rb +2 -3
- data/test/template/lambda-event-source-mapping_test.rb +1 -1
- data/test/template/lambda-function_test.rb +20 -32
- data/test/template/lambda-permission_test.rb +7 -4
- data/test/template/lambda-version_test.rb +5 -2
- data/test/template/logs-log-group_test.rb +1 -3
- data/test/template/logs-log-stream_test.rb +2 -6
- data/test/template/logs-metric-filter_test.rb +1 -3
- data/test/template/logs-subscription-filter_test.rb +1 -3
- data/test/template/mappings-ec2_test.rb +10 -3
- data/test/template/output-domain-name_test.rb +30 -0
- data/test/template/output-name_test.rb +9 -0
- data/test/template/{output-rds_test.rb → output-rds-instance_test.rb} +2 -2
- data/test/template/output-rest-api_test.rb +30 -0
- data/test/template/output-s3_test.rb +9 -0
- data/test/template/output-stage_test.rb +43 -0
- data/test/template/output-user-pool-client_test.rb +39 -0
- data/test/template/output-user-pool_test.rb +48 -0
- data/test/template/output_test.rb +3 -1
- data/test/template/parameter-ec2_test.rb +22 -24
- data/test/template/parameter-elasticache_test.rb +2 -1
- data/test/template/parameter-rds_test.rb +32 -3
- data/test/template/parameter-redshift_test.rb +31 -2
- data/test/template/parameter_test.rb +37 -4
- data/test/template/rds-db-cluster-parameter-group_test.rb +1 -1
- data/test/template/rds-db-cluster_test.rb +4 -20
- data/test/template/rds-db-instance_test.rb +3 -373
- data/test/template/rds-db-parameter-group_test.rb +1 -1
- data/test/template/rds-option-group_test.rb +2 -2
- data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
- data/test/template/redshift-cluster-security-group_test.rb +49 -0
- data/test/template/redshift-cluster-subnet-group_test.rb +28 -0
- data/test/template/redshift-cluster_test.rb +33 -5
- data/test/template/s3-bucket_test.rb +6 -20
- metadata +130 -22
data/test/s3_test.rb
CHANGED
@@ -36,7 +36,7 @@ Test _s3_cors(cors: [ { headers: "test", methods: "test", origins: "test", expos
|
|
36
36
|
|
37
37
|
def test_s3_lifecycle
|
38
38
|
template = <<-EOS
|
39
|
-
Test _s3_lifecycle(
|
39
|
+
Test _s3_lifecycle(lifecycles: [ { id: "test", exp_in_days: "test", noncurrent_version_transitions: [ { storage: "test", transition: "test" } ], non_exp_in_days: "test" } ])
|
40
40
|
EOS
|
41
41
|
act_template = run_client_as_json(template)
|
42
42
|
exp_template = <<-EOS
|
@@ -44,14 +44,13 @@ Test _s3_lifecycle(lifecycle: [ { expiration_date: "ExpirationDate", expiration_
|
|
44
44
|
"Test": {
|
45
45
|
"Rules": [
|
46
46
|
{
|
47
|
-
"ExpirationDate": "ExpirationDate",
|
48
47
|
"ExpirationInDays": "test",
|
49
48
|
"Id": "test",
|
50
49
|
"NoncurrentVersionExpirationInDays": "test",
|
51
50
|
"NoncurrentVersionTransitions": [
|
52
51
|
{
|
53
|
-
"StorageClass": "
|
54
|
-
"TransitionInDays": "
|
52
|
+
"StorageClass": "GLACIER",
|
53
|
+
"TransitionInDays": ""
|
55
54
|
}
|
56
55
|
],
|
57
56
|
"Status": "Enabled"
|
@@ -81,9 +80,11 @@ Test _s3_logging({ logging: { destination: "test", prefix: "test" } })
|
|
81
80
|
|
82
81
|
def test_s3_notification
|
83
82
|
template = <<-EOS
|
84
|
-
Test _s3_notification(notification: {
|
85
|
-
|
86
|
-
|
83
|
+
Test _s3_notification(notification: {
|
84
|
+
lambda: [ { event: "new", filters: [ name: "test" ], function: "test" }],
|
85
|
+
queue: [ { event: "post", filters: [ name: "test" ], queue: "test" }],
|
86
|
+
topic: [ { event: "delete", filters: [ name: "test" ], topic: "test" }],
|
87
|
+
})
|
87
88
|
EOS
|
88
89
|
act_template = run_client_as_json(template)
|
89
90
|
exp_template = <<-EOS
|
@@ -91,27 +92,48 @@ Test _s3_notification(notification: { lambda: [ { event: "test", filter: "test",
|
|
91
92
|
"Test": {
|
92
93
|
"LambdaConfigurations": [
|
93
94
|
{
|
94
|
-
"Event": "
|
95
|
+
"Event": "s3:ObjectCreated:*",
|
95
96
|
"Filter": {
|
96
|
-
"S3Key":
|
97
|
+
"S3Key": {
|
98
|
+
"Rules": [
|
99
|
+
{
|
100
|
+
"Name": "name",
|
101
|
+
"Value": "test"
|
102
|
+
}
|
103
|
+
]
|
104
|
+
}
|
97
105
|
},
|
98
106
|
"Function": "test"
|
99
107
|
}
|
100
108
|
],
|
101
109
|
"QueueConfigurations": [
|
102
110
|
{
|
103
|
-
"Event": "
|
111
|
+
"Event": "s3:ObjectCreated:Post",
|
104
112
|
"Filter": {
|
105
|
-
"S3Key":
|
113
|
+
"S3Key": {
|
114
|
+
"Rules": [
|
115
|
+
{
|
116
|
+
"Name": "name",
|
117
|
+
"Value": "test"
|
118
|
+
}
|
119
|
+
]
|
120
|
+
}
|
106
121
|
},
|
107
122
|
"Queue": "test"
|
108
123
|
}
|
109
124
|
],
|
110
125
|
"TopicConfigurations": [
|
111
126
|
{
|
112
|
-
"Event": "
|
127
|
+
"Event": "s3:ObjectRemoved:Delete",
|
113
128
|
"Filter": {
|
114
|
-
"S3Key":
|
129
|
+
"S3Key": {
|
130
|
+
"Rules": [
|
131
|
+
{
|
132
|
+
"Name": "name",
|
133
|
+
"Value": "test"
|
134
|
+
}
|
135
|
+
]
|
136
|
+
}
|
115
137
|
},
|
116
138
|
"Topic": "test"
|
117
139
|
}
|
@@ -150,7 +172,7 @@ Test _s3_replication(replication: { role: "test" , rules: [ { destination: { buc
|
|
150
172
|
|
151
173
|
def test_s3_versioning
|
152
174
|
template = <<-EOS
|
153
|
-
Test _s3_versioning(
|
175
|
+
Test _s3_versioning({ versioning: true })
|
154
176
|
EOS
|
155
177
|
act_template = run_client_as_json(template)
|
156
178
|
exp_template = <<-EOS
|
@@ -158,6 +180,19 @@ Test _s3_versioning(versioning: { status: "test" })
|
|
158
180
|
"Test": {
|
159
181
|
"Status": "Enabled"
|
160
182
|
}
|
183
|
+
}
|
184
|
+
EOS
|
185
|
+
assert_equal exp_template.chomp, act_template
|
186
|
+
|
187
|
+
template = <<-EOS
|
188
|
+
Test _s3_versioning({ versioning: false })
|
189
|
+
EOS
|
190
|
+
act_template = run_client_as_json(template)
|
191
|
+
exp_template = <<-EOS
|
192
|
+
{
|
193
|
+
"Test": {
|
194
|
+
"Status": "Suspended"
|
195
|
+
}
|
161
196
|
}
|
162
197
|
EOS
|
163
198
|
assert_equal exp_template.chomp, act_template
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class AlbLoadbalancerTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_alb_load_balancer "test", attributes: [ {
|
6
|
+
_alb_load_balancer "test", attributes: [ { test: "test" } ], ref_security_groups: [ "test" ]
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -24,9 +24,7 @@ _alb_load_balancer "test", attributes: [ { "test": "test" } ], ref_security_grou
|
|
24
24
|
{
|
25
25
|
"Ref": "Service"
|
26
26
|
},
|
27
|
-
|
28
|
-
"Ref": "Name"
|
29
|
-
}
|
27
|
+
"test"
|
30
28
|
]
|
31
29
|
]
|
32
30
|
},
|
@@ -62,7 +60,8 @@ _alb_load_balancer "test", attributes: [ { "test": "test" } ], ref_security_grou
|
|
62
60
|
"Ref": "Version"
|
63
61
|
}
|
64
62
|
}
|
65
|
-
]
|
63
|
+
],
|
64
|
+
"Type": "application"
|
66
65
|
}
|
67
66
|
}
|
68
67
|
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayAccountTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_account "test", ref_cloudwatch: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestAccount": {
|
12
|
+
"Type": "AWS::ApiGateway::Account",
|
13
|
+
"Properties": {
|
14
|
+
"CloudWatchRoleArn": {
|
15
|
+
"Fn::GetAtt": [
|
16
|
+
"TestRole",
|
17
|
+
"Arn"
|
18
|
+
]
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
EOS
|
24
|
+
assert_equal exp_template.chomp, act_template
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayApiKeyTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_api_key "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestApiKey": {
|
12
|
+
"Type": "AWS::ApiGateway::ApiKey",
|
13
|
+
"Properties": {
|
14
|
+
"Description": "test api key description",
|
15
|
+
"Enabled": "true",
|
16
|
+
"Name": {
|
17
|
+
"Fn::Join": [
|
18
|
+
"-",
|
19
|
+
[
|
20
|
+
{
|
21
|
+
"Ref": "Service"
|
22
|
+
},
|
23
|
+
"test"
|
24
|
+
]
|
25
|
+
]
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
EOS
|
31
|
+
assert_equal exp_template.chomp, act_template
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayAuthorizerTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_authorizer "test", ref_rest: "test", ref_role: "test", ref_uri: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestAuthorizer": {
|
12
|
+
"Type": "AWS::ApiGateway::Authorizer",
|
13
|
+
"Properties": {
|
14
|
+
"AuthorizerCredentials": {
|
15
|
+
"Fn::GetAtt": [
|
16
|
+
"TestRole",
|
17
|
+
"Arn"
|
18
|
+
]
|
19
|
+
},
|
20
|
+
"AuthorizerResultTtlInSeconds": "300",
|
21
|
+
"AuthorizerUri": {
|
22
|
+
"Fn::Join": [
|
23
|
+
"",
|
24
|
+
[
|
25
|
+
"arn:aws:apigateway:",
|
26
|
+
{
|
27
|
+
"Ref": "AWS::Region"
|
28
|
+
},
|
29
|
+
":lambda:path/2015-03-31/functions/",
|
30
|
+
{
|
31
|
+
"Fn::GetAtt": [
|
32
|
+
"TestLambdaFunction",
|
33
|
+
"Arn"
|
34
|
+
]
|
35
|
+
},
|
36
|
+
"/invocations"
|
37
|
+
]
|
38
|
+
]
|
39
|
+
},
|
40
|
+
"IdentitySource": "method.request.header.Auth",
|
41
|
+
"Name": {
|
42
|
+
"Fn::Join": [
|
43
|
+
"-",
|
44
|
+
[
|
45
|
+
{
|
46
|
+
"Ref": "Service"
|
47
|
+
},
|
48
|
+
"test"
|
49
|
+
]
|
50
|
+
]
|
51
|
+
},
|
52
|
+
"RestApiId": {
|
53
|
+
"Ref": "TestRestApi"
|
54
|
+
},
|
55
|
+
"Type": "TOKEN"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
EOS
|
60
|
+
assert_equal exp_template.chomp, act_template
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayBasePathMappingTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_base_path_mapping "test", ref_domain: "test", ref_rest: "test", path: ""
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestBasePathMapping": {
|
12
|
+
"Type": "AWS::ApiGateway::BasePathMapping",
|
13
|
+
"Properties": {
|
14
|
+
"BasePath": "",
|
15
|
+
"DomainName": {
|
16
|
+
"Ref": "TestDomain"
|
17
|
+
},
|
18
|
+
"RestApiId": {
|
19
|
+
"Ref": "TestRestApi"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
EOS
|
25
|
+
assert_equal exp_template.chomp, act_template
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayClientCertificateTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_client_certificate "test", description: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestClientCertificate": {
|
12
|
+
"Type": "AWS::ApiGateway::ClientCertificate",
|
13
|
+
"Properties": {
|
14
|
+
"Description": "test"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
EOS
|
19
|
+
assert_equal exp_template.chomp, act_template
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayDeploymentTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_deployment "test", ref_rest: "test", ref_stage: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestDeployment": {
|
12
|
+
"Type": "AWS::ApiGateway::Deployment",
|
13
|
+
"Properties": {
|
14
|
+
"Description": "test deployment description",
|
15
|
+
"RestApiId": {
|
16
|
+
"Ref": "TestRestApi"
|
17
|
+
},
|
18
|
+
"StageName": {
|
19
|
+
"Ref": "Test"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
EOS
|
25
|
+
assert_equal exp_template.chomp, act_template
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayDomainNameTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_domain_name "test", ref_certificate: "test", ref_domain: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestDomainName": {
|
12
|
+
"Type": "AWS::ApiGateway::DomainName",
|
13
|
+
"Properties": {
|
14
|
+
"CertificateArn": {
|
15
|
+
"Ref": "TestCertificate"
|
16
|
+
},
|
17
|
+
"DomainName": {
|
18
|
+
"Ref": "TestDomain"
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
EOS
|
24
|
+
assert_equal exp_template.chomp, act_template
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayMethodTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_method "test", ref_resource: "test", ref_rest: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestMethod": {
|
12
|
+
"Type": "AWS::ApiGateway::Method",
|
13
|
+
"Properties": {
|
14
|
+
"ApiKeyRequired": "false",
|
15
|
+
"AuthorizationType": "NONE",
|
16
|
+
"HttpMethod": "ANY",
|
17
|
+
"ResourceId": {
|
18
|
+
"Ref": "TestResource"
|
19
|
+
},
|
20
|
+
"RestApiId": {
|
21
|
+
"Ref": "TestRestApi"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
EOS
|
27
|
+
assert_equal exp_template.chomp, act_template
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayModelTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_model "test", ref_rest: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestModel": {
|
12
|
+
"Type": "AWS::ApiGateway::Model",
|
13
|
+
"Properties": {
|
14
|
+
"ContentType": "application/json",
|
15
|
+
"Description": "test model description",
|
16
|
+
"Name": {
|
17
|
+
"Fn::Join": [
|
18
|
+
"-",
|
19
|
+
[
|
20
|
+
{
|
21
|
+
"Ref": "Service"
|
22
|
+
},
|
23
|
+
"test"
|
24
|
+
]
|
25
|
+
]
|
26
|
+
},
|
27
|
+
"RestApiId": {
|
28
|
+
"Ref": "TestRestApi"
|
29
|
+
},
|
30
|
+
"Schema": ""
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
EOS
|
35
|
+
assert_equal exp_template.chomp, act_template
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayResourceTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_resource "test", ref_rest: "test", ref_path: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestResource": {
|
12
|
+
"Type": "AWS::ApiGateway::Resource",
|
13
|
+
"Properties": {
|
14
|
+
"ParentId": {
|
15
|
+
"Fn::GetAtt": [
|
16
|
+
"TestRestApi",
|
17
|
+
"RootResourceId"
|
18
|
+
]
|
19
|
+
},
|
20
|
+
"PathPart": {
|
21
|
+
"Ref": "Test"
|
22
|
+
},
|
23
|
+
"RestApiId": {
|
24
|
+
"Ref": "TestRestApi"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
EOS
|
30
|
+
assert_equal exp_template.chomp, act_template
|
31
|
+
|
32
|
+
template = <<-EOS
|
33
|
+
_api_gateway_resource "test", ref_rest: "test", path: "/test"
|
34
|
+
EOS
|
35
|
+
act_template = run_client_as_json(template)
|
36
|
+
exp_template = <<-EOS
|
37
|
+
{
|
38
|
+
"TestResource": {
|
39
|
+
"Type": "AWS::ApiGateway::Resource",
|
40
|
+
"Properties": {
|
41
|
+
"ParentId": {
|
42
|
+
"Fn::GetAtt": [
|
43
|
+
"TestRestApi",
|
44
|
+
"RootResourceId"
|
45
|
+
]
|
46
|
+
},
|
47
|
+
"PathPart": "test",
|
48
|
+
"RestApiId": {
|
49
|
+
"Ref": "TestRestApi"
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
EOS
|
55
|
+
assert_equal exp_template.chomp, act_template
|
56
|
+
|
57
|
+
template = <<-EOS
|
58
|
+
_api_gateway_resource "test", ref_rest: "test", proxy: true
|
59
|
+
EOS
|
60
|
+
act_template = run_client_as_json(template)
|
61
|
+
exp_template = <<-EOS
|
62
|
+
{
|
63
|
+
"TestResource": {
|
64
|
+
"Type": "AWS::ApiGateway::Resource",
|
65
|
+
"Properties": {
|
66
|
+
"ParentId": {
|
67
|
+
"Fn::GetAtt": [
|
68
|
+
"TestRestApi",
|
69
|
+
"RootResourceId"
|
70
|
+
]
|
71
|
+
},
|
72
|
+
"PathPart": "{proxy+}",
|
73
|
+
"RestApiId": {
|
74
|
+
"Ref": "TestRestApi"
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
EOS
|
80
|
+
assert_equal exp_template.chomp, act_template
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayRestApiTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_rest_api "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestRestApi": {
|
12
|
+
"Type": "AWS::ApiGateway::RestApi",
|
13
|
+
"Properties": {
|
14
|
+
"Description": "test rest api description",
|
15
|
+
"FailOnWarnings": "true",
|
16
|
+
"Name": {
|
17
|
+
"Fn::Join": [
|
18
|
+
"-",
|
19
|
+
[
|
20
|
+
{
|
21
|
+
"Ref": "Service"
|
22
|
+
},
|
23
|
+
"test"
|
24
|
+
]
|
25
|
+
]
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
EOS
|
31
|
+
assert_equal exp_template.chomp, act_template
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayStageTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_stage "test", ref_deployment: "test", ref_rest: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestStage": {
|
12
|
+
"Type": "AWS::ApiGateway::Stage",
|
13
|
+
"Properties": {
|
14
|
+
"CacheClusterEnabled": "false",
|
15
|
+
"DeploymentId": {
|
16
|
+
"Ref": "TestDeployment"
|
17
|
+
},
|
18
|
+
"Description": "test stage description",
|
19
|
+
"RestApiId": {
|
20
|
+
"Ref": "TestRestApi"
|
21
|
+
},
|
22
|
+
"StageName": {
|
23
|
+
"Fn::Join": [
|
24
|
+
"_",
|
25
|
+
[
|
26
|
+
{
|
27
|
+
"Ref": "Service"
|
28
|
+
},
|
29
|
+
"test"
|
30
|
+
]
|
31
|
+
]
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
EOS
|
37
|
+
assert_equal exp_template.chomp, act_template
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayUsagePlanKeyTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_usage_plan_key "test", key: "test", ref_usage_plan: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestUsagePlanKey": {
|
12
|
+
"Type": "AWS::ApiGateway::UsagePlanKey",
|
13
|
+
"Properties": {
|
14
|
+
"KeyId": "test",
|
15
|
+
"KeyType": "API_KEY",
|
16
|
+
"UsagePlanId": {
|
17
|
+
"Ref": "TestUsagePlan"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
EOS
|
23
|
+
assert_equal exp_template.chomp, act_template
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ApiGatewayUsagePlanTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_api_gateway_usage_plan "test", stages: [ { ref_rest: "test", ref_stage: "test" } ]
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestUsagePlan": {
|
12
|
+
"Type": "AWS::ApiGateway::UsagePlan",
|
13
|
+
"Properties": {
|
14
|
+
"ApiStages": [
|
15
|
+
{
|
16
|
+
"ApiId": {
|
17
|
+
"Ref": "TestRestApi"
|
18
|
+
},
|
19
|
+
"Stage": {
|
20
|
+
"Ref": "TestStage"
|
21
|
+
}
|
22
|
+
}
|
23
|
+
],
|
24
|
+
"Description": "test usage plan description",
|
25
|
+
"UsagePlanName": {
|
26
|
+
"Fn::Join": [
|
27
|
+
"-",
|
28
|
+
[
|
29
|
+
{
|
30
|
+
"Ref": "Service"
|
31
|
+
},
|
32
|
+
"test"
|
33
|
+
]
|
34
|
+
]
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
EOS
|
40
|
+
assert_equal exp_template.chomp, act_template
|
41
|
+
end
|
42
|
+
end
|