rc

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PivnetProfile

type PivnetProfile struct {
	Name              string `yaml:"name"`
	APIToken          string `yaml:"api_token"`
	Host              string `yaml:"host"`
	AccessToken       string `yaml:"access_token"`
	AccessTokenExpiry int64  `yaml:"access_token_expiry"`
}

func (*PivnetProfile) Validate

func (p *PivnetProfile) Validate() error

type PivnetRC

type PivnetRC struct {
	Profiles []PivnetProfile `yaml:"profiles"`
}

type PivnetRCReadWriter

type PivnetRCReadWriter interface {
	WriteToFile(contents []byte) error
	ReadFromFile() ([]byte, error)
}

type RCHandler

type RCHandler struct {
	// contains filtered or unexported fields
}

func NewRCHandler

func NewRCHandler(rcReadWriter PivnetRCReadWriter) *RCHandler

func (*RCHandler) ProfileForName

func (h *RCHandler) ProfileForName(profileName string) (*PivnetProfile, error)

ProfileForName will return (nil,nil) if the file does not exist, or if the profile does not exist, but will return (nil,err) for other reasons e.g. the file cannot be read.

func (*RCHandler) RemoveProfileWithName

func (h *RCHandler) RemoveProfileWithName(profileName string) error

RemoveProfileWithName will return error for all errors except if file does not exist

func (*RCHandler) SaveProfile

func (h *RCHandler) SaveProfile(
	profileName string,
	apiToken string,
	host string,
	accessToken string,
	accessTokenExpiry int64,
) error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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