util

package
v0.3.31 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(filename string, directoryPerm, filePerm fs.FileMode) error

CreateFile safely creates an empty file and any missing directory structure. The directories will have directoryPerm filemode. The file will have filePerm filemode.

func FileExists

func FileExists(path string) bool

func FirstRunPrompt

func FirstRunPrompt() error

FirstRunPrompt gets user input to bootstrap a bare-minimum configuration.

func OpenLink(link string) error

OpenLink attempts to open a link in browser, if supported

func PromptBool

func PromptBool(label string) (bool, error)

func PromptFilePath

func PromptFilePath(label, defaultValue string) (string, error)

func PromptFilePathNoValidate

func PromptFilePathNoValidate(label, defaultValue string) (string, error)

func PromptString

func PromptString(label string) (string, error)

func RenderTabularData added in v0.3.4

func RenderTabularData(headers []string, data [][]string) string

RenderTabularData creates a string for given data in a pretty tabular format, with the provided headers

func StringInSlice added in v0.3.21

func StringInSlice(elem string, list []string) bool

func WriteError

func WriteError(w http.ResponseWriter, message string, status int)

WriteError writes a status code and plaintext error to the provided http.ResponseWriter. The error is written as plaintext so AWS SDKs will display it inline with an error message.

Types

type AwsArn

type AwsArn struct {
	Arn               string
	Partition         string
	Service           string
	Region            string
	AccountId         string
	ResourceType      string
	Resource          string
	ResourceDelimiter string
}

func ArnParse

func ArnParse(arn string) (*AwsArn, error)

func (AwsArn) ArnString

func (a AwsArn) ArnString() string

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
	Code    string `json:"code"`
}

Jump to

Keyboard shortcuts

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