55 "os"
66
77 "github.com/aws/aws-cdk-go/awscdk/v2"
8- "github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway "
8+ "github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2 "
99 "github.com/aws/constructs-go/constructs/v10"
1010 "github.com/aws/jsii-runtime-go"
1111 "github.com/fogfish/scud"
@@ -35,8 +35,11 @@ func main() {
3535 //
3636 // Stack
3737 //
38- stackID := fmt .Sprintf ("blueprint-golang-%s" , vsn (app ))
39- stack := awscdk .NewStack (app , jsii .String (stackID ), config )
38+ vsn := vsn (app )
39+ stack := awscdk .NewStack (app ,
40+ jsii .String (fmt .Sprintf ("blueprint-golang-%s" , vsn )),
41+ config ,
42+ )
4043
4144 NewBlueprint (stack )
4245
@@ -46,16 +49,17 @@ func main() {
4649// NewBlueprint create example REST api
4750func NewBlueprint (scope constructs.Construct ) {
4851 gateway := scud .NewGateway (scope , jsii .String ("Gateway" ),
49- & awsapigateway. RestApiProps {
50- RestApiName : jsii . String ( "petshop" ) ,
52+ & scud. GatewayProps {
53+ HttpApiProps : & awsapigatewayv2. HttpApiProps {} ,
5154 },
5255 )
56+ gateway .WithAuthorizerIAM ()
5357
54- myfun := scud .NewFunctionGo (scope , jsii .String ("MyFun " ),
58+ handler := scud .NewFunctionGo (scope , jsii .String ("Handler " ),
5559 & scud.FunctionGoProps {
5660 SourceCodePackage : "github.com/fogfish/blueprint-serverless-golang" ,
5761 SourceCodeLambda : "cmd/lambda/petshop" ,
5862 },
5963 )
60- gateway .AddResource ("petshop" , myfun )
64+ gateway .AddResource ("/ petshop" , handler )
6165}
0 commit comments