Documentation ¶
Overview ¶
Package jobs provides methods and message types of the jobs v1alpha1 API.
Index ¶
- Constants
- type API
- func (s *API) CreateJobDefinition(req *CreateJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error)
- func (s *API) DeleteJobDefinition(req *DeleteJobDefinitionRequest, opts ...scw.RequestOption) error
- func (s *API) GetJobDefinition(req *GetJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error)
- func (s *API) GetJobRun(req *GetJobRunRequest, opts ...scw.RequestOption) (*JobRun, error)
- func (s *API) ListJobDefinitions(req *ListJobDefinitionsRequest, opts ...scw.RequestOption) (*ListJobDefinitionsResponse, error)
- func (s *API) ListJobRuns(req *ListJobRunsRequest, opts ...scw.RequestOption) (*ListJobRunsResponse, error)
- func (s *API) ListJobsResources(req *ListJobsResourcesRequest, opts ...scw.RequestOption) (*ListJobsResourcesResponse, error)
- func (s *API) Regions() []scw.Region
- func (s *API) StartJobDefinition(req *StartJobDefinitionRequest, opts ...scw.RequestOption) (*StartJobDefinitionResponse, error)
- func (s *API) StopJobRun(req *StopJobRunRequest, opts ...scw.RequestOption) (*JobRun, error)
- func (s *API) UpdateJobDefinition(req *UpdateJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error)
- func (s *API) WaitForJobRun(req *WaitForJobRunRequest, opts ...scw.RequestOption) (*JobRun, error)
- type CreateJobDefinitionRequest
- type CreateJobDefinitionRequestCronScheduleConfig
- type CronSchedule
- type DeleteJobDefinitionRequest
- type GetJobDefinitionRequest
- type GetJobRunRequest
- type JobDefinition
- type JobRun
- type JobRunState
- type ListJobDefinitionsRequest
- type ListJobDefinitionsRequestOrderBy
- func (enum ListJobDefinitionsRequestOrderBy) MarshalJSON() ([]byte, error)
- func (enum ListJobDefinitionsRequestOrderBy) String() string
- func (enum *ListJobDefinitionsRequestOrderBy) UnmarshalJSON(data []byte) error
- func (enum ListJobDefinitionsRequestOrderBy) Values() []ListJobDefinitionsRequestOrderBy
- type ListJobDefinitionsResponse
- type ListJobRunsRequest
- type ListJobRunsRequestOrderBy
- type ListJobRunsResponse
- type ListJobsResourcesRequest
- type ListJobsResourcesResponse
- type Resource
- type StartJobDefinitionRequest
- type StartJobDefinitionResponse
- type StopJobRunRequest
- type UpdateJobDefinitionRequest
- type UpdateJobDefinitionRequestCronScheduleConfig
- type WaitForJobRunRequest
Constants ¶
const ( JobRunStateUnknownState = JobRunState("unknown_state") JobRunStateQueued = JobRunState("queued") JobRunStateScheduled = JobRunState("scheduled") JobRunStateRunning = JobRunState("running") JobRunStateSucceeded = JobRunState("succeeded") JobRunStateFailed = JobRunState("failed") JobRunStateCanceled = JobRunState("canceled") JobRunStateInternalError = JobRunState("internal_error") )
const ( ListJobDefinitionsRequestOrderByCreatedAtAsc = ListJobDefinitionsRequestOrderBy("created_at_asc") ListJobDefinitionsRequestOrderByCreatedAtDesc = ListJobDefinitionsRequestOrderBy("created_at_desc") )
const ( ListJobRunsRequestOrderByCreatedAtAsc = ListJobRunsRequestOrderBy("created_at_asc") ListJobRunsRequestOrderByCreatedAtDesc = ListJobRunsRequestOrderBy("created_at_desc") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
This API allows you to manage your Serverless Jobs.
func (*API) CreateJobDefinition ¶
func (s *API) CreateJobDefinition(req *CreateJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error)
CreateJobDefinition: Create a new job definition in a specified Project.
func (*API) DeleteJobDefinition ¶
func (s *API) DeleteJobDefinition(req *DeleteJobDefinitionRequest, opts ...scw.RequestOption) error
DeleteJobDefinition: Delete an exsisting job definition by its unique identifier.
func (*API) GetJobDefinition ¶
func (s *API) GetJobDefinition(req *GetJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error)
GetJobDefinition: Get a job definition by its unique identifier.
func (*API) GetJobRun ¶
func (s *API) GetJobRun(req *GetJobRunRequest, opts ...scw.RequestOption) (*JobRun, error)
GetJobRun: Get a job run by its unique identifier.
func (*API) ListJobDefinitions ¶
func (s *API) ListJobDefinitions(req *ListJobDefinitionsRequest, opts ...scw.RequestOption) (*ListJobDefinitionsResponse, error)
ListJobDefinitions: List all your job definitions with filters.
func (*API) ListJobRuns ¶
func (s *API) ListJobRuns(req *ListJobRunsRequest, opts ...scw.RequestOption) (*ListJobRunsResponse, error)
ListJobRuns: List all job runs with filters.
func (*API) ListJobsResources ¶
func (s *API) ListJobsResources(req *ListJobsResourcesRequest, opts ...scw.RequestOption) (*ListJobsResourcesResponse, error)
ListJobsResources: List jobs resources for the console.
func (*API) StartJobDefinition ¶
func (s *API) StartJobDefinition(req *StartJobDefinitionRequest, opts ...scw.RequestOption) (*StartJobDefinitionResponse, error)
StartJobDefinition: Run an existing job definition by its unique identifier. This will create a new job run.
func (*API) StopJobRun ¶
func (s *API) StopJobRun(req *StopJobRunRequest, opts ...scw.RequestOption) (*JobRun, error)
StopJobRun: Stop a job run by its unique identifier.
func (*API) UpdateJobDefinition ¶
func (s *API) UpdateJobDefinition(req *UpdateJobDefinitionRequest, opts ...scw.RequestOption) (*JobDefinition, error)
UpdateJobDefinition: Update an existing job definition associated with the specified unique identifier.
func (*API) WaitForJobRun ¶
func (s *API) WaitForJobRun(req *WaitForJobRunRequest, opts ...scw.RequestOption) (*JobRun, error)
WaitForJobRun waits for the job run to be in a "terminal state" before returning. This function can be used to wait for a job run to fail for example.
type CreateJobDefinitionRequest ¶
type CreateJobDefinitionRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` // Name: name of the job definition. Name string `json:"name"` // CPULimit: CPU limit of the job. CPULimit uint32 `json:"cpu_limit"` // MemoryLimit: memory limit of the job (in MiB). MemoryLimit uint32 `json:"memory_limit"` // LocalStorageCapacity: local storage capacity of the job (in MiB). LocalStorageCapacity *uint32 `json:"local_storage_capacity,omitempty"` // ImageURI: image to use for the job. ImageURI string `json:"image_uri"` // Command: startup command. If empty or not defined, the image's default command is used. Command string `json:"command"` // ProjectID: UUID of the Scaleway Project containing the job. ProjectID string `json:"project_id"` // EnvironmentVariables: environment variables of the job. EnvironmentVariables map[string]string `json:"environment_variables"` // Description: description of the job. Description string `json:"description"` // JobTimeout: timeout of the job in seconds. JobTimeout *scw.Duration `json:"job_timeout,omitempty"` // CronSchedule: configure a cron for the job. CronSchedule *CreateJobDefinitionRequestCronScheduleConfig `json:"cron_schedule,omitempty"` }
CreateJobDefinitionRequest: create job definition request.
type CreateJobDefinitionRequestCronScheduleConfig ¶
type CreateJobDefinitionRequestCronScheduleConfig struct { Schedule string `json:"schedule"` Timezone string `json:"timezone"` }
CreateJobDefinitionRequestCronScheduleConfig: create job definition request cron schedule config.
type CronSchedule ¶
type CronSchedule struct { // Schedule: uNIX cron schedule to run job (e.g., '* * * * *'). Schedule string `json:"schedule"` // Timezone: timezone for the cron schedule, in tz database format (e.g., 'Europe/Paris'). Timezone string `json:"timezone"` }
CronSchedule: cron schedule.
type DeleteJobDefinitionRequest ¶
type DeleteJobDefinitionRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` // JobDefinitionID: UUID of the job definition to delete. JobDefinitionID string `json:"-"` }
DeleteJobDefinitionRequest: delete job definition request.
type GetJobDefinitionRequest ¶
type GetJobDefinitionRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` // JobDefinitionID: UUID of the job definition to get. JobDefinitionID string `json:"-"` }
GetJobDefinitionRequest: get job definition request.
type GetJobRunRequest ¶
type GetJobRunRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` // JobRunID: UUID of the job run to get. JobRunID string `json:"-"` }
GetJobRunRequest: get job run request.
type JobDefinition ¶
type JobDefinition struct { ID string `json:"id"` Name string `json:"name"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` CPULimit uint32 `json:"cpu_limit"` MemoryLimit uint32 `json:"memory_limit"` ImageURI string `json:"image_uri"` Command string `json:"command"` ProjectID string `json:"project_id"` EnvironmentVariables map[string]string `json:"environment_variables"` Description string `json:"description"` JobTimeout *scw.Duration `json:"job_timeout"` CronSchedule *CronSchedule `json:"cron_schedule"` LocalStorageCapacity uint32 `json:"local_storage_capacity"` // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"region"` }
JobDefinition: job definition.
type JobRun ¶
type JobRun struct { ID string `json:"id"` JobDefinitionID string `json:"job_definition_id"` // State: default value: unknown_state State JobRunState `json:"state"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` TerminatedAt *time.Time `json:"terminated_at"` ExitCode *int32 `json:"exit_code"` RunDuration *scw.Duration `json:"run_duration"` ErrorMessage string `json:"error_message"` CPULimit uint32 `json:"cpu_limit"` MemoryLimit uint32 `json:"memory_limit"` Command string `json:"command"` EnvironmentVariables map[string]string `json:"environment_variables"` LocalStorageCapacity uint32 `json:"local_storage_capacity"` StartedAt *time.Time `json:"started_at"` // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"region"` }
JobRun: job run.
type JobRunState ¶
type JobRunState string
func (JobRunState) MarshalJSON ¶
func (enum JobRunState) MarshalJSON() ([]byte, error)
func (JobRunState) String ¶
func (enum JobRunState) String() string
func (*JobRunState) UnmarshalJSON ¶
func (enum *JobRunState) UnmarshalJSON(data []byte) error
func (JobRunState) Values ¶
func (enum JobRunState) Values() []JobRunState
type ListJobDefinitionsRequest ¶
type ListJobDefinitionsRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` Page *int32 `json:"-"` PageSize *uint32 `json:"-"` // OrderBy: default value: created_at_asc OrderBy ListJobDefinitionsRequestOrderBy `json:"-"` ProjectID *string `json:"-"` OrganizationID *string `json:"-"` }
ListJobDefinitionsRequest: list job definitions request.
type ListJobDefinitionsRequestOrderBy ¶
type ListJobDefinitionsRequestOrderBy string
func (ListJobDefinitionsRequestOrderBy) MarshalJSON ¶
func (enum ListJobDefinitionsRequestOrderBy) MarshalJSON() ([]byte, error)
func (ListJobDefinitionsRequestOrderBy) String ¶
func (enum ListJobDefinitionsRequestOrderBy) String() string
func (*ListJobDefinitionsRequestOrderBy) UnmarshalJSON ¶
func (enum *ListJobDefinitionsRequestOrderBy) UnmarshalJSON(data []byte) error
func (ListJobDefinitionsRequestOrderBy) Values ¶
func (enum ListJobDefinitionsRequestOrderBy) Values() []ListJobDefinitionsRequestOrderBy
type ListJobDefinitionsResponse ¶
type ListJobDefinitionsResponse struct { JobDefinitions []*JobDefinition `json:"job_definitions"` TotalCount uint64 `json:"total_count"` }
ListJobDefinitionsResponse: list job definitions response.
func (*ListJobDefinitionsResponse) UnsafeAppend ¶
func (r *ListJobDefinitionsResponse) UnsafeAppend(res interface{}) (uint64, error)
UnsafeAppend should not be used Internal usage only
func (*ListJobDefinitionsResponse) UnsafeGetTotalCount ¶
func (r *ListJobDefinitionsResponse) UnsafeGetTotalCount() uint64
UnsafeGetTotalCount should not be used Internal usage only
type ListJobRunsRequest ¶
type ListJobRunsRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` Page *int32 `json:"-"` PageSize *uint32 `json:"-"` // OrderBy: default value: created_at_asc OrderBy ListJobRunsRequestOrderBy `json:"-"` JobDefinitionID *string `json:"-"` ProjectID *string `json:"-"` OrganizationID *string `json:"-"` }
ListJobRunsRequest: list job runs request.
type ListJobRunsRequestOrderBy ¶
type ListJobRunsRequestOrderBy string
func (ListJobRunsRequestOrderBy) MarshalJSON ¶
func (enum ListJobRunsRequestOrderBy) MarshalJSON() ([]byte, error)
func (ListJobRunsRequestOrderBy) String ¶
func (enum ListJobRunsRequestOrderBy) String() string
func (*ListJobRunsRequestOrderBy) UnmarshalJSON ¶
func (enum *ListJobRunsRequestOrderBy) UnmarshalJSON(data []byte) error
func (ListJobRunsRequestOrderBy) Values ¶
func (enum ListJobRunsRequestOrderBy) Values() []ListJobRunsRequestOrderBy
type ListJobRunsResponse ¶
type ListJobRunsResponse struct { JobRuns []*JobRun `json:"job_runs"` TotalCount uint64 `json:"total_count"` }
ListJobRunsResponse: list job runs response.
func (*ListJobRunsResponse) UnsafeAppend ¶
func (r *ListJobRunsResponse) UnsafeAppend(res interface{}) (uint64, error)
UnsafeAppend should not be used Internal usage only
func (*ListJobRunsResponse) UnsafeGetTotalCount ¶
func (r *ListJobRunsResponse) UnsafeGetTotalCount() uint64
UnsafeGetTotalCount should not be used Internal usage only
type ListJobsResourcesRequest ¶
type ListJobsResourcesRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` }
ListJobsResourcesRequest: list jobs resources request.
type ListJobsResourcesResponse ¶
type ListJobsResourcesResponse struct {
Resources []*Resource `json:"resources"`
}
ListJobsResourcesResponse: list jobs resources response.
type Resource ¶
type Resource struct { CPULimit uint32 `json:"cpu_limit"` MemoryLimit uint32 `json:"memory_limit"` }
Resource: resource.
type StartJobDefinitionRequest ¶
type StartJobDefinitionRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` // JobDefinitionID: UUID of the job definition to start. JobDefinitionID string `json:"-"` // Command: contextual startup command for this specific job run. Command *string `json:"command,omitempty"` // EnvironmentVariables: contextual environment variables for this specific job run. EnvironmentVariables *map[string]string `json:"environment_variables,omitempty"` // Replicas: number of jobs to run. Replicas *uint32 `json:"replicas,omitempty"` }
StartJobDefinitionRequest: start job definition request.
type StartJobDefinitionResponse ¶
type StartJobDefinitionResponse struct {
JobRuns []*JobRun `json:"job_runs"`
}
StartJobDefinitionResponse: start job definition response.
type StopJobRunRequest ¶
type StopJobRunRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` // JobRunID: UUID of the job run to stop. JobRunID string `json:"-"` }
StopJobRunRequest: stop job run request.
type UpdateJobDefinitionRequest ¶
type UpdateJobDefinitionRequest struct { // Region: region to target. If none is passed will use default region from the config. Region scw.Region `json:"-"` // JobDefinitionID: UUID of the job definition to update. JobDefinitionID string `json:"-"` // Name: name of the job definition. Name *string `json:"name,omitempty"` // CPULimit: CPU limit of the job. CPULimit *uint32 `json:"cpu_limit,omitempty"` // MemoryLimit: memory limit of the job (in MiB). MemoryLimit *uint32 `json:"memory_limit,omitempty"` // LocalStorageCapacity: local storage capacity of the job (in MiB). LocalStorageCapacity *uint32 `json:"local_storage_capacity,omitempty"` // ImageURI: image to use for the job. ImageURI *string `json:"image_uri,omitempty"` // Command: startup command. Command *string `json:"command,omitempty"` // EnvironmentVariables: environment variables of the job. EnvironmentVariables *map[string]string `json:"environment_variables,omitempty"` // Description: description of the job. Description *string `json:"description,omitempty"` // JobTimeout: timeout of the job in seconds. JobTimeout *scw.Duration `json:"job_timeout,omitempty"` CronSchedule *UpdateJobDefinitionRequestCronScheduleConfig `json:"cron_schedule,omitempty"` }
UpdateJobDefinitionRequest: update job definition request.
type UpdateJobDefinitionRequestCronScheduleConfig ¶
type UpdateJobDefinitionRequestCronScheduleConfig struct { Schedule *string `json:"schedule"` Timezone *string `json:"timezone"` }
UpdateJobDefinitionRequestCronScheduleConfig: update job definition request cron schedule config.