Skip to content

Commit

Permalink
feat(serverless): add CronSchedule to job definitions (#1962)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Dec 26, 2023
1 parent b3e420e commit d6e72a6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions api/jobs/v1alpha1/jobs_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ func (enum *ListJobRunsRequestOrderBy) UnmarshalJSON(data []byte) error {
return nil
}

// CronSchedule: cron schedule.
type CronSchedule struct {
Schedule string `json:"schedule"`

Timezone string `json:"timezone"`
}

// CreateJobDefinitionRequestCronScheduleConfig: create job definition request cron schedule config.
type CreateJobDefinitionRequestCronScheduleConfig struct {
Schedule string `json:"schedule"`

Timezone string `json:"timezone"`
}

// JobDefinition: job definition.
type JobDefinition struct {
ID string `json:"id"`
Expand All @@ -160,6 +174,8 @@ type JobDefinition struct {

JobTimeout *scw.Duration `json:"job_timeout"`

CronSchedule *CronSchedule `json:"cron_schedule"`

// Region: region to target. If none is passed will use default region from the config.
Region scw.Region `json:"region"`
}
Expand Down Expand Up @@ -193,6 +209,13 @@ type JobRun struct {
Region scw.Region `json:"region"`
}

// UpdateJobDefinitionRequestCronScheduleConfig: update job definition request cron schedule config.
type UpdateJobDefinitionRequestCronScheduleConfig struct {
Schedule *string `json:"schedule"`

Timezone *string `json:"timezone"`
}

// CreateJobDefinitionRequest: create job definition request.
type CreateJobDefinitionRequest struct {
// Region: region to target. If none is passed will use default region from the config.
Expand Down Expand Up @@ -224,6 +247,8 @@ type CreateJobDefinitionRequest struct {

// JobTimeout: timeout of the job in seconds.
JobTimeout *scw.Duration `json:"job_timeout,omitempty"`

CronSchedule *CreateJobDefinitionRequestCronScheduleConfig `json:"cron_schedule,omitempty"`
}

// DeleteJobDefinitionRequest: delete job definition request.
Expand Down Expand Up @@ -386,6 +411,8 @@ type UpdateJobDefinitionRequest struct {

// JobTimeout: timeout of the job in seconds.
JobTimeout *scw.Duration `json:"job_timeout,omitempty"`

CronSchedule *UpdateJobDefinitionRequestCronScheduleConfig `json:"cron_schedule,omitempty"`
}

// Serverless Jobs API.
Expand Down

0 comments on commit d6e72a6

Please sign in to comment.