Debian Codegraph @

v2/sarif/invocation.go

raw
1 package sarif
2
3 import "time"
4
5 // Invocation describes the runtime environment of the analysis tool run.
6 type Invocation struct {
7 Account *string `json:"account,omitempty"`
8 Arguments []string `json:"arguments,omitempty"`
9 CommandLine *string `json:"commandLine,omitempty"`
10 EndTimeUTC *time.Time `json:"endTimeUtc,omitempty"`
11 EnvironmentVariables map[string]string `json:"environmentVariables,omitempty"`
12 ExecutableLocation *ArtifactLocation `json:"executableLocation,omitempty"`
13 ExecutionSuccessful *bool `json:"executionSuccessful"`
14 ExitCode *int `json:"exitCode,omitempty"`
15 ExitCodeDescription *string `json:"exitCodeDescription,omitempty"`
16 ExitSignalName *string `json:"exitSignalName,omitempty"`
17 ExitSignalNumber *int `json:"exitSignalNumber,omitempty"`
18 Machine *string `json:"machine,omitempty"`
19 NotificationConfigurationOverrides []*ConfigurationOverride `json:"notificationConfigurationOverrides,omitempty"`
20 ProcessID *int `json:"processId,omitempty"`
21 ProcessStartFailureMessage *string `json:"processStartFailureMessage,omitempty"`
22 ResponseFiles []*ArtifactLocation `json:"responseFiles,omitempty"`
23 RuleConfigurationOverrides []*ConfigurationOverride `json:"ruleConfigurationOverrides,omitempty"`
24 StartTimeUTC *time.Time `json:"startTimeUtc,omitempty"`
25 Stderr *ArtifactLocation `json:"stderr,omitempty"`
26 Stdin *ArtifactLocation `json:"stdin,omitempty"`
27 Stdout *ArtifactLocation `json:"stdout,omitempty"`
28 StdoutStderr *ArtifactLocation `json:"stdoutStderr,omitempty"`
29 ToolConfigurationNotifications []*Notification `json:"toolConfigurationNotifications,omitempty"`
30 ToolExecutionNotifications []*Notification `json:"toolExecutionNotifications,omitempty"`
31 WorkingDirectory *ArtifactLocation `json:"workingDirectory,omitempty"`
32 PropertyBag
33 }
34
35 // NewInvocation creates a new Invocation and returns a pointer to it
36 func NewInvocation() *Invocation {
37 return &Invocation{}
38 }
39
40 // WithAccount sets the Account
41 func (invocation *Invocation) WithAccount(account string) *Invocation {
42 invocation.Account = &account
43 return invocation
44 }
45
46 // WithArguments sets the Arguments
47 func (invocation *Invocation) WithArguments(arguments []string) *Invocation {
48 invocation.Arguments = arguments
49 return invocation
50 }
51
52 // AddArgument ...
53 func (invocation *Invocation) AddArgument(argument string) {
54 invocation.Arguments = append(invocation.Arguments, argument)
55 }
56
57 // WithCommanLine sets the CommanLine
58 func (invocation *Invocation) WithCommanLine(commandLine string) *Invocation {
59 invocation.CommandLine = &commandLine
60 return invocation
61 }
62
63 // WithEndTimeUTC sets the instant when the invocation ended and returns the same Invocation.
64 func (invocation *Invocation) WithEndTimeUTC(endTime time.Time) *Invocation {
65 endTimeUTC := endTime.UTC()
66 invocation.EndTimeUTC = &endTimeUTC
67 return invocation
68 }
69
70 // WithEnvironmentVariables sets the EnvironmentVariables
71 func (invocation *Invocation) WithEnvironmentVariables(environmentVariables map[string]string) *Invocation {
72 invocation.EnvironmentVariables = environmentVariables
73 return invocation
74 }
75
76 // SetEnvironmentVariable ...
77 func (invocation *Invocation) SetEnvironmentVariable(name, value string) {
78 invocation.EnvironmentVariables[name] = value
79 }
80
81 // WithExecutableLocation sets the ExecutableLocation
82 func (invocation *Invocation) WithExecutableLocation(executableLocation *ArtifactLocation) *Invocation {
83 invocation.ExecutableLocation = executableLocation
84 return invocation
85 }
86
87 // WithExecutionSuccess sets the ExecutionSuccess
88 func (invocation *Invocation) WithExecutionSuccess(executionSuccessful bool) *Invocation {
89 invocation.ExecutionSuccessful = &executionSuccessful
90 return invocation
91 }
92
93 // WithExitCode sets the ExitCode
94 func (invocation *Invocation) WithExitCode(exitCode int) *Invocation {
95 invocation.ExitCode = &exitCode
96 return invocation
97 }
98
99 // WithExitCodeDescription sets the ExitCodeDescription
100 func (invocation *Invocation) WithExitCodeDescription(exitCodeDescription string) *Invocation {
101 invocation.ExitCodeDescription = &exitCodeDescription
102 return invocation
103 }
104
105 // WithExitSignalNumber sets the ExitSignalNumber
106 func (invocation *Invocation) WithExitSignalNumber(exitSignalNumber int) *Invocation {
107 invocation.ExitSignalNumber = &exitSignalNumber
108 return invocation
109 }
110
111 // WithExitSignalName sets the ExitSignalName
112 func (invocation *Invocation) WithExitSignalName(exitSignalName string) *Invocation {
113 invocation.ExitSignalName = &exitSignalName
114 return invocation
115 }
116
117 // WithMachine sets the Machine
118 func (invocation *Invocation) WithMachine(machine string) *Invocation {
119 invocation.Machine = &machine
120 return invocation
121 }
122
123 // WithNotificationConfigurationOverrides sets the NotificationConfigurationOverrides
124 func (invocation *Invocation) WithNotificationConfigurationOverrides(overrides []*ConfigurationOverride) *Invocation {
125 invocation.NotificationConfigurationOverrides = overrides
126 return invocation
127 }
128
129 // AddNotificationConfigurationOverride ...
130 func (invocation *Invocation) AddNotificationConfigurationOverride(override *ConfigurationOverride) {
131 invocation.NotificationConfigurationOverrides = append(invocation.NotificationConfigurationOverrides, override)
132 }
133
134 // WithProcessID sets the ProcessID
135 func (invocation *Invocation) WithProcessID(processID int) *Invocation {
136 invocation.ProcessID = &processID
137
138 return invocation
139 }
140
141 // WithProcessStartFailureMessage sets the ProcessStartFailureMessage
142 func (invocation *Invocation) WithProcessStartFailureMessage(failureMessage string) *Invocation {
143 invocation.ProcessStartFailureMessage = &failureMessage
144 return invocation
145 }
146
147 // WithResponseFiles sets the ResponseFiles
148 func (invocation *Invocation) WithResponseFiles(responseFiles []*ArtifactLocation) *Invocation {
149 invocation.ResponseFiles = responseFiles
150 return invocation
151 }
152
153 // AddResponseFile ...
154 func (invocation *Invocation) AddResponseFile(responseFile *ArtifactLocation) {
155 invocation.ResponseFiles = append(invocation.ResponseFiles, responseFile)
156 }
157
158 // WithRuleConfigurationOverrides sets the RuleConfigurationOverrides
159 func (invocation *Invocation) WithRuleConfigurationOverrides(overrides []*ConfigurationOverride) *Invocation {
160 invocation.RuleConfigurationOverrides = overrides
161 return invocation
162 }
163
164 // AddRuleConfigurationOverride ...
165 func (invocation *Invocation) AddRuleConfigurationOverride(override *ConfigurationOverride) {
166 invocation.RuleConfigurationOverrides = append(invocation.RuleConfigurationOverrides, override)
167 }
168
169 // WithStartTimeUTC sets the instant when the invocation started and returns the same Invocation.
170 func (invocation *Invocation) WithStartTimeUTC(startTime time.Time) *Invocation {
171 startTimeUTC := startTime.UTC()
172 invocation.StartTimeUTC = &startTimeUTC
173 return invocation
174 }
175
176 // WithStdErr sets the StdErr
177 func (invocation *Invocation) WithStdErr(stdErr *ArtifactLocation) *Invocation {
178 invocation.Stderr = stdErr
179 return invocation
180 }
181
182 // WithStdIn sets the StdIn
183 func (invocation *Invocation) WithStdIn(stdIn *ArtifactLocation) *Invocation {
184 invocation.Stdin = stdIn
185 return invocation
186 }
187
188 // WithStdout sets the Stdout
189 func (invocation *Invocation) WithStdout(stdOut *ArtifactLocation) *Invocation {
190 invocation.Stdout = stdOut
191 return invocation
192 }
193
194 // WithStdoutStderr sets the StdoutStderr
195 func (invocation *Invocation) WithStdoutStderr(stdoutStderr *ArtifactLocation) *Invocation {
196 invocation.StdoutStderr = stdoutStderr
197 return invocation
198 }
199
200 // WithToolConfigurationNotifications sets the ToolConfigurationNotifications
201 func (invocation *Invocation) WithToolConfigurationNotifications(toolConfigNotifications []*Notification) *Invocation {
202 invocation.ToolConfigurationNotifications = toolConfigNotifications
203 return invocation
204 }
205
206 // AddToolConfigurationNotification ...
207 func (invocation *Invocation) AddToolConfigurationNotification(toolConfigNotification *Notification) {
208 invocation.ToolConfigurationNotifications = append(invocation.ToolConfigurationNotifications, toolConfigNotification)
209 }
210
211 // WithToolExecutionNotifications sets the ToolExecutionNotifications
212 func (invocation *Invocation) WithToolExecutionNotifications(toolExecutionNotification []*Notification) *Invocation {
213 invocation.ToolExecutionNotifications = toolExecutionNotification
214 return invocation
215 }
216
217 // AddTToolExecutionNotification ...
218 func (invocation *Invocation) AddTToolExecutionNotification(toolExecutionNotification *Notification) {
219 invocation.ToolExecutionNotifications = append(invocation.ToolExecutionNotifications, toolExecutionNotification)
220 }
221
222 // WithWorkingDirectory sets the current working directory of the invocation and returns the same Invocation.
223 func (invocation *Invocation) WithWorkingDirectory(workingDirectory *ArtifactLocation) *Invocation {
224 invocation.WorkingDirectory = workingDirectory
225 return invocation
226 }