forked from spinnaker/spin
/
executions_controller_api.go
269 lines (239 loc) · 14.6 KB
/
executions_controller_api.go
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*
* Spinnaker API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 1.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package swagger
import (
"io/ioutil"
"net/url"
"net/http"
"strings"
"golang.org/x/net/context"
"encoding/json"
"fmt"
)
// Linger please
var (
_ context.Context
)
type ExecutionsControllerApiService service
/* ExecutionsControllerApiService Retrieves an ad-hoc collection of executions based on a number of user-supplied parameters. Either executionIds or pipelineConfigIds must be supplied in order to return any results. If both are supplied, an exception will be thrown.
* @param ctx context.Context for authentication, logging, tracing, etc.
@param optional (nil or map[string]interface{}) with one or more of:
@param "pipelineConfigIds" (string) A comma-separated list of pipeline configuration IDs to retrieve recent executions for. Either this OR pipelineConfigIds must be supplied, but not both.
@param "executionIds" (string) A comma-separated list of executions to retrieve. Either this OR pipelineConfigIds must be supplied, but not both.
@param "limit" (int32) The number of executions to return per pipeline configuration. Ignored if executionIds parameter is supplied. If this value is missing, it is defaulted to 1.
@param "statuses" (string) A comma-separated list of execution statuses to filter by. Ignored if executionIds parameter is supplied. If this value is missing, it is defaulted to all statuses.
@param "expand" (bool) Expands each execution object in the resulting list. If this value is missing, it is defaulted to true.
@return []interface{}*/
func (a *ExecutionsControllerApiService) GetLatestExecutionsByConfigIdsUsingGET(ctx context.Context, localVarOptionals map[string]interface{}) ([]interface{}, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload []interface{}
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/executions"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if err := typeCheckParameter(localVarOptionals["pipelineConfigIds"], "string", "pipelineConfigIds"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["executionIds"], "string", "executionIds"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["limit"], "int32", "limit"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["statuses"], "string", "statuses"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["expand"], "bool", "expand"); err != nil {
return successPayload, nil, err
}
if localVarTempParam, localVarOk := localVarOptionals["pipelineConfigIds"].(string); localVarOk {
localVarQueryParams.Add("pipelineConfigIds", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["executionIds"].(string); localVarOk {
localVarQueryParams.Add("executionIds", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["limit"].(int32); localVarOk {
localVarQueryParams.Add("limit", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["statuses"].(string); localVarOk {
localVarQueryParams.Add("statuses", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["expand"].(bool); localVarOk {
localVarQueryParams.Add("expand", parameterToString(localVarTempParam, ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"*/*",
}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
}
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return successPayload, localVarHttpResponse, err
}
return successPayload, localVarHttpResponse, err
}
/* ExecutionsControllerApiService Search for pipeline executions using a combination of criteria. The returned list is sorted by buildTime (trigger time) in reverse order so that newer executions are first in the list.
* @param ctx context.Context for authentication, logging, tracing, etc.
@param application Only includes executions that are part of this application. If this value is \"*\", results will include executions of all applications.
@param optional (nil or map[string]interface{}) with one or more of:
@param "triggerTypes" (string) Only includes executions that were triggered by a trigger with a type that is equal to a type provided in this field. The list of trigger types should be a comma-delimited string. If this value is missing, results will includes executions of all trigger types.
@param "pipelineName" (string) Only includes executions that with this pipeline name.
@param "eventId" (string) Only includes executions that were triggered by a trigger with this eventId.
@param "trigger" (string) Only includes executions that were triggered by a trigger that matches the subset of fields provided by this value. This value should be a base64-encoded string of a JSON representation of a trigger object. The comparison succeeds if the execution trigger contains all the fields of the input trigger, the fields are of the same type, and each value of the field \"matches\". The term \"matches\" is specific for each field's type: - For Strings: A String value in the execution's trigger matches the input trigger's String value if the former equals the latter (case-insensitive) OR if the former matches the latter as a regular expression. - For Maps: A Map value in the execution's trigger matches the input trigger's Map value if the former contains all keys of the latter and their values match. - For Collections: A Collection value in the execution's trigger matches the input trigger's Collection value if the former has a unique element that matches each element of the latter. - Every other value is compared using the Java \"equals\" method (Groovy \"==\" operator)
@param "triggerTimeStartBoundary" (int64) Only includes executions that were built at or after the given time, represented as a Unix timestamp in ms (UTC). This value must be >= 0 and <= the value of [triggerTimeEndBoundary], if provided. If this value is missing, it is defaulted to 0.
@param "triggerTimeEndBoundary" (int64) Only includes executions that were built at or before the given time, represented as a Unix timestamp in ms (UTC). This value must be <= 9223372036854775807 (Long.MAX_VALUE) and >= the value of [triggerTimeStartBoundary], if provided. If this value is missing, it is defaulted to 9223372036854775807.
@param "statuses" (string) Only includes executions with a status that is equal to a status provided in this field. The list of statuses should be given as a comma-delimited string. If this value is missing, includes executions of all statuses. Allowed statuses are: NOT_STARTED, RUNNING, PAUSED, SUSPENDED, SUCCEEDED, FAILED_CONTINUE, TERMINAL, CANCELED, REDIRECT, STOPPED, SKIPPED, BUFFERED.
@param "startIndex" (int32) Sets the first item of the resulting list for pagination. The list is 0-indexed. This value must be >= 0. If this value is missing, it is defaulted to 0.
@param "size" (int32) Sets the size of the resulting list for pagination. This value must be > 0. If this value is missing, it is defaulted to 10.
@param "reverse" (bool) Reverses the resulting list before it is paginated. If this value is missing, it is defaulted to false.
@param "expand" (bool) Expands each execution object in the resulting list. If this value is missing, it is defaulted to false.
@return []interface{}*/
func (a *ExecutionsControllerApiService) SearchForPipelineExecutionsByTriggerUsingGET(ctx context.Context, application string, localVarOptionals map[string]interface{}) ([]interface{}, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload []interface{}
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/applications/{application}/executions/search"
localVarPath = strings.Replace(localVarPath, "{"+"application"+"}", fmt.Sprintf("%v", application), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if err := typeCheckParameter(localVarOptionals["triggerTypes"], "string", "triggerTypes"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["pipelineName"], "string", "pipelineName"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["eventId"], "string", "eventId"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["trigger"], "string", "trigger"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["triggerTimeStartBoundary"], "int64", "triggerTimeStartBoundary"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["triggerTimeEndBoundary"], "int64", "triggerTimeEndBoundary"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["statuses"], "string", "statuses"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["startIndex"], "int32", "startIndex"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["size"], "int32", "size"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["reverse"], "bool", "reverse"); err != nil {
return successPayload, nil, err
}
if err := typeCheckParameter(localVarOptionals["expand"], "bool", "expand"); err != nil {
return successPayload, nil, err
}
if localVarTempParam, localVarOk := localVarOptionals["triggerTypes"].(string); localVarOk {
localVarQueryParams.Add("triggerTypes", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["pipelineName"].(string); localVarOk {
localVarQueryParams.Add("pipelineName", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["eventId"].(string); localVarOk {
localVarQueryParams.Add("eventId", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["trigger"].(string); localVarOk {
localVarQueryParams.Add("trigger", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["triggerTimeStartBoundary"].(int64); localVarOk {
localVarQueryParams.Add("triggerTimeStartBoundary", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["triggerTimeEndBoundary"].(int64); localVarOk {
localVarQueryParams.Add("triggerTimeEndBoundary", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["statuses"].(string); localVarOk {
localVarQueryParams.Add("statuses", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["startIndex"].(int32); localVarOk {
localVarQueryParams.Add("startIndex", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["size"].(int32); localVarOk {
localVarQueryParams.Add("size", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["reverse"].(bool); localVarOk {
localVarQueryParams.Add("reverse", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["expand"].(bool); localVarOk {
localVarQueryParams.Add("expand", parameterToString(localVarTempParam, ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"*/*",
}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
}
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return successPayload, localVarHttpResponse, err
}
return successPayload, localVarHttpResponse, err
}