admin

package
v0.0.0-...-e474068 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2017 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin struct {
	State chan state
	// contains filtered or unexported fields
}

Admin contains all necessary resources for an administration api. This includes unix connection resources and command handler information.

func NewAdmin

func NewAdmin(db *database.DB, socketPath string) (a *Admin, err error)

NewAdmin creates a new Admin socket and initializes administration handlers

func (*Admin) ChangeUserName

func (a *Admin) ChangeUserName(args args, r *Response) error

ChangeUserName changes a user's name

func (*Admin) ChangeUserPassword

func (a *Admin) ChangeUserPassword(args args, r *Response) error

ChangeUserPassword changes a user's password.

func (*Admin) DeleteUser

func (a *Admin) DeleteUser(args args, r *Response) error

DeleteUser deletes a user

func (*Admin) GetUser

func (a *Admin) GetUser(args args, r *Response) error

GetUser returns all information on a user.

func (*Admin) GetUsers

func (a *Admin) GetUsers(args args, r *Response) error

GetUsers returns a list of all existing users.

func (*Admin) NewUser

func (a *Admin) NewUser(args args, r *Response) error

NewUser creates a user

func (*Admin) Start

func (a *Admin) Start()

Start listening at the administration socket

func (*Admin) Stop

func (a *Admin) Stop(wait bool)

Stop listening at the administration socket and optionally wait for a full stop.

type Request

type Request struct {
	Command   string `json:"command"`
	Arguments args   `json:"arguments"`
}

Request represents a request made to the Admin API

type Response

type Response struct {
	Status StatusCode  `json:"status"`
	Error  string      `json:"error,omitempty"`
	Result interface{} `json:"result,optional"`
}

Response represents a response given as a result of a request to the Admin API.

type StatusCode

type StatusCode int

StatusCode represents the status of a request.

const (
	// OK signals that the command was successful.
	OK StatusCode = iota

	// NotImplemented signals that the command requested
	// is not implemented by the service.
	NotImplemented

	// UnkownCommand signals that the requested command
	// could not be identified.
	UnkownCommand

	// BadRequest signals that the request is invalid.
	BadRequest

	// BadArgument signals that the some or all of the
	// given arguments are invalid.
	BadArgument

	// DatabaseError signals that the command failed due to
	// a database error.
	DatabaseError

	// InternalError signals that the command failed due to
	// other errors.
	InternalError
)

Jump to

Keyboard shortcuts

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