jobsqueueapi

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 10 Imported by: 0

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

This section is empty.

Variables

This section is empty.

Functions

func ClientWithHostAndToken

func ClientWithHostAndToken(c client.Client, apiHost string, apiToken string) client.Client

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.

`configId` can be set to an empty string and it will be omitted.

func WaitForJob

func WaitForJob(ctx context.Context, sender client.Sender, job *Job) error

WaitForJob pulls job status until it is completed.

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 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) Error

func (e Error) Error() string

func (Error) ErrorExceptionID

func (e Error) ErrorExceptionID() string

ErrorExceptionID returns exception ID to find details in logs.

func (Error) ErrorName

func (e Error) ErrorName() string

ErrorName returns a human-readable name of the error.

func (Error) ErrorUserMessage

func (e Error) ErrorUserMessage() string

ErrorUserMessage returns error message for end user.

func (*Error) SetRequest

func (e *Error) SetRequest(request *http.Request)

SetRequest method allows injection of HTTP request to the error, it implements client.errorWithRequest.

func (*Error) SetResponse

func (e *Error) SetResponse(response *http.Response)

SetResponse method allows injection of HTTP response to the error, it implements client.errorWithResponse.

func (Error) StatusCode

func (e Error) StatusCode() int

StatusCode returns HTTP status code.

type Job

type Job struct {
	JobKey
	Status     string        `json:"status"`
	IsFinished bool          `json:"isFinished"`
	URL        string        `json:"url"`
	Result     JobResult     `json:"result,omitempty"`
	CreateTime iso8601.Time  `json:"createdTime"`
	StartTime  *iso8601.Time `json:"startTime"`
	EndTime    *iso8601.Time `json:"endTime"`
}

Job is a component job.

type JobID

type JobID string

JobID is an ID of a component job.

func (JobID) String

func (j JobID) String() string

type JobKey

type JobKey struct {
	ID JobID `json:"id"`
}

JobKey is a unique identifier of Job.

type JobResult

type JobResult struct {
	Error   map[string]any `json:"error,omitempty"`
	Message string         `json:"message,omitempty"`
}

func (*JobResult) UnmarshalJSON

func (r *JobResult) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements JSON decoding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL