Documentation ¶
Overview ¶
Package malgomaj provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
Package malgomaj provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
Index ¶
- Constants
- Variables
- func GetOpenAPIFile() ([]byte, error)
- func GetSwagger() (swagger *openapi3.Swagger, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func ProgramCacheGetLoad() int64
- func SetCacheTimeout(seconds int)
- type ChiServerOptions
- type CreateTaskJSONBodyLanguage
- type CreateTaskJSONBody_Http_Headers
- func (a CreateTaskJSONBody_Http_Headers) Get(fieldName string) (value string, found bool)
- func (a CreateTaskJSONBody_Http_Headers) MarshalJSON() ([]byte, error)
- func (a *CreateTaskJSONBody_Http_Headers) Set(fieldName string, value string)
- func (a *CreateTaskJSONBody_Http_Headers) UnmarshalJSON(b []byte) error
- type CreateTaskJSONRequestBody
- type Error
- type MiddlewareFunc
- type NewTask
- type NewTaskHttp
- type NewTaskLanguage
- type NewTask_Http_Headers
- type NewTask_Libraries
- type Program
- type ProgramCache
- type ProgramCacheItem
- type Response
- type RestApi
- type ServerInterface
- type ServerInterfaceWrapper
- type Status
- type TengoProgram
- func (p *TengoProgram) AllImports() []string
- func (p *TengoProgram) Checksum() [16]byte
- func (p *TengoProgram) Compile(ctx context.Context) (err error)
- func (p *TengoProgram) Deadline() time.Duration
- func (p *TengoProgram) Equals(b Program) bool
- func (p *TengoProgram) Id() string
- func (p *TengoProgram) IsCGI() bool
- func (p *TengoProgram) Language() string
- func (p *TengoProgram) Modules() []string
- func (p *TengoProgram) Run(ctx context.Context) error
- func (p *TengoProgram) RunWithHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request) error
Constants ¶
const (
BasicAuthScopes = "BasicAuth.Scopes"
)
Variables ¶
var AllowedBaseModules = []string{
"base64",
"enum",
"hex",
"json",
"math",
"rand",
"text",
"times",
}
var ExtraModules = map[string]map[string]tengo.Object{ "fmt": fmtModule, "http": httpModule, "log": logModule, "cgi": nil, }
Functions ¶
func GetOpenAPIFile ¶
func GetSwagger ¶
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 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
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func ProgramCacheGetLoad ¶
func ProgramCacheGetLoad() int64
func SetCacheTimeout ¶
func SetCacheTimeout(seconds int)
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc }
type CreateTaskJSONBodyLanguage ¶
type CreateTaskJSONBodyLanguage string
CreateTaskJSONBodyLanguage defines parameters for CreateTask.
type CreateTaskJSONBody_Http_Headers ¶
CreateTaskJSONBody_Http_Headers defines parameters for CreateTask.
func (CreateTaskJSONBody_Http_Headers) Get ¶
func (a CreateTaskJSONBody_Http_Headers) Get(fieldName string) (value string, found bool)
Getter for additional properties for CreateTaskJSONBody_Http_Headers. Returns the specified element and whether it was found
func (CreateTaskJSONBody_Http_Headers) MarshalJSON ¶
func (a CreateTaskJSONBody_Http_Headers) MarshalJSON() ([]byte, error)
Override default JSON handling for CreateTaskJSONBody_Http_Headers to handle AdditionalProperties
func (*CreateTaskJSONBody_Http_Headers) Set ¶
func (a *CreateTaskJSONBody_Http_Headers) Set(fieldName string, value string)
Setter for additional properties for CreateTaskJSONBody_Http_Headers
func (*CreateTaskJSONBody_Http_Headers) UnmarshalJSON ¶
func (a *CreateTaskJSONBody_Http_Headers) UnmarshalJSON(b []byte) error
Override default JSON handling for CreateTaskJSONBody_Http_Headers to handle AdditionalProperties
type CreateTaskJSONRequestBody ¶
type CreateTaskJSONRequestBody NewTask
CreateTaskJSONRequestBody defines body for CreateTask for application/json ContentType.
type MiddlewareFunc ¶
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
type NewTask ¶
type NewTask struct { Deadline int `json:"deadline"` Domain string `json:"domain"` // Optional. When in use the task is executed as a HTTP procedure. Http *struct { Body []byte `json:"body"` Headers NewTask_Http_Headers `json:"headers"` } `json:"http,omitempty"` Language NewTaskLanguage `json:"language"` ProgramUuid string `json:"program_uuid"` SourceCode []byte `json:"source_code"` }
NewTask defines model for NewTask.
type NewTaskHttp ¶
type NewTaskHttp struct { Body []byte `json:"body"` Headers NewTask_Http_Headers `json:"headers"` }
type NewTaskLanguage ¶
type NewTaskLanguage string
const (
NewTaskLanguageTengo NewTaskLanguage = "tengo"
)
Defines values for NewTaskLanguage.
type NewTask_Http_Headers ¶
type NewTask_Libraries ¶
type Program ¶
type ProgramCache ¶
type ProgramCache struct {
// contains filtered or unexported fields
}
type ProgramCacheItem ¶
func ProgramCacheAdd ¶
func ProgramCacheAdd(p Program) *ProgramCacheItem
func ProgramCacheGet ¶
func ProgramCacheGet(id string) *ProgramCacheItem
func (*ProgramCacheItem) Expires ¶
func (p *ProgramCacheItem) Expires() time.Time
func (*ProgramCacheItem) GetId ¶
func (p *ProgramCacheItem) GetId() string
func (*ProgramCacheItem) Start ¶
func (p *ProgramCacheItem) Start()
func (*ProgramCacheItem) Stop ¶
func (p *ProgramCacheItem) Stop()
type RestApi ¶
type RestApi struct{}
func (*RestApi) CreateTask ¶
func (ra *RestApi) CreateTask(w http.ResponseWriter, r *http.Request)
type ServerInterface ¶
type ServerInterface interface { // Get worker status // (GET /v1/status) GetStatus(w http.ResponseWriter, r *http.Request) // Add a new Task // (POST /v1/tasks) CreateTask(w http.ResponseWriter, r *http.Request) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateTask ¶
func (siw *ServerInterfaceWrapper) CreateTask(w http.ResponseWriter, r *http.Request)
CreateTask operation middleware
func (*ServerInterfaceWrapper) GetStatus ¶
func (siw *ServerInterfaceWrapper) GetStatus(w http.ResponseWriter, r *http.Request)
GetStatus operation middleware
type Status ¶
type Status struct { // The current load (aggregated deadlines) Load int64 `json:"load"` }
Status defines model for Status.
type TengoProgram ¶
func NewTengoProgram ¶
func (*TengoProgram) AllImports ¶
func (p *TengoProgram) AllImports() []string
func (*TengoProgram) Checksum ¶
func (p *TengoProgram) Checksum() [16]byte
func (*TengoProgram) Deadline ¶
func (p *TengoProgram) Deadline() time.Duration
func (*TengoProgram) Equals ¶
func (p *TengoProgram) Equals(b Program) bool
func (*TengoProgram) Id ¶
func (p *TengoProgram) Id() string
func (*TengoProgram) IsCGI ¶
func (p *TengoProgram) IsCGI() bool
func (*TengoProgram) Language ¶
func (p *TengoProgram) Language() string
func (*TengoProgram) Modules ¶
func (p *TengoProgram) Modules() []string
func (*TengoProgram) RunWithHTTP ¶
func (p *TengoProgram) RunWithHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request) error