bytemark-client: github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app/flags Index | Files

package flags

import "github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app/flags"

Index

Package Files

accessors.go account_name.go account_name_slice.go date_time_flag.go disc_spec.go fileflag.go group_name.go group_name_slice.go ip.go privilege.go resize.go sizespec.go slice_flags.go virtual_machine_name.go virtual_machine_name_slice.go

func Discs Uses

func Discs(c *app.Context, flagname string) []brain.Disc

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 Uses

func FileContents(c *app.Context, flagname string) string

FileContents returns the contents of the file given by the named flag.

func FileName Uses

func FileName(c *app.Context, flagname string) string

FileName returns the name of the file given by the named flag

func GroupName Uses

func GroupName(c *app.Context, flagname string) (gp pathers.GroupName)

GroupName returns the named flag as a pathers.GroupName

func IPs Uses

func IPs(c *app.Context, flagname string) []net.IP

IPs returns the ips passed along as the named flag.

func Size Uses

func Size(c *app.Context, flagname string) int

Size returns the value of the named SizeSpecFlag as an int in megabytes

func VirtualMachineName Uses

func VirtualMachineName(c *app.Context, flagname string) (vm pathers.VirtualMachineName)

VirtualMachineName returns the named flag as a pathers.VirtualMachineName

type AccountNameFlag Uses

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 Uses

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 Uses

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 Uses

func (name *AccountNameFlag) Set(value string) error

Set sets Value and SetFromCommandLine on the flag

func (AccountNameFlag) String Uses

func (name AccountNameFlag) String() string

String returns the AccountNameFlag as a string.

type AccountNameSliceFlag Uses

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 Uses

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 Uses

func (sf *AccountNameSliceFlag) Preprocess(ctx *app.Context) error

Preprocess calls Preprocess on all the underlying AccountNameFlags

func (*AccountNameSliceFlag) Set Uses

func (sf *AccountNameSliceFlag) Set(value string) error

Set appends a AccountNameFlag (created for you) to the slice

func (AccountNameSliceFlag) String Uses

func (sf AccountNameSliceFlag) String() string

String returns all values in the slice, comma-delimeted

type DateTimeFlag Uses

type DateTimeFlag string

DateTimeFlag holds datatime in iso8601 format

func (*DateTimeFlag) Set Uses

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 Uses

func (dtf *DateTimeFlag) String() string

type DiscSpecFlag Uses

type DiscSpecFlag []brain.Disc

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 Uses

func (discsFlag *DiscSpecFlag) Set(value string) error

Set adds all the defined discs to this flag's value

func (*DiscSpecFlag) String Uses

func (discsFlag *DiscSpecFlag) String() string

type FileFlag Uses

type FileFlag struct {
    FileName string
    Value    string
}

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.

func (*FileFlag) Set Uses

func (f *FileFlag) Set(name string) error

Set sets the value of FileFlag given the filename as an argument. This reads in the file synchronously.

func (*FileFlag) String Uses

func (f *FileFlag) String() string

type GroupNameFlag Uses

type GroupNameFlag struct {
    GroupName pathers.GroupName
    Value     string
}

GroupNameFlag is used for all --group flags, including the global one.

func (*GroupNameFlag) Preprocess Uses

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 Uses

func (name *GroupNameFlag) Set(value string) error

Set runs lib.ParseGroupName to make sure we have a valid group name

func (GroupNameFlag) String Uses

func (name GroupNameFlag) String() string

String returns the GroupName as a string.

type GroupNameSliceFlag Uses

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 Uses

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 Uses

func (sf *GroupNameSliceFlag) Preprocess(ctx *app.Context) error

Preprocess calls Preprocess on all the underlying GroupNameFlags

func (*GroupNameSliceFlag) Set Uses

func (sf *GroupNameSliceFlag) Set(value string) error

Set appends a GroupNameFlag (created for you) to the slice

func (GroupNameSliceFlag) String Uses

func (sf GroupNameSliceFlag) String() string

String returns all values in the slice, comma-delimeted

type IPFlag Uses

type IPFlag []net.IP

IPFlag is a flag.Value used to provide an array of net.IPs

func (*IPFlag) Set Uses

func (ips *IPFlag) Set(value string) error

Set sets the IPFlag given the space-separated string of IPs

func (*IPFlag) String Uses

func (ips *IPFlag) String() string

type PrivilegeFlag Uses

type PrivilegeFlag struct {
    AccountName        string
    GroupName          *pathers.GroupName
    VirtualMachineName *pathers.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 Uses

func Privilege(c *app.Context, flagname string) PrivilegeFlag

Privilege returns the named flag as a PrivilegeFlag

func (*PrivilegeFlag) Preprocess Uses

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 Uses

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 Uses

func (pf PrivilegeFlag) String() string

func (PrivilegeFlag) TargetType Uses

func (pf PrivilegeFlag) TargetType() string

TargetType returns the prefix of the Privilege's Level. Use the brain.PrivilegeTargetType* constants for comparison

type ResizeFlag Uses

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 Uses

func Resize(c *app.Context, flagname string) ResizeFlag

Resize returns the named ResizeFlag

func (*ResizeFlag) Set Uses

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 Uses

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 Uses

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 Uses

type SizeSpecFlag int

SizeSpecFlag represents a capacity as an integer number of megabytes.

func (*SizeSpecFlag) Set Uses

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 Uses

func (ssf *SizeSpecFlag) String() string

type VirtualMachineNameFlag Uses

type VirtualMachineNameFlag struct {
    VirtualMachineName pathers.VirtualMachineName
    Value              string
}

VirtualMachineNameFlag is used for all --server flags, or should be at least.

func (*VirtualMachineNameFlag) Preprocess Uses

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 Uses

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 Uses

func (name VirtualMachineNameFlag) String() string

String returns the VirtualMachineName as a string.

type VirtualMachineNameSliceFlag Uses

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 Uses

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 Uses

func (sf *VirtualMachineNameSliceFlag) Preprocess(ctx *app.Context) error

Preprocess calls Preprocess on all the underlying VirtualMachineNameFlags

func (*VirtualMachineNameSliceFlag) Set Uses

func (sf *VirtualMachineNameSliceFlag) Set(value string) error

Set appends a VirtualMachineNameFlag (created for you) to the slice

func (VirtualMachineNameSliceFlag) String Uses

func (sf VirtualMachineNameSliceFlag) String() string

String returns all values in the slice, comma-delimeted

Package flags imports 13 packages (graph) and is imported by 11 packages. Updated 2019-02-07. Refresh now. Tools for package owners.