api

package
v0.0.0-...-43ce26c Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.1-0.20240519200907-da9077bb5ffe DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

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

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

func HandlerFromMuxWithBaseURL

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

func HandlerWithOptions

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

HandlerWithOptions creates http.Handler with additional options

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func New

func New(l *zerolog.Logger, envVars *utils.Map[string, string]) *API

func (*API) GetEnvs

func (a *API) GetEnvs(w http.ResponseWriter, _ *http.Request)

func (*API) GetFiles

func (a *API) GetFiles(w http.ResponseWriter, r *http.Request, params GetFilesParams)

func (*API) GetHealth

func (a *API) GetHealth(w http.ResponseWriter, r *http.Request)

func (*API) GetMetrics

func (a *API) GetMetrics(w http.ResponseWriter, r *http.Request)

func (*API) PostFiles

func (a *API) PostFiles(w http.ResponseWriter, r *http.Request, params PostFilesParams)

func (*API) PostInit

func (a *API) PostInit(w http.ResponseWriter, r *http.Request)

type ChiServerOptions

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

type EntryInfo

type EntryInfo struct {
	// Name Name of the file
	Name string `json:"name"`

	// Path Path to the file
	Path string `json:"path"`

	// Type Type of the file
	Type EntryInfoType `json:"type"`
}

EntryInfo defines model for EntryInfo.

type EntryInfoType

type EntryInfoType string

EntryInfoType Type of the file

const (
	File EntryInfoType = "file"
)

Defines values for EntryInfoType.

type EnvVars

type EnvVars map[string]string

EnvVars Environment variables to set

type Error

type Error struct {
	// Code Error code
	Code int `json:"code"`

	// Message Error message
	Message string `json:"message"`
}

Error defines model for Error.

type FileNotFound

type FileNotFound = Error

FileNotFound defines model for FileNotFound.

type FilePath

type FilePath = string

FilePath defines model for FilePath.

type GetFilesParams

type GetFilesParams struct {
	// Path Path to the file, URL encoded. Can be relative to user's home directory.
	Path *FilePath `form:"path,omitempty" json:"path,omitempty"`

	// Username User used for setting the owner, or resolving relative paths.
	Username User `form:"username" json:"username"`
}

GetFilesParams defines parameters for GetFiles.

type InternalServerError

type InternalServerError = Error

InternalServerError defines model for InternalServerError.

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 InvalidPath

type InvalidPath = Error

InvalidPath defines model for InvalidPath.

type InvalidUser

type InvalidUser = Error

InvalidUser defines model for InvalidUser.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type NotEnoughDiskSpace

type NotEnoughDiskSpace = Error

NotEnoughDiskSpace defines model for NotEnoughDiskSpace.

type PostFilesMultipartBody

type PostFilesMultipartBody struct {
	File *openapi_types.File `json:"file,omitempty"`
}

PostFilesMultipartBody defines parameters for PostFiles.

type PostFilesMultipartRequestBody

type PostFilesMultipartRequestBody PostFilesMultipartBody

PostFilesMultipartRequestBody defines body for PostFiles for multipart/form-data ContentType.

type PostFilesParams

type PostFilesParams struct {
	// Path Path to the file, URL encoded. Can be relative to user's home directory.
	Path *FilePath `form:"path,omitempty" json:"path,omitempty"`

	// Username User used for setting the owner, or resolving relative paths.
	Username User `form:"username" json:"username"`
}

PostFilesParams defines parameters for PostFiles.

type PostInitJSONBody

type PostInitJSONBody struct {
	// EnvVars Environment variables to set
	EnvVars *EnvVars `json:"envVars,omitempty"`
}

PostInitJSONBody defines parameters for PostInit.

type PostInitJSONRequestBody

type PostInitJSONRequestBody PostInitJSONBody

PostInitJSONRequestBody defines body for PostInit for application/json ContentType.

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 {
	// Get the environment variables
	// (GET /envs)
	GetEnvs(w http.ResponseWriter, r *http.Request)
	// Download a file
	// (GET /files)
	GetFiles(w http.ResponseWriter, r *http.Request, params GetFilesParams)
	// Upload a file and ensure the parent directories exist. If the file exists, it will be overwritten.
	// (POST /files)
	PostFiles(w http.ResponseWriter, r *http.Request, params PostFilesParams)
	// Check the health of the service
	// (GET /health)
	GetHealth(w http.ResponseWriter, r *http.Request)
	// Set env vars, ensure the time and metadata is synced with the host
	// (POST /init)
	PostInit(w http.ResponseWriter, r *http.Request)
	// Get the stats of the service
	// (GET /metrics)
	GetMetrics(w http.ResponseWriter, r *http.Request)
}

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

GetEnvs operation middleware

func (*ServerInterfaceWrapper) GetFiles

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

GetFiles operation middleware

func (*ServerInterfaceWrapper) GetHealth

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

GetHealth operation middleware

func (*ServerInterfaceWrapper) GetMetrics

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

GetMetrics operation middleware

func (*ServerInterfaceWrapper) PostFiles

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

PostFiles operation middleware

func (*ServerInterfaceWrapper) PostInit

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

PostInit 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 Unimplemented

type Unimplemented struct{}

func (Unimplemented) GetEnvs

func (_ Unimplemented) GetEnvs(w http.ResponseWriter, r *http.Request)

Get the environment variables (GET /envs)

func (Unimplemented) GetFiles

func (_ Unimplemented) GetFiles(w http.ResponseWriter, r *http.Request, params GetFilesParams)

Download a file (GET /files)

func (Unimplemented) GetHealth

func (_ Unimplemented) GetHealth(w http.ResponseWriter, r *http.Request)

Check the health of the service (GET /health)

func (Unimplemented) GetMetrics

func (_ Unimplemented) GetMetrics(w http.ResponseWriter, r *http.Request)

Get the stats of the service (GET /metrics)

func (Unimplemented) PostFiles

func (_ Unimplemented) PostFiles(w http.ResponseWriter, r *http.Request, params PostFilesParams)

Upload a file and ensure the parent directories exist. If the file exists, it will be overwritten. (POST /files)

func (Unimplemented) PostInit

func (_ Unimplemented) PostInit(w http.ResponseWriter, r *http.Request)

Set env vars, ensure the time and metadata is synced with the host (POST /init)

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UploadSuccess

type UploadSuccess = []EntryInfo

UploadSuccess defines model for UploadSuccess.

type User

type User = string

User defines model for User.

Jump to

Keyboard shortcuts

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