UNPKG

projen-statemachine-example

Version:

An example construct for deploying to npm, PyPi, Maven, and Nuget with Amazon API Gateway and AWS Step Functions.

958 lines 44.4 kB
{ "version": "tree-0.1", "tree": { "id": "App", "path": "", "children": { "Tree": { "id": "Tree", "path": "Tree", "constructInfo": { "fqn": "@aws-cdk/core.Construct", "version": "1.104.0" } }, "TypescriptStack": { "id": "TypescriptStack", "path": "TypescriptStack", "children": { "KerKer": { "id": "KerKer", "path": "TypescriptStack/KerKer", "children": { "ApiGatewayPetStoreApi": { "id": "ApiGatewayPetStoreApi", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::RestApi", "aws:cdk:cloudformation:props": { "description": "Your first API with Amazon API Gateway. This is a sample API that integrates via HTTP with our demo Pet Store endpoints.", "endpointConfiguration": { "types": [ "REGIONAL" ] }, "name": "PetStore" } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnRestApi", "version": "1.104.0" } }, "CloudWatchRole": { "id": "CloudWatchRole", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/CloudWatchRole", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/CloudWatchRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { "assumeRolePolicyDocument": { "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": "apigateway.amazonaws.com" } } ], "Version": "2012-10-17" }, "managedPolicyArns": [ { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" ] ] } ] } }, "constructInfo": { "fqn": "@aws-cdk/aws-iam.CfnRole", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-iam.Role", "version": "1.104.0" } }, "Account": { "id": "Account", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Account", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Account", "aws:cdk:cloudformation:props": { "cloudWatchRoleArn": { "Fn::GetAtt": [ "KerKerApiGatewayPetStoreApiCloudWatchRoleEC1F55E0", "Arn" ] } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnAccount", "version": "1.104.0" } }, "Deployment": { "id": "Deployment", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Deployment", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Deployment/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Deployment", "aws:cdk:cloudformation:props": { "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "description": "Automatically created by the RestApi construct" } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnDeployment", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Deployment", "version": "1.104.0" } }, "DeploymentStage.default": { "id": "DeploymentStage.default", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/DeploymentStage.default", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/DeploymentStage.default/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Stage", "aws:cdk:cloudformation:props": { "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "deploymentId": { "Ref": "KerKerApiGatewayPetStoreApiDeployment5EC0C45282594ef1a2ef3f6f30f948fa77aa1373" }, "stageName": "default" } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnStage", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Stage", "version": "1.104.0" } }, "Endpoint": { "id": "Endpoint", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Endpoint", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "1.104.0" } }, "Default": { "id": "Default", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Default", "children": { "pets": { "id": "pets", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Default/pets", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Default/pets/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Resource", "aws:cdk:cloudformation:props": { "parentId": { "Fn::GetAtt": [ "KerKerApiGatewayPetStoreApi9BA24AA9", "RootResourceId" ] }, "pathPart": "pets", "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnResource", "version": "1.104.0" } }, "GET": { "id": "GET", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Default/pets/GET", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Default/pets/GET/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", "aws:cdk:cloudformation:props": { "httpMethod": "GET", "resourceId": { "Ref": "KerKerApiGatewayPetStoreApipetsD7F79E3C" }, "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "authorizationType": "AWS_IAM", "integration": { "type": "HTTP", "uri": { "Fn::Join": [ "", [ "http://petstore.execute-api.", { "Ref": "AWS::Region" }, ".amazonaws.com/petstore/pets" ] ] }, "integrationHttpMethod": "GET", "passthroughBehavior": "WHEN_NO_MATCH", "integrationResponses": [ { "statusCode": "200" } ] }, "methodResponses": [ { "statusCode": "200", "responseModels": { "application/json": { "Ref": "KerKerApiGatewayPetStoreApiPetsModel08B53F16" } } } ] } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnMethod", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Method", "version": "1.104.0" } }, "POST": { "id": "POST", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Default/pets/POST", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Default/pets/POST/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", "aws:cdk:cloudformation:props": { "httpMethod": "POST", "resourceId": { "Ref": "KerKerApiGatewayPetStoreApipetsD7F79E3C" }, "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "authorizationType": "AWS_IAM", "integration": { "type": "HTTP", "uri": { "Fn::Join": [ "", [ "http://petstore.execute-api.", { "Ref": "AWS::Region" }, ".amazonaws.com/petstore/pets" ] ] }, "integrationHttpMethod": "POST", "passthroughBehavior": "WHEN_NO_MATCH", "integrationResponses": [ { "statusCode": "200" } ] }, "methodResponses": [ { "statusCode": "200", "responseModels": { "application/json": { "Ref": "KerKerApiGatewayPetStoreApiNewPetResponseF627B28A" } } } ], "requestModels": { "application/json": { "Ref": "KerKerApiGatewayPetStoreApiNewPet026A479A" } } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnMethod", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Method", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Resource", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.ResourceBase", "version": "1.104.0" } }, "Pet": { "id": "Pet", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Pet", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/Pet/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Model", "aws:cdk:cloudformation:props": { "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "contentType": "application/json", "name": "Pet", "schema": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Pet Mdoel", "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "type": { "type": "string" }, "price": { "type": "number" } } } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnModel", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Model", "version": "1.104.0" } }, "PetType": { "id": "PetType", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/PetType", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/PetType/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Model", "aws:cdk:cloudformation:props": { "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "contentType": "application/json", "name": "PetType", "schema": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Pet Type", "type": "string", "enum": [ "dog", "cat", "fish", "bird", "gecko" ] } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnModel", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Model", "version": "1.104.0" } }, "PetsModel": { "id": "PetsModel", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/PetsModel", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/PetsModel/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Model", "aws:cdk:cloudformation:props": { "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "contentType": "application/json", "name": "Pets", "schema": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Pets", "type": "array", "items": { "$ref": { "Fn::Join": [ "", [ "https://apigateway.amazonaws.com/restapis/", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "/models/", { "Ref": "KerKerApiGatewayPetStoreApiPet53F8F3D3" } ] ] } } } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnModel", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Model", "version": "1.104.0" } }, "NewPet": { "id": "NewPet", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/NewPet", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/NewPet/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Model", "aws:cdk:cloudformation:props": { "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "contentType": "application/json", "name": "NewPet", "schema": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "New Pet", "type": "object", "properties": { "type": { "$ref": { "Fn::Join": [ "", [ "https://apigateway.amazonaws.com/restapis/", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "/models/", { "Ref": "KerKerApiGatewayPetStoreApiPetTypeF83A869B" } ] ] } }, "price": { "type": "number" } } } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnModel", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Model", "version": "1.104.0" } }, "NewPetResponse": { "id": "NewPetResponse", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/NewPetResponse", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/ApiGatewayPetStoreApi/NewPetResponse/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Model", "aws:cdk:cloudformation:props": { "restApiId": { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "contentType": "application/json", "name": "NewPetResponse", "schema": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "New Pet Response", "type": "object", "properties": { "pet": { "$ref": { "Fn::Join": [ "", [ "https://apigateway.amazonaws.com/restapis/", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "/models/", { "Ref": "KerKerApiGatewayPetStoreApiPet53F8F3D3" } ] ] } }, "message": { "type": "string" } } } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.CfnModel", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.Model", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-apigateway.RestApi", "version": "1.104.0" } }, "StepFunctionExecutionRole": { "id": "StepFunctionExecutionRole", "path": "TypescriptStack/KerKer/StepFunctionExecutionRole", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/StepFunctionExecutionRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { "assumeRolePolicyDocument": { "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": { "Fn::Join": [ "", [ "states.", { "Ref": "AWS::Region" }, ".amazonaws.com" ] ] } } } ], "Version": "2012-10-17" }, "description": "Execute a workflow related to API Gateway." } }, "constructInfo": { "fqn": "@aws-cdk/aws-iam.CfnRole", "version": "1.104.0" } }, "DefaultPolicy": { "id": "DefaultPolicy", "path": "TypescriptStack/KerKer/StepFunctionExecutionRole/DefaultPolicy", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/StepFunctionExecutionRole/DefaultPolicy/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Policy", "aws:cdk:cloudformation:props": { "policyDocument": { "Statement": [ { "Action": "execute-api:Invoke", "Effect": "Allow", "Resource": [ { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":execute-api:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "/default/GET/pets" ] ] }, { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":execute-api:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "/default/POST/pets" ] ] } ], "Sid": "ApiGatewayExecutionPermissions" }, { "Action": "execute-api:Invoke", "Effect": "Allow", "Resource": { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":execute-api:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "/default/POST/pets" ] ] } }, { "Action": "execute-api:Invoke", "Effect": "Allow", "Resource": { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":execute-api:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, "/default/GET/pets" ] ] } } ], "Version": "2012-10-17" }, "policyName": "KerKerStepFunctionExecutionRoleDefaultPolicy827D55A3", "roles": [ { "Ref": "KerKerStepFunctionExecutionRoleE8FEF4EC" } ] } }, "constructInfo": { "fqn": "@aws-cdk/aws-iam.CfnPolicy", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-iam.Policy", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-iam.Role", "version": "1.104.0" } }, "Add Pet to Store": { "id": "Add Pet to Store", "path": "TypescriptStack/KerKer/Add Pet to Store", "constructInfo": { "fqn": "@aws-cdk/aws-stepfunctions-tasks.CallApiGatewayRestApiEndpoint", "version": "1.104.0" } }, "Retrieve Pet Store Data": { "id": "Retrieve Pet Store Data", "path": "TypescriptStack/KerKer/Retrieve Pet Store Data", "constructInfo": { "fqn": "@aws-cdk/aws-stepfunctions-tasks.CallApiGatewayRestApiEndpoint", "version": "1.104.0" } }, "Failure": { "id": "Failure", "path": "TypescriptStack/KerKer/Failure", "constructInfo": { "fqn": "@aws-cdk/aws-stepfunctions.Fail", "version": "1.104.0" } }, "Pet was Added Successfully?": { "id": "Pet was Added Successfully?", "path": "TypescriptStack/KerKer/Pet was Added Successfully?", "constructInfo": { "fqn": "@aws-cdk/aws-stepfunctions.Choice", "version": "1.104.0" } }, "StateMachine": { "id": "StateMachine", "path": "TypescriptStack/KerKer/StateMachine", "children": { "Resource": { "id": "Resource", "path": "TypescriptStack/KerKer/StateMachine/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", "aws:cdk:cloudformation:props": { "roleArn": { "Fn::GetAtt": [ "KerKerStepFunctionExecutionRoleE8FEF4EC", "Arn" ] }, "definitionString": { "Fn::Join": [ "", [ "{\"StartAt\":\"Add Pet to Store\",\"States\":{\"Add Pet to Store\":{\"Next\":\"Pet was Added Successfully?\",\"Type\":\"Task\",\"Resource\":\"arn:", { "Ref": "AWS::Partition" }, ":states:::apigateway:invoke\",\"Parameters\":{\"ApiEndpoint\":\"", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, ".execute-api.", { "Ref": "AWS::Region" }, ".", { "Ref": "AWS::URLSuffix" }, "\",\"Method\":\"POST\",\"Stage\":\"default\",\"Path\":\"/pets\",\"RequestBody\":\"$.NewPet\",\"AuthType\":\"IAM_ROLE\"},\"ResultSelector\":{\"ResponseBody.$\":\"$.ResponseBody\"}},\"Pet was Added Successfully?\":{\"Type\":\"Choice\",\"Choices\":[{\"Variable\":\"$.ResponseBody.errors\",\"IsPresent\":true,\"Next\":\"Failure\"}],\"Default\":\"Retrieve Pet Store Data\"},\"Retrieve Pet Store Data\":{\"End\":true,\"Type\":\"Task\",\"ResultPath\":\"$.ExistingPets\",\"Resource\":\"arn:", { "Ref": "AWS::Partition" }, ":states:::apigateway:invoke\",\"Parameters\":{\"ApiEndpoint\":\"", { "Ref": "KerKerApiGatewayPetStoreApi9BA24AA9" }, ".execute-api.", { "Ref": "AWS::Region" }, ".", { "Ref": "AWS::URLSuffix" }, "\",\"Method\":\"GET\",\"Stage\":\"default\",\"Path\":\"/pets\",\"AuthType\":\"IAM_ROLE\"},\"ResultSelector\":{\"Pets.$\":\"$.ResponseBody\"}},\"Failure\":{\"Type\":\"Fail\"}}}" ] ] } } }, "constructInfo": { "fqn": "@aws-cdk/aws-stepfunctions.CfnStateMachine", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/aws-stepfunctions.StateMachine", "version": "1.104.0" } } }, "constructInfo": { "fqn": "projen-statemachine-example.StateMachineApiGatewayExample", "version": "0.0.0" } }, "OStateMachine": { "id": "OStateMachine", "path": "TypescriptStack/OStateMachine", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "1.104.0" } }, "OExecutionOutput": { "id": "OExecutionOutput", "path": "TypescriptStack/OExecutionOutput", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "1.104.0" } }, "CDKMetadata": { "id": "CDKMetadata", "path": "TypescriptStack/CDKMetadata", "children": { "Default": { "id": "Default", "path": "TypescriptStack/CDKMetadata/Default", "constructInfo": { "fqn": "@aws-cdk/core.CfnResource", "version": "1.104.0" } }, "Condition": { "id": "Condition", "path": "TypescriptStack/CDKMetadata/Condition", "constructInfo": { "fqn": "@aws-cdk/core.CfnCondition", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/core.Construct", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/core.Stack", "version": "1.104.0" } } }, "constructInfo": { "fqn": "@aws-cdk/core.App", "version": "1.104.0" } } }