commands

package
v0.0.0-...-f2e5974 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ListFlags are flags of sub command List
	ListFlags []cli.Flag
	// ShowFlags are flags of sub command Show
	ShowFlags []cli.Flag
	// ReloadFlags are flags of sub command Reload
	ReloadFlags []cli.Flag
)

Functions

func BuildHTTPListRequest

func BuildHTTPListRequest(endpoint, user, token string, limit, offset int) (*http.Request, error)

BuildHTTPListRequest builds HTTP Request to list Creds

func BuildHTTPRequest

func BuildHTTPRequest(endpoint, user, token, path string, queryParams map[string]string) (*http.Request, error)

BuildHTTPRequest builds HTTP Request

func BuildHTTPShowRequest

func BuildHTTPShowRequest(endpoint, user, token string, id int) (*http.Request, error)

BuildHTTPShowRequest builds HTTP Request to list Creds

func CacheExpired

func CacheExpired(cachePath string, cacheTTL int) bool

CacheExpired return cache is expired or not

func DoHTTPRequest

func DoHTTPRequest(req *http.Request) ([]byte, error)

DoHTTPRequest do HTTP Request and return response body

func GetCachedCreds

func GetCachedCreds(cachePath string) []string

GetCachedCreds return creds from cache

func ListAction

func ListAction(c *cli.Context) error

ListAction do HTTP request to list Cred url

func ReloadAction

func ReloadAction(c *cli.Context) error

ReloadAction do re-auth, update token, discard local cache

func ShowAction

func ShowAction(c *cli.Context) error

ShowAction do HTTP request to fetch Cred details

func StoreCreds

func StoreCreds(cachePath string, creds []ListResponseCred, lastUpdated time.Time) error

StoreCreds store creds to cache

Types

type ListResponse

type ListResponse struct {
	Meta    ListResponseMeta   `json:"meta"`
	Objects []ListResponseCred `json:"objects"`
}

ListResponse HTTP Response

type ListResponseCred

type ListResponseCred struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

ListResponseCred HTTP Response

func GetCreds

func GetCreds(endpoint, user, token string) []ListResponseCred

GetCreds return ... from RatticWeb

type ListResponseMeta

type ListResponseMeta struct {
	Next   string `json:"next"`
	Limit  int    `json:"limit"`
	Offset int    `json:"offset"`
}

ListResponseMeta HTTP Response

type ShowResponseCred

type ShowResponseCred struct {
	ID       int    `json:"id"`
	Password string `json:"password"`
}

ShowResponseCred HTTP Response

func GetCred

func GetCred(endpoint, user, token string, id int) ShowResponseCred

GetCred return ... from RatticWeb

Jump to

Keyboard shortcuts

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