api

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRINCIPAL     = "oinit"
	FORCE_COMMAND = "oinit-switch"
)
View Source
const (
	API_VERSION = "1.0.0"

	ERR_BAD_BODY       = "Request body is malformed."
	ERR_UNKNOWN_HOST   = "Unknown host."
	ERR_GATEWAY_DOWN   = "motley_cue is not reachable."
	ERR_UNAUTHORIZED   = "User is not authorized or suspended."
	ERR_INTERNAL_ERROR = "Internal server error."
)

Variables

This section is empty.

Functions

func Error

func Error(c *gin.Context, code int, msg string)

func GetHost

func GetHost(c *gin.Context)

GetHost is the handler for GET /:host

@Summary		Get host information
@Description	Return the CA public key and supported OpenID Connect providers with their required scopes.
@Produce		json
@Param			host	path		string	true	"Host"	example("example.com")
@Success		200		{object}	ApiResponseHost
@Failure		400		{object}	ApiResponseError
@Failure		404		{object}	ApiResponseError
@Failure		500		{object}	ApiResponseError
@Failure		502		{object}	ApiResponseError
@Router			/{host} [get]

func GetIndex

func GetIndex(c *gin.Context)

GetIndex is the handler for GET /

@Summary		Get API version
@Description	Return the running API version.
@Produce		json
@Success		200	{object}	ApiResponseIndex
@Router			/ [get]

func GetSwagger

func GetSwagger(c *gin.Context)

func PostHostCertificate

func PostHostCertificate(c *gin.Context)

PostHostCertificate is the handler for POST /:host/certificate

@Summary		Generate SSH certificate
@Description	Generate and return a new SSH certificate using the given public key and access token.
@Accept			json
@Produce		json
@Param			host	path		string				true	"Host"	example("example.com")
@Param			body	body		FormHostCertificate	true	"Public key and access token"
@Success		201		{object}	ApiResponseCertificate
@Failure		400		{object}	ApiResponseError
@Failure		401		{object}	ApiResponseError
@Failure		404		{object}	ApiResponseError
@Failure		500		{object}	ApiResponseError
@Failure		502		{object}	ApiResponseError
@Router			/{host}/certificate [post]

Types

type ApiResponseCertificate

type ApiResponseCertificate struct {
	Certificate string `json:"certificate"`
}

type ApiResponseError

type ApiResponseError struct {
	Error string `json:"error"`
}

type ApiResponseHost

type ApiResponseHost struct {
	PublicKey string     `json:"publickey"`
	Providers []Provider `json:"providers"`
}

type ApiResponseIndex

type ApiResponseIndex struct {
	Version string `json:"version"`
}

type FormHostCertificate

type FormHostCertificate struct {
	Publickey string `json:"publickey" binding:"required"`
	Token     string `json:"token" binding:"required"`
}

type Provider

type Provider struct {
	URL    string   `json:"url"`
	Scopes []string `json:"scopes"`
}

type UriHost

type UriHost struct {
	Host string `uri:"host" binding:"required"`
}

Jump to

Keyboard shortcuts

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