Changed: DB Params
This commit is contained in:
19
templ/storybook/_example/cdk/.gitignore
vendored
Normal file
19
templ/storybook/_example/cdk/.gitignore
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# go.sum should be committed
|
||||
!go.sum
|
||||
|
||||
# CDK asset staging directory
|
||||
.cdk.staging
|
||||
cdk.out
|
14
templ/storybook/_example/cdk/README.md
Normal file
14
templ/storybook/_example/cdk/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Welcome to your CDK Go project!
|
||||
|
||||
This is a blank project for Go development with CDK.
|
||||
|
||||
**NOTICE**: Go support is still in Developer Preview. This implies that APIs may
|
||||
change while we address early feedback from the community. We would love to hear
|
||||
about your experience through GitHub issues.
|
||||
|
||||
## Useful commands
|
||||
|
||||
* `cdk deploy` deploy this stack to your default AWS account/region
|
||||
* `cdk diff` compare deployed stack with current state
|
||||
* `cdk synth` emits the synthesized CloudFormation template
|
||||
* `go test` run unit tests
|
87
templ/storybook/_example/cdk/cdk.go
Normal file
87
templ/storybook/_example/cdk/cdk.go
Normal file
@@ -0,0 +1,87 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-cdk-go/awscdk/v2"
|
||||
"github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
|
||||
"github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2"
|
||||
awsapigatewayv2 "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2"
|
||||
awsapigatewayv2integrations "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha/v2"
|
||||
awslambdago "github.com/aws/aws-cdk-go/awscdklambdagoalpha/v2"
|
||||
"github.com/aws/constructs-go/constructs/v10"
|
||||
"github.com/aws/jsii-runtime-go"
|
||||
)
|
||||
|
||||
type CdkStackProps struct {
|
||||
awscdk.StackProps
|
||||
}
|
||||
|
||||
func NewCdkStack(scope constructs.Construct, id string, props *CdkStackProps) awscdk.Stack {
|
||||
var sprops awscdk.StackProps
|
||||
if props != nil {
|
||||
sprops = props.StackProps
|
||||
}
|
||||
stack := awscdk.NewStack(scope, &id, &sprops)
|
||||
|
||||
bundlingOptions := &awslambdago.BundlingOptions{
|
||||
GoBuildFlags: &[]*string{jsii.String(`-ldflags "-s -w"`)},
|
||||
}
|
||||
|
||||
f := awslambdago.NewGoFunction(stack, jsii.String("storybookHandler"), &awslambdago.GoFunctionProps{
|
||||
Runtime: awslambda.Runtime_GO_1_X(),
|
||||
Entry: jsii.String("../lambda"),
|
||||
Bundling: bundlingOptions,
|
||||
MemorySize: jsii.Number(1024),
|
||||
Timeout: awscdk.Duration_Millis(jsii.Number(15000)),
|
||||
})
|
||||
fi := awsapigatewayv2integrations.NewHttpLambdaIntegration(jsii.String("handlerIntegration"), f, &awsapigatewayv2integrations.HttpLambdaIntegrationProps{
|
||||
PayloadFormatVersion: awscdkapigatewayv2alpha.PayloadFormatVersion_VERSION_2_0(),
|
||||
})
|
||||
endpoint := awsapigatewayv2.NewHttpApi(stack, jsii.String("storybookHttpApi"), &awsapigatewayv2.HttpApiProps{
|
||||
DefaultIntegration: fi,
|
||||
})
|
||||
awscdk.NewCfnOutput(stack, jsii.String("storybookEndpointUrl"), &awscdk.CfnOutputProps{
|
||||
ExportName: jsii.String("storybookEndpointUrl"),
|
||||
Value: endpoint.Url(),
|
||||
})
|
||||
|
||||
return stack
|
||||
}
|
||||
|
||||
func main() {
|
||||
app := awscdk.NewApp(nil)
|
||||
|
||||
NewCdkStack(app, "templStorybookExample", &CdkStackProps{
|
||||
awscdk.StackProps{
|
||||
Env: env(),
|
||||
},
|
||||
})
|
||||
|
||||
app.Synth(nil)
|
||||
}
|
||||
|
||||
// env determines the AWS environment (account+region) in which our stack is to
|
||||
// be deployed. For more information see: https://docs.aws.amazon.com/cdk/latest/guide/environments.html
|
||||
func env() *awscdk.Environment {
|
||||
// If unspecified, this stack will be "environment-agnostic".
|
||||
// Account/Region-dependent features and context lookups will not work, but a
|
||||
// single synthesized template can be deployed anywhere.
|
||||
//---------------------------------------------------------------------------
|
||||
return nil
|
||||
|
||||
// Uncomment if you know exactly what account and region you want to deploy
|
||||
// the stack to. This is the recommendation for production stacks.
|
||||
//---------------------------------------------------------------------------
|
||||
// return &awscdk.Environment{
|
||||
// Account: jsii.String("123456789012"),
|
||||
// Region: jsii.String("us-east-1"),
|
||||
// }
|
||||
|
||||
// Uncomment to specialize this stack for the AWS Account and Region that are
|
||||
// implied by the current CLI configuration. This is recommended for dev
|
||||
// stacks.
|
||||
//---------------------------------------------------------------------------
|
||||
// return &awscdk.Environment{
|
||||
// Account: jsii.String(os.Getenv("CDK_DEFAULT_ACCOUNT")),
|
||||
// Region: jsii.String(os.Getenv("CDK_DEFAULT_REGION")),
|
||||
// }
|
||||
}
|
18
templ/storybook/_example/cdk/cdk.json
Normal file
18
templ/storybook/_example/cdk/cdk.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"app": "go mod download && go run cdk.go",
|
||||
"context": {
|
||||
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
|
||||
"@aws-cdk/core:enableStackNameDuplicates": "true",
|
||||
"aws-cdk:enableDiffNoFail": "true",
|
||||
"@aws-cdk/core:stackRelativeExports": "true",
|
||||
"@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true,
|
||||
"@aws-cdk/aws-secretsmanager:parseOwnedSecretName": true,
|
||||
"@aws-cdk/aws-kms:defaultKeyPolicies": true,
|
||||
"@aws-cdk/aws-s3:grantWriteWithoutAcl": true,
|
||||
"@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount": true,
|
||||
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
|
||||
"@aws-cdk/aws-efs:defaultEncryptionAtRest": true,
|
||||
"@aws-cdk/aws-lambda:recognizeVersionProps": true,
|
||||
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true
|
||||
}
|
||||
}
|
4
templ/storybook/_example/cdk/deploy.sh
Executable file
4
templ/storybook/_example/cdk/deploy.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
# Build the Storybook.
|
||||
`cd ../lambda && go run main.go build`
|
||||
# Deploy it.
|
||||
cdk deploy
|
Reference in New Issue
Block a user