Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions packages/clients/src/api/jobs/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ export class API extends ParentAPI {
/** Lists the available regions of the API. */
public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams', 'pl-waw']

/**
* Create a new job definition in a specified Project.
*
* @param request - The request {@link CreateJobDefinitionRequest}
* @returns A Promise of JobDefinition
*/
createJobDefinition = (request: Readonly<CreateJobDefinitionRequest>) =>
this.client.fetch<JobDefinition>(
{
Expand All @@ -56,6 +62,12 @@ export class API extends ParentAPI {
unmarshalJobDefinition,
)

/**
* Get a job definition by its unique identifier.
*
* @param request - The request {@link GetJobDefinitionRequest}
* @returns A Promise of JobDefinition
*/
getJobDefinition = (request: Readonly<GetJobDefinitionRequest>) =>
this.client.fetch<JobDefinition>(
{
Expand Down Expand Up @@ -94,13 +106,26 @@ export class API extends ParentAPI {
unmarshalListJobDefinitionsResponse,
)

/**
* List all your job definitions with filters.
*
* @param request - The request {@link ListJobDefinitionsRequest}
* @returns A Promise of ListJobDefinitionsResponse
*/
listJobDefinitions = (request: Readonly<ListJobDefinitionsRequest> = {}) =>
enrichForPagination(
'jobDefinitions',
this.pageOfListJobDefinitions,
request,
)

/**
* Update an existing job definition associated with the specified unique
* identifier.
*
* @param request - The request {@link UpdateJobDefinitionRequest}
* @returns A Promise of JobDefinition
*/
updateJobDefinition = (request: Readonly<UpdateJobDefinitionRequest>) =>
this.client.fetch<JobDefinition>(
{
Expand All @@ -120,6 +145,11 @@ export class API extends ParentAPI {
unmarshalJobDefinition,
)

/**
* Delete an exsisting job definition by its unique identifier.
*
* @param request - The request {@link DeleteJobDefinitionRequest}
*/
deleteJobDefinition = (request: Readonly<DeleteJobDefinitionRequest>) =>
this.client.fetch<void>({
method: 'DELETE',
Expand All @@ -132,6 +162,13 @@ export class API extends ParentAPI {
)}`,
})

/**
* Run an existing job definition by its unique identifier. This will create a
* new job run.
*
* @param request - The request {@link StartJobDefinitionRequest}
* @returns A Promise of JobRun
*/
startJobDefinition = (request: Readonly<StartJobDefinitionRequest>) =>
this.client.fetch<JobRun>(
{
Expand All @@ -149,6 +186,12 @@ export class API extends ParentAPI {
unmarshalJobRun,
)

/**
* Get a job run by its unique identifier.
*
* @param request - The request {@link GetJobRunRequest}
* @returns A Promise of JobRun
*/
getJobRun = (request: Readonly<GetJobRunRequest>) =>
this.client.fetch<JobRun>(
{
Expand All @@ -161,6 +204,12 @@ export class API extends ParentAPI {
unmarshalJobRun,
)

/**
* Stop a job run by its unique identifier.
*
* @param request - The request {@link StopJobRunRequest}
* @returns A Promise of JobRun
*/
stopJobRun = (request: Readonly<StopJobRunRequest>) =>
this.client.fetch<JobRun>(
{
Expand Down Expand Up @@ -197,6 +246,12 @@ export class API extends ParentAPI {
unmarshalListJobRunsResponse,
)

/**
* List all job runs with filters.
*
* @param request - The request {@link ListJobRunsRequest}
* @returns A Promise of ListJobRunsResponse
*/
listJobRuns = (request: Readonly<ListJobRunsRequest> = {}) =>
enrichForPagination('jobRuns', this.pageOfListJobRuns, request)
}
23 changes: 23 additions & 0 deletions packages/clients/src/api/jobs/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,23 @@ export type CreateJobDefinitionRequest = {
* config.
*/
region?: Region
/** Name of the job definition. */
name?: string
/** CPU limit of the job. */
cpuLimit: number
/** Memory limit of the job. */
memoryLimit: number
/** Image to use for the job. */
imageUri: string
/** Startup command. */
command: string
/** UUID of the Scaleway Project containing the job. */
projectId?: string
/** Environment variables of the job. */
environmentVariables?: Record<string, string>
/** Description of the job. */
description: string
/** Timeout of the job in seconds. */
jobTimeout?: string
}

Expand All @@ -79,6 +88,7 @@ export type DeleteJobDefinitionRequest = {
* config.
*/
region?: Region
/** UUID of the job definition to delete. */
jobDefinitionId: string
}

Expand All @@ -88,6 +98,7 @@ export type GetJobDefinitionRequest = {
* config.
*/
region?: Region
/** UUID of the job definition to get. */
jobDefinitionId: string
}

Expand All @@ -97,6 +108,7 @@ export type GetJobRunRequest = {
* config.
*/
region?: Region
/** UUID of the job run to get. */
jobRunId: string
}

Expand Down Expand Up @@ -141,6 +153,7 @@ export type StartJobDefinitionRequest = {
* config.
*/
region?: Region
/** UUID of the job definition to start. */
jobDefinitionId: string
}

Expand All @@ -150,6 +163,7 @@ export type StopJobRunRequest = {
* config.
*/
region?: Region
/** UUID of the job run to stop. */
jobRunId: string
}

Expand All @@ -159,13 +173,22 @@ export type UpdateJobDefinitionRequest = {
* config.
*/
region?: Region
/** UUID of the job definition to update. */
jobDefinitionId: string
/** Name of the job definition. */
name?: string
/** CPU limit of the job. */
cpuLimit?: number
/** Memory limit of the job. */
memoryLimit?: number
/** Image to use for the job. */
imageUri?: string
/** Startup command. */
command?: string
/** Environment variables of the job. */
environmentVariables?: Record<string, string>
/** Description of the job. */
description?: string
/** Timeout of the job in seconds. */
jobTimeout?: string
}