utils

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_AWS_ACCOUNTID = 999999999999

Variables

This section is empty.

Functions

func AccountIdToInt64 added in v1.7.4

func AccountIdToInt64(a string) (int64, error)

AccountIdToInt64 returns an int64 version of AWS AccountID in base10

func AccountIdToString

func AccountIdToString(a int64) (string, error)

AccountIdToString returns a string version of AWS AccountID

func EnsureDirExists

func EnsureDirExists(filename string) error

ensures the given directory exists for the filename used by JsonStore and InsecureStore

func GetHomePath

func GetHomePath(path string) string

GetHomePath returns the absolute path of the provided path with the first ~ replaced with the location of the users home directory and the path rewritten for the host operating system

func MakeRoleARN

func MakeRoleARN(account int64, name string) string

MakeRoleARN create an IAM Role ARN using an int64 for the account

func MakeRoleARNs added in v1.7.4

func MakeRoleARNs(account, name string) string

MakeRoleARNs creates an IAM Role ARN using a string for the account and role

func MakeUserARN added in v1.8.0

func MakeUserARN(account int64, name string) string

MakeUserARN create an IAM User ARN using an int64 for the account

func ParseRoleARN

func ParseRoleARN(arn string) (int64, string, error)

ParseRoleARN parses an ARN representing a role in long or short format

func ParseTimeString

func ParseTimeString(t string) (int64, error)

ParseTimeString converts a standard time string to Unix Epoch

func ParseUserARN added in v1.8.0

func ParseUserARN(arn string) (int64, string, error)

ParseUserARN parses an ARN representing a user in long or short format

func SetLogger added in v1.7.5

func SetLogger(l *logrus.Logger)

func StrListContains added in v1.8.1

func StrListContains(str string, list []string) bool

StrListContains returns if `str` is in the `list`

func TimeRemain

func TimeRemain(expires int64, space bool) (string, error)

Returns the MMm or HHhMMm or 'Expired' if no time remains

Types

type HandleUrl

type HandleUrl struct {
	Action  UrlAction
	ExecCmd interface{}
	Browser string
	Url     string
	PreMsg  string
	PostMsg string
}

func NewHandleUrl added in v1.7.5

func NewHandleUrl(action, browser string, command interface{}) *HandleUrl

func (*HandleUrl) Open added in v1.7.5

func (h *HandleUrl) Open(url, pre, post string) error

Prints, opens or copies to clipboard the given URL

type UrlAction added in v1.7.5

type UrlAction int
const (
	UrlActionClip     UrlAction = iota // copy to clipboard
	UrlActionPrint                     // print message & url to stderr
	UrlActionPrintUrl                  // print only the  url to stderr
	UrlActionExec                      // Exec comand
	UrlActionOpen                      // auto-open in default or specified browser
)

Jump to

Keyboard shortcuts

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