openapi

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 9 Imported by: 0

README

Distributed scheduler client

Welcome 👋

This repository contains client library/SDK for the distributed scheduler.

Every version has OpenAPI specification that is used to generate the client using oapi-codegen generator.

Installation

 go get github.com/GLCharge/distributed-scheduler-client@latest"

Usage

import client "https://github.com/GLCharge/distributed-scheduler-client

Generation

This code base, was generated using oapi-codegen.

You can generate the SDK manually by running the Makefile script:

make gen-client

Documentation

Overview

Package openapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeleteJobsIdRequest

func NewDeleteJobsIdRequest(server string, id string) (*http.Request, error)

NewDeleteJobsIdRequest generates requests for DeleteJobsId

func NewGetJobsIdExecutionsRequest

func NewGetJobsIdExecutionsRequest(server string, id string, params *GetJobsIdExecutionsParams) (*http.Request, error)

NewGetJobsIdExecutionsRequest generates requests for GetJobsIdExecutions

func NewGetJobsIdRequest

func NewGetJobsIdRequest(server string, id string) (*http.Request, error)

NewGetJobsIdRequest generates requests for GetJobsId

func NewGetJobsRequest

func NewGetJobsRequest(server string, params *GetJobsParams) (*http.Request, error)

NewGetJobsRequest generates requests for GetJobs

func NewPostJobsRequest

func NewPostJobsRequest(server string, body PostJobsJSONRequestBody) (*http.Request, error)

NewPostJobsRequest calls the generic PostJobs builder with application/json body

func NewPostJobsRequestWithBody

func NewPostJobsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewPostJobsRequestWithBody generates requests for PostJobs with any type of body

func NewPutJobsIdRequest

func NewPutJobsIdRequest(server string, id string, body PutJobsIdJSONRequestBody) (*http.Request, error)

NewPutJobsIdRequest calls the generic PutJobsId builder with application/json body

func NewPutJobsIdRequestWithBody

func NewPutJobsIdRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error)

NewPutJobsIdRequestWithBody generates requests for PutJobsId with any type of body

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) DeleteJobsId

func (c *Client) DeleteJobsId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetJobs

