Documentation ¶
Index ¶
- func Discs(c *app.Context, flagname string) []brain.Disc
- func FileContents(c *app.Context, flagname string) string
- func FileName(c *app.Context, flagname string) string
- func GroupName(c *app.Context, flagname string) (gp lib.GroupName)
- func IPs(c *app.Context, flagname string) []net.IP
- func Size(c *app.Context, flagname string) int
- func VirtualMachineName(c *app.Context, flagname string) (vm lib.VirtualMachineName)
- type AccountNameFlag
- type AccountNameSliceFlag
- type DateTimeFlag
- type DiscSpecFlag
- type FileFlag
- type GroupNameFlag
- type GroupNameSliceFlag
- type IPFlag
- type PrivilegeFlag
- type ResizeFlag
- type ResizeMode
- type SizeSpecFlag
- type VirtualMachineNameFlag
- type VirtualMachineNameSliceFlag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Discs ¶
Discs returns the discs passed along as the named flag. I can't imagine why I'd ever name a disc flag anything other than --disc, but the flexibility is there just in case.
func FileContents ¶
FileContents returns the contents of the file given by the named flag.
func VirtualMachineName ¶
func VirtualMachineName(c *app.Context, flagname string) (vm lib.VirtualMachineName)
VirtualMachineName returns the named flag as a lib.VirtualMachineName
Types ¶
type AccountNameFlag ¶
type AccountNameFlag struct { // AccountName is the actual name that will be passed on to API calls, and // is made by checking the contents of Value are a valid account. If Value // is unset then the value of the 'account' config variable is used AccountName string // Value is the raw input to the flag, and can be used as the default when // creating the flag. Value string // SetFromCommandLine is false by default but is set to true when Set is // called. This allows setting a default by setting Value by yourself - Set // is called from urfave/cli's flag-parsing code. SetFromCommandLine bool }
AccountNameFlag is used for all --account flags, excluding the global one.
func AccountName ¶
func AccountName(c *app.Context, flagname string) AccountNameFlag
AccountName returns the named AccountNameFlag. Why does it return the flag and not simply the account name? I don't know
func (*AccountNameFlag) Preprocess ¶
func (name *AccountNameFlag) Preprocess(c *app.Context) (err error)
Preprocess sets the value of this flag to the global account flag if it's unset, and then runs lib.ParseAccountName to set AccountName. This is an implementation of `app.Preprocessor`, which is detected and called automatically by actions created with `app.Action`
func (*AccountNameFlag) Set ¶
func (name *AccountNameFlag) Set(value string) error
Set sets Value and SetFromCommandLine on the flag
func (AccountNameFlag) String ¶
func (name AccountNameFlag) String() string
String returns the AccountNameFlag as a string.
type AccountNameSliceFlag ¶
type AccountNameSliceFlag []AccountNameFlag
AccountNameSliceFlag is used for AccountNameFlags that may be specified more than once. It's a slice of AccountNameFlag in order to avoid rewriting parsing logic.
func AccountNameSlice ¶
func AccountNameSlice(ctx *app.Context, name string) AccountNameSliceFlag
AccountNameSlice returns the named flag as a AccountNameSliceFlag, if it was one in the first place.
func (*AccountNameSliceFlag) Preprocess ¶
func (sf *AccountNameSliceFlag) Preprocess(ctx *app.Context) error
Preprocess calls Preprocess on all the underlying AccountNameFlags
func (*AccountNameSliceFlag) Set ¶
func (sf *AccountNameSliceFlag) Set(value string) error
Set appends a AccountNameFlag (created for you) to the slice
func (AccountNameSliceFlag) String ¶
func (sf AccountNameSliceFlag) String() string
String returns all values in the slice, comma-delimeted
type DateTimeFlag ¶
type DateTimeFlag string
DateTimeFlag holds datatime in iso8601 format
func (*DateTimeFlag) Set ¶
func (dtf *DateTimeFlag) Set(value string) (err error)
Set takes user input and attempts to parse the datetime from any format to iso8601
func (*DateTimeFlag) String ¶
func (dtf *DateTimeFlag) String() string
type DiscSpecFlag ¶
DiscSpecFlag is a flag which reads its argument as a disc spec. It can be specified multiple times to add multiple discs.
func (*DiscSpecFlag) Set ¶
func (discsFlag *DiscSpecFlag) Set(value string) error
Set adds all the defined discs to this flag's value
func (*DiscSpecFlag) String ¶
func (discsFlag *DiscSpecFlag) String() string
type FileFlag ¶
FileFlag implements the flag.Value (aka urfave/cli.Generic) interface to provide a flag value type that reads its effective value from the file named as its input.
type GroupNameFlag ¶
GroupNameFlag is used for all --group flags, including the global one.
func (*GroupNameFlag) Preprocess ¶
func (name *GroupNameFlag) Preprocess(c *app.Context) (err error)
Preprocess defaults the value of this flag to the default group from the config attached to the context and then runs lib.ParseGroupName This is an implementation of `app.Preprocessor`, which is detected and called automatically by actions created with `app.Action`
func (*GroupNameFlag) Set ¶
func (name *GroupNameFlag) Set(value string) error
Set runs lib.ParseGroupName to make sure we have a valid group name
func (GroupNameFlag) String ¶
func (name GroupNameFlag) String() string
String returns the GroupName as a string.
type GroupNameSliceFlag ¶
type GroupNameSliceFlag []GroupNameFlag
GroupNameSliceFlag is used for GroupNameFlags that may be specified more than once. It's a slice of GroupNameFlag in order to avoid rewriting parsing logic.
func GroupNameSlice ¶
func GroupNameSlice(ctx *app.Context, name string) GroupNameSliceFlag
GroupNameSlice returns the named flag as a GroupNameSliceFlag, if it was one in the first place.
func (*GroupNameSliceFlag) Preprocess ¶
func (sf *GroupNameSliceFlag) Preprocess(ctx *app.Context) error
Preprocess calls Preprocess on all the underlying GroupNameFlags
func (*GroupNameSliceFlag) Set ¶
func (sf *GroupNameSliceFlag) Set(value string) error
Set appends a GroupNameFlag (created for you) to the slice
func (GroupNameSliceFlag) String ¶
func (sf GroupNameSliceFlag) String() string
String returns all values in the slice, comma-delimeted
type IPFlag ¶
IPFlag is a flag.Value used to provide an array of net.IPs
type PrivilegeFlag ¶
type PrivilegeFlag struct { AccountName string GroupName *lib.GroupName VirtualMachineName *lib.VirtualMachineName Username string Level brain.PrivilegeLevel Value string }
PrivilegeFlag is an un-realised brain.Privilege - where the target name has been parsed but hasn't been turned into IDs yet
func Privilege ¶
func Privilege(c *app.Context, flagname string) PrivilegeFlag
Privilege returns the named flag as a PrivilegeFlag
func (*PrivilegeFlag) Preprocess ¶
func (pf *PrivilegeFlag) Preprocess(c *app.Context) (err error)
Preprocess parses the Privilege and looks up the target's ID so it can be made into a brain.Privilege This is an implementation of `app.Preprocessor`, which is detected and called automatically by actions created with `app.Action`
func (*PrivilegeFlag) Set ¶
func (pf *PrivilegeFlag) Set(value string) (err error)
Set sets the privilege given some string (should be in the form "<level> [[on] <target>] [to|from|for] <user>"
func (PrivilegeFlag) String ¶
func (pf PrivilegeFlag) String() string
func (PrivilegeFlag) TargetType ¶
func (pf PrivilegeFlag) TargetType() string
TargetType returns the prefix of the Privilege's Level. Use the brain.PrivilegeTargetType* constants for comparison
type ResizeFlag ¶
type ResizeFlag struct { Mode ResizeMode Size int }
ResizeFlag is effectively an extension of SizeSpecFlag which has a ResizeMode. The Size stored in the flag is the size to set to or increase by depending on the Mode
func Resize ¶
func Resize(c *app.Context, flagname string) ResizeFlag
Resize returns the named ResizeFlag
func (*ResizeFlag) Set ¶
func (rf *ResizeFlag) Set(value string) (err error)
Set parses the string into a Resize. If it starts with +, Mode is set to ResizeModeIncrease. Otherwise, it's set to ResizeModeSet. The rest of the string is parsed as a sizespec using sizespec.Parse
func (ResizeFlag) String ¶
func (rf ResizeFlag) String() string
String returns the size, in GiB or TiB (if the size is > 1TIB) with the unit used as a suffix. If Mode is ResizeModeIncrease, the string is prefixed with '+'
type ResizeMode ¶
type ResizeMode int
ResizeMode represents whether to increment a size or just to set it.
const ( // ResizeModeSet will cause resize disk to set the disc size to the one specified ResizeModeSet ResizeMode = iota // ResizeModeIncrease will cause resize disk to increase the disc size by the one specified ResizeModeIncrease )
type SizeSpecFlag ¶
type SizeSpecFlag int
SizeSpecFlag represents a capacity as an integer number of megabytes.
func (*SizeSpecFlag) Set ¶
func (ssf *SizeSpecFlag) Set(spec string) error
Set sets the value to the size specified. Users can add "M" or "G" as a suffix to specify that they are talking about megabytes/gigabytes. Gigabytes are assumed by default.
func (*SizeSpecFlag) String ¶
func (ssf *SizeSpecFlag) String() string
type VirtualMachineNameFlag ¶
type VirtualMachineNameFlag struct { VirtualMachineName lib.VirtualMachineName Value string }
VirtualMachineNameFlag is used for all --server flags, or should be at least.
func (*VirtualMachineNameFlag) Preprocess ¶
func (name *VirtualMachineNameFlag) Preprocess(c *app.Context) (err error)
Preprocess defaults the value of this flag to the default server from the config attached to the context and then runs lib.ParseVirtualMachineName This is an implementation of `app.Preprocessor`, which is detected and called automatically by actions created with `app.Action`
func (*VirtualMachineNameFlag) Set ¶
func (name *VirtualMachineNameFlag) Set(value string) error
Set runs lib.ParseVirtualMachineName using the c.Client() to make sure we have a valid group name
func (VirtualMachineNameFlag) String ¶
func (name VirtualMachineNameFlag) String() string
String returns the VirtualMachineName as a string.
type VirtualMachineNameSliceFlag ¶
type VirtualMachineNameSliceFlag []VirtualMachineNameFlag
VirtualMachineNameSliceFlag is used for VirtualMachineNameFlags that may be specified more than once. It's a slice of VirtualMachineNameFlag in order to avoid rewriting parsing logic.
func VirtualMachineNameSlice ¶
func VirtualMachineNameSlice(ctx *app.Context, name string) VirtualMachineNameSliceFlag
VirtualMachineNameSlice returns the named flag as a VirtualMachineNameSliceFlag, if it was one in the first place.
func (*VirtualMachineNameSliceFlag) Preprocess ¶
func (sf *VirtualMachineNameSliceFlag) Preprocess(ctx *app.Context) error
Preprocess calls Preprocess on all the underlying VirtualMachineNameFlags
func (*VirtualMachineNameSliceFlag) Set ¶
func (sf *VirtualMachineNameSliceFlag) Set(value string) error
Set appends a VirtualMachineNameFlag (created for you) to the slice
func (VirtualMachineNameSliceFlag) String ¶
func (sf VirtualMachineNameSliceFlag) String() string
String returns all values in the slice, comma-delimeted
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
gen
|
|
slice_flags
slice_flags is a tool to instantly implement a flag.Value called <Something>SliceFlag, which contains a slice of <Something>Flags, an accessor called <Something>Slice, and a test to ensure that the SliceFlag parses and Preprocesses correctly if necessary.
|
slice_flags is a tool to instantly implement a flag.Value called <Something>SliceFlag, which contains a slice of <Something>Flags, an accessor called <Something>Slice, and a test to ensure that the SliceFlag parses and Preprocesses correctly if necessary. |