ctrlh

package
v0.0.0-...-7c66ffc Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ctrlh contains management commands for Horde. The commands are implemented with the Cobra library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APNCommand

type APNCommand struct {
	Add    apnAddCommand    `kong:"cmd,help='Add new APN in Horde'"`
	Rm     apnRemoveCommand `kong:"cmd,help='Remove APN from Horde'"`
	List   apnListCommand   `kong:"cmd,help='List APNs registered in Horde'"`
	Reload apnReloadCommand `kong:"cmd,help='Reload APN and NAS list'"`
}

APNCommand is the subcommand for APN management

type AllocCommand

type AllocCommand struct {
	APNID int                `kong:"required, help='APN ID',short='a'"`
	NASID int                `kong:"required, help='NAS ID',short='n'"`
	Add   allocAddCommand    `kong:"cmd,help='Add allocation for device'"`
	Rm    allocRemoveCommand `kong:"cmd,help='Remove allocation for device'"`
	List  allocListCommand   `kong:"cmd,help='List address allocations'"`
}

AllocCommand is the subcommand for ip address allocations

type Command

type Command struct {
	Server   ManagementServerParameters `kong:"embed"`
	Commands CommandList                `kong:"embed"`
}

Command is the default configuration for the management tool

func (*Command) HordeCommands

func (c *Command) HordeCommands() CommandList

HordeCommands returns the mangement server command list

func (*Command) HordeServer

func (c *Command) HordeServer() ManagementServerParameters

HordeServer returns the management server parameters

type CommandList

type CommandList struct {
	Ping  PingCommand  `kong:"cmd,help='Ping the management service'"`
	APN   APNCommand   `kong:"cmd,help='APN subcommands'"`
	NAS   NASCommand   `kong:"cmd,help='NAS subcommands'"`
	Alloc AllocCommand `kong:"cmd,help='Device IP address allocations'"`
	Token TokenCommand `kong:"cmd,help='API token management'"`
	User  UserCommand  `kong:"cmd,help='User management'"`
	Util  UtilCommand  `kong:"cmd,help='Misc utiltiies'"`
}

CommandList is the commands for the management tool

type ManagementServerParameters

type ManagementServerParameters struct {
	Endpoint         string `kong:"required,help='gRPC management endpoint',default='localhost:1234'"`
	TLS              bool   `kong:"help='TLS enabled for gRPC'"`
	CertFile         string `kong:"help='Client certificate for management service',type='path'"`
	HostnameOverride string `kong:"help='Host name override for certificate'"`
}

ManagementServerParameters is the configuration for the management server interface

type NASCommand

type NASCommand struct {
	Add  nasAddCommand    `cmd:"" help:"Add new NAS"`
	Rm   nasRemoveCommand `cmd:"" help:"Remove existing NAS"`
	List nasListCommand   `cmd:"" help:"List NASes"`
}

NASCommand is the subcommand for NAS management

type PingCommand

type PingCommand struct {
}

PingCommand is a subcommand that checks if the management service is reachable.

func (*PingCommand) Run

func (c *PingCommand) Run(rc RunContext) error

Run connects to the management service and ensures that the connection changes state to Ready.

type RunContext

type RunContext interface {
	HordeServer() ManagementServerParameters
	HordeCommands() CommandList
}

RunContext is the common context for the commands. The Command type implements this interface and can be used as is.

type TokenCommand

type TokenCommand struct {
	Add addTokenCommand    `kong:"cmd,help='Create a new API token for an user'"`
	Rm  removeTokenCommand `kong:"cmd,help='Remove an API token from an existing user'"`
}

TokenCommand is the token subcommand

type UserCommand

type UserCommand struct {
	Add addUserCommand `kong:"cmd,help='Create new API user and associated token in Horde'"`
}

UserCommand is the subcommand for user management

type UtilCommand

type UtilCommand struct {
	ID idConversionCommand `kong:"cmd,help='Decode API identifiers to internal identifiers'"`
	DI diConversionCommand `kong:"cmd,help='Encode internal identifiers into API identifiers'"`
}

UtilCommand is the Kong command struct for the util subcommand

Jump to

Keyboard shortcuts

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