func (c *Client) GetJobs(ctx context.Context, params *GetJobsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetJobsId

func (c *Client) GetJobsId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetJobsIdExecutions

func (c *Client) GetJobsIdExecutions(ctx context.Context, id string, params *GetJobsIdExecutionsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostJobs

func (c *Client) PostJobs(ctx context.Context, body PostJobsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostJobsWithBody

func (c *Client) PostJobsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PutJobsId

func (c *Client) PutJobsId(ctx context.Context, id string, body PutJobsIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PutJobsIdWithBody

func (c *Client) PutJobsIdWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetJobs request
	GetJobs(ctx context.Context, params *GetJobsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PostJobsWithBody request with any body
	PostJobsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	PostJobs(ctx context.Context, body PostJobsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteJobsId request
	DeleteJobsId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetJobsId request
	GetJobsId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PutJobsIdWithBody request with any body
	PutJobsIdWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	PutJobsId(ctx context.Context, id string, body PutJobsIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetJobsIdExecutions request
	GetJobsIdExecutions(ctx context.Context, id string, params *GetJobsIdExecutionsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) DeleteJobsIdWithResponse

func (c *ClientWithResponses) DeleteJobsIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteJobsIdResponse, error)

DeleteJobsIdWithResponse request returning *DeleteJobsIdResponse

func (*ClientWithResponses) GetJobsIdExecutionsWithResponse

func (c *ClientWithResponses) GetJobsIdExecutionsWithResponse(ctx context.Context, id string, params *GetJobsIdExecutionsParams, reqEditors ...RequestEditorFn) (*GetJobsIdExecutionsResponse, error)

GetJobsIdExecutionsWithResponse request returning *GetJobsIdExecutionsResponse

func (*ClientWithResponses) GetJobsIdWithResponse

func (c *ClientWithResponses) GetJobsIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetJobsIdResponse, error)

GetJobsIdWithResponse request returning *GetJobsIdResponse

func (*ClientWithResponses) GetJobsWithResponse

func (c *ClientWithResponses) GetJobsWithResponse(ctx context.Context, params *GetJobsParams, reqEditors ...RequestEditorFn) (*GetJobsResponse, error)

GetJobsWithResponse request returning *GetJobsResponse

func (*ClientWithResponses) PostJobsWithBodyWithResponse

func (c *ClientWithResponses) PostJobsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostJobsResponse, error)

PostJobsWithBodyWithResponse request with arbitrary body returning *PostJobsResponse

func (*ClientWithResponses) PostJobsWithResponse

func (c *ClientWithResponses) PostJobsWithResponse(ctx context.Context, body PostJobsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostJobsResponse, error)

func (*ClientWithResponses) PutJobsIdWithBodyWithResponse

func (c *ClientWithResponses) PutJobsIdWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutJobsIdResponse, error)

PutJobsIdWithBodyWithResponse request with arbitrary body returning *PutJobsIdResponse

func (*ClientWithResponses) PutJobsIdWithResponse

func (c *ClientWithResponses) PutJobsIdWithResponse(ctx context.Context, id string, body PutJobsIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutJobsIdResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetJobsWithResponse request
	GetJobsWithResponse(ctx context.Context, params *GetJobsParams, reqEditors ...RequestEditorFn) (*GetJobsResponse, error)

	// PostJobsWithBodyWithResponse request with any body
	PostJobsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostJobsResponse, error)

	PostJobsWithResponse(ctx context.Context, body PostJobsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostJobsResponse, error)

	// DeleteJobsIdWithResponse request
	DeleteJobsIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteJobsIdResponse, error)

	// GetJobsIdWithResponse request
	GetJobsIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetJobsIdResponse, error)

	// PutJobsIdWithBodyWithResponse request with any body
	PutJobsIdWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutJobsIdResponse, error)

	PutJobsIdWithResponse(ctx context.Context, id string, body PutJobsIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutJobsIdResponse, error)

	// GetJobsIdExecutionsWithResponse request
	GetJobsIdExecutionsWithResponse(ctx context.Context, id string, params *GetJobsIdExecutionsParams, reqEditors ...RequestEditorFn) (*GetJobsIdExecutionsResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type DeleteJobsIdResponse

type DeleteJobsIdResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON400      *HandlersErrorResponse
	JSON500      *HandlersErrorResponse
}

func ParseDeleteJobsIdResponse

func ParseDeleteJobsIdResponse(rsp *http.Response) (*DeleteJobsIdResponse, error)

ParseDeleteJobsIdResponse parses an HTTP response from a DeleteJobsIdWithResponse call

func (DeleteJobsIdResponse) Status

func (r DeleteJobsIdResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteJobsIdResponse) StatusCode

func (r DeleteJobsIdResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetJobsIdExecutionsParams

type GetJobsIdExecutionsParams struct {
	// FailedOnly Failed Only
	FailedOnly *bool `form:"failedOnly,omitempty" json:"failedOnly,omitempty"`

	// Limit Limit
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Offset
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

GetJobsIdExecutionsParams defines parameters for GetJobsIdExecutions.

type GetJobsIdExecutionsResponse

type GetJobsIdExecutionsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]ModelJobExecution
	JSON400      *HandlersErrorResponse
	JSON500      *HandlersErrorResponse
}

func ParseGetJobsIdExecutionsResponse

func ParseGetJobsIdExecutionsResponse(rsp *http.Response) (*GetJobsIdExecutionsResponse, error)

ParseGetJobsIdExecutionsResponse parses an HTTP response from a GetJobsIdExecutionsWithResponse call

func (GetJobsIdExecutionsResponse) Status

Status returns HTTPResponse.Status

func (GetJobsIdExecutionsResponse) StatusCode

func (r GetJobsIdExecutionsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetJobsIdResponse

type GetJobsIdResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ModelJob
	JSON400      *HandlersErrorResponse
	JSON500      *HandlersErrorResponse
}

func ParseGetJobsIdResponse

func ParseGetJobsIdResponse(rsp *http.Response) (*GetJobsIdResponse, error)

ParseGetJobsIdResponse parses an HTTP response from a GetJobsIdWithResponse call

func (GetJobsIdResponse) Status

func (r GetJobsIdResponse) Status() string

Status returns HTTPResponse.Status

func (GetJobsIdResponse) StatusCode

