@scaleway/sdk-jobs 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/dist/index.gen.cjs +4 -0
- package/dist/index.gen.d.ts +5 -0
- package/dist/index.gen.js +4 -0
- package/dist/v1alpha1/api.gen.cjs +272 -0
- package/dist/v1alpha1/api.gen.d.ts +130 -0
- package/dist/v1alpha1/api.gen.js +272 -0
- package/dist/v1alpha1/content.gen.cjs +8 -0
- package/dist/v1alpha1/content.gen.d.ts +3 -0
- package/dist/v1alpha1/content.gen.js +8 -0
- package/dist/v1alpha1/index.gen.cjs +24 -0
- package/dist/v1alpha1/index.gen.d.ts +5 -0
- package/dist/v1alpha1/index.gen.js +24 -0
- package/dist/v1alpha1/marshalling.gen.cjs +262 -0
- package/dist/v1alpha1/marshalling.gen.d.ts +17 -0
- package/dist/v1alpha1/marshalling.gen.js +262 -0
- package/dist/v1alpha1/types.gen.d.ts +423 -0
- package/dist/v1alpha1/validation-rules.gen.cjs +115 -0
- package/dist/v1alpha1/validation-rules.gen.d.ts +103 -0
- package/dist/v1alpha1/validation-rules.gen.js +115 -0
- package/package.json +51 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import randomName from "@scaleway/random-name";
|
|
2
|
+
import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
|
|
3
|
+
const unmarshalSecretEnvVar = (data) => {
|
|
4
|
+
if (!isJSONObject(data)) {
|
|
5
|
+
throw new TypeError(
|
|
6
|
+
`Unmarshalling the type 'SecretEnvVar' failed as data isn't a dictionary.`
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
name: data.name
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const unmarshalSecretFile = (data) => {
|
|
14
|
+
if (!isJSONObject(data)) {
|
|
15
|
+
throw new TypeError(
|
|
16
|
+
`Unmarshalling the type 'SecretFile' failed as data isn't a dictionary.`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
path: data.path
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const unmarshalSecret = (data) => {
|
|
24
|
+
if (!isJSONObject(data)) {
|
|
25
|
+
throw new TypeError(
|
|
26
|
+
`Unmarshalling the type 'Secret' failed as data isn't a dictionary.`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
envVar: data.env_var ? unmarshalSecretEnvVar(data.env_var) : void 0,
|
|
31
|
+
file: data.file ? unmarshalSecretFile(data.file) : void 0,
|
|
32
|
+
secretId: data.secret_id,
|
|
33
|
+
secretManagerId: data.secret_manager_id,
|
|
34
|
+
secretManagerVersion: data.secret_manager_version
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const unmarshalCronSchedule = (data) => {
|
|
38
|
+
if (!isJSONObject(data)) {
|
|
39
|
+
throw new TypeError(
|
|
40
|
+
`Unmarshalling the type 'CronSchedule' failed as data isn't a dictionary.`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
schedule: data.schedule,
|
|
45
|
+
timezone: data.timezone
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const unmarshalJobDefinition = (data) => {
|
|
49
|
+
if (!isJSONObject(data)) {
|
|
50
|
+
throw new TypeError(
|
|
51
|
+
`Unmarshalling the type 'JobDefinition' failed as data isn't a dictionary.`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
command: data.command,
|
|
56
|
+
cpuLimit: data.cpu_limit,
|
|
57
|
+
createdAt: unmarshalDate(data.created_at),
|
|
58
|
+
cronSchedule: data.cron_schedule ? unmarshalCronSchedule(data.cron_schedule) : void 0,
|
|
59
|
+
description: data.description,
|
|
60
|
+
environmentVariables: data.environment_variables,
|
|
61
|
+
id: data.id,
|
|
62
|
+
imageUri: data.image_uri,
|
|
63
|
+
jobTimeout: data.job_timeout,
|
|
64
|
+
localStorageCapacity: data.local_storage_capacity,
|
|
65
|
+
memoryLimit: data.memory_limit,
|
|
66
|
+
name: data.name,
|
|
67
|
+
projectId: data.project_id,
|
|
68
|
+
region: data.region,
|
|
69
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const unmarshalJobRun = (data) => {
|
|
73
|
+
if (!isJSONObject(data)) {
|
|
74
|
+
throw new TypeError(
|
|
75
|
+
`Unmarshalling the type 'JobRun' failed as data isn't a dictionary.`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
command: data.command,
|
|
80
|
+
cpuLimit: data.cpu_limit,
|
|
81
|
+
createdAt: unmarshalDate(data.created_at),
|
|
82
|
+
environmentVariables: data.environment_variables,
|
|
83
|
+
errorMessage: data.error_message,
|
|
84
|
+
exitCode: data.exit_code,
|
|
85
|
+
id: data.id,
|
|
86
|
+
jobDefinitionId: data.job_definition_id,
|
|
87
|
+
localStorageCapacity: data.local_storage_capacity,
|
|
88
|
+
memoryLimit: data.memory_limit,
|
|
89
|
+
region: data.region,
|
|
90
|
+
runDuration: data.run_duration,
|
|
91
|
+
startedAt: unmarshalDate(data.started_at),
|
|
92
|
+
state: data.state,
|
|
93
|
+
terminatedAt: unmarshalDate(data.terminated_at),
|
|
94
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
const unmarshalCreateJobDefinitionSecretsResponse = (data) => {
|
|
98
|
+
if (!isJSONObject(data)) {
|
|
99
|
+
throw new TypeError(
|
|
100
|
+
`Unmarshalling the type 'CreateJobDefinitionSecretsResponse' failed as data isn't a dictionary.`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
secrets: unmarshalArrayOfObject(data.secrets, unmarshalSecret)
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
const unmarshalJobsLimits = (data) => {
|
|
108
|
+
if (!isJSONObject(data)) {
|
|
109
|
+
throw new TypeError(
|
|
110
|
+
`Unmarshalling the type 'JobsLimits' failed as data isn't a dictionary.`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
secretsPerJobDefinition: data.secrets_per_job_definition
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
const unmarshalListJobDefinitionSecretsResponse = (data) => {
|
|
118
|
+
if (!isJSONObject(data)) {
|
|
119
|
+
throw new TypeError(
|
|
120
|
+
`Unmarshalling the type 'ListJobDefinitionSecretsResponse' failed as data isn't a dictionary.`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
secrets: unmarshalArrayOfObject(data.secrets, unmarshalSecret),
|
|
125
|
+
totalCount: data.total_count
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const unmarshalListJobDefinitionsResponse = (data) => {
|
|
129
|
+
if (!isJSONObject(data)) {
|
|
130
|
+
throw new TypeError(
|
|
131
|
+
`Unmarshalling the type 'ListJobDefinitionsResponse' failed as data isn't a dictionary.`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
jobDefinitions: unmarshalArrayOfObject(
|
|
136
|
+
data.job_definitions,
|
|
137
|
+
unmarshalJobDefinition
|
|
138
|
+
),
|
|
139
|
+
totalCount: data.total_count
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
const unmarshalListJobRunsResponse = (data) => {
|
|
143
|
+
if (!isJSONObject(data)) {
|
|
144
|
+
throw new TypeError(
|
|
145
|
+
`Unmarshalling the type 'ListJobRunsResponse' failed as data isn't a dictionary.`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
jobRuns: unmarshalArrayOfObject(data.job_runs, unmarshalJobRun),
|
|
150
|
+
totalCount: data.total_count
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
const unmarshalResource = (data) => {
|
|
154
|
+
if (!isJSONObject(data)) {
|
|
155
|
+
throw new TypeError(
|
|
156
|
+
`Unmarshalling the type 'Resource' failed as data isn't a dictionary.`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
cpuLimit: data.cpu_limit,
|
|
161
|
+
memoryLimit: data.memory_limit
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
const unmarshalListJobsResourcesResponse = (data) => {
|
|
165
|
+
if (!isJSONObject(data)) {
|
|
166
|
+
throw new TypeError(
|
|
167
|
+
`Unmarshalling the type 'ListJobsResourcesResponse' failed as data isn't a dictionary.`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
resources: unmarshalArrayOfObject(data.resources, unmarshalResource)
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
const unmarshalStartJobDefinitionResponse = (data) => {
|
|
175
|
+
if (!isJSONObject(data)) {
|
|
176
|
+
throw new TypeError(
|
|
177
|
+
`Unmarshalling the type 'StartJobDefinitionResponse' failed as data isn't a dictionary.`
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
jobRuns: unmarshalArrayOfObject(data.job_runs, unmarshalJobRun)
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
const marshalCreateJobDefinitionRequestCronScheduleConfig = (request, defaults) => ({
|
|
185
|
+
schedule: request.schedule,
|
|
186
|
+
timezone: request.timezone
|
|
187
|
+
});
|
|
188
|
+
const marshalCreateJobDefinitionRequest = (request, defaults) => ({
|
|
189
|
+
command: request.command,
|
|
190
|
+
cpu_limit: request.cpuLimit,
|
|
191
|
+
cron_schedule: request.cronSchedule !== void 0 ? marshalCreateJobDefinitionRequestCronScheduleConfig(
|
|
192
|
+
request.cronSchedule
|
|
193
|
+
) : void 0,
|
|
194
|
+
description: request.description,
|
|
195
|
+
environment_variables: request.environmentVariables !== void 0 ? request.environmentVariables : void 0,
|
|
196
|
+
image_uri: request.imageUri,
|
|
197
|
+
job_timeout: request.jobTimeout,
|
|
198
|
+
local_storage_capacity: request.localStorageCapacity,
|
|
199
|
+
memory_limit: request.memoryLimit,
|
|
200
|
+
name: request.name || randomName("job"),
|
|
201
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
202
|
+
});
|
|
203
|
+
const marshalCreateJobDefinitionSecretsRequestSecretConfig = (request, defaults) => ({
|
|
204
|
+
secret_manager_id: request.secretManagerId,
|
|
205
|
+
secret_manager_version: request.secretManagerVersion,
|
|
206
|
+
...resolveOneOf([
|
|
207
|
+
{ param: "path", value: request.path },
|
|
208
|
+
{ param: "env_var_name", value: request.envVarName }
|
|
209
|
+
])
|
|
210
|
+
});
|
|
211
|
+
const marshalCreateJobDefinitionSecretsRequest = (request, defaults) => ({
|
|
212
|
+
secrets: request.secrets.map(
|
|
213
|
+
(elt) => marshalCreateJobDefinitionSecretsRequestSecretConfig(elt)
|
|
214
|
+
)
|
|
215
|
+
});
|
|
216
|
+
const marshalStartJobDefinitionRequest = (request, defaults) => ({
|
|
217
|
+
command: request.command,
|
|
218
|
+
environment_variables: request.environmentVariables,
|
|
219
|
+
replicas: request.replicas
|
|
220
|
+
});
|
|
221
|
+
const marshalUpdateJobDefinitionRequestCronScheduleConfig = (request, defaults) => ({
|
|
222
|
+
schedule: request.schedule,
|
|
223
|
+
timezone: request.timezone
|
|
224
|
+
});
|
|
225
|
+
const marshalUpdateJobDefinitionRequest = (request, defaults) => ({
|
|
226
|
+
command: request.command,
|
|
227
|
+
cpu_limit: request.cpuLimit,
|
|
228
|
+
cron_schedule: request.cronSchedule !== void 0 ? marshalUpdateJobDefinitionRequestCronScheduleConfig(
|
|
229
|
+
request.cronSchedule
|
|
230
|
+
) : void 0,
|
|
231
|
+
description: request.description,
|
|
232
|
+
environment_variables: request.environmentVariables,
|
|
233
|
+
image_uri: request.imageUri,
|
|
234
|
+
job_timeout: request.jobTimeout,
|
|
235
|
+
local_storage_capacity: request.localStorageCapacity,
|
|
236
|
+
memory_limit: request.memoryLimit,
|
|
237
|
+
name: request.name
|
|
238
|
+
});
|
|
239
|
+
const marshalUpdateJobDefinitionSecretRequest = (request, defaults) => ({
|
|
240
|
+
secret_manager_version: request.secretManagerVersion,
|
|
241
|
+
...resolveOneOf([
|
|
242
|
+
{ param: "path", value: request.path },
|
|
243
|
+
{ param: "env_var_name", value: request.envVarName }
|
|
244
|
+
])
|
|
245
|
+
});
|
|
246
|
+
export {
|
|
247
|
+
marshalCreateJobDefinitionRequest,
|
|
248
|
+
marshalCreateJobDefinitionSecretsRequest,
|
|
249
|
+
marshalStartJobDefinitionRequest,
|
|
250
|
+
marshalUpdateJobDefinitionRequest,
|
|
251
|
+
marshalUpdateJobDefinitionSecretRequest,
|
|
252
|
+
unmarshalCreateJobDefinitionSecretsResponse,
|
|
253
|
+
unmarshalJobDefinition,
|
|
254
|
+
unmarshalJobRun,
|
|
255
|
+
unmarshalJobsLimits,
|
|
256
|
+
unmarshalListJobDefinitionSecretsResponse,
|
|
257
|
+
unmarshalListJobDefinitionsResponse,
|
|
258
|
+
unmarshalListJobRunsResponse,
|
|
259
|
+
unmarshalListJobsResourcesResponse,
|
|
260
|
+
unmarshalSecret,
|
|
261
|
+
unmarshalStartJobDefinitionResponse
|
|
262
|
+
};
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import type { Region as ScwRegion } from '@scaleway/sdk-client';
|
|
2
|
+
export type JobRunState = 'unknown_state' | 'queued' | 'scheduled' | 'running' | 'succeeded' | 'failed' | 'canceled' | 'internal_error';
|
|
3
|
+
export type ListJobDefinitionsRequestOrderBy = 'created_at_asc' | 'created_at_desc';
|
|
4
|
+
export type ListJobRunsRequestOrderBy = 'created_at_asc' | 'created_at_desc';
|
|
5
|
+
export interface SecretEnvVar {
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SecretFile {
|
|
9
|
+
path: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CronSchedule {
|
|
12
|
+
/**
|
|
13
|
+
* UNIX cron schedule to run job (e.g., '* * * * *').
|
|
14
|
+
*/
|
|
15
|
+
schedule: string;
|
|
16
|
+
/**
|
|
17
|
+
* Timezone for the cron schedule, in tz database format (e.g., 'Europe/Paris').
|
|
18
|
+
*/
|
|
19
|
+
timezone: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateJobDefinitionRequestCronScheduleConfig {
|
|
22
|
+
schedule: string;
|
|
23
|
+
timezone: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CreateJobDefinitionSecretsRequestSecretConfig {
|
|
26
|
+
secretManagerId: string;
|
|
27
|
+
secretManagerVersion: string;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* One-of ('pathOrEnvVar'): at most one of 'path', 'envVarName' could be set.
|
|
31
|
+
*/
|
|
32
|
+
path?: string;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* One-of ('pathOrEnvVar'): at most one of 'path', 'envVarName' could be set.
|
|
36
|
+
*/
|
|
37
|
+
envVarName?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface Secret {
|
|
40
|
+
/**
|
|
41
|
+
* UUID of the secret reference within the job.
|
|
42
|
+
*/
|
|
43
|
+
secretId: string;
|
|
44
|
+
/**
|
|
45
|
+
* UUID of the secret in Secret Manager.
|
|
46
|
+
*/
|
|
47
|
+
secretManagerId: string;
|
|
48
|
+
/**
|
|
49
|
+
* Version of the secret in Secret Manager.
|
|
50
|
+
*/
|
|
51
|
+
secretManagerVersion: string;
|
|
52
|
+
/**
|
|
53
|
+
* File secret mounted inside the job.
|
|
54
|
+
*
|
|
55
|
+
* One-of ('secretConfig'): at most one of 'file', 'envVar' could be set.
|
|
56
|
+
*/
|
|
57
|
+
file?: SecretFile;
|
|
58
|
+
/**
|
|
59
|
+
* Environment variable used to expose the secret.
|
|
60
|
+
*
|
|
61
|
+
* One-of ('secretConfig'): at most one of 'file', 'envVar' could be set.
|
|
62
|
+
*/
|
|
63
|
+
envVar?: SecretEnvVar;
|
|
64
|
+
}
|
|
65
|
+
export interface JobDefinition {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
createdAt?: Date;
|
|
69
|
+
updatedAt?: Date;
|
|
70
|
+
cpuLimit: number;
|
|
71
|
+
memoryLimit: number;
|
|
72
|
+
imageUri: string;
|
|
73
|
+
command: string;
|
|
74
|
+
projectId: string;
|
|
75
|
+
environmentVariables: Record<string, string>;
|
|
76
|
+
description: string;
|
|
77
|
+
jobTimeout?: string;
|
|
78
|
+
cronSchedule?: CronSchedule;
|
|
79
|
+
localStorageCapacity: number;
|
|
80
|
+
/**
|
|
81
|
+
* Region to target. If none is passed will use default region from the config.
|
|
82
|
+
*/
|
|
83
|
+
region: ScwRegion;
|
|
84
|
+
}
|
|
85
|
+
export interface JobRun {
|
|
86
|
+
id: string;
|
|
87
|
+
jobDefinitionId: string;
|
|
88
|
+
state: JobRunState;
|
|
89
|
+
createdAt?: Date;
|
|
90
|
+
updatedAt?: Date;
|
|
91
|
+
terminatedAt?: Date;
|
|
92
|
+
exitCode?: number;
|
|
93
|
+
runDuration?: string;
|
|
94
|
+
errorMessage: string;
|
|
95
|
+
cpuLimit: number;
|
|
96
|
+
memoryLimit: number;
|
|
97
|
+
command: string;
|
|
98
|
+
environmentVariables: Record<string, string>;
|
|
99
|
+
localStorageCapacity: number;
|
|
100
|
+
startedAt?: Date;
|
|
101
|
+
/**
|
|
102
|
+
* Region to target. If none is passed will use default region from the config.
|
|
103
|
+
*/
|
|
104
|
+
region: ScwRegion;
|
|
105
|
+
}
|
|
106
|
+
export interface Resource {
|
|
107
|
+
cpuLimit: number;
|
|
108
|
+
memoryLimit: number;
|
|
109
|
+
}
|
|
110
|
+
export interface UpdateJobDefinitionRequestCronScheduleConfig {
|
|
111
|
+
schedule?: string;
|
|
112
|
+
timezone?: string;
|
|
113
|
+
}
|
|
114
|
+
export type CreateJobDefinitionRequest = {
|
|
115
|
+
/**
|
|
116
|
+
* Region to target. If none is passed will use default region from the config.
|
|
117
|
+
*/
|
|
118
|
+
region?: ScwRegion;
|
|
119
|
+
/**
|
|
120
|
+
* Name of the job definition.
|
|
121
|
+
*/
|
|
122
|
+
name?: string;
|
|
123
|
+
/**
|
|
124
|
+
* CPU limit of the job.
|
|
125
|
+
*/
|
|
126
|
+
cpuLimit: number;
|
|
127
|
+
/**
|
|
128
|
+
* Memory limit of the job (in MiB).
|
|
129
|
+
*/
|
|
130
|
+
memoryLimit: number;
|
|
131
|
+
/**
|
|
132
|
+
* Local storage capacity of the job (in MiB).
|
|
133
|
+
*/
|
|
134
|
+
localStorageCapacity?: number;
|
|
135
|
+
/**
|
|
136
|
+
* Image to use for the job.
|
|
137
|
+
*/
|
|
138
|
+
imageUri: string;
|
|
139
|
+
/**
|
|
140
|
+
* Startup command. If empty or not defined, the image's default command is used.
|
|
141
|
+
*/
|
|
142
|
+
command: string;
|
|
143
|
+
/**
|
|
144
|
+
* UUID of the Scaleway Project containing the job.
|
|
145
|
+
*/
|
|
146
|
+
projectId?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Environment variables of the job.
|
|
149
|
+
*/
|
|
150
|
+
environmentVariables?: Record<string, string>;
|
|
151
|
+
/**
|
|
152
|
+
* Description of the job.
|
|
153
|
+
*/
|
|
154
|
+
description: string;
|
|
155
|
+
/**
|
|
156
|
+
* Timeout of the job in seconds.
|
|
157
|
+
*/
|
|
158
|
+
jobTimeout?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Configure a cron for the job.
|
|
161
|
+
*/
|
|
162
|
+
cronSchedule?: CreateJobDefinitionRequestCronScheduleConfig;
|
|
163
|
+
};
|
|
164
|
+
export type CreateJobDefinitionSecretsRequest = {
|
|
165
|
+
/**
|
|
166
|
+
* Region to target. If none is passed will use default region from the config.
|
|
167
|
+
*/
|
|
168
|
+
region?: ScwRegion;
|
|
169
|
+
/**
|
|
170
|
+
* UUID of the job definition.
|
|
171
|
+
*/
|
|
172
|
+
jobDefinitionId: string;
|
|
173
|
+
/**
|
|
174
|
+
* List of secrets to inject into the job.
|
|
175
|
+
*/
|
|
176
|
+
secrets: CreateJobDefinitionSecretsRequestSecretConfig[];
|
|
177
|
+
};
|
|
178
|
+
export interface CreateJobDefinitionSecretsResponse {
|
|
179
|
+
/**
|
|
180
|
+
* List of secrets created.
|
|
181
|
+
*/
|
|
182
|
+
secrets: Secret[];
|
|
183
|
+
}
|
|
184
|
+
export type DeleteJobDefinitionRequest = {
|
|
185
|
+
/**
|
|
186
|
+
* Region to target. If none is passed will use default region from the config.
|
|
187
|
+
*/
|
|
188
|
+
region?: ScwRegion;
|
|
189
|
+
/**
|
|
190
|
+
* UUID of the job definition to delete.
|
|
191
|
+
*/
|
|
192
|
+
jobDefinitionId: string;
|
|
193
|
+
};
|
|
194
|
+
export type DeleteJobDefinitionSecretRequest = {
|
|
195
|
+
/**
|
|
196
|
+
* Region to target. If none is passed will use default region from the config.
|
|
197
|
+
*/
|
|
198
|
+
region?: ScwRegion;
|
|
199
|
+
/**
|
|
200
|
+
* UUID of the job definition.
|
|
201
|
+
*/
|
|
202
|
+
jobDefinitionId: string;
|
|
203
|
+
/**
|
|
204
|
+
* UUID of the secret reference within the job.
|
|
205
|
+
*/
|
|
206
|
+
secretId: string;
|
|
207
|
+
};
|
|
208
|
+
export type GetJobDefinitionRequest = {
|
|
209
|
+
/**
|
|
210
|
+
* Region to target. If none is passed will use default region from the config.
|
|
211
|
+
*/
|
|
212
|
+
region?: ScwRegion;
|
|
213
|
+
/**
|
|
214
|
+
* UUID of the job definition to get.
|
|
215
|
+
*/
|
|
216
|
+
jobDefinitionId: string;
|
|
217
|
+
};
|
|
218
|
+
export type GetJobDefinitionSecretRequest = {
|
|
219
|
+
/**
|
|
220
|
+
* Region to target. If none is passed will use default region from the config.
|
|
221
|
+
*/
|
|
222
|
+
region?: ScwRegion;
|
|
223
|
+
/**
|
|
224
|
+
* UUID of the job definition.
|
|
225
|
+
*/
|
|
226
|
+
jobDefinitionId: string;
|
|
227
|
+
/**
|
|
228
|
+
* UUID of the secret reference within the job.
|
|
229
|
+
*/
|
|
230
|
+
secretId: string;
|
|
231
|
+
};
|
|
232
|
+
export type GetJobRunRequest = {
|
|
233
|
+
/**
|
|
234
|
+
* Region to target. If none is passed will use default region from the config.
|
|
235
|
+
*/
|
|
236
|
+
region?: ScwRegion;
|
|
237
|
+
/**
|
|
238
|
+
* UUID of the job run to get.
|
|
239
|
+
*/
|
|
240
|
+
jobRunId: string;
|
|
241
|
+
};
|
|
242
|
+
export type GetJobsLimitsRequest = {
|
|
243
|
+
/**
|
|
244
|
+
* Region to target. If none is passed will use default region from the config.
|
|
245
|
+
*/
|
|
246
|
+
region?: ScwRegion;
|
|
247
|
+
};
|
|
248
|
+
export interface JobsLimits {
|
|
249
|
+
secretsPerJobDefinition: number;
|
|
250
|
+
}
|
|
251
|
+
export type ListJobDefinitionSecretsRequest = {
|
|
252
|
+
/**
|
|
253
|
+
* Region to target. If none is passed will use default region from the config.
|
|
254
|
+
*/
|
|
255
|
+
region?: ScwRegion;
|
|
256
|
+
/**
|
|
257
|
+
* UUID of the job definition.
|
|
258
|
+
*/
|
|
259
|
+
jobDefinitionId: string;
|
|
260
|
+
};
|
|
261
|
+
export interface ListJobDefinitionSecretsResponse {
|
|
262
|
+
/**
|
|
263
|
+
* List of secret references within a job definition.
|
|
264
|
+
*/
|
|
265
|
+
secrets: Secret[];
|
|
266
|
+
/**
|
|
267
|
+
* Total count of secret references within a job definition.
|
|
268
|
+
*/
|
|
269
|
+
totalCount: number;
|
|
270
|
+
}
|
|
271
|
+
export type ListJobDefinitionsRequest = {
|
|
272
|
+
/**
|
|
273
|
+
* Region to target. If none is passed will use default region from the config.
|
|
274
|
+
*/
|
|
275
|
+
region?: ScwRegion;
|
|
276
|
+
page?: number;
|
|
277
|
+
pageSize?: number;
|
|
278
|
+
orderBy?: ListJobDefinitionsRequestOrderBy;
|
|
279
|
+
projectId?: string;
|
|
280
|
+
organizationId?: string;
|
|
281
|
+
};
|
|
282
|
+
export interface ListJobDefinitionsResponse {
|
|
283
|
+
jobDefinitions: JobDefinition[];
|
|
284
|
+
totalCount: number;
|
|
285
|
+
}
|
|
286
|
+
export type ListJobRunsRequest = {
|
|
287
|
+
/**
|
|
288
|
+
* Region to target. If none is passed will use default region from the config.
|
|
289
|
+
*/
|
|
290
|
+
region?: ScwRegion;
|
|
291
|
+
page?: number;
|
|
292
|
+
pageSize?: number;
|
|
293
|
+
orderBy?: ListJobRunsRequestOrderBy;
|
|
294
|
+
jobDefinitionId?: string;
|
|
295
|
+
projectId?: string;
|
|
296
|
+
organizationId?: string;
|
|
297
|
+
state?: JobRunState;
|
|
298
|
+
};
|
|
299
|
+
export interface ListJobRunsResponse {
|
|
300
|
+
jobRuns: JobRun[];
|
|
301
|
+
totalCount: number;
|
|
302
|
+
}
|
|
303
|
+
export type ListJobsResourcesRequest = {
|
|
304
|
+
/**
|
|
305
|
+
* Region to target. If none is passed will use default region from the config.
|
|
306
|
+
*/
|
|
307
|
+
region?: ScwRegion;
|
|
308
|
+
};
|
|
309
|
+
export interface ListJobsResourcesResponse {
|
|
310
|
+
resources: Resource[];
|
|
311
|
+
}
|
|
312
|
+
export type StartJobDefinitionRequest = {
|
|
313
|
+
/**
|
|
314
|
+
* Region to target. If none is passed will use default region from the config.
|
|
315
|
+
*/
|
|
316
|
+
region?: ScwRegion;
|
|
317
|
+
/**
|
|
318
|
+
* UUID of the job definition to start.
|
|
319
|
+
*/
|
|
320
|
+
jobDefinitionId: string;
|
|
321
|
+
/**
|
|
322
|
+
* Contextual startup command for this specific job run.
|
|
323
|
+
*/
|
|
324
|
+
command?: string;
|
|
325
|
+
/**
|
|
326
|
+
* Contextual environment variables for this specific job run.
|
|
327
|
+
*/
|
|
328
|
+
environmentVariables?: Record<string, string>;
|
|
329
|
+
/**
|
|
330
|
+
* Number of jobs to run.
|
|
331
|
+
*/
|
|
332
|
+
replicas?: number;
|
|
333
|
+
};
|
|
334
|
+
export interface StartJobDefinitionResponse {
|
|
335
|
+
jobRuns: JobRun[];
|
|
336
|
+
}
|
|
337
|
+
export type StopJobRunRequest = {
|
|
338
|
+
/**
|
|
339
|
+
* Region to target. If none is passed will use default region from the config.
|
|
340
|
+
*/
|
|
341
|
+
region?: ScwRegion;
|
|
342
|
+
/**
|
|
343
|
+
* UUID of the job run to stop.
|
|
344
|
+
*/
|
|
345
|
+
jobRunId: string;
|
|
346
|
+
};
|
|
347
|
+
export type UpdateJobDefinitionRequest = {
|
|
348
|
+
/**
|
|
349
|
+
* Region to target. If none is passed will use default region from the config.
|
|
350
|
+
*/
|
|
351
|
+
region?: ScwRegion;
|
|
352
|
+
/**
|
|
353
|
+
* UUID of the job definition to update.
|
|
354
|
+
*/
|
|
355
|
+
jobDefinitionId: string;
|
|
356
|
+
/**
|
|
357
|
+
* Name of the job definition.
|
|
358
|
+
*/
|
|
359
|
+
name?: string;
|
|
360
|
+
/**
|
|
361
|
+
* CPU limit of the job.
|
|
362
|
+
*/
|
|
363
|
+
cpuLimit?: number;
|
|
364
|
+
/**
|
|
365
|
+
* Memory limit of the job (in MiB).
|
|
366
|
+
*/
|
|
367
|
+
memoryLimit?: number;
|
|
368
|
+
/**
|
|
369
|
+
* Local storage capacity of the job (in MiB).
|
|
370
|
+
*/
|
|
371
|
+
localStorageCapacity?: number;
|
|
372
|
+
/**
|
|
373
|
+
* Image to use for the job.
|
|
374
|
+
*/
|
|
375
|
+
imageUri?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Startup command.
|
|
378
|
+
*/
|
|
379
|
+
command?: string;
|
|
380
|
+
/**
|
|
381
|
+
* Environment variables of the job.
|
|
382
|
+
*/
|
|
383
|
+
environmentVariables?: Record<string, string>;
|
|
384
|
+
/**
|
|
385
|
+
* Description of the job.
|
|
386
|
+
*/
|
|
387
|
+
description?: string;
|
|
388
|
+
/**
|
|
389
|
+
* Timeout of the job in seconds.
|
|
390
|
+
*/
|
|
391
|
+
jobTimeout?: string;
|
|
392
|
+
cronSchedule?: UpdateJobDefinitionRequestCronScheduleConfig;
|
|
393
|
+
};
|
|
394
|
+
export type UpdateJobDefinitionSecretRequest = {
|
|
395
|
+
/**
|
|
396
|
+
* Region to target. If none is passed will use default region from the config.
|
|
397
|
+
*/
|
|
398
|
+
region?: ScwRegion;
|
|
399
|
+
/**
|
|
400
|
+
* UUID of the job definition.
|
|
401
|
+
*/
|
|
402
|
+
jobDefinitionId: string;
|
|
403
|
+
/**
|
|
404
|
+
* UUID of the secret reference within the job.
|
|
405
|
+
*/
|
|
406
|
+
secretId: string;
|
|
407
|
+
/**
|
|
408
|
+
* Version of the secret in Secret Manager.
|
|
409
|
+
*/
|
|
410
|
+
secretManagerVersion?: string;
|
|
411
|
+
/**
|
|
412
|
+
* Path of the secret to mount inside the job (either `path` or `env_var_name` must be set).
|
|
413
|
+
*
|
|
414
|
+
* One-of ('secretConfig'): at most one of 'path', 'envVarName' could be set.
|
|
415
|
+
*/
|
|
416
|
+
path?: string;
|
|
417
|
+
/**
|
|
418
|
+
* Environment variable name used to expose the secret inside the job (either `path` or `env_var_name` must be set).
|
|
419
|
+
*
|
|
420
|
+
* One-of ('secretConfig'): at most one of 'path', 'envVarName' could be set.
|
|
421
|
+
*/
|
|
422
|
+
envVarName?: string;
|
|
423
|
+
};
|