Skip to content

Commit ab7c1c8

Browse files
authored
docs(serverless_jobs): add documentation (#1073)
1 parent 6c9197b commit ab7c1c8

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

packages/clients/src/api/jobs/v1alpha1/api.gen.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ export class API extends ParentAPI {
4040
/** Lists the available regions of the API. */
4141
public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams', 'pl-waw']
4242

43+
/**
44+
* Create a new job definition in a specified Project.
45+
*
46+
* @param request - The request {@link CreateJobDefinitionRequest}
47+
* @returns A Promise of JobDefinition
48+
*/
4349
createJobDefinition = (request: Readonly<CreateJobDefinitionRequest>) =>
4450
this.client.fetch<JobDefinition>(
4551
{
@@ -56,6 +62,12 @@ export class API extends ParentAPI {
5662
unmarshalJobDefinition,
5763
)
5864

65+
/**
66+
* Get a job definition by its unique identifier.
67+
*
68+
* @param request - The request {@link GetJobDefinitionRequest}
69+
* @returns A Promise of JobDefinition
70+
*/
5971
getJobDefinition = (request: Readonly<GetJobDefinitionRequest>) =>
6072
this.client.fetch<JobDefinition>(
6173
{
@@ -94,13 +106,26 @@ export class API extends ParentAPI {
94106
unmarshalListJobDefinitionsResponse,
95107
)
96108

109+
/**
110+
* List all your job definitions with filters.
111+
*
112+
* @param request - The request {@link ListJobDefinitionsRequest}
113+
* @returns A Promise of ListJobDefinitionsResponse
114+
*/
97115
listJobDefinitions = (request: Readonly<ListJobDefinitionsRequest> = {}) =>
98116
enrichForPagination(
99117
'jobDefinitions',
100118
this.pageOfListJobDefinitions,
101119
request,
102120
)
103121

122+
/**
123+
* Update an existing job definition associated with the specified unique
124+
* identifier.
125+
*
126+
* @param request - The request {@link UpdateJobDefinitionRequest}
127+
* @returns A Promise of JobDefinition
128+
*/
104129
updateJobDefinition = (request: Readonly<UpdateJobDefinitionRequest>) =>
105130
this.client.fetch<JobDefinition>(
106131
{
@@ -120,6 +145,11 @@ export class API extends ParentAPI {
120145
unmarshalJobDefinition,
121146
)
122147

148+
/**
149+
* Delete an exsisting job definition by its unique identifier.
150+
*
151+
* @param request - The request {@link DeleteJobDefinitionRequest}
152+
*/
123153
deleteJobDefinition = (request: Readonly<DeleteJobDefinitionRequest>) =>
124154
this.client.fetch<void>({
125155
method: 'DELETE',
@@ -132,6 +162,13 @@ export class API extends ParentAPI {
132162
)}`,
133163
})
134164

165+
/**
166+
* Run an existing job definition by its unique identifier. This will create a
167+
* new job run.
168+
*
169+
* @param request - The request {@link StartJobDefinitionRequest}
170+
* @returns A Promise of JobRun
171+
*/
135172
startJobDefinition = (request: Readonly<StartJobDefinitionRequest>) =>
136173
this.client.fetch<JobRun>(
137174
{
@@ -149,6 +186,12 @@ export class API extends ParentAPI {
149186
unmarshalJobRun,
150187
)
151188

189+
/**
190+
* Get a job run by its unique identifier.
191+
*
192+
* @param request - The request {@link GetJobRunRequest}
193+
* @returns A Promise of JobRun
194+
*/
152195
getJobRun = (request: Readonly<GetJobRunRequest>) =>
153196
this.client.fetch<JobRun>(
154197
{
@@ -161,6 +204,12 @@ export class API extends ParentAPI {
161204
unmarshalJobRun,
162205
)
163206

207+
/**
208+
* Stop a job run by its unique identifier.
209+
*
210+
* @param request - The request {@link StopJobRunRequest}
211+
* @returns A Promise of JobRun
212+
*/
164213
stopJobRun = (request: Readonly<StopJobRunRequest>) =>
165214
this.client.fetch<JobRun>(
166215
{
@@ -197,6 +246,12 @@ export class API extends ParentAPI {
197246
unmarshalListJobRunsResponse,
198247
)
199248

249+
/**
250+
* List all job runs with filters.
251+
*
252+
* @param request - The request {@link ListJobRunsRequest}
253+
* @returns A Promise of ListJobRunsResponse
254+
*/
200255
listJobRuns = (request: Readonly<ListJobRunsRequest> = {}) =>
201256
enrichForPagination('jobRuns', this.pageOfListJobRuns, request)
202257
}

packages/clients/src/api/jobs/v1alpha1/types.gen.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,23 @@ export type CreateJobDefinitionRequest = {
6262
* config.
6363
*/
6464
region?: Region
65+
/** Name of the job definition. */
6566
name?: string
67+
/** CPU limit of the job. */
6668
cpuLimit: number
69+
/** Memory limit of the job. */
6770
memoryLimit: number
71+
/** Image to use for the job. */
6872
imageUri: string
73+
/** Startup command. */
6974
command: string
75+
/** UUID of the Scaleway Project containing the job. */
7076
projectId?: string
77+
/** Environment variables of the job. */
7178
environmentVariables?: Record<string, string>
79+
/** Description of the job. */
7280
description: string
81+
/** Timeout of the job in seconds. */
7382
jobTimeout?: string
7483
}
7584

@@ -79,6 +88,7 @@ export type DeleteJobDefinitionRequest = {
7988
* config.
8089
*/
8190
region?: Region
91+
/** UUID of the job definition to delete. */
8292
jobDefinitionId: string
8393
}
8494

@@ -88,6 +98,7 @@ export type GetJobDefinitionRequest = {
8898
* config.
8999
*/
90100
region?: Region
101+
/** UUID of the job definition to get. */
91102
jobDefinitionId: string
92103
}
93104

@@ -97,6 +108,7 @@ export type GetJobRunRequest = {
97108
* config.
98109
*/
99110
region?: Region
111+
/** UUID of the job run to get. */
100112
jobRunId: string
101113
}
102114

@@ -141,6 +153,7 @@ export type StartJobDefinitionRequest = {
141153
* config.
142154
*/
143155
region?: Region
156+
/** UUID of the job definition to start. */
144157
jobDefinitionId: string
145158
}
146159

@@ -150,6 +163,7 @@ export type StopJobRunRequest = {
150163
* config.
151164
*/
152165
region?: Region
166+
/** UUID of the job run to stop. */
153167
jobRunId: string
154168
}
155169

@@ -159,13 +173,22 @@ export type UpdateJobDefinitionRequest = {
159173
* config.
160174
*/
161175
region?: Region
176+
/** UUID of the job definition to update. */
162177
jobDefinitionId: string
178+
/** Name of the job definition. */
163179
name?: string
180+
/** CPU limit of the job. */
164181
cpuLimit?: number
182+
/** Memory limit of the job. */
165183
memoryLimit?: number
184+
/** Image to use for the job. */
166185
imageUri?: string
186+
/** Startup command. */
167187
command?: string
188+
/** Environment variables of the job. */
168189
environmentVariables?: Record<string, string>
190+
/** Description of the job. */
169191
description?: string
192+
/** Timeout of the job in seconds. */
170193
jobTimeout?: string
171194
}

0 commit comments

Comments
 (0)