api

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLeafOutputs added in v0.3.0

func GetLeafOutputs(ctx context.Context, dag []dag.Node[dag.IOSpec]) []string

getLeafOutputs returns the outputs of the leaf nodes in the DAG

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r *mux.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r *mux.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func NewAmplifyAPI

func NewAmplifyAPI(er item.QueueRepository, tf task.TaskFactory) (*amplifyAPI, error)

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type Error

type Error struct {
	// Detail A human-readable explanation specific to this occurrence of the problem.
	Detail *string `json:"detail,omitempty"`

	// Title A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
	Title *string `json:"title,omitempty"`
}

Error defines model for error.

type Errors

type Errors = []Error

Errors defines model for errors.

type ExecutionRequest

type ExecutionRequest struct {
	Cid string `json:"cid"`
}

ExecutionRequest defines model for executionRequest.

type GorillaServerOptions

type GorillaServerOptions struct {
	BaseURL          string
	BaseRouter       *mux.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type Graph added in v0.1.0

type Graph struct {
	Data  *[]NodeConfig `json:"data,omitempty"`
	Links *Links        `json:"links,omitempty"`
}

Graph defines model for graph.

type Home

type Home struct {
	Links *Links  `json:"links,omitempty"`
	Type  *string `json:"type,omitempty"`
}

Home defines model for home.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type Item

type Item struct {
	Id       string       `json:"id"`
	Links    *Links       `json:"links,omitempty"`
	Metadata ItemMetadata `json:"metadata"`
	Type     string       `json:"type"`
}

Item defines model for item.

type ItemMetadata

type ItemMetadata struct {
	Ended     *string `json:"ended,omitempty"`
	Started   *string `json:"started,omitempty"`
	Status    string  `json:"status"`
	Submitted string  `json:"submitted"`
}

ItemMetadata defines model for itemMetadata.

type ItemResult added in v0.3.0

type ItemResult struct {
	// Id External execution ID
	Id *string `json:"id,omitempty"`

	// Skipped Whether this node was skipped due to predicates not matching.
	Skipped *bool   `json:"skipped,omitempty"`
	Stderr  *string `json:"stderr,omitempty"`
	Stdout  *string `json:"stdout,omitempty"`
}

ItemResult defines model for itemResult.

type Job

type Job struct {
	Entrypoint *[]string `json:"entrypoint,omitempty"`
	Id         string    `json:"id"`
	Image      string    `json:"image"`
	Links      *Links    `json:"links,omitempty"`
	Type       string    `json:"type"`
}

Job defines model for job.

type Jobs

type Jobs struct {
	Data  *[]Job `json:"data,omitempty"`
	Links *Links `json:"links,omitempty"`
}

Jobs defines model for jobs.

type Links = map[string]interface{}

Links defines model for links.

type MiddlewareFunc

type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc

type Node

type Node struct {
	Children *[]Node            `json:"children,omitempty"`
	Id       openapi_types.UUID `json:"id"`
	Inputs   []ExecutionRequest `json:"inputs"`
	Links    *Links             `json:"links,omitempty"`
	Metadata ItemMetadata       `json:"metadata"`
	Name     *string            `json:"name,omitempty"`
	Outputs  []ExecutionRequest `json:"outputs"`
	Result   *ItemResult        `json:"result,omitempty"`
	Type     string             `json:"type"`
}

Node defines model for node.

type NodeConfig

type NodeConfig struct {
	Id      *string       `json:"id,omitempty"`
	Inputs  *[]NodeInput  `json:"inputs,omitempty"`
	JobId   *string       `json:"job_id,omitempty"`
	Outputs *[]NodeOutput `json:"outputs,omitempty"`
}

NodeConfig Static configuration of a node.

type NodeInput

type NodeInput struct {
	OutputId  *string `json:"output_id,omitempty"`
	Path      *string `json:"path,omitempty"`
	Predicate *string `json:"predicate,omitempty"`
	Root      *bool   `json:"root,omitempty"`
	StepId    *string `json:"step_id,omitempty"`
}

NodeInput Input specification for a node.

type NodeOutput

type NodeOutput struct {
	Id   *string `json:"id,omitempty"`
	Path *string `json:"path,omitempty"`
}

NodeOutput Output specification for a node.

type PageMeta added in v0.3.1

type PageMeta struct {
	// TotalPages Total number of pages in paginated result.
	TotalPages *int `json:"totalPages,omitempty"`
}

PageMeta defines model for pageMeta.

type PostApiV0QueueFormdataRequestBody added in v0.2.4

type PostApiV0QueueFormdataRequestBody = ExecutionRequest

PostApiV0QueueFormdataRequestBody defines body for PostApiV0Queue for application/x-www-form-urlencoded ContentType.

type PutApiV0QueueIdJSONRequestBody added in v0.2.1

type PutApiV0QueueIdJSONRequestBody = ExecutionRequest

PutApiV0QueueIdJSONRequestBody defines body for PutApiV0QueueId for application/json ContentType.

type Queue

type Queue struct {
	Data  *[]Item   `json:"data,omitempty"`
	Links *Links    `json:"links,omitempty"`
	Meta  *PageMeta `json:"meta,omitempty"`
}

Queue defines model for queue.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {
	// Amplify Home
	// (GET /)
	Get(w http.ResponseWriter, r *http.Request)
	// Amplify V0 API Home
	// (GET /api/v0)
	GetApiV0(w http.ResponseWriter, r *http.Request)
	// Get Amplify work graph
	// (GET /api/v0/graph)
	GetApiV0Graph(w http.ResponseWriter, r *http.Request)
	// List all Amplify jobs
	// (GET /api/v0/jobs)
	GetApiV0Jobs(w http.ResponseWriter, r *http.Request)
	// Get a job by id
	// (GET /api/v0/jobs/{id})
	GetApiV0JobsId(w http.ResponseWriter, r *http.Request, id string)
	// Amplify work queue
	// (GET /api/v0/queue)
	GetApiV0Queue(w http.ResponseWriter, r *http.Request)
	// Run all workflows for a CID (not recommended)
	// (POST /api/v0/queue)
	PostApiV0Queue(w http.ResponseWriter, r *http.Request)
	// Get an item from the queue by id
	// (GET /api/v0/queue/{id})
	GetApiV0QueueId(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
	// Run all workflows for a CID
	// (PUT /api/v0/queue/{id})
	PutApiV0QueueId(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) Get added in v0.2.1

Get operation middleware

func (*ServerInterfaceWrapper) GetApiV0 added in v0.2.1

func (siw *ServerInterfaceWrapper) GetApiV0(w http.ResponseWriter, r *http.Request)

GetApiV0 operation middleware

func (*ServerInterfaceWrapper) GetApiV0Graph added in v0.2.1

func (siw *ServerInterfaceWrapper) GetApiV0Graph(w http.ResponseWriter, r *http.Request)

GetApiV0Graph operation middleware

func (*ServerInterfaceWrapper) GetApiV0Jobs added in v0.2.1

func (siw *ServerInterfaceWrapper) GetApiV0Jobs(w http.ResponseWriter, r *http.Request)

GetApiV0Jobs operation middleware

func (*ServerInterfaceWrapper) GetApiV0JobsId added in v0.2.1

func (siw *ServerInterfaceWrapper) GetApiV0JobsId(w http.ResponseWriter, r *http.Request)

GetApiV0JobsId operation middleware

func (*ServerInterfaceWrapper) GetApiV0Queue added in v0.2.1

func (siw *ServerInterfaceWrapper) GetApiV0Queue(w http.ResponseWriter, r *http.Request)

GetApiV0Queue operation middleware

func (*ServerInterfaceWrapper) GetApiV0QueueId added in v0.2.1

func (siw *ServerInterfaceWrapper) GetApiV0QueueId(w http.ResponseWriter, r *http.Request)

GetApiV0QueueId operation middleware

func (*ServerInterfaceWrapper) PostApiV0Queue added in v0.2.4

func (siw *ServerInterfaceWrapper) PostApiV0Queue(w http.ResponseWriter, r *http.Request)

PostApiV0Queue operation middleware

func (*ServerInterfaceWrapper) PutApiV0QueueId added in v0.2.1

func (siw *ServerInterfaceWrapper) PutApiV0QueueId(w http.ResponseWriter, r *http.Request)

PutApiV0QueueId operation middleware

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshallingParamError

type UnmarshallingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshallingParamError) Error

func (e *UnmarshallingParamError) Error() string

func (*UnmarshallingParamError) Unwrap

func (e *UnmarshallingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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