| 1 | package sarif |
| 2 | |
| 3 | import "time" |
| 4 | |
| 5 | // Invocation describes the runtime environment of the analysis tool run. |
| 6 | type Invocation struct { |
| 7 | PropertyBag |
| 8 | StartTimeUTC *time.Time `json:"startTimeUtc,omitempty"` |
| 9 | EndTimeUTC *time.Time `json:"endTimeUtc,omitempty"` |
| 10 | ExecutionSuccessful bool `json:"executionSuccessful"` |
| 11 | WorkingDirectory *ArtifactLocation `json:"workingDirectory,omitempty"` |
| 12 | } |
| 13 | |
| 14 | // WithStartTimeUTC sets the instant when the invocation started and returns the same Invocation. |
| 15 | func (i *Invocation) WithStartTimeUTC(startTime time.Time) *Invocation { |
| 16 | startTimeUTC := startTime.UTC() |
| 17 | i.StartTimeUTC = &startTimeUTC |
| 18 | return i |
| 19 | } |
| 20 | |
| 21 | // WithEndTimeUTC sets the instant when the invocation ended and returns the same Invocation. |
| 22 | func (i *Invocation) WithEndTimeUTC(endTime time.Time) *Invocation { |
| 23 | endTimeUTC := endTime.UTC() |
| 24 | i.EndTimeUTC = &endTimeUTC |
| 25 | return i |
| 26 | } |
| 27 | |
| 28 | // WithWorkingDirectory sets the current working directory of the invocation and returns the same Invocation. |
| 29 | func (i *Invocation) WithWorkingDirectory(workingDirectory *ArtifactLocation) *Invocation { |
| 30 | i.WorkingDirectory = workingDirectory |
| 31 | return i |
| 32 | } |