cmd

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ErrMissingPath returned when no path is provided for a REST op
	ErrMissingPath = Error("Missing path parameter for REST operation")
	// ErrMissingserver returned when there is no server to log in
	ErrMissingserver = Error("Missing CPPM server name or IP address")
	// ErrMissingCreds returned when there are no credentials to log in
	ErrMissingCreds = Error("Missing credentials to log into CPPM")
	// ErrInvalidCreds returned when not allowed to log in
	ErrInvalidCreds = Error("Credentials are invalid or expired")
	// ErrMissingResource returned when no resource is provided for export
	ErrMissingResource = Error("No resource specified for import/export")
)
View Source
const DefaultPageSize = 24

DefaultPageSize is the default page size for pagination

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "cpcli",
	Short: "Command-line interface for Aruba Clearpass API",
	Long: `cpcli (cp for short) is a command line application that interacts with
    Aruba Clearpass through the REST API.

It performs:

  - Authentication against Clearpass with the "login" command.
  - GET, POST, PUT, PATCH, DELETE requests to the API.`,
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type Error

type Error string

Error type for predefined errors

func (Error) Error

func (e Error) Error() string

type Master

type Master struct {

	// Logger for error messages
	Log *log.Logger

	// Options to mamage with Cobra
	ConfigFile string
	Options    term.Options
	Force      bool
	Query      []string
	// contains filtered or unexported fields
}

Master is the master application object

var Singleton Master

Singleton is the config holder for all commands

func (*Master) Export

func (master *Master) Export(args []string) (string, error)

Export some resource to a zip file named after the resource.

func (*Master) Import

func (master *Master) Import(args []string) error

Import some resource from a zip file.

func (*Master) Login

func (master *Master) Login() (string, string, error)

Login into the ClearPass. Return access and refresh token

func (*Master) OnInit

func (master *Master) OnInit()

OnInit reads in config file and ENV variables if set.

func (*Master) Run

func (master *Master) Run(method model.Method, args []string) error

Run runs a command against the Clearpass

func (*Master) Save

func (master *Master) Save(token, refresh string) error

Save login parameters

func (*Master) SaveCookie

func (master *Master) SaveCookie(cookie []*http.Cookie) error

SaveCookie saves weblogin cookie

func (*Master) WebLogin

func (master *Master) WebLogin() ([]*http.Cookie, error)

WebLogin into the ClearPass. Return access and refresh token

func (*Master) WebLogout

func (master *Master) WebLogout() error

WebLogout from the ClearPass.

Jump to

Keyboard shortcuts

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