-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice.go
More file actions
33 lines (28 loc) · 791 Bytes
/
service.go
File metadata and controls
33 lines (28 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/codepipeline"
)
type codepipelineService struct {
*codepipeline.CodePipeline
JobID string
}
func (s *codepipelineService) successJob() error {
log.Println("Job succeeded")
_, err := s.CodePipeline.PutJobSuccessResult(&codepipeline.PutJobSuccessResultInput{
JobId: aws.String(s.JobID),
})
return err
}
func (s *codepipelineService) failJob(err error) error {
log.Println("Job failed with", err)
_, err2 := s.CodePipeline.PutJobFailureResult(&codepipeline.PutJobFailureResultInput{
JobId: aws.String(s.JobID),
FailureDetails: &codepipeline.FailureDetails{
Type: aws.String(codepipeline.FailureTypeJobFailed),
Message: aws.String(err.Error()),
},
})
return err2
}