File: invocation.go

package info (click to toggle)
golang-github-owenrumney-go-sarif 2.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 712 kB
  • sloc: makefile: 13
file content (32 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download
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
package sarif

import "time"

// Invocation describes the runtime environment of the analysis tool run.
type Invocation struct {
	PropertyBag
	StartTimeUTC        *time.Time        `json:"startTimeUtc,omitempty"`
	EndTimeUTC          *time.Time        `json:"endTimeUtc,omitempty"`
	ExecutionSuccessful bool              `json:"executionSuccessful"`
	WorkingDirectory    *ArtifactLocation `json:"workingDirectory,omitempty"`
}

// WithStartTimeUTC sets the instant when the invocation started and returns the same Invocation.
func (i *Invocation) WithStartTimeUTC(startTime time.Time) *Invocation {
	startTimeUTC := startTime.UTC()
	i.StartTimeUTC = &startTimeUTC
	return i
}

// WithEndTimeUTC sets the instant when the invocation ended and returns the same Invocation.
func (i *Invocation) WithEndTimeUTC(endTime time.Time) *Invocation {
	endTimeUTC := endTime.UTC()
	i.EndTimeUTC = &endTimeUTC
	return i
}

// WithWorkingDirectory sets the current working directory of the invocation and returns the same Invocation.
func (i *Invocation) WithWorkingDirectory(workingDirectory *ArtifactLocation) *Invocation {
	i.WorkingDirectory = workingDirectory
	return i
}