-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(migrate): add go and update tests (#27226)
---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
1 parent
a2a4f68
commit a32674a
Showing
9 changed files
with
117 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/aws-cdk/test/commands/test-resources/stacks/S3Stack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.acme.test.simple; | ||
package com.myorg; | ||
|
||
import software.constructs.Construct; | ||
|
||
|
87 changes: 87 additions & 0 deletions
87
packages/aws-cdk/test/commands/test-resources/stacks/s3.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package main | ||
|
||
import ( | ||
cdk "github.com/aws/aws-cdk-go/awscdk/v2" | ||
s3 "github.com/aws/aws-cdk-go/awscdk/v2/awss3" | ||
"github.com/aws/constructs-go/constructs/v10" | ||
"github.com/aws/jsii-runtime-go" | ||
) | ||
|
||
type GoodGoStackProps struct { | ||
cdk.StackProps | ||
} | ||
|
||
/// AWS CloudFormation Sample Template S3_Website_Bucket_With_Retain_On_Delete: Sample template showing how to create a publicly accessible S3 bucket configured for website access with a deletion policy of retain on delete. | ||
type GoodGoStack struct { | ||
cdk.Stack | ||
/// URL for website hosted on S3 | ||
WebsiteUrl interface{} // TODO: fix to appropriate type | ||
/// Name of S3 bucket to hold website content | ||
S3BucketSecureUrl interface{} // TODO: fix to appropriate type | ||
} | ||
|
||
func NewGoodGoStack(scope constructs.Construct, id string, props GoodGoStackProps) *GoodGoStack { | ||
stack := cdk.NewStack(scope, &id, &props.StackProps) | ||
|
||
s3Bucket := s3.NewCfnBucket( | ||
stack, | ||
jsii.String("S3Bucket"), | ||
&s3.CfnBucketProps{ | ||
AccessControl: jsii.String("PublicRead"), | ||
WebsiteConfiguration: &WebsiteConfiguration/* FIXME */{ | ||
IndexDocument: jsii.String("index.html"), | ||
ErrorDocument: jsii.String("error.html"), | ||
}, | ||
}, | ||
) | ||
|
||
return &GoodGoStack{ | ||
Stack: stack, | ||
WebsiteUrl: s3Bucket.AttrWebsiteUrl(), | ||
S3BucketSecureUrl: cdk.Fn_Join(jsii.String(""), &[]*string{ | ||
jsii.String("https://"), | ||
s3Bucket.AttrDomainName(), | ||
}), | ||
} | ||
} | ||
|
||
func main() { | ||
defer jsii.Close() | ||
|
||
app := awscdk.NewApp(nil) | ||
|
||
NewGoodGoStack(app, "GoodGo", &GoodGoStackProps{ | ||
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")), | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters