common

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenericErrorExitCode    = 1
	ProxmoxErrorExitCode    = 2
	ValidationErrorExitCode = 3
)
View Source
const (
	ProxmoxCSRFTokenHeader  = "CSRFPreventionToken"
	ProxmoxTicketCookieName = "PVEAuthCookie"
)
View Source
const (
	TicketCache = ".proxmox"
)

Variables

This section is empty.

Functions

func GenericError

func GenericError(err error) error

func HandleError

func HandleError(err error) error

func HttpClient

func HttpClient() *http.Client

Returns an http client. TODO: support secure transport

func ProxmoxError

func ProxmoxError(err error) error

func WithHttpCredentials

func WithHttpCredentials(r *http.Request) (*http.Request, error)

func WriteSubjectToCache

func WriteSubjectToCache(subject *ProxmoxSubject) error

Write session information to ticket cache in (pretty) JSON format.

Types

type CommandError

type CommandError struct {
	Err  error
	Code int
}

func (*CommandError) Error

func (e *CommandError) Error() string

func (*CommandError) ExitCode

func (e *CommandError) ExitCode() int

type ExitCodeAwareError

type ExitCodeAwareError interface {
	error
	ExitCode() int
}

type ProxmoxSubject

type ProxmoxSubject struct {
	Username  string `json:"username"`
	Ticket    string `json:"ticket"`
	CSRFToken string `json:"csrf_token"`
	ApiServer string `json:"api_server"`
}

Session information representing an authenticated Proxmox user

func ReadSubjectFromCache

func ReadSubjectFromCache() (*ProxmoxSubject, error)

Read session subject from ticket cache

Jump to

Keyboard shortcuts

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