cmd

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright © 2019 NAME HERE <EMAIL ADDRESS>

Copyright © 2019 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "hb",
	Short: "Healthbot Command Line Interface",
	Long: `A tool for interacting with Healthbot over the REST API. 
	
The intent with this tool is to provide bulk or aggregate functions, that
simplify interacting with Healthbot. 
	`,
}

RootCmd represents the base command when called without any subcommands

View Source
var (
	// VERSION passed in as a build variable
	VERSION string
)

Functions

func AskForConfirmation added in v0.0.8

func AskForConfirmation(s string, tries int, in io.Reader) bool

AskForConfirmation - console y/n

func Completion

func Completion(cmd *cobra.Command, args []string)

Completion is a helper function to allow passing arguments to other functions (so that they can be unit tested)

func DELETE added in v0.0.8

func DELETE(resource, path, username, password string) (resp *resty.Response, err error)

DELETE - HTTP POST to a Resource

func Execute

func Execute(version string)

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.

func FilesInDirectory added in v0.0.8

func FilesInDirectory(dirname string) (names []string)

FilesInDirectory - returns a list of filenames for a given directory

func GET added in v0.0.6

func GET(resource, path, username, password string) (resp *resty.Response, err error)

GET - HTTP GET to a Resource

func NewTable added in v0.0.7

func NewTable() *tablewriter.Table

NewTable - provides a blank table for rendering.

func POST added in v0.0.8

func POST(body interface{}, resource, path, username, password string) (resp *resty.Response, err error)

POST - HTTP POST to a Resource

func Version

func Version(cmd *cobra.Command, args []string)

Version is a helper function to allow passing arguments to other functions (so that they can be unit tested)

Types

type Config added in v0.0.6

type Config struct {
	Directory string
	Resource  string
	Username  string
	Password  string
	Erase     string
}

Config - bean for common provisioning configuration info

func NewConfig added in v0.0.6

func NewConfig(cmd *cobra.Command) Config

NewConfig - construct the bean from viper / cmd

type DeviceFacts added in v0.0.6

type DeviceFacts []struct {
	DeviceID string `json:"device-id"`
	Facts    struct {
		Hostname  string `json:"hostname"`
		JunosInfo []struct {
			LastRebootReason string `json:"last-reboot-reason"`
			MastershipState  string `json:"mastership-state"`
			Model            string `json:"model"`
			Name             string `json:"name"`
			Status           string `json:"status"`
			UpTime           string `json:"up-time"`
		} `json:"junos-info"`
		Platform     string `json:"platform"`
		PlatformInfo []struct {
			Name     string `json:"name"`
			Platform string `json:"platform"`
		} `json:"platform-info"`
		Product      string `json:"product"`
		Release      string `json:"release"`
		SerialNumber string `json:"serial-number"`
	} `json:"facts,omitempty"`
}

DeviceFacts - Provides Device Facts

type SystemDetails added in v0.0.6

type SystemDetails struct {
	ServerTime string `json:"server-time"`
	Version    string `json:"version"`
}

SystemDetails - Provides some basic hb info

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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