@@ -11,6 +11,7 @@ const (
1111 CodeBuildPhaseChangeDetailType = "CodeBuild Build Phase Change"
1212)
1313
14+ // CodeBuildPhaseStatus represents the status of code build phase (i.e. failed, in progress)
1415type CodeBuildPhaseStatus string
1516
1617const (
@@ -23,6 +24,7 @@ const (
2324 CodeBuildPhaseStatusTimedOut = "TIMED_OUT"
2425)
2526
27+ // CodeBuildPhaseType represents the type of the code build phase (i.e. submitted, install)
2628type CodeBuildPhaseType string
2729
2830const (
@@ -73,6 +75,7 @@ type CodeBuildEvent struct {
7375 Detail CodeBuildEventDetail `json:"detail"`
7476}
7577
78+ // CodeBuildEventDetail represents the all details related to the code build event
7679type CodeBuildEventDetail struct {
7780 BuildStatus CodeBuildPhaseStatus `json:"build-status"`
7881 ProjectName string `json:"project-name"`
@@ -90,6 +93,7 @@ type CodeBuildEventDetail struct {
9093 CompletedPhaseEnd CodeBuildTime `json:"completed-phase-end"`
9194}
9295
96+ //CodeBuildEventAdditionalInformation represents additional informations to the code build event
9397type CodeBuildEventAdditionalInformation struct {
9498 Artifact CodeBuildArtifact `json:"artifact"`
9599
@@ -110,12 +114,14 @@ type CodeBuildEventAdditionalInformation struct {
110114 Phases []CodeBuildPhase `json:"phases"`
111115}
112116
117+ // CodeBuildArtifact represents the artifact provided to build
113118type CodeBuildArtifact struct {
114119 MD5Sum string `json:"md5sum"`
115120 SHA256Sum string `json:"sha256sum"`
116121 Location string `json:"location"`
117122}
118123
124+ // CodeBuildEnvironment represents the environment for a build
119125type CodeBuildEnvironment struct {
120126 Image string `json:"image"`
121127 PrivilegedMode bool `json:"privileged-mode"`
@@ -124,6 +130,7 @@ type CodeBuildEnvironment struct {
124130 EnvironmentVariables []CodeBuildEnvironmentVariable `json:"environment-variables"`
125131}
126132
133+ // CodeBuildEnvironmentVariable encapsulate environment variables for the code build
127134type CodeBuildEnvironmentVariable struct {
128135 // Name is the name of the environment variable.
129136 Name string `json:"name"`
@@ -135,17 +142,20 @@ type CodeBuildEnvironmentVariable struct {
135142 Value string `json:"value"`
136143}
137144
145+ // CodeBuildSource represent the code source will be build
138146type CodeBuildSource struct {
139147 Location string `json:"location"`
140148 Type string `json:"type"`
141149}
142150
151+ // CodeBuildLogs gives the log details of a code build
143152type CodeBuildLogs struct {
144153 GroupName string `json:"group-name"`
145154 StreamName string `json:"stream-name"`
146155 DeepLink string `json:"deep-link"`
147156}
148157
158+ // CodeBuildPhase represents the phase of a build and its details
149159type CodeBuildPhase struct {
150160 PhaseContext []interface {} `json:"phase-context"`
151161
@@ -160,14 +170,17 @@ type CodeBuildPhase struct {
160170 PhaseStatus CodeBuildPhaseStatus `json:"phase-status"`
161171}
162172
173+ // CodeBuildTime represents the time of the build
163174type CodeBuildTime time.Time
164175
165176const codeBuildTimeFormat = "Jan 2, 2006 3:04:05 PM"
166177
178+ // MarshalJSON converts a given CodeBuildTime to json
167179func (t CodeBuildTime ) MarshalJSON () ([]byte , error ) {
168180 return json .Marshal (time .Time (t ).Format (codeBuildTimeFormat ))
169181}
170182
183+ // UnmarshalJSON converts a given json to a CodeBuildTime
171184func (t * CodeBuildTime ) UnmarshalJSON (data []byte ) error {
172185 var s string
173186 if err := json .Unmarshal (data , & s ); err != nil {
0 commit comments