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.
Files changed (278) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +4 -2
  3. data/Gemfile +1 -1
  4. data/Rakefile +1 -1
  5. data/kumogata-template.gemspec +4 -4
  6. data/lib/kumogata/template/alb.rb +48 -34
  7. data/lib/kumogata/template/api-gateway.rb +262 -0
  8. data/lib/kumogata/template/autoscaling.rb +17 -44
  9. data/lib/kumogata/template/certificate.rb +11 -8
  10. data/lib/kumogata/template/cloudfront.rb +67 -60
  11. data/lib/kumogata/template/cloudwatch.rb +7 -12
  12. data/lib/kumogata/template/codebuild.rb +4 -8
  13. data/lib/kumogata/template/codecommit.rb +2 -6
  14. data/lib/kumogata/template/codedeploy.rb +15 -0
  15. data/lib/kumogata/template/cognito.rb +203 -0
  16. data/lib/kumogata/template/const.rb +109 -47
  17. data/lib/kumogata/template/datapipeline.rb +16 -47
  18. data/lib/kumogata/template/dynamodb.rb +17 -8
  19. data/lib/kumogata/template/ec2.rb +61 -10
  20. data/lib/kumogata/template/ecr.rb +11 -9
  21. data/lib/kumogata/template/ecs.rb +256 -91
  22. data/lib/kumogata/template/elasticbeanstalk.rb +6 -9
  23. data/lib/kumogata/template/elb.rb +9 -24
  24. data/lib/kumogata/template/emr.rb +184 -51
  25. data/lib/kumogata/template/events.rb +22 -10
  26. data/lib/kumogata/template/ext/kumogata.rb +7 -7
  27. data/lib/kumogata/template/helper.rb +189 -130
  28. data/lib/kumogata/template/iam.rb +556 -146
  29. data/lib/kumogata/template/kinesis.rb +282 -0
  30. data/lib/kumogata/template/lambda.rb +43 -2
  31. data/lib/kumogata/template/logs.rb +2 -6
  32. data/lib/kumogata/template/nlb.rb +10 -0
  33. data/lib/kumogata/template/pinpoint.rb +83 -0
  34. data/lib/kumogata/template/rds.rb +52 -0
  35. data/lib/kumogata/template/redshift.rb +15 -6
  36. data/lib/kumogata/template/role.rb +425 -0
  37. data/lib/kumogata/template/s3.rb +120 -80
  38. data/lib/kumogata/template/sns.rb +2 -6
  39. data/lib/kumogata/template/version.rb +1 -1
  40. data/lib/kumogata/template.rb +9 -1
  41. data/template/_template.rb +2 -2
  42. data/template/alb-load-balancer.rb +5 -4
  43. data/template/alb-target-group.rb +8 -9
  44. data/template/api-gateway-account.rb +15 -0
  45. data/template/api-gateway-api-key.rb +22 -0
  46. data/template/api-gateway-authorizer.rb +38 -0
  47. data/template/api-gateway-base-path-mapping.rb +23 -0
  48. data/template/api-gateway-client-certificate.rb +16 -0
  49. data/template/api-gateway-deployment.rb +24 -0
  50. data/template/api-gateway-domain-name.rb +17 -0
  51. data/template/api-gateway-method.rb +71 -0
  52. data/template/api-gateway-model.rb +23 -0
  53. data/template/api-gateway-resource.rb +32 -0
  54. data/template/api-gateway-rest-api.rb +29 -0
  55. data/template/api-gateway-stage.rb +33 -0
  56. data/template/api-gateway-usage-plan-key.rb +19 -0
  57. data/template/api-gateway-usage-plan.rb +24 -0
  58. data/template/autoscaling-group.rb +2 -2
  59. data/template/autoscaling-launch-configuration.rb +7 -4
  60. data/template/autoscaling-scheduled-action.rb +0 -1
  61. data/template/certificate.rb +2 -2
  62. data/template/cloudfront-distribution.rb +4 -0
  63. data/template/cloudfront-origin-access-identity.rb +19 -0
  64. data/template/cloudtrail.rb +6 -4
  65. data/template/cloudwatch-alarm.rb +9 -3
  66. data/template/codebuild-project.rb +3 -3
  67. data/template/codecommit-repository.rb +2 -2
  68. data/template/codedeploy-application.rb +1 -1
  69. data/template/codedeploy-deployment-config.rb +1 -1
  70. data/template/codedeploy-deployment-group.rb +2 -0
  71. data/template/cognito-identity-pool.rb +34 -0
  72. data/template/cognito-identity-role-attachment.rb +22 -0
  73. data/template/cognito-user-pool-client.rb +28 -0
  74. data/template/cognito-user-pool-group.rb +24 -0
  75. data/template/cognito-user-pool-user-to-group-attachment.rb +20 -0
  76. data/template/cognito-user-pool-user.rb +28 -0
  77. data/template/cognito-user-pool.rb +45 -0
  78. data/template/datapipeline-pipeline.rb +4 -4
  79. data/template/dynamodb-table.rb +5 -1
  80. data/template/ec2-eip-association.rb +1 -1
  81. data/template/ec2-instance.rb +4 -1
  82. data/template/ec2-nat-gateway.rb +4 -0
  83. data/template/ec2-route.rb +4 -0
  84. data/template/ec2-security-group-ingress.rb +1 -1
  85. data/template/ec2-security-group.rb +2 -2
  86. data/template/ec2-subnet.rb +8 -4
  87. data/template/ec2-volume.rb +1 -2
  88. data/template/ec2-vpc-cidr-block.rb +4 -2
  89. data/template/ec2-vpc-endpoint.rb +5 -2
  90. data/template/ecr-repository.rb +2 -2
  91. data/template/ecs-cluster.rb +1 -1
  92. data/template/ecs-service.rb +19 -7
  93. data/template/ecs-task-definition.rb +4 -4
  94. data/template/elasticache-cache-cluster.rb +1 -1
  95. data/template/elasticache-parameter-group.rb +1 -1
  96. data/template/elasticache-replication-group.rb +1 -1
  97. data/template/elasticache-subnet-group.rb +1 -1
  98. data/template/elasticbeanstalk-application-version.rb +1 -1
  99. data/template/elasticbeanstalk-application.rb +1 -1
  100. data/template/elasticbeanstalk-configuration-template.rb +1 -1
  101. data/template/elasticbeanstalk-environment.rb +1 -1
  102. data/template/elb-load-balancer.rb +2 -2
  103. data/template/emr-cluster.rb +3 -3
  104. data/template/emr-instance-group-config.rb +4 -2
  105. data/template/emr-security-configuration.rb +17 -0
  106. data/template/emr-step.rb +2 -2
  107. data/template/events-rule.rb +8 -8
  108. data/template/iam-group.rb +2 -2
  109. data/template/iam-instance-profile.rb +2 -2
  110. data/template/iam-managed-policy.rb +1 -1
  111. data/template/iam-policy.rb +1 -1
  112. data/template/iam-role.rb +17 -2
  113. data/template/iam-user.rb +4 -4
  114. data/template/kinesis-firehose-delivery-stream.rb +36 -0
  115. data/template/kinesis-stream.rb +21 -0
  116. data/template/kms-alias.rb +2 -2
  117. data/template/kms-key.rb +1 -1
  118. data/template/lambda-alias.rb +2 -2
  119. data/template/lambda-event-source-mapping.rb +4 -4
  120. data/template/lambda-function.rb +17 -17
  121. data/template/lambda-permission.rb +31 -10
  122. data/template/lambda-version.rb +4 -2
  123. data/template/logs-destination.rb +1 -1
  124. data/template/logs-log-group.rb +1 -1
  125. data/template/logs-log-stream.rb +4 -2
  126. data/template/logs-metric-filter.rb +1 -1
  127. data/template/logs-subscription_filter.rb +1 -1
  128. data/template/mappings-ec2.rb +114 -52
  129. data/template/output-arn.rb +12 -4
  130. data/template/output-certificate.rb +11 -0
  131. data/template/output-distribution.rb +11 -0
  132. data/template/output-domain-name.rb +11 -0
  133. data/template/output-ecr-repository.rb +16 -0
  134. data/template/output-eip.rb +11 -0
  135. data/template/output-lambda-function.rb +6 -0
  136. data/template/output-name.rb +7 -2
  137. data/template/output-origin-access-identity.rb +13 -0
  138. data/template/output-rds-cluster.rb +17 -0
  139. data/template/{output-rds.rb → output-rds-instance.rb} +1 -1
  140. data/template/output-redshift.rb +11 -0
  141. data/template/output-rest-api.rb +11 -0
  142. data/template/output-s3.rb +3 -0
  143. data/template/output-stage.rb +19 -0
  144. data/template/output-subnet.rb +6 -3
  145. data/template/output-trail.rb +14 -0
  146. data/template/output-user-pool-client.rb +14 -0
  147. data/template/output-user-pool.rb +17 -0
  148. data/template/output-vpc.rb +13 -3
  149. data/template/output.rb +3 -2
  150. data/template/parameter-ec2.rb +10 -4
  151. data/template/parameter-elasticache.rb +1 -1
  152. data/template/parameter-rds.rb +51 -4
  153. data/template/parameter-redshift.rb +31 -1
  154. data/template/parameter.rb +87 -7
  155. data/template/rds-db-cluster-parameter-group.rb +18 -4
  156. data/template/rds-db-cluster.rb +19 -7
  157. data/template/rds-db-instance.rb +55 -131
  158. data/template/rds-db-parameter-group.rb +29 -3
  159. data/template/rds-db-subnet-group.rb +1 -1
  160. data/template/rds-event-subscription.rb +2 -4
  161. data/template/rds-option-group.rb +28 -5
  162. data/template/redshift-cluster-parameter-group.rb +3 -1
  163. data/template/redshift-cluster-security-group.rb +17 -0
  164. data/template/redshift-cluster-subnet-group.rb +3 -1
  165. data/template/redshift-cluster.rb +15 -12
  166. data/template/s3-bucket.rb +10 -5
  167. data/template/sns-topic.rb +2 -2
  168. data/template/sqs-queue.rb +1 -1
  169. data/test/abstract_unit.rb +2 -9
  170. data/test/cloudfront_test.rb +57 -28
  171. data/test/codedeploy_test.rb +21 -0
  172. data/test/datapipeline_test.rb +0 -22
  173. data/test/ec2_test.rb +12 -52
  174. data/test/ecs_test.rb +30 -26
  175. data/test/emr_test.rb +101 -20
  176. data/test/events_test.rb +47 -0
  177. data/test/helper_test.rb +251 -281
  178. data/test/iam_test.rb +572 -57
  179. data/test/lambda_test.rb +1 -1
  180. data/test/s3_test.rb +49 -14
  181. data/test/template/alb-load-balancer_test.rb +4 -5
  182. data/test/template/alb-target-group_test.rb +1 -3
  183. data/test/template/api-gateway-account_test.rb +26 -0
  184. data/test/template/api-gateway-api-key_test.rb +33 -0
  185. data/test/template/api-gateway-authorizer_test.rb +62 -0
  186. data/test/template/api-gateway-base-path-mapping_test.rb +27 -0
  187. data/test/template/api-gateway-client-certificate_test.rb +21 -0
  188. data/test/template/api-gateway-deployment_test.rb +27 -0
  189. data/test/template/api-gateway-domain-name_test.rb +26 -0
  190. data/test/template/api-gateway-method_test.rb +29 -0
  191. data/test/template/api-gateway-model_test.rb +37 -0
  192. data/test/template/api-gateway-resource_test.rb +82 -0
  193. data/test/template/api-gateway-rest-api_test.rb +33 -0
  194. data/test/template/api-gateway-stage_test.rb +39 -0
  195. data/test/template/api-gateway-usage-plan-key_test.rb +25 -0
  196. data/test/template/api-gateway-usage-plan_test.rb +42 -0
  197. data/test/template/cloudfront-distribution_test.rb +41 -3
  198. data/test/template/cloudtrail_test.rb +13 -5
  199. data/test/template/cloudwatch-alarm_test.rb +14 -2
  200. data/test/template/codebuild-project_test.rb +2 -11
  201. data/test/template/codecommit-repository_test.rb +12 -1
  202. data/test/template/cognito-identity-pool_test.rb +32 -0
  203. data/test/template/cognito-identity-role-attachment_test.rb +38 -0
  204. data/test/template/cognito-user-pool-client_test.rb +36 -0
  205. data/test/template/cognito-user-pool-group_test.rb +36 -0
  206. data/test/template/cognito-user-pool-user-to-group-attachment_test.rb +29 -0
  207. data/test/template/cognito-user-pool-user_test.rb +38 -0
  208. data/test/template/cognito-user-pool_test.rb +99 -0
  209. data/test/template/datapipeline-pipeline_test.rb +45 -6
  210. data/test/template/dynamodb-table_test.rb +19 -1
  211. data/test/template/ec2-instance_test.rb +9 -1
  212. data/test/template/ec2-nat-gateway_test.rb +29 -1
  213. data/test/template/ec2-security-group-egress_test.rb +1 -0
  214. data/test/template/ec2-security-group-ingress_test.rb +1 -0
  215. data/test/template/ec2-security-group_test.rb +11 -1
  216. data/test/template/ec2-spot-fleet_test.rb +1 -1
  217. data/test/template/ec2-subnet_test.rb +62 -1
  218. data/test/template/ec2-vpc-cidr-block_test.rb +1 -1
  219. data/test/template/ec2-vpc-endpoint_test.rb +56 -0
  220. data/test/template/ecr-repository_test.rb +63 -11
  221. data/test/template/ecs-service_test.rb +13 -2
  222. data/test/template/ecs-task-definition_test.rb +86 -13
  223. data/test/template/elasticache-cache-cluster_test.rb +4 -6
  224. data/test/template/elasticache-replication-group_test.rb +1 -1
  225. data/test/template/elasticbeanstalk-application-version_test.rb +1 -0
  226. data/test/template/elasticbeanstalk-application_test.rb +2 -1
  227. data/test/template/elasticbeanstalk-configuration-template_test.rb +2 -1
  228. data/test/template/elasticbeanstalk-template_test.rb +1 -0
  229. data/test/template/elb-load-balancer_test.rb +1 -3
  230. data/test/template/emr-cluster_test.rb +2 -14
  231. data/test/template/emr-instance-group-config_test.rb +2 -4
  232. data/test/template/emr-security-configuration_test.rb +34 -0
  233. data/test/template/emr-step_test.rb +2 -6
  234. data/test/template/events-rule_test.rb +3 -3
  235. data/test/template/iam-group_test.rb +11 -1
  236. data/test/template/iam-instance-profile_test.rb +11 -1
  237. data/test/template/iam-managed-policy_test.rb +1 -0
  238. data/test/template/iam-policy_test.rb +1 -3
  239. data/test/template/iam-role_test.rb +12 -2
  240. data/test/template/iam-user_test.rb +11 -17
  241. data/test/template/kinesis-firehorse-delivery-stream_test.rb +68 -0
  242. data/test/template/kinesis-stream_test.rb +61 -0
  243. data/test/template/kms-key_test.rb +1 -0
  244. data/test/template/lambda-alias_test.rb +2 -3
  245. data/test/template/lambda-event-source-mapping_test.rb +1 -1
  246. data/test/template/lambda-function_test.rb +20 -32
  247. data/test/template/lambda-permission_test.rb +7 -4
  248. data/test/template/lambda-version_test.rb +5 -2
  249. data/test/template/logs-log-group_test.rb +1 -3
  250. data/test/template/logs-log-stream_test.rb +2 -6
  251. data/test/template/logs-metric-filter_test.rb +1 -3
  252. data/test/template/logs-subscription-filter_test.rb +1 -3
  253. data/test/template/mappings-ec2_test.rb +10 -3
  254. data/test/template/output-domain-name_test.rb +30 -0
  255. data/test/template/output-name_test.rb +9 -0
  256. data/test/template/{output-rds_test.rb → output-rds-instance_test.rb} +2 -2
  257. data/test/template/output-rest-api_test.rb +30 -0
  258. data/test/template/output-s3_test.rb +9 -0
  259. data/test/template/output-stage_test.rb +43 -0
  260. data/test/template/output-user-pool-client_test.rb +39 -0
  261. data/test/template/output-user-pool_test.rb +48 -0
  262. data/test/template/output_test.rb +3 -1
  263. data/test/template/parameter-ec2_test.rb +22 -24
  264. data/test/template/parameter-elasticache_test.rb +2 -1
  265. data/test/template/parameter-rds_test.rb +32 -3
  266. data/test/template/parameter-redshift_test.rb +31 -2
  267. data/test/template/parameter_test.rb +37 -4
  268. data/test/template/rds-db-cluster-parameter-group_test.rb +1 -1
  269. data/test/template/rds-db-cluster_test.rb +4 -20
  270. data/test/template/rds-db-instance_test.rb +3 -373
  271. data/test/template/rds-db-parameter-group_test.rb +1 -1
  272. data/test/template/rds-option-group_test.rb +2 -2
  273. data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
  274. data/test/template/redshift-cluster-security-group_test.rb +49 -0
  275. data/test/template/redshift-cluster-subnet-group_test.rb +28 -0
  276. data/test/template/redshift-cluster_test.rb +33 -5
  277. data/test/template/s3-bucket_test.rb +6 -20
  278. metadata +130 -22
