api

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: Apache-2.0 Imports: 27 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 GetV0QueueParams added in v0.4.0

type GetV0QueueParams struct {
	// CreatedBefore Filter for items created before this date-time
	CreatedBefore *time.Time `form:"createdBefore,omitempty" json:"createdBefore,omitempty"`

	// CreatedAfter Filter for items created after this date-time
	CreatedAfter *time.Time `form:"createdAfter,omitempty" json:"createdAfter,omitempty"`

	// Limit The numbers of items to return
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}

GetV0QueueParams defines parameters for GetV0Queue.

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 PostV0QueueFormdataRequestBody added in v0.4.0

type PostV0QueueFormdataRequestBody = ExecutionRequest

PostV0QueueFormdataRequestBody defines body for PostV0Queue for application/x-www-form-urlencoded ContentType.

type PutV0QueueIdJSONRequestBody

type PutV0QueueIdJSONRequestBody = ExecutionRequest

PutV0QueueIdJSONRequestBody defines body for PutV0QueueId 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 V0 API Home
	// (GET /v0)
	GetV0(w http.ResponseWriter, r *http.Request)
	// Get Amplify work graph
	// (GET /v0/graph)
	GetV0Graph(w http.ResponseWriter, r *http.Request)
	// List all Amplify jobs
	// (GET /v0/jobs)
	GetV0Jobs(w http.ResponseWriter, r *http.Request)
	// Get a job by id
	// (GET /v0/jobs/{id})
	GetV0JobsId(w http.ResponseWriter, r *http.Request, id string)
	// Amplify work queue
	// (GET /v0/queue)
	GetV0Queue(w http.ResponseWriter, r *http.Request, params GetV0QueueParams)
	// Run all workflows for a CID (not recommended)
	// (POST /v0/queue)
	PostV0Queue(w http.ResponseWriter, r *http.Request)
	// Get an item from the queue by id
	// (GET /v0/queue/{id})
	GetV0QueueId(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
	// Run all workflows for a CID
	// (PUT /v0/queue/{id})
	PutV0QueueId(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) GetV0

GetV0 operation middleware

func (*ServerInterfaceWrapper) GetV0Graph added in v0.1.0

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

GetV0Graph operation middleware

func (*ServerInterfaceWrapper) GetV0Jobs

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

GetV0Jobs operation middleware

func (*ServerInterfaceWrapper) GetV0JobsId

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

GetV0JobsId operation middleware

func (*ServerInterfaceWrapper) GetV0Queue

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

GetV0Queue operation middleware

func (*ServerInterfaceWrapper) GetV0QueueId

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

GetV0QueueId operation middleware

func (*ServerInterfaceWrapper) PostV0Queue added in v0.4.0

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

PostV0Queue operation middleware

func (*ServerInterfaceWrapper) PutV0QueueId

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

PutV0QueueId 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