api

package
v1.0.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 12 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.9.1 DO NOT EDIT.

Index

Constants

View Source
const (
	BasicAuthScopes = "BasicAuth.Scopes"
)

Variables

This section is empty.

Functions

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 PathToRawSpec

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

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

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type AddApplicationJSONBody

type AddApplicationJSONBody NewApplication

AddApplicationJSONBody defines parameters for AddApplication.

type AddApplicationJSONRequestBody

type AddApplicationJSONRequestBody AddApplicationJSONBody

AddApplicationJSONRequestBody defines body for AddApplication for application/json ContentType.

type ApplicationCollection

type ApplicationCollection struct {
	Items []ApplicationCollectionItem `json:"items"`
}

ApplicationCollection defines model for ApplicationCollection.

type ApplicationCollectionItem

type ApplicationCollectionItem struct {
	Description *string `json:"description,omitempty"`
	Id          int     `json:"id"`
	Name        string  `json:"name"`
}

ApplicationCollectionItem defines model for ApplicationCollectionItem.

type ApplicationItem

type ApplicationItem struct {
	Description    *string     `json:"description,omitempty"`
	Id             int         `json:"id"`
	LastDeployedAt *time.Time  `json:"lastDeployedAt,omitempty"`
	LatestCommit   *string     `json:"latestCommit,omitempty"`
	LatestVersion  *string     `json:"latestVersion,omitempty"`
	Name           string      `json:"name"`
	Tasks          *[]TaskItem `json:"tasks,omitempty"`
}

ApplicationItem defines model for ApplicationItem.

type BadRequest

type BadRequest struct {
	Message string `json:"message"`
}

BadRequest defines model for BadRequest.

type CreatedApplication

type CreatedApplication struct {
	Description *string `json:"description,omitempty"`
	Id          int     `json:"id"`
	Name        string  `json:"name"`

	// Secret used to trigger a deployment, store somewhere safe
	RawSecret string `json:"rawSecret"`
}

CreatedApplication defines model for CreatedApplication.

type DeployApplicationJSONBody

type DeployApplicationJSONBody TriggerDeployment

DeployApplicationJSONBody defines parameters for DeployApplication.

type DeployApplicationJSONRequestBody

type DeployApplicationJSONRequestBody DeployApplicationJSONBody

DeployApplicationJSONRequestBody defines body for DeployApplication for application/json ContentType.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type HttpTaskItem

type HttpTaskItem struct {
	Body *string `json:"body,omitempty"`

	// An object containing headers and their values, all values must be of the type string
	Headers *map[string]interface{} `json:"headers,omitempty"`
	Method  string                  `json:"method"`
	Url     string                  `json:"url"`
}

HttpTaskItem defines model for HttpTaskItem.

type NewApplication

type NewApplication struct {
	Description *string `json:"description,omitempty"`

	// A list of HTTP requests to send
	HttpTasks *[]NewHttpTask `json:"httpTasks,omitempty"`
	Name      string         `json:"name"`

	// A list oh SSH commands to run
	SshTasks *[]NewSshTask `json:"sshTasks,omitempty"`
}

NewApplication defines model for NewApplication.

type NewHttpTask

type NewHttpTask struct {
	Body *string `json:"body,omitempty"`

	// An object of Header-name:Value
	Headers *map[string]interface{} `json:"headers,omitempty"`
	Method  string                  `json:"method"`

	// The lower the number the higher the priority
	Priority int    `json:"priority"`
	Url      string `json:"url"`
}

NewHttpTask defines model for NewHttpTask.

type NewSshTask

type NewSshTask struct {
	// Command to run on the target host
	Command string `json:"command"`

	// SHA256 server fingerprint
	Fingerprint string `json:"fingerprint"`
	Host        string `json:"host"`
	Port        int    `json:"port"`

	// The lower the number the higher the priority
	Priority int    `json:"priority"`
	Username string `json:"username"`
}

NewSshTask defines model for NewSshTask.

type ServerInterface

type ServerInterface interface {

	// (GET /applications)
	GetApplications(ctx echo.Context) error

	// (POST /applications)
	AddApplication(ctx echo.Context) error

	// (DELETE /applications/{id})
	DeleteApplication(ctx echo.Context, id int) error

	// (GET /applications/{id})
	GetApplication(ctx echo.Context, id int) error

	// (POST /applications/{id}/deploy)
	DeployApplication(ctx echo.Context, id int) error

	// (POST /applications/{id}/regenerate)
	RegenerateApplicationSecret(ctx echo.Context, id int) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) AddApplication

func (w *ServerInterfaceWrapper) AddApplication(ctx echo.Context) error

AddApplication converts echo context to params.

func (*ServerInterfaceWrapper) DeleteApplication

func (w *ServerInterfaceWrapper) DeleteApplication(ctx echo.Context) error

DeleteApplication converts echo context to params.

func (*ServerInterfaceWrapper) DeployApplication

func (w *ServerInterfaceWrapper) DeployApplication(ctx echo.Context) error

DeployApplication converts echo context to params.

func (*ServerInterfaceWrapper) GetApplication

func (w *ServerInterfaceWrapper) GetApplication(ctx echo.Context) error

GetApplication converts echo context to params.

func (*ServerInterfaceWrapper) GetApplications

func (w *ServerInterfaceWrapper) GetApplications(ctx echo.Context) error

GetApplications converts echo context to params.

func (*ServerInterfaceWrapper) RegenerateApplicationSecret

func (w *ServerInterfaceWrapper) RegenerateApplicationSecret(ctx echo.Context) error

RegenerateApplicationSecret converts echo context to params.

type SshTaskItem

type SshTaskItem struct {
	Command  string `json:"command"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
}

SshTaskItem defines model for SshTaskItem.

type TaskItem

type TaskItem struct {
	Priority int `json:"priority"`

	// Can either contain HTTP or SSH task
	Task interface{} `json:"task"`

	// Can be either ssh or http
	TaskType TaskItemTaskType `json:"taskType"`
}

TaskItem defines model for TaskItem.

type TaskItemTaskType

type TaskItemTaskType string

Can be either ssh or http

const (
	TaskItemTaskTypeHttpTask TaskItemTaskType = "HttpTask"

	TaskItemTaskTypeSshTask TaskItemTaskType = "SshTask"
)

Defines values for TaskItemTaskType.

type TriggerDeployment

type TriggerDeployment struct {
	// The deployed commit's hash
	Commit *string `json:"commit,omitempty"`

	// Secret obtained when creating the application
	Secret string `json:"secret"`

	// The version being deployed
	Version *string `json:"version,omitempty"`
}

TriggerDeployment defines model for TriggerDeployment.

Jump to

Keyboard shortcuts

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