@@ -0,0 +1,71 @@
1
+ #
2
+ # Api Gateway Method
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/api-gateway'
7
+
8
+ proxy = _bool("proxy", args, false)
9
+ args[:parameters] = [] unless args.key? :parameters
10
+ args[:parameters] << { type: "method", location: "path", name: "proxy", value: true } if proxy
11
+
12
+ cognito = _bool("cognito", args, false)
13
+ if cognito
14
+ args[:integration] = {} unless args.key? :integration
15
+ args[:integration][:parameters] = [] unless args[:integration][:parameters]
16
+ _api_gateway_to_parameter_headers("aws").collect{|v| args[:integration][:parameters] << v }
17
+ _api_gateway_to_parameter_headers("cognito").collect{|v| args[:integration][:parameters] << v }
18
+ end
19
+
20
+ cors = _bool("cors", args, false)
21
+ if cors
22
+ args[:http] = "options"
23
+ args[:responses] = [] unless args.key? :responses
24
+ responses_parameters = {}
25
+ _api_gateway_to_parameter_response_headers().keys().collect{|v| responses_parameters[v] = false }
26
+ args[:responses] << { parameters: responses_parameters, models: { "application/json": "Empty" } }
27
+
28
+ args[:integration] = {} unless args.key? :integration
29
+ args[:integration][:type] = "mock"
30
+ args[:integration][:pass] = "when_no_match"
31
+ args[:integration][:templates] = {} unless args[:integration].key? :templates
32
+ args[:integration][:templates]["application/json"] = '{"statusCode": 200}'
33
+ args[:integration][:responses] = [] unless args[:integration].key? :responses
34
+ args[:integration][:responses] << {
35
+ parameter: _api_gateway_to_parameter_response_headers({ allow_headers: args[:allow_headers] || [] }),
36
+ template: { "application/json": "" }
37
+ }
38
+ end
39
+
40
+ name = _resource_name(args[:name], "method")
41
+ required = _bool("required", args, false)
42
+ auth_type = _valid_values(args[:auth_type], %w( none custom aws_iam iam ), "none")
43
+ auth_type = "aws_iam" if auth_type == "iam"
44
+ auth_id = _ref_string_default("auth", args, "authorizer")
45
+ http = _valid_values(args[:http], %w( delete get head options patch post put any ), "any")
46
+ integration = _api_gateway_integration(args)
47
+ responses = _api_gateway_responses(args)
48
+ # RequestModels
49
+ # - key: The content type
50
+ # - value: A Model resource name
51
+ models = args[:models] || {}
52
+ parameters = {}
53
+ args[:parameters].collect{|v| parameters[_api_gateway_to_parameter(v)] = v[:value] }
54
+ resource = _ref_string("resource", args, "resource")
55
+ rest = _ref_string("rest", args, "rest api")
56
+
57
+ _(name) do
58
+ Type "AWS::ApiGateway::Method"
59
+ Properties do
60
+ ApiKeyRequired required
61
+ AuthorizationType auth_type.upcase
62
+ AuthorizerId auth_id if auth_type == "custom"
63
+ HttpMethod http.upcase
64
+ Integration integration unless integration.empty?
65
+ MethodResponses responses unless responses.empty?
66
+ RequestModels models unless models.empty?
67
+ RequestParameters parameters unless parameters.empty?
68
+ ResourceId resource
69
+ RestApiId rest
70
+ end
71
+ end
@@ -0,0 +1,23 @@
1
+ #
2
+ # Api Gateway Model
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-model.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "model")
8
+ content = _ref_string_default("content", args, "", "application/json")
9
+ description = _ref_string_default("description", args, '', "#{args[:name]} model description")
10
+ model = _name("model", args)
11
+ rest = _ref_string("rest", args, "rest api")
12
+ schema = args[:schema]
13
+
14
+ _(name) do
15
+ Type "AWS::ApiGateway::Model"
16
+ Properties do
17
+ ContentType content
18
+ Description description unless description.empty?
19
+ Name model
20
+ RestApiId rest
21
+ Schema schema
22
+ end
23
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ # Api Gateway Resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "resource")
8
+ parent_key =
9
+ if _ref_key? "parent", args
10
+ "parent"
11
+ else
12
+ "rest"
13
+ end
14
+ parent = _ref_attr_string(parent_key, "RootResourceId", args, "rest api")
15
+ proxy = _bool("proxy", args, false)
16
+ path =
17
+ if proxy
18
+ "{proxy+}"
19
+ else
20
+ _ref_string("path", args)
21
+ end
22
+ path = path.gsub(/^\//, "") if path.is_a? String
23
+ rest = _ref_string("rest", args, "rest api")
24
+
25
+ _(name) do
26
+ Type "AWS::ApiGateway::Resource"
27
+ Properties do
28
+ ParentId parent
29
+ PathPart path
30
+ RestApiId rest
31
+ end
32
+ end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Api Gateway Rest API resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "rest api")
8
+ binary_types = args[:binary_types] || [] # ex) image/png or application/octet-stream
9
+ body = args[:body] || {}
10
+ body_s3 = args[:body_s3] || {}
11
+ clone = _ref_string_default("clone", args)
12
+ description = _ref_string_default("description", args, '', "#{args[:name]} rest api description")
13
+ fail_on = _bool("fail_on", args, true)
14
+ api = _name("api", args)
15
+ parameters = _ref_array("parameters", args)
16
+
17
+ _(name) do
18
+ Type "AWS::ApiGateway::RestApi"
19
+ Properties do
20
+ BinaryMediaTypes binary_types unless binary_types.empty?
21
+ Body body unless body.empty?
22
+ BodyS3Location body_s3 unless body_s3.empty?
23
+ CloneFrom clone unless clone.empty?
24
+ Description description unless description.empty?
25
+ FailOnWarnings fail_on
26
+ Name api
27
+ Parameters parameters unless parameters.empty?
28
+ end
29
+ end
@@ -0,0 +1,33 @@
1
+ #
2
+ # Api Gateway Stage resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/api-gateway'
7
+
8
+ name = _resource_name(args[:name], "stage")
9
+ cache_cluster = _ref_string_default("cache_cluster", args)
10
+ certificate = _ref_string_default("certificate", args, "certificate")
11
+ deployment = _ref_string("deployment", args, "deployment")
12
+ description = _ref_string_default("description", args, '', "#{args[:name]} stage description")
13
+ settings = _api_gateway_method_settings(args)
14
+ rest = _ref_string("rest", args, "rest api")
15
+ stage = _name("stage", args, "_")
16
+ variables = args[:variables] || {}
17
+ depends = _depends([ { ref_account: "account" } ], args)
18
+
19
+ _(name) do
20
+ Type "AWS::ApiGateway::Stage"
21
+ Properties do
22
+ CacheClusterEnabled cache_cluster.empty? ? false : true
23
+ CacheClusterSize cache_cluster unless cache_cluster.empty?
24
+ ClientCertificateId certificate unless certificate.empty?
25
+ DeploymentId deployment
26
+ Description description unless description.empty?
27
+ MethodSettings settings unless settings.empty?
28
+ RestApiId rest
29
+ StageName stage
30
+ Variables variables unless variables.empty?
31
+ end
32
+ DependsOn depends unless depends.empty?
33
+ end
@@ -0,0 +1,19 @@
1
+ #
2
+ # Api Gateway Usage Plan Key resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/api-gateway'
7
+
8
+ name = _resource_name(args[:name], "usage plan key")
9
+ key = _ref_string("key", args)
10
+ usage_plan = _ref_string("usage_plan", args, "usage plan")
11
+
12
+ _(name) do
13
+ Type "AWS::ApiGateway::UsagePlanKey"
14
+ Properties do
15
+ KeyId key
16
+ KeyType "API_KEY"
17
+ UsagePlanId usage_plan
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ #
2
+ # Api Gateway Usage Plan resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/api-gateway'
7
+
8
+ name = _resource_name(args[:name], "usage plan")
9
+ stages = _api_gateway_stages(args)
10
+ description = _ref_string_default("description", args, '', "#{args[:name]} usage plan description")
11
+ quota = _api_gateway_quota(args)
12
+ throttle = _api_gateway_throttle(args)
13
+ plan = _name("plan", args)
14
+
15
+ _(name) do
16
+ Type "AWS::ApiGateway::UsagePlan"
17
+ Properties do
18
+ ApiStages stages
19
+ Description description unless description.empty?
20
+ Quota quota unless quota.empty?
21
+ Throttle throttle unless throttle.empty?
22
+ UsagePlanName plan
23
+ end
24
+ end
@@ -14,9 +14,9 @@ health_check_type = _valid_values(args[:helath_check_type], %w( ec2 elb ), "ec2"
14
14
  instance = _ref_string("instance", args)
15
15
  launch = _ref_string("launch", args, "autoscaling launch configuration")
16
16
  load_balancers = _ref_array("load_balancers", args)
17
- max = args[:max] || 1
17
+ max = (args[:max] || 1).to_i
18
18
  metrics = [ _autoscaling_metrics ]
19
- min = args[:min] || 0
19
+ min = (args[:min] || 0).to_i
20
20
  max = min if max < min
21
21
  notifications = (args[:notifications] || []).collect{|v| _autoscaling_notification(v) }
22
22
  placement = args[:placement] || ""
@@ -5,14 +5,17 @@
5
5
  require 'kumogata/template/helper'
6
6
  require 'kumogata/template/ec2'
7
7
 
8
+ args[:block_device] = [] unless args.key? :block_device
9
+ args[:block_device] += _ec2_to_block_device_ecs(args) if args.key? :ecs
10
+
8
11
  name = _resource_name(args[:name], "autoscaling launch configuration")
9
- instance_type = _ref_string("instance_type", args, "instance type")
10
- associate = _bool("associate", args, false)
12
+ public_ip = _bool("public_ip", args, false)
11
13
  block_device = (args[:block_device] || []).collect{|v| _ec2_block_device(v) }
12
14
  iam_instance = _ref_string("iam_instance", args, "iam instance profile")
13
- image = _ec2_image(instance_type, args)
15
+ image = _ec2_image(args)
14
16
  instance = args[:instance] || ""
15
17
  instance_monitoring = _bool("instance_monitoring", args, true)
18
+ instance_type = _ref_string("instance_type", args, "instance type")
16
19
  kernel = args[:kernel] || ""
17
20
  key_name = _ref_string("key_name", args, "key name")
18
21
  placement = _ref_string("placement", args)
@@ -24,7 +27,7 @@ user_data = _ec2_user_data(args)
24
27
  _(name) do
25
28
  Type "AWS::AutoScaling::LaunchConfiguration"
26
29
  Properties do
27
- AssociatePublicIpAddress associate
30
+ AssociatePublicIpAddress public_ip
28
31
  BlockDeviceMappings block_device unless block_device.empty?
29
32
  #ClassicLinkVPCId
30
33
  #ClassicLinkVPCSecurityGroups
@@ -7,7 +7,6 @@ require 'kumogata/template/autoscaling'
7
7
 
8
8
  name = _resource_name(args[:name], "autoscaling scheduled action")
9
9
  autoscaling = _ref_string("autoscaling", args, "autoscaling group")
10
- autoscaling = _ref_resource_name(args, "autoscaling group") if autoscaling.empty?
11
10
  desired = _integer("desired", args, -1)
12
11
  end_time =
13
12
  if args.key? :end_time
@@ -6,9 +6,9 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/certificate'
7
7
 
8
8
  name = _resource_name(args[:name], "certificate")
9
- domain = args[:domain]
9
+ domain = _ref_string("domain", args, "domain")
10
10
  validation = _certificate_validations(args)
11
- subject = args[:subject] || ""
11
+ subject = _ref_array("subject", args)
12
12
 
13
13
  _(name) do
14
14
  Type "AWS::CertificateManager::Certificate"
@@ -7,10 +7,14 @@ require 'kumogata/template/cloudfront'
7
7
 
8
8
  name = _resource_name(args[:name], "distribution")
9
9
  config = _cloudfront_distribution_config(args)
10
+ depends = _depends([ { function1: 'lambda function' } ], args)
11
+ tags = _tags(args)
10
12
 
11
13
  _(name) do
12
14
  Type "AWS::CloudFront::Distribution"
13
15
  Properties do
14
16
  DistributionConfig config
17
+ Tags tags
15
18
  end
19
+ DependsOn depends unless depends.empty?
16
20
  end
@@ -0,0 +1,19 @@
1
+ #
2
+ # CloudFront origin access identity
3
+ # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-cloudfrontoriginaccessidentity.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "origin access identity")
8
+ comment = args[:comment] || "access-identity-#{args[:name]}"
9
+ depends = _depends([], args)
10
+
11
+ _(name) do
12
+ Type "AWS::CloudFront::CloudFrontOriginAccessIdentity"
13
+ Properties do
14
+ CloudFrontOriginAccessIdentityConfig _{
15
+ Comment comment
16
+ }
17
+ end
18
+ DependsOn depends unless depends.empty?
19
+ end
@@ -1,11 +1,10 @@
1
1
  #
2
- # Cloudtrail Trail resource
2
+ # CloudTrail Trail resource
3
3
  # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html
4
4
  #
5
5
  require 'kumogata/template/helper'
6
6
 
7
7
  name = _resource_name(args[:name], "trail")
8
- depends = args[:depends] || []
9
8
  group = _ref_attr_string("group", "Arn", args)
10
9
  role = _ref_attr_string("role", "Arn", args)
11
10
  enable = _bool("enable", args, false)
@@ -20,10 +19,11 @@ sns =
20
19
  else
21
20
  ""
22
21
  end
23
- tags = _tags(args)
22
+ tags = _tags(args, "trail")
23
+ depends = _depends([], args)
24
+ trail = _name("trail", args)
24
25
 
25
26
  _(name) do
26
- DependsOn depends unless depends.empty?
27
27
  Type "AWS::CloudTrail::Trail"
28
28
  Properties do
29
29
  CloudWatchLogsLogGroupArn group unless group.empty?
@@ -37,5 +37,7 @@ _(name) do
37
37
  S3KeyPrefix s3_key unless s3_key.empty?
38
38
  SnsTopicName sns unless sns.empty?
39
39
  Tags tags unless tags.empty?
40
+ TrailName trail
40
41
  end
42
+ DependsOn depends unless depends.empty?
41
43
  end
@@ -8,11 +8,13 @@ require 'kumogata/template/cloudwatch'
8
8
  name = _resource_name(args[:name], "alarm")
9
9
  enabled = _bool("enabled", args, true)
10
10
  actions = _cloudwatch_actions(args)
11
- description = args[:description] || ""
12
- alarm_name = _ref_name("alarm_name", args)
11
+ description = _ref_string_default("description", args, '', "#{args[:name]} alarm description")
12
+ alarm_name = _name("alarm", args)
13
13
  operator = _cloudwatch_to_operator(args[:operator])
14
14
  dimensions = (args[:dimensions] || []).collect{|v| _cloudwatch_dimension(v) }
15
+ evaluate_low = args[:evaluate_low] || ""
15
16
  evaluation = args[:evaluation] || 3
17
+ ex_statistic = args[:ex_statistic] || ""
16
18
  insufficients = args[:insufficients] || []
17
19
  metric = _cloudwatch_to_metric(args[:metric])
18
20
  namespace = _cloudwatch_to_namespace(args[:namespace])
@@ -21,6 +23,7 @@ period = _cloudwatch_to_period(args[:period] || "5m")
21
23
  statistic = _valid_values(_cloudwatch_to_statistic(args[:statistic]),
22
24
  %w(SampleCount Average Sum Minimum Maximum), "Average")
23
25
  threshold = args[:threshold] || 60
26
+ treat = _valid_values(args[:treat], %w( breaching notBreaching ignore missing ), "missing")
24
27
  unit = _cloudwatch_to_unit(args[:unit])
25
28
 
26
29
  _(name) do
@@ -32,14 +35,17 @@ _(name) do
32
35
  AlarmName alarm_name
33
36
  ComparisonOperator operator
34
37
  Dimensions dimensions
38
+ EvaluateLowSampleCountPercentile evaluate_low unless evaluate_low.empty?
35
39
  EvaluationPeriods evaluation
40
+ ExtendedStatistic ex_statistic unless ex_statistic.empty?
36
41
  InsufficientDataActions insufficients unless insufficients.empty?
37
42
  MetricName metric
38
43
  Namespace namespace
39
44
  OKActions ok_actions unless ok_actions.empty?
40
45
  Period period
41
- Statistic statistic
46
+ Statistic statistic if ex_statistic.empty?
42
47
  Threshold threshold
48
+ TreatMissingData treat
43
49
  Unit unit unless unit.empty?
44
50
  end
45
51
  end
@@ -7,13 +7,13 @@ require 'kumogata/template/codebuild'
7
7
 
8
8
  name = _resource_name(args[:name], "codebuild project")
9
9
  artifacts = _codebuild_artifacts(args[:artifacts])
10
- description = args[:description] || ""
10
+ description = _ref_string_default("description", args, '', "#{args[:name]} codebuild project description")
11
11
  encryption = args[:encryption] || ""
12
12
  environment =_codebuild_environement(args[:environment])
13
- project = _ref_name_default("project", args)
13
+ project = _name("project", args)
14
14
  service = _ref_attr_string("service", "Arn", args, "role")
15
15
  source = _codebuild_source(args[:source])
16
- tags = _tags(args)
16
+ tags = _tags(args, "project")
17
17
  timeout = _valid_numbers(args[:timeout], min = 5, max = 480, 0)
18
18
 
19
19
  _(name) do
@@ -6,8 +6,8 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/codecommit'
7
7
 
8
8
  name = _resource_name(args[:name], "codecommit repository")
9
- description = args[:description] || ""
10
- repository = _ref_name_default("repository", args)
9
+ description = _ref_string_default("description", args, '', "#{args[:name]} codecommit repository description")
10
+ repository = _name("repository", args)
11
11
  triggers = _codecommit_triggers(args)
12
12
 
13
13
  _(name) do
@@ -5,7 +5,7 @@
5
5
  require 'kumogata/template/helper'
6
6
 
7
7
  name = _resource_name(args[:name], "codedeploy application")
8
- application = _ref_name("application", args)
8
+ application = _name("application", args)
9
9
 
10
10
  _(name) do
11
11
  Type "AWS::CodeDeploy::Application"
@@ -6,7 +6,7 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/codedeploy'
7
7
 
8
8
  name = _resource_name(args[:name], "deployment config")
9
- deployment = _ref_name("deployment", args, "codedeploy deployment")
9
+ deployment = _name("deployment", args)
10
10
  minimum =
11
11
  if args.key? :minimum
12
12
  _codedeploy_minimum(args[:minimum])
@@ -6,6 +6,7 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/codedeploy'
7
7
 
8
8
  name = _resource_name(args[:name], "deployment group")
9
+ alarm = _codedeploy_alarm(args)
9
10
  application = _ref_string("application", args, "codedeploy application")
10
11
  autoscalings = _ref_array("autoscalings", args, "autoscaling group")
11
12
  deployment =
@@ -23,6 +24,7 @@ service = _ref_string("service", args, "service role")
23
24
  _(name) do
24
25
  Type "AWS::CodeDeploy::DeploymentGroup"
25
26
  Properties do
27
+ AlarmConfiguration alarm unless alarm.empty?
26
28
  ApplicationName application
27
29
  AutoScalingGroups autoscalings unless autoscalings.empty?
28
30
  Deployment deployment unless deployment.empty?
@@ -0,0 +1,34 @@
1
+ #
2
+ # Cognito Identity Pool resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/cognito'
7
+
8
+ name = _resource_name(args[:name], "identity pool")
9
+ pool = _name("pool", args, "_")
10
+ allow_unauth = _bool("unauth", args, false)
11
+ developer = _ref_string_default("developer", args)
12
+ supported = args[:supported] || ""
13
+ providers = _cognito_providers(args)
14
+ saml_providers = args[:saml_providers] || []
15
+ open_id_providers = args[:open_id_providers] || []
16
+ stream = args[:stream] || ""
17
+ push_sync = _cognito_push_sync(args)
18
+ events = args[:events] || ""
19
+
20
+ _(name) do
21
+ Type "AWS::Cognito::IdentityPool"
22
+ Properties do
23
+ IdentityPoolName pool
24
+ AllowUnauthenticatedIdentities allow_unauth
25
+ DeveloperProviderName developer unless developer.empty?
26
+ SupportedLoginProviders supported unless supported.empty?
27
+ CognitoIdentityProviders providers unless providers.empty?
28
+ SamlProviderARNs saml_providers unless saml_providers.empty?
29
+ OpenIdConnectProviderARNs open_id_providers unless open_id_providers.empty?
30
+ CognitoStreams stream unless stream.empty?
31
+ PushSync push_sync unless push_sync.empty?
32
+ CognitoEvents events unless events.empty?
33
+ end
34
+ end
@@ -0,0 +1,22 @@
1
+ #
2
+ # Cognito Identity Pool Role Attachment resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/cognito'
7
+
8
+ name = _resource_name(args[:name], "identity pool role attachment")
9
+ pool_id = _ref_string("pool", args, "identity pool")
10
+ mapping = _ref_string("mapping", args)
11
+ roles = _cognito_roles(args)
12
+ depends = _depends([ { ref_auth_role: "role" }, { ref_unauth_role: "role" } ], args)
13
+
14
+ _(name) do
15
+ Type "AWS::Cognito::IdentityPoolRoleAttachment"
16
+ Properties do
17
+ IdentityPoolId pool_id
18
+ RoleMappings mapping unless mapping.empty?
19
+ Roles roles
20
+ end
21
+ DependsOn depends unless depends.empty?
22
+ end
@@ -0,0 +1,28 @@
1
+ #
2
+ # Cognito User Pool Client resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/cognito'
7
+
8
+ name = _resource_name(args[:name], "user pool client")
9
+ client = _name("client", args)
10
+ auth_flows = args[:auth_flows] || [] # ADMIN_NO_SRP_AUTH or CUSTOM_AUTH_FLOW_ONLY
11
+ secret = _bool("secret", args, false)
12
+ read_attributes = args[:read_attributes] || []
13
+ refresh = args[:refresh] || 30
14
+ pool = _ref_string("pool", args, "user pool")
15
+ write_attributes = args[:write_attributes] || []
16
+
17
+ _(name) do
18
+ Type "AWS::Cognito::UserPoolClient"
19
+ Properties do
20
+ ClientName client
21
+ ExplicitAuthFlows auth_flows unless auth_flows.empty?
22
+ GenerateSecret secret
23
+ ReadAttributes read_attributes unless read_attributes.empty?
24
+ RefreshTokenValidity refresh
25
+ UserPoolId pool
26
+ WriteAttributes write_attributes unless write_attributes.empty?
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ #
2
+ # Cognito User Pool Group resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/cognito'
7
+
8
+ name = _resource_name(args[:name], "user pool group")
9
+ description = _ref_string_default("description", args, '', "#{args[:name]} user pool description")
10
+ group = _name("group", args)
11
+ precedence = args[:precedence] || ""
12
+ role = _ref_string_default("role", args, "role")
13
+ pool = _ref_string("pool", args, "user pool")
14
+
15
+ _(name) do
16
+ Type "AWS::Cognito::UserPoolGroup"
17
+ Properties do
18
+ Description description unless description.empty?
19
+ GroupName group
20
+ Precedence precedence unless precedence.empty?
21
+ RoleArn role unless role.empty?
22
+ UserPoolId pool
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ #
2
+ # Cognito User Pool User To Group Attachment resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolusertogroupattachment.html#w2ab2c19c10d216b9
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/cognito'
7
+
8
+ name = _resource_name(args[:name], "user pool user to group attachment")
9
+ group = _ref_string("group", args, "user pool group")
10
+ user_name = _ref_string("user", args, "user pool user")
11
+ pool = _ref_string("pool", args, "user pool")
12
+
13
+ _(name) do
14
+ Type "AWS::Cognito::UserPoolUserToGroupAttachment"
15
+ Properties do
16
+ GroupName group
17
+ Username user_name
18
+ UserPoolId pool
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ #
2
+ # Cognito User Pool User resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/cognito'
7
+
8
+ name = _resource_name(args[:name], "user pool user")
9
+ mediums = args[:mediums] || [ 'sms' ]
10
+ force = _bool("force", args, false)
11
+ attributes = (args[:attributes] || []).collect{|v| _pair_name_value({ attribute: v }, 'attribute') }
12
+ message = _valid_values(args, %w( resend suppress ), "")
13
+ user = _name("user", args)
14
+ pool = _ref_string("pool", args, "user pool")
15
+ validations = (args[:validations] || []).collect{|v| _pair_name_value({ validation: v }, 'validation') }
16
+
17
+ _(name) do
18
+ Type "AWS::Cognito::UserPoolUser"
19
+ Properties do
20
+ DesiredDeliveryMediums mediums.collect{|v| v.upcase }
21
+ ForceAliasCreation force
22
+ UserAttributes attributes.flatten unless attributes.empty?
23
+ MessageAction message.upcase unless message.empty?
24
+ Username user
25
+ UserPoolId pool
26
+ ValidationData validations.flatten unless validations.empty?
27
+ end
28
+ end