Skip to content

Commit b3e420e

Browse files
authored
docs(serverless_jobs): add documentation (#1961)
1 parent 4e66350 commit b3e420e

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

api/jobs/v1alpha1/jobs_sdk.go

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,31 @@ type CreateJobDefinitionRequest struct {
198198
// Region: region to target. If none is passed will use default region from the config.
199199
Region scw.Region `json:"-"`
200200

201+
// Name: name of the job definition.
201202
Name string `json:"name"`
202203

204+
// CPULimit: CPU limit of the job.
203205
CPULimit uint32 `json:"cpu_limit"`
204206

207+
// MemoryLimit: memory limit of the job.
205208
MemoryLimit uint32 `json:"memory_limit"`
206209

210+
// ImageURI: image to use for the job.
207211
ImageURI string `json:"image_uri"`
208212

213+
// Command: startup command.
209214
Command string `json:"command"`
210215

216+
// ProjectID: UUID of the Scaleway Project containing the job.
211217
ProjectID string `json:"project_id"`
212218

219+
// EnvironmentVariables: environment variables of the job.
213220
EnvironmentVariables map[string]string `json:"environment_variables"`
214221

222+
// Description: description of the job.
215223
Description string `json:"description"`
216224

225+
// JobTimeout: timeout of the job in seconds.
217226
JobTimeout *scw.Duration `json:"job_timeout,omitempty"`
218227
}
219228

@@ -222,6 +231,7 @@ type DeleteJobDefinitionRequest struct {
222231
// Region: region to target. If none is passed will use default region from the config.
223232
Region scw.Region `json:"-"`
224233

234+
// JobDefinitionID: UUID of the job definition to delete.
225235
JobDefinitionID string `json:"-"`
226236
}
227237

@@ -230,6 +240,7 @@ type GetJobDefinitionRequest struct {
230240
// Region: region to target. If none is passed will use default region from the config.
231241
Region scw.Region `json:"-"`
232242

243+
// JobDefinitionID: UUID of the job definition to get.
233244
JobDefinitionID string `json:"-"`
234245
}
235246

@@ -238,6 +249,7 @@ type GetJobRunRequest struct {
238249
// Region: region to target. If none is passed will use default region from the config.
239250
Region scw.Region `json:"-"`
240251

252+
// JobRunID: UUID of the job run to get.
241253
JobRunID string `json:"-"`
242254
}
243255

@@ -330,6 +342,7 @@ type StartJobDefinitionRequest struct {
330342
// Region: region to target. If none is passed will use default region from the config.
331343
Region scw.Region `json:"-"`
332344

345+
// JobDefinitionID: UUID of the job definition to start.
333346
JobDefinitionID string `json:"-"`
334347
}
335348

@@ -338,6 +351,7 @@ type StopJobRunRequest struct {
338351
// Region: region to target. If none is passed will use default region from the config.
339352
Region scw.Region `json:"-"`
340353

354+
// JobRunID: UUID of the job run to stop.
341355
JobRunID string `json:"-"`
342356
}
343357

@@ -346,22 +360,31 @@ type UpdateJobDefinitionRequest struct {
346360
// Region: region to target. If none is passed will use default region from the config.
347361
Region scw.Region `json:"-"`
348362

363+
// JobDefinitionID: UUID of the job definition to update.
349364
JobDefinitionID string `json:"-"`
350365

366+
// Name: name of the job definition.
351367
Name *string `json:"name,omitempty"`
352368

369+
// CPULimit: CPU limit of the job.
353370
CPULimit *uint32 `json:"cpu_limit,omitempty"`
354371

372+
// MemoryLimit: memory limit of the job.
355373
MemoryLimit *uint32 `json:"memory_limit,omitempty"`
356374

375+
// ImageURI: image to use for the job.
357376
ImageURI *string `json:"image_uri,omitempty"`
358377

378+
// Command: startup command.
359379
Command *string `json:"command,omitempty"`
360380

381+
// EnvironmentVariables: environment variables of the job.
361382
EnvironmentVariables *map[string]string `json:"environment_variables,omitempty"`
362383

384+
// Description: description of the job.
363385
Description *string `json:"description,omitempty"`
364386

387+
// JobTimeout: timeout of the job in seconds.
365388
JobTimeout *scw.Duration `json:"job_timeout,omitempty"`
366389
}
367390

@@ -380,7 +403,7 @@ func (s *API) Regions() []scw.Region {
380403
return []scw.Region{scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw}
381404
}
382405

383-
// CreateJobDefinition:
406+
// CreateJobDefinition: Create a new job definition in a specified Project.
384407
func (s *API) CreateJobDefinition(req *CreateJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error) {
385408
var err error
386409

@@ -421,7 +444,7 @@ func (s *API) CreateJobDefinition(req *CreateJobDefinitionRequest, opts ...scw.R
421444
return &resp, nil
422445
}
423446

424-
// GetJobDefinition:
447+
// GetJobDefinition: Get a job definition by its unique identifier.
425448
func (s *API) GetJobDefinition(req *GetJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error) {
426449
var err error
427450

@@ -452,7 +475,7 @@ func (s *API) GetJobDefinition(req *GetJobDefinitionRequest, opts ...scw.Request
452475
return &resp, nil
453476
}
454477

455-
// ListJobDefinitions:
478+
// ListJobDefinitions: List all your job definitions with filters.
456479
func (s *API) ListJobDefinitions(req *ListJobDefinitionsRequest, opts ...scw.RequestOption) (*ListJobDefinitionsResponse, error) {
457480
var err error
458481

@@ -491,7 +514,7 @@ func (s *API) ListJobDefinitions(req *ListJobDefinitionsRequest, opts ...scw.Req
491514
return &resp, nil
492515
}
493516

494-
// UpdateJobDefinition:
517+
// UpdateJobDefinition: Update an existing job definition associated with the specified unique identifier.
495518
func (s *API) UpdateJobDefinition(req *UpdateJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error) {
496519
var err error
497520

@@ -527,7 +550,7 @@ func (s *API) UpdateJobDefinition(req *UpdateJobDefinitionRequest, opts ...scw.R
527550
return &resp, nil
528551
}
529552

530-
// DeleteJobDefinition:
553+
// DeleteJobDefinition: Delete an exsisting job definition by its unique identifier.
531554
func (s *API) DeleteJobDefinition(req *DeleteJobDefinitionRequest, opts ...scw.RequestOption) error {
532555
var err error
533556

@@ -556,7 +579,7 @@ func (s *API) DeleteJobDefinition(req *DeleteJobDefinitionRequest, opts ...scw.R
556579
return nil
557580
}
558581

559-
// StartJobDefinition:
582+
// StartJobDefinition: Run an existing job definition by its unique identifier. This will create a new job run.
560583
func (s *API) StartJobDefinition(req *StartJobDefinitionRequest, opts ...scw.RequestOption) (*JobRun, error) {
561584
var err error
562585

@@ -592,7 +615,7 @@ func (s *API) StartJobDefinition(req *StartJobDefinitionRequest, opts ...scw.Req
592615
return &resp, nil
593616
}
594617

595-
// GetJobRun:
618+
// GetJobRun: Get a job run by its unique identifier.
596619
func (s *API) GetJobRun(req *GetJobRunRequest, opts ...scw.RequestOption) (*JobRun, error) {
597620
var err error
598621

@@ -623,7 +646,7 @@ func (s *API) GetJobRun(req *GetJobRunRequest, opts ...scw.RequestOption) (*JobR
623646
return &resp, nil
624647
}
625648

626-
// StopJobRun:
649+
// StopJobRun: Stop a job run by its unique identifier.
627650
func (s *API) StopJobRun(req *StopJobRunRequest, opts ...scw.RequestOption) (*JobRun, error) {
628651
var err error
629652

@@ -659,7 +682,7 @@ func (s *API) StopJobRun(req *StopJobRunRequest, opts ...scw.RequestOption) (*Jo
659682
return &resp, nil
660683
}
661684

662-
// ListJobRuns:
685+
// ListJobRuns: List all job runs with filters.
663686
func (s *API) ListJobRuns(req *ListJobRunsRequest, opts ...scw.RequestOption) (*ListJobRunsResponse, error) {
664687
var err error
665688

0 commit comments

Comments
 (0)