func NewHelloWorldStack()

in hello-world/go/hello-world.go [20:53]


func NewHelloWorldStack(scope constructs.Construct, id string, props *HelloWorldStackProps) awscdk.Stack {
	var sprops awscdk.StackProps
	if props != nil {
		sprops = props.StackProps
	}

	stack := awscdk.NewStack(scope, &id, &sprops)

	// Define an S3 construct. Some of the properties are default values, but they're listed here for demonstration purposes
	awsS3 := awss3.NewBucket(stack, jsii.String("MyS3"), &awss3.BucketProps{
		Versioned:         jsii.Bool(false),
		AutoDeleteObjects: jsii.Bool(false),
		BlockPublicAccess: awss3.BlockPublicAccess_BLOCK_ALL(),
		BucketName:        jsii.String("my-happy-bucket-name"),
		Encryption:        awss3.BucketEncryption_S3_MANAGED,
		RemovalPolicy:     awscdk.RemovalPolicy_RETAIN,
	})

	// Specify that the file "files/hello_world.txt" should be added to the new Bucket
	curPath, _ := os.Getwd()
	filesPath := curPath + string(os.PathSeparator) + "files"

	hwAssets := make([]awss3deployment.ISource, 1)
	hwAssets[0] = awss3deployment.Source_Asset(&filesPath, &awss3assets.AssetOptions{
		Exclude: jsii.Strings("**", "!hello_world.txt"),
	})

	awss3deployment.NewBucketDeployment(stack, jsii.String("MyHelloWorldFile"), &awss3deployment.BucketDeploymentProps{
		DestinationBucket: awsS3,
		Sources:           &hwAssets,
	})

	return stack
}