-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunnerconfigurationenvironmentclass.go
334 lines (302 loc) · 11.4 KB
/
runnerconfigurationenvironmentclass.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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package gitpod
import (
"context"
"net/http"
"net/url"
"github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
"github.com/gitpod-io/gitpod-sdk-go/internal/apiquery"
"github.com/gitpod-io/gitpod-sdk-go/internal/param"
"github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
"github.com/gitpod-io/gitpod-sdk-go/option"
"github.com/gitpod-io/gitpod-sdk-go/packages/pagination"
"github.com/gitpod-io/gitpod-sdk-go/shared"
)
// RunnerConfigurationEnvironmentClassService contains methods and other services
// that help with interacting with the gitpod API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewRunnerConfigurationEnvironmentClassService] method instead.
type RunnerConfigurationEnvironmentClassService struct {
Options []option.RequestOption
}
// NewRunnerConfigurationEnvironmentClassService generates a new service that
// applies the given options to each request. These options are applied after the
// parent client's options (if there is one), and before any request-specific
// options.
func NewRunnerConfigurationEnvironmentClassService(opts ...option.RequestOption) (r *RunnerConfigurationEnvironmentClassService) {
r = &RunnerConfigurationEnvironmentClassService{}
r.Options = opts
return
}
// Creates a new environment class for a runner.
//
// Use this method to:
//
// - Define compute resources
// - Configure environment settings
// - Set up runtime options
//
// ### Examples
//
// - Create environment class:
//
// Creates a new environment configuration.
//
// ```yaml
// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// displayName: "Large Instance"
// description: "8 CPU, 16GB RAM"
// configuration:
// - key: "cpu"
// value: "8"
// - key: "memory"
// value: "16384"
// ```
func (r *RunnerConfigurationEnvironmentClassService) New(ctx context.Context, body RunnerConfigurationEnvironmentClassNewParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassNewResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.RunnerConfigurationService/CreateEnvironmentClass"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Gets details about a specific environment class.
//
// Use this method to:
//
// - View class configuration
// - Check resource settings
// - Verify availability
//
// ### Examples
//
// - Get class details:
//
// Retrieves information about a specific class.
//
// ```yaml
// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// ```
func (r *RunnerConfigurationEnvironmentClassService) Get(ctx context.Context, body RunnerConfigurationEnvironmentClassGetParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassGetResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.RunnerConfigurationService/GetEnvironmentClass"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Updates an environment class.
//
// Use this method to:
//
// - Modify class settings
// - Update resource limits
// - Change availability
//
// ### Examples
//
// - Update class:
//
// Changes class configuration.
//
// ```yaml
// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// displayName: "Updated Large Instance"
// description: "16 CPU, 32GB RAM"
// enabled: true
// ```
func (r *RunnerConfigurationEnvironmentClassService) Update(ctx context.Context, body RunnerConfigurationEnvironmentClassUpdateParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.RunnerConfigurationService/UpdateEnvironmentClass"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Lists environment classes with optional filtering.
//
// Use this method to:
//
// - View available classes
// - Filter by capability
// - Check enabled status
//
// ### Examples
//
// - List all classes:
//
// Shows all environment classes.
//
// ```yaml
// pagination:
// pageSize: 20
// ```
//
// - Filter enabled classes:
//
// Lists only enabled environment classes.
//
// ```yaml
// filter:
// enabled: true
// pagination:
// pageSize: 20
// ```
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
func (r *RunnerConfigurationEnvironmentClassService) List(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) (res *pagination.EnvironmentClassesPage[shared.EnvironmentClass], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "gitpod.v1.RunnerConfigurationService/ListEnvironmentClasses"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// Lists environment classes with optional filtering.
//
// Use this method to:
//
// - View available classes
// - Filter by capability
// - Check enabled status
//
// ### Examples
//
// - List all classes:
//
// Shows all environment classes.
//
// ```yaml
// pagination:
// pageSize: 20
// ```
//
// - Filter enabled classes:
//
// Lists only enabled environment classes.
//
// ```yaml
// filter:
// enabled: true
// pagination:
// pageSize: 20
// ```
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
func (r *RunnerConfigurationEnvironmentClassService) ListAutoPaging(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) *pagination.EnvironmentClassesPageAutoPager[shared.EnvironmentClass] {
return pagination.NewEnvironmentClassesPageAutoPager(r.List(ctx, params, opts...))
}
type RunnerConfigurationEnvironmentClassNewResponse struct {
ID string `json:"id"`
JSON runnerConfigurationEnvironmentClassNewResponseJSON `json:"-"`
}
// runnerConfigurationEnvironmentClassNewResponseJSON contains the JSON metadata
// for the struct [RunnerConfigurationEnvironmentClassNewResponse]
type runnerConfigurationEnvironmentClassNewResponseJSON struct {
ID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RunnerConfigurationEnvironmentClassNewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r runnerConfigurationEnvironmentClassNewResponseJSON) RawJSON() string {
return r.raw
}
type RunnerConfigurationEnvironmentClassGetResponse struct {
EnvironmentClass shared.EnvironmentClass `json:"environmentClass"`
JSON runnerConfigurationEnvironmentClassGetResponseJSON `json:"-"`
}
// runnerConfigurationEnvironmentClassGetResponseJSON contains the JSON metadata
// for the struct [RunnerConfigurationEnvironmentClassGetResponse]
type runnerConfigurationEnvironmentClassGetResponseJSON struct {
EnvironmentClass apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RunnerConfigurationEnvironmentClassGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r runnerConfigurationEnvironmentClassGetResponseJSON) RawJSON() string {
return r.raw
}
type RunnerConfigurationEnvironmentClassUpdateResponse = interface{}
type RunnerConfigurationEnvironmentClassNewParams struct {
Configuration param.Field[[]shared.FieldValueParam] `json:"configuration"`
Description param.Field[string] `json:"description"`
DisplayName param.Field[string] `json:"displayName"`
RunnerID param.Field[string] `json:"runnerId" format:"uuid"`
}
func (r RunnerConfigurationEnvironmentClassNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type RunnerConfigurationEnvironmentClassGetParams struct {
EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"`
}
func (r RunnerConfigurationEnvironmentClassGetParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type RunnerConfigurationEnvironmentClassUpdateParams struct {
Description param.Field[string] `json:"description"`
DisplayName param.Field[string] `json:"displayName"`
Enabled param.Field[bool] `json:"enabled"`
EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"`
}
func (r RunnerConfigurationEnvironmentClassUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type RunnerConfigurationEnvironmentClassListParams struct {
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
Filter param.Field[RunnerConfigurationEnvironmentClassListParamsFilter] `json:"filter"`
// pagination contains the pagination options for listing environment classes
Pagination param.Field[RunnerConfigurationEnvironmentClassListParamsPagination] `json:"pagination"`
}
func (r RunnerConfigurationEnvironmentClassListParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// URLQuery serializes [RunnerConfigurationEnvironmentClassListParams]'s query
// parameters as `url.Values`.
func (r RunnerConfigurationEnvironmentClassListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type RunnerConfigurationEnvironmentClassListParamsFilter struct {
// can_create_environments filters the response to only environment classes that
// can be used to create new environments by the caller. Unlike enabled, which
// indicates general availability, this ensures the caller only sees environment
// classes they are allowed to use.
CanCreateEnvironments param.Field[bool] `json:"canCreateEnvironments"`
// enabled filters the response to only enabled or disabled environment classes. If
// not set, all environment classes are returned.
Enabled param.Field[bool] `json:"enabled"`
// runner_ids filters the response to only EnvironmentClasses of these Runner IDs
RunnerIDs param.Field[[]string] `json:"runnerIds" format:"uuid"`
// runner_kind filters the response to only environment classes from runners of
// these kinds.
RunnerKinds param.Field[[]RunnerKind] `json:"runnerKinds"`
// runner_providers filters the response to only environment classes from runners
// of these providers.
RunnerProviders param.Field[[]RunnerProvider] `json:"runnerProviders"`
}
func (r RunnerConfigurationEnvironmentClassListParamsFilter) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// pagination contains the pagination options for listing environment classes
type RunnerConfigurationEnvironmentClassListParamsPagination struct {
// Token for the next set of results that was returned as next_token of a
// PaginationResponse
Token param.Field[string] `json:"token"`
// Page size is the maximum number of results to retrieve per page. Defaults to 25.
// Maximum 100.
PageSize param.Field[int64] `json:"pageSize"`
}
func (r RunnerConfigurationEnvironmentClassListParamsPagination) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}