api

package
v0.0.0-...-2ba466c Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CONTEXT_KEY = "ssh-key-manager-client"
View Source
const MIN_LENGTH = 10
View Source
const MIN_STRENGTH = 3

Variables

View Source
var API_KEY string

Functions

func AddGroup

func AddGroup(c *gin.Context)

func AddKey

func AddKey(c *gin.Context)

func AddRoutes

func AddRoutes(r *gin.Engine) *gin.Engine

AddRoutes

func AddUser

func AddUser(c *gin.Context)

func CheckApiKey

func CheckApiKey() gin.HandlerFunc

func CreateHome

func CreateHome(c *gin.Context)

func DefaultGetClient

func DefaultGetClient(c *gin.Context) *sshkeymanager.Client

DefaultGetClient is designed to be overriden for custom API server settings

func DeleteGroup

func DeleteGroup(c *gin.Context)

func DeleteKey

func DeleteKey(c *gin.Context)

func DeleteUser

func DeleteUser(c *gin.Context)

func FindGroup

func FindGroup(c *gin.Context)

func FindKey

func FindKey(c *gin.Context)

func FindUser

func FindUser(c *gin.Context)

func GetClient

func GetClient(c *gin.Context) *sshkeymanager.Client

func GetGroups

func GetGroups(c *gin.Context)

func GetKeys

func GetKeys(c *gin.Context)

func GetUsers

func GetUsers(c *gin.Context)

func RequestLoggerMiddleware

func RequestLoggerMiddleware() gin.HandlerFunc

func SetClient

func SetClient(GetClient func(*gin.Context) *sshkeymanager.Client) gin.HandlerFunc

func WriteKeys

func WriteKeys(c *gin.Context)

Types

type BasicError

type BasicError struct {
	Err *string `json:"error"`
}

type BasicRequest

type BasicRequest struct {
}

type BasicResponse

type BasicResponse struct {
	Err *KmError `json:"error"`
}

type EmptyRequest

type EmptyRequest struct{}

type EmptyResponse

type EmptyResponse struct{}

type GroupRequest

type GroupRequest struct {
	Group *group.Group `json:"group"`
}

type GroupResponse

type GroupResponse struct {
	Group *group.Group `json:"group"`
	Err   *KmError     `json:"error"`
}

type GroupsResponse

type GroupsResponse struct {
	Groups []group.Group `json:"groups"`
	Err    *KmError      `json:"error"`
}

type KeyRequest

type KeyRequest struct {
	User passwd.User             `json:"user"`
	Key  *authorized_keys.SSHKey `json:"key"`
	Err  *KmError                `json:"error"`
}

type KeyResponse

type KeyResponse struct {
	User *passwd.User            `json:"user"`
	Key  *authorized_keys.SSHKey `json:"key"`
	Err  *KmError                `json:"error"`
}

type KeysRequest

type KeysRequest struct {
	User passwd.User              `json:"user"`
	Keys []authorized_keys.SSHKey `json:"keys"`
	Err  *KmError                 `json:"error"`
}

type KeysResponse

type KeysResponse struct {
	User *passwd.User             `json:"user"`
	Keys []authorized_keys.SSHKey `json:"keys"`
	Err  *KmError                 `json:"error"`
}

type KmError

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

JSON marshaling of errors See: http://blog.magmalabs.io/2014/11/13/custom-error-marshaling-to-json-in-go.html

func MakeKmError

func MakeKmError(e error) *KmError

func (*KmError) Err

func (me *KmError) Err() error

func (*KmError) MarshalJSON

func (me *KmError) MarshalJSON() ([]byte, error)

type UserRequest

type UserRequest struct {
	User       *passwd.User `json:"user"`
	CreateHome *bool        `json:"create_home"`
	RemoveHome *bool        `json:"remove_home"`
}

type UserResponse

type UserResponse struct {
	User *passwd.User `json:"user"`
	Err  *KmError     `json:"error"`
}

type UsersResponse

type UsersResponse struct {
	Users []passwd.User `json:"users"`
	Err   *KmError      `json:"error"`
}

Jump to

Keyboard shortcuts

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