cli

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIApp

type CLIApp struct {
	*kingpin.Application
	ClientName string
	AccountId  string
	Config     *config
	Client     *Client
}

CLIApp represents a cli application instance

func New

func New() *CLIApp

New initializes the brightbox cli application

func (*CLIApp) Configure

func (c *CLIApp) Configure() error

type Client

type Client struct {
	*brightbox.Client
	ClientName     string
	ClientID       string `ini:"client_id"`
	Secret         string `ini:"secret"`
	ApiUrl         string `ini:"api_url"`
	DefaultAccount string `ini:"default_account"`
	AuthUrl        string `ini:"auth_url"`
	Username       string `ini:"username"`
	// contains filtered or unexported fields
}

Represents a Client section from the config Can also be used as a TokenSource for oauth2 transport

func (*Client) Setup

func (c *Client) Setup(accountId string) error

func (*Client) Token

func (c *Client) Token() (*oauth2.Token, error)

Token returns the cached OAuth token from disk if it's still valid, or retrieves a new one from the token source.

func (*Client) TokenCache

func (c *Client) TokenCache() *TokenCacher

func (*Client) TokenSource

func (c *Client) TokenSource() oauth2.TokenSource

Setup the OAuth token source, which can then issue (and cache) OAuth tokens. API clients can always be used to get new tokens. Password auth credentials need a valid refresh token, or they error out (and need a login to get a new refresh token).

type FieldOutput

type FieldOutput struct {
	Writer *tabwriter.Writer
}

func (*FieldOutput) Flush

func (fo *FieldOutput) Flush()

type RowFieldOutput

type RowFieldOutput struct {
	FieldOutput
	FieldOrder []string
}

func (*RowFieldOutput) SendHeader

func (fo *RowFieldOutput) SendHeader()

func (*RowFieldOutput) Setup

func (fo *RowFieldOutput) Setup(fieldorder []string)

func (*RowFieldOutput) Write

func (fo *RowFieldOutput) Write(fields map[string]string) error

type ShowFieldOutput

type ShowFieldOutput struct {
	FieldOutput
	FieldOrder []string
}

func (*ShowFieldOutput) Setup

func (fo *ShowFieldOutput) Setup(fieldorder []string)

func (*ShowFieldOutput) Write

func (fo *ShowFieldOutput) Write(fields map[string]string) error

type TokenCacher

type TokenCacher struct {
	Key string
	// contains filtered or unexported fields
}

func (*TokenCacher) Clear

func (tc *TokenCacher) Clear()

func (*TokenCacher) Read

func (tc *TokenCacher) Read() *oauth2.Token

func (*TokenCacher) Write

func (tc *TokenCacher) Write(token *oauth2.Token)

Jump to

Keyboard shortcuts

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