func (r GetJobsIdResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetJobsParams

type GetJobsParams struct {
	// Limit Limit
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Offset
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`

	// Tags Tags
	Tags *[]interface{} `form:"tags,omitempty" json:"tags,omitempty"`
}

GetJobsParams defines parameters for GetJobs.

type GetJobsResponse

type GetJobsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]ModelJob
	JSON400      *HandlersErrorResponse
	JSON500      *HandlersErrorResponse
}

func ParseGetJobsResponse

func ParseGetJobsResponse(rsp *http.Response) (*GetJobsResponse, error)

ParseGetJobsResponse parses an HTTP response from a GetJobsWithResponse call

func (GetJobsResponse) Status

func (r GetJobsResponse) Status() string

Status returns HTTPResponse.Status

func (GetJobsResponse) StatusCode

func (r GetJobsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HandlersErrorResponse

type HandlersErrorResponse struct {
	Error *string `json:"error,omitempty"`
}

HandlersErrorResponse defines model for handlers.ErrorResponse.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ModelAMQPJob

type ModelAMQPJob struct {
	// Body e.g., "Hello, world!"
	Body *string `json:"body,omitempty"`

	// BodyEncoding e.g., null, "base64"
	BodyEncoding *ModelBodyEncoding `json:"body_encoding,omitempty"`

	// Connection e.g., "amqp://guest:guest@localhost:5672/"
	Connection *string `json:"connection,omitempty"`

	// ContentType e.g., "text/plain"
	ContentType *string `json:"content_type,omitempty"`

	// Exchange e.g., "my_exchange"
	Exchange *string `json:"exchange,omitempty"`

	// Headers e.g., {"x-delay": 10000}
	Headers *map[string]interface{} `json:"headers,omitempty"`

	// RoutingKey e.g., "my_routing_key"
	RoutingKey *string `json:"routing_key,omitempty"`
}

ModelAMQPJob defines model for model.AMQPJob.

type ModelAuth

type ModelAuth struct {
	// BearerToken for "bearer"
	BearerToken *string `json:"bearer_token,omitempty"`

	// Password for "basic"
	Password *string `json:"password,omitempty"`

	// Type e.g., "none", "basic", "bearer"
	Type *ModelAuthType `json:"type,omitempty"`

	// Username for "basic"
	Username *string `json:"username,omitempty"`
}

ModelAuth defines model for model.Auth.

type ModelAuthType

type ModelAuthType string

ModelAuthType defines model for model.AuthType.

const (
	AuthTypeBasic  ModelAuthType = "basic"
	AuthTypeBearer ModelAuthType = "bearer"
	AuthTypeNone   ModelAuthType = "none"
)

Defines values for ModelAuthType.

type ModelBodyEncoding

type ModelBodyEncoding string

ModelBodyEncoding defines model for model.BodyEncoding.

const (
	BodyEncodingBase64 ModelBodyEncoding = "base64"
)

Defines values for ModelBodyEncoding.

type ModelHTTPJob

type ModelHTTPJob struct {
	// Auth e.g., {"type": "basic", "username": "foo", "password": "bar"}
	Auth *ModelAuth `json:"auth,omitempty"`

	// Body e.g., "{\"hello\": \"world\"}"
	Body *string `json:"body,omitempty"`

	// Headers e.g., {"Content-Type": "application/json"}
	Headers *map[string]string `json:"headers,omitempty"`

	// Method e.g., "GET", "POST", "PUT", "PATCH", "DELETE"
	Method *string `json:"method,omitempty"`

	// Url e.g., "https://example.com"
	Url *string `json:"url,omitempty"`

	// ValidResponseCodes e.g., [200, 201, 202]
	ValidResponseCodes *[]int `json:"valid_response_codes,omitempty"`
}

ModelHTTPJob defines model for model.HTTPJob.

type ModelJob

type ModelJob struct {
	AmqpJob   *ModelAMQPJob `json:"amqp_job,omitempty"`
	CreatedAt *string       `json:"created_at,omitempty"`

	// CronSchedule for recurring jobs
	CronSchedule *string `json:"cron_schedule,omitempty"`

	// ExecuteAt for one-off jobs
	ExecuteAt *string       `json:"execute_at,omitempty"`
	HttpJob   *ModelHTTPJob `json:"http_job,omitempty"`
	Id        *string       `json:"id,omitempty"`

	// NextRun when the job is scheduled to run next (can be null if the job is not scheduled to run again)
	NextRun   *string         `json:"next_run,omitempty"`
	Status    *ModelJobStatus `json:"status,omitempty"`
	Tags      *[]string       `json:"tags,omitempty"`
	Type      *ModelJobType   `json:"type,omitempty"`
	UpdatedAt *string         `json:"updated_at,omitempty"`
}

ModelJob defines model for model.Job.

type ModelJobCreate

type ModelJobCreate struct {
	AmqpJob *ModelAMQPJob `json:"amqp_job,omitempty"`

	// CronSchedule for recurring jobs
	CronSchedule *string `json:"cron_schedule,omitempty"`

	// ExecuteAt ExecuteAt and CronSchedule are mutually exclusive.
	ExecuteAt *string `json:"execute_at,omitempty"`

	// HttpJob HTTPJob and AMQPJob are mutually exclusive.
	HttpJob *ModelHTTPJob `json:"http_job,omitempty"`
	Tags    *[]string     `json:"tags,omitempty"`

	// Type Job type
	Type *ModelJobType `json:"type,omitempty"`
}

ModelJobCreate defines model for model.JobCreate.

type ModelJobExecution

type ModelJobExecution struct {
	EndTime      *string `json:"end_time,omitempty"`
	ErrorMessage *string `json:"error_message,omitempty"`
	Id           *int    `json:"id,omitempty"`
	JobId        *string `json:"job_id,omitempty"`
	StartTime    *string `json:"start_time,omitempty"`
	Success      *bool   `json:"success,omitempty"`
}

ModelJobExecution defines model for model.JobExecution.

type ModelJobStatus

type ModelJobStatus string

ModelJobStatus defines model for model.JobStatus.

const (
	JobStatusRunning ModelJobStatus = "RUNNING"
	JobStatusStopped ModelJobStatus = "STOPPED"
)

Defines values for ModelJobStatus.

type ModelJobType

type ModelJobType string

ModelJobType defines model for model.JobType.

const (
	JobTypeAMQP ModelJobType = "AMQP"
	JobTypeHTTP ModelJobType = "HTTP"
)

Defines values for ModelJobType.

type ModelJobUpdate

type ModelJobUpdate struct {
	Amqp         *ModelAMQPJob `json:"amqp,omitempty"`
	CronSchedule *string       `json:"cron_schedule,omitempty"`
	ExecuteAt    *string       `json:"execute_at,omitempty"`
	Http         *ModelHTTPJob `json:"http,omitempty"`
	Tags         *[]string     `json:"tags,omitempty"`
	Type         *ModelJobType `json:"type,omitempty"`
}

ModelJobUpdate defines model for model.JobUpdate.

type PostJobsJSONRequestBody

type PostJobsJSONRequestBody = ModelJobCreate

PostJobsJSONRequestBody defines body for PostJobs for application/json ContentType.

type PostJobsResponse

type PostJobsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *ModelJob
	JSON400      *HandlersErrorResponse
	JSON500      *HandlersErrorResponse
}

func ParsePostJobsResponse

func ParsePostJobsResponse(rsp *http.Response) (*PostJobsResponse, error)

ParsePostJobsResponse parses an HTTP response from a PostJobsWithResponse call

func (PostJobsResponse) Status

func (r PostJobsResponse) Status() string

Status returns HTTPResponse.Status

func (PostJobsResponse) StatusCode

func (r PostJobsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PutJobsIdJSONRequestBody

type PutJobsIdJSONRequestBody = ModelJobUpdate

PutJobsIdJSONRequestBody defines body for PutJobsId for application/json ContentType.

type PutJobsIdResponse

type PutJobsIdResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ModelJob
	JSON400      *HandlersErrorResponse
	JSON500      *HandlersErrorResponse
}

func ParsePutJobsIdResponse

func ParsePutJobsIdResponse(rsp *http.Response) (*PutJobsIdResponse, error)

ParsePutJobsIdResponse parses an HTTP response from a PutJobsIdWithResponse call

func (PutJobsIdResponse) Status

func (r PutJobsIdResponse) Status() string

Status returns HTTPResponse.Status

func (PutJobsIdResponse) StatusCode

func (r PutJobsIdResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

Jump to

Keyboard shortcuts

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