Documentation
¶
Overview ¶
Package jobsqueueapi contains request definitions for the Jobs Queue API. Requests can be sent by any HTTP client that implements the client.Sender interface. It is necessary to set API host in the HTTP client, see the ClientWithHost function.
Index ¶
- Constants
- func ClientWithHostAndToken(c client.Client, apiHost string, apiToken string) client.Client
- func CreateJobConfigDataRequest(componentID ComponentID, configID ConfigID, configData map[string]any) client.APIRequest[*Job]
- func CreateJobRequest(componentID ComponentID, configID ConfigID) client.APIRequest[*Job]
- func GetJobRequest(key JobKey) client.APIRequest[*Job]
- func WaitForJob(ctx context.Context, sender client.Sender, job *Job) error
- type ComponentID
- type ConfigID
- type DurationSeconds
- type Error
- type Job
- type JobID
- type JobKey
- type JobResult
- type Time
Constants ¶
const TimeFormat = "2006-01-02T15:04:05-07:00"
TimeFormat used in Storage API
Variables ¶
This section is empty.
Functions ¶
func ClientWithHostAndToken ¶
ClientWithHostAndToken returns HTTP client with api host and token set.
func CreateJobConfigDataRequest ¶ added in v0.5.0
func CreateJobConfigDataRequest(componentID ComponentID, configID ConfigID, configData map[string]any) client.APIRequest[*Job]
CreateJobConfigDataRequest - https://app.swaggerhub.com/apis-docs/keboola/job-queue-api/1.3.2#/Jobs/createJob
Allows setting configData
func CreateJobRequest ¶
func CreateJobRequest(componentID ComponentID, configID ConfigID) client.APIRequest[*Job]
CreateJobRequest - https://app.swaggerhub.com/apis-docs/keboola/job-queue-api/1.3.2#/Jobs/createJob
func GetJobRequest ¶
func GetJobRequest(key JobKey) client.APIRequest[*Job]
GetJobRequest https://app.swaggerhub.com/apis-docs/keboola/job-queue-api/1.3.2#/Jobs/getJob
Types ¶
type ComponentID ¶
type ComponentID = storageapi.ComponentID
ComponentID is id of a Keboola component.
type ConfigID ¶
type ConfigID = storageapi.ConfigID
ConfigID is id of a Keboola component configuration.
type DurationSeconds ¶
DurationSeconds is time.Duration encoded/decoded as number of seconds.
func (DurationSeconds) MarshalJSON ¶
func (d DurationSeconds) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding.
func (DurationSeconds) String ¶
func (d DurationSeconds) String() string
func (*DurationSeconds) UnmarshalJSON ¶
func (d *DurationSeconds) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON implements JSON decoding.
type Error ¶
type Error struct { Message string `json:"error"` ErrCode int `json:"code"` ExceptionID string `json:"exceptionId"` // contains filtered or unexported fields }
Error represents the structure of Jobs Queue API error.
func (Error) ErrorExceptionID ¶
ErrorExceptionID returns exception ID to find details in logs.
func (Error) ErrorUserMessage ¶
ErrorUserMessage returns error message for end user.
func (*Error) SetRequest ¶
SetRequest method allows injection of HTTP request to the error, it implements client.errorWithRequest.
func (*Error) SetResponse ¶
SetResponse method allows injection of HTTP response to the error, it implements client.errorWithResponse.
type Job ¶
type Job struct { JobKey Status string `json:"status"` IsFinished bool `json:"isFinished"` URL string `json:"url"` Result JobResult `json:"result,omitempty"` CreateTime Time `json:"createdTime"` StartTime *Time `json:"startTime"` EndTime *Time `json:"endTime"` }
Job is a component job.
type JobResult ¶
type JobResult struct { Error map[string]any `json:"error,omitempty"` Message string `json:"message,omitempty"` }
func (*JobResult) UnmarshalJSON ¶
UnmarshalJSON implements JSON decoding.
type Time ¶
Time is encoded/decoded in TimeFormat used in Storage API.
func (Time) MarshalJSON ¶
MarshalJSON implements JSON encoding.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements JSON decoding.