I have this lambda go code, which approves a code deploy manual action step at a certain stage.
If the preview stage was successful then lambda will auto-approve the action. If not, then someone will have to check and do it manually. As a starting point, I wrote this code to always auto-approve, before adding more complex logic.
I'm having a hard time with something so simple as entering PutApprovalResult documentation and ApprovalResult documentation. Been looking everywhere for examples but nothing. Can someone give me a hand here, please?
My code:
func auto_approve(pipeName, stageName, actionName, token string){
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("eu-central-1"))
if err != nil {
log.Fatal(err)
}
client := codepipeline.NewFromConfig(cfg)
//approve := { Status: "Approved", Summary: "Approved by lambda" }
client.PutApprovalResult(context.TODO(), &codepipeline.PutApprovalResultInput{
ActionName: &actionName,
StageName: &stageName,
PipelineName: &pipeName,
Token: &token,
Result: { Status: "Approved", Summary: "Approved by lambda"}, \\Here is the problem
})
return
}