Documentation ¶
Index ¶
- Variables
- func Confirm(msg string) bool
- func ConfirmContinue(target string, ids ...int64) bool
- func FlattenErrors(errors []error) error
- func FlattenErrorsWithPrefix(errors []error, pref string) error
- func GetParamTemplateValue(o InputOption) (string, error)
- func IsEmpty(object interface{}) bool
- func StringIDs(ids []int64) []string
- func UniqIDs(elements []int64) []int64
- func ValidateBetween(fieldName string, object interface{}, min int, max int) []error
- func ValidateConflictValues(fieldName string, object interface{}, values map[string]interface{}) []error
- func ValidateConflicts(fieldName string, object interface{}, values map[string]interface{}) []error
- func ValidateExistsFileOrStdIn(fieldName string, object interface{}) []error
- func ValidateIPv4Address(fieldName string, object interface{}) []error
- func ValidateIPv6Address(fieldName string, object interface{}) []error
- func ValidateInStrValues(fieldName string, object interface{}, allowValues ...string) []error
- func ValidateInputOption(o InputOption) []error
- func ValidateOutputOption(o output.Option) []error
- func ValidateRequired(fieldName string, object interface{}) []error
- func ValidateSakuraID(fieldName string, object interface{}) []error
- func ValidateSetProhibited(fieldName string, object interface{}) []error
- type Context
- type FlagContext
- type InputOption
- type Option
- type OutputTypeHolder
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultZone = "tk1a" DefaultOutputType = "table" )
View Source
var GlobalFlags = []cli.Flag{ &cli.StringFlag{ Name: "token", Usage: "API Token of SakuraCloud", EnvVars: []string{"SAKURACLOUD_ACCESS_TOKEN"}, DefaultText: "none", Destination: &GlobalOption.AccessToken, }, &cli.StringFlag{ Name: "secret", Usage: "API Secret of SakuraCloud", EnvVars: []string{"SAKURACLOUD_ACCESS_TOKEN_SECRET"}, DefaultText: "none", Destination: &GlobalOption.AccessTokenSecret, }, &cli.StringFlag{ Name: "zone", Usage: "Target zone of SakuraCloud", EnvVars: []string{"SAKURACLOUD_ZONE"}, Value: DefaultZone, DefaultText: DefaultZone, Destination: &GlobalOption.Zone, }, &cli.StringFlag{ Name: "config", Aliases: []string{"profile"}, Usage: "Config(Profile) name", EnvVars: []string{"USACLOUD_PROFILE"}, Destination: &GlobalOption.ProfileName, }, &cli.IntFlag{ Name: "timeout", Usage: "Number of timeout minutes for polling functions", EnvVars: []string{"SAKURACLOUD_TIMEOUT"}, Value: 20, Destination: &GlobalOption.Timeout, }, &cli.StringFlag{ Name: "accept-language", Usage: "Accept-Language Header", EnvVars: []string{"SAKURACLOUD_ACCEPT_LANGUAGE"}, Destination: &GlobalOption.AcceptLanguage, }, &cli.IntFlag{ Name: "retry-max", Usage: "Number of API-Client retries", EnvVars: []string{"SAKURACLOUD_RETRY_MAX"}, Destination: &GlobalOption.RetryMax, }, &cli.Int64Flag{ Name: "retry-interval", Usage: "API client retry interval seconds", EnvVars: []string{"SAKURACLOUD_RETRY_INTERVAL"}, Destination: &GlobalOption.RetryIntervalSec, }, &cli.BoolFlag{ Name: "no-color", Usage: "Flag of not using ANSI color output", EnvVars: []string{"NO_COLOR"}, Destination: &GlobalOption.NoColor, }, &cli.StringFlag{ Name: "api-root-url", EnvVars: []string{"USACLOUD_API_ROOT_URL"}, Destination: &GlobalOption.APIRootURL, Hidden: true, }, &cli.StringFlag{ Name: "default-output-type", EnvVars: []string{"USACLOUD_DEFAULT_OUTPUT_TYPE"}, Destination: &GlobalOption.DefaultOutputType, Value: DefaultOutputType, Hidden: true, }, &cli.StringSliceFlag{ Name: "zones", Hidden: true, }, &cli.BoolFlag{ Name: "trace", Usage: "Flag of SakuraCloud debug-mode", EnvVars: []string{"SAKURACLOUD_TRACE_MODE"}, Destination: &GlobalOption.TraceMode, Value: false, Hidden: true, }, }
View Source
var GlobalOption = &Option{ In: os.Stdin, Out: colorable.NewColorableStdout(), Progress: colorable.NewColorableStderr(), Err: colorable.NewColorableStderr(), }
Functions ¶
func ConfirmContinue ¶ added in v0.0.11
func FlattenErrors ¶ added in v0.0.11
func FlattenErrorsWithPrefix ¶ added in v0.0.11
func GetParamTemplateValue ¶ added in v0.0.11
func GetParamTemplateValue(o InputOption) (string, error)
func IsEmpty ¶ added in v0.0.11
func IsEmpty(object interface{}) bool
IsEmpty is copied from github.com/stretchr/testify/assert/assetions.go
func ValidateBetween ¶ added in v0.0.11
func ValidateConflictValues ¶ added in v0.0.11
func ValidateConflicts ¶ added in v0.0.11
func ValidateExistsFileOrStdIn ¶ added in v0.7.0
func ValidateIPv4Address ¶ added in v0.3.0
func ValidateIPv6Address ¶ added in v0.3.0
func ValidateInStrValues ¶ added in v0.0.11
func ValidateInputOption ¶ added in v0.0.11
func ValidateInputOption(o InputOption) []error
func ValidateOutputOption ¶ added in v0.0.11
func ValidateRequired ¶ added in v0.0.11
func ValidateSakuraID ¶ added in v0.0.11
func ValidateSetProhibited ¶ added in v0.0.11
Types ¶
type Context ¶
type Context interface { GetOutput() output.Output GetAPIClient() *api.Client Args() []string NArgs() int FlagContext }
func NewContext ¶
func NewContext(flagContext FlagContext, args []string, formater interface{}) Context
type FlagContext ¶
type InputOption ¶ added in v0.0.11
type Option ¶
type Option struct { AccessToken string AccessTokenSecret string Zone string ProfileName string Timeout int AcceptLanguage string RetryMax int RetryIntervalSec int64 Zones []string APIRootURL string TraceMode bool Format string DefaultOutputType string NoColor bool In *os.File Out io.Writer Progress io.Writer Err io.Writer Validated bool Valid bool ValidationResults []error }
type OutputTypeHolder ¶ added in v0.6.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.