options

package
v2.2.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseListOptionsType = reflect.TypeOf((*BaseListOptions)(nil)).Elem()

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to bool type with the same value as the argument. This is intended to be used for literal initialization of options

func BoolV

func BoolV(p *bool) bool

BoolV returns the bool value as pointed to by the argument if it's non-nil, return false otherwise

func Int

func Int(v int) *int

Int returns a pointer to int type with the same value as the argument. This is intended to be used for literal initialization of options

func IntV

func IntV(p *int) int

IntV returns the integer value as pointed to by the argument if it's non-nil, return 0 otherwise

func ListStructToParams

func ListStructToParams(v interface{}) (*jsonutils.JSONDict, error)

ListStructToParams converts the struct as pointed to by the argument to JSON dict params, taking into account .BaseListOptions.Params() if it exists

func ParseServerDeployInfoList

func ParseServerDeployInfoList(list []string) (*jsonutils.JSONDict, error)

func StructToParams

func StructToParams(v interface{}) (*jsonutils.JSONDict, error)

StructToParams converts the struct as pointed to by the argument to JSON dict params, ignoring any embedded in struct

Types

type AlarmEventListOptions

type AlarmEventListOptions struct {
	BaseListOptions
	NodeLabels     string `help:"Service tree node labels"`
	MetricName     string `help:"Metric name"`
	HostName       string `help:"Host name"`
	HostIp         string `help:"Host IP address"`
	AlarmLevel     string `help:"Alarm level"`
	AlarmCondition string `help:"Concrete alarm rule"`
	Template       string `help:"Template number of the alarm condition"`
	AckStatus      string `help:"Alarm event ack status"`
}

type BaseListOptions

type BaseListOptions struct {
	Limit            *int     `default:"20" help:"Page limit"`
	Offset           *int     `default:"0" help:"Page offset"`
	OrderBy          []string `help:"Name of the field to be ordered by"`
	Order            string   `help:"List order" choices:"desc|asc"`
	Details          *bool    `help:"Show more details" default:"false"`
	Search           string   `help:"Filter results by a simple keyword search"`
	Meta             *bool    `help:"Piggyback metadata information"`
	Filter           []string `help:"Filters"`
	JointFilter      []string `help:"Filters with joint table col; joint_tbl.related_key(origin_key).filter_col.filter_cond(filters)"`
	FilterAny        *bool    `help:"If true, match if any of the filters matches; otherwise, match if all of the filters match"`
	Admin            *bool    `help:"Is an admin call?"`
	Tenant           string   `help:"Tenant ID or Name"`
	User             string   `help:"User ID or Name"`
	System           *bool    `help:"Show system resource"`
	PendingDelete    *bool    `help:"Show only pending deleted resource"`
	PendingDeleteAll *bool    `help:"Show all resources including pending deleted" json:"-"`
	Field            []string `help:"Show only specified fields"`
	ShowEmulated     *bool    `help:"Show all resources including the emulated resources"`
	ExportFile       string   `help:"Export to file" metavar:"<EXPORT_FILE_PATH>" json:"-"`
	ExportKeys       string   `help:"Export field keys"`
	ExportTexts      string   `help:"Export field displayname texts" json:"-"`
}

func (*BaseListOptions) Params

func (opts *BaseListOptions) Params() (*jsonutils.JSONDict, error)

type IParamsOptions

type IParamsOptions interface {
	Params() (*jsonutils.JSONDict, error)
}

type PodBaseOptions

type PodBaseOptions struct {
	WebConsoleOptions
	NAME      string `help:"Name of k8s pod to connect"`
	Namespace string `help:"Namespace of this pod"`
	Container string `help:"Container in this pod"`
	Cluster   string `default:"$K8S_CLUSTER|default" help:"Kubernetes cluster name"`
}

func (*PodBaseOptions) Params

func (opt *PodBaseOptions) Params() (*jsonutils.JSONDict, error)

type PodLogOptoins

type PodLogOptoins struct {
	PodBaseOptions
}

type PodShellOptions

type PodShellOptions struct {
	PodBaseOptions
}

type ServerChangeConfigOptions

type ServerChangeConfigOptions struct {
	ID   string   `help:"Server to rebuild root" json:"-"`
	Ncpu *int     `help:"New number of Virtual CPU cores" json:"vcpu_count"`
	Vmem string   `help:"New memory size" json:"vmem_size"`
	Disk []string `help:"Data disk description, from the 1st data disk to the last one, empty string if no change for this data disk"`
}

type ServerCreateOptions

type ServerCreateOptions struct {
	NAME             string   `help:"Name of server"`
	MEM              string   `help:"Memory size" metavar:"MEMORY" json:"vmem_size"`
	Disk             []string `help:"Disk descriptions" nargs:"+"`
	Net              []string `help:"Network descriptions" metavar:"NETWORK"`
	IsolatedDevice   []string `help:"Isolated device model or ID" metavar:"ISOLATED_DEVICE"`
	Keypair          string   `help:"SSH Keypair"`
	Password         string   `help:"Default user password"`
	Iso              string   `help:"ISO image ID" metavar:"IMAGE_ID" json:"cdrom"`
	Ncpu             *int     `help:"#CPU cores of VM server, default 1" default:"1" metavar:"<SERVER_CPU_COUNT>" json:"vcpu_count"`
	Vga              string   `help:"VGA driver" choices:"std|vmware|cirrus|qxl"`
	Vdi              string   `help:"VDI protocool" choices:"vnc|spice"`
	Bios             string   `help:"BIOS" choices:"BIOS|UEFI"`
	Desc             string   `help:"Description" metavar:"<DESCRIPTION>" json:"description"`
	Boot             string   `help:"Boot device" metavar:"<BOOT_DEVICE>" choices:"disk|cdrom" json:"-"`
	NoAccountInit    *bool    `help:"Not reset account password"`
	AllowDelete      *bool    `help:"Unlock server to allow deleting" json:"-"`
	ShutdownBehavior string   `help:"Behavior after VM server shutdown, stop or terminate server" metavar:"<SHUTDOWN_BEHAVIOR>" choices:"stop|terminate"`
	AutoStart        *bool    `help:"Auto start server after it is created"`
	Zone             string   `help:"Preferred zone where virtual server should be created" json:"prefer_zone"`
	Host             string   `help:"Preferred host where virtual server should be created" json:"prefer_host"`
	SchedTag         []string `help:"Schedule policy, key = aggregate name, value = require|exclude|prefer|avoid" metavar:"<KEY:VALUE>"`
	Deploy           []string `help:"Specify deploy files in virtual server file system" json:"-"`
	Group            []string `help:"Group of virtual server"`
	Project          string   `help:"'Owner project ID or Name" json:"tenant"`
	User             string   `help:"Owner user ID or Name"`
	System           *bool    `help:"Create a system VM, sysadmin ONLY option" json:"is_system"`
	Hypervisor       string   `help:"Hypervisor type" choices:"kvm|esxi|baremetal|container|aliyun|azure"`
	TaskNotify       *bool    `help:"Setup task notify" json:"-"`
	Count            *int     `help:"Create multiple simultaneously" default:"1" json:"-"`
	DryRun           *bool    `help:"Dry run to test scheduler" json:"-"`
	RaidConfig       []string `help:"Baremetal raid config" json:"-"`
}

func (*ServerCreateOptions) Params

func (opts *ServerCreateOptions) Params() (*jsonutils.JSONDict, error)

type ServerDeleteOptions

type ServerDeleteOptions struct {
	ID                    []string `help:"ID of servers to operate" metavar:"SERVER" json:"-"`
	OverridePendingDelete *bool    `help:"Delete server directly instead of pending delete"`
}

type ServerDeployInfo

type ServerDeployInfo struct {
	Action  string
	Path    string
	Content string
}

func ParseServerDeployInfo

func ParseServerDeployInfo(info string) (*ServerDeployInfo, error)

type ServerDeployOptions

type ServerDeployOptions struct {
	ID            string   `help:"ID or Name of server" json:"-"`
	Keypair       string   `help:"ssh Keypair used for login" json:"-"`
	DeleteKeypair *bool    `help:"Remove ssh Keypairs" json:"-"`
	Deploy        []string `help:"Specify deploy files in virtual server file system" json:"-"`
	ResetPassword *bool    `help:"Force reset password"`
	Password      string   `help:"Default user password"`
	AutoStart     *bool    `help:"Auto start server after deployed"`
}

func (*ServerDeployOptions) Params

func (opts *ServerDeployOptions) Params() (*jsonutils.JSONDict, error)

type ServerIdOptions

type ServerIdOptions struct {
	ID string `help:"ID or name of the server" json:"-"`
}

type ServerIdsOptions

type ServerIdsOptions struct {
	ID []string `help:"ID of servers to operate" metavar:"SERVER" json:"-"`
}

type ServerListOptions

type ServerListOptions struct {
	Zone          string `help:"Zone ID or Name"`
	Wire          string `help:"Wire ID or Name"`
	Network       string `help:"Network ID or Name"`
	Disk          string `help:"Disk ID or Name"`
	Host          string `help:"Host ID or Name"`
	Baremetal     *bool  `help:"Show baremetal servers"`
	Gpu           *bool  `help:"Show gpu servers"`
	Secgroup      string `help:"Secgroup ID or Name"`
	AdminSecgroup string `help:"AdminSecgroup ID or Name"`
	Hypervisor    string `help:"Show server of hypervisor" choices:"kvm|esxi|container|baremetal|aliyun|azure"`
	Manager       string `help:"Show servers imported from manager"`
	Region        string `help:"Show servers in cloudregion"`
	WithEip       *bool  `help:"Show Servers with EIP"`
	WithoutEip    *bool  `help:"Show Servers without EIP"`

	BaseListOptions
}

type ServerMonitorOptions

type ServerMonitorOptions struct {
	ID  string `help:"ID or Name of server" json:"-"`
	CMD string `help:"Qemu Monitor command to send"`
}

type ServerRebuildRootOptions

type ServerRebuildRootOptions struct {
	ID            string `help:"Server to rebuild root" json:"-"`
	Image         string `help:"New root Image template ID" json:"image_id"`
	Keypair       string `help:"ssh Keypair used for login"`
	Password      string `help:"Default user password"`
	NoAccountInit *bool  `help:"Not reset account password"`
	AutoStart     *bool  `help:"Auto start server after it is created"`
}

type ServerResetOptions

type ServerResetOptions struct {
	ID   []string `help:"ID of servers to operate" metavar:"SERVER" json:"-"`
	Hard *bool    `help:"Hard reset or not; default soft" json:"is_hard"`
}

type ServerRestartOptions

type ServerRestartOptions struct {
	ID      []string `help:"ID of servers to operate" metavar:"SERVER" json:"-"`
	IsForce *bool    `help:"Force reset or not; default false" json:"is_force"`
}

type ServerSaveImageOptions

type ServerSaveImageOptions struct {
	ID        string `help:"ID or name of server" json:"-"`
	IMAGE     string `help:"Image name" json:"name"`
	Public    *bool  `help:"Make the image public available" json:"is_public"`
	Format    string `help:"image format" choices:"vmdk|qcow2"`
	Notes     string `help:"Notes about the image"`
	AutoStart *bool  `help:"Auto start server after image saved"`
}

type ServerSecGroupOptions

type ServerSecGroupOptions struct {
	ID     string `help:"ID or Name of server" metavar:"Guest" json:"-"`
	Secgrp string `help:"ID of Security Group" metavar:"Security Group" positional:"true"`
}

type ServerSendKeyOptions

type ServerSendKeyOptions struct {
	ID   string `help:"ID or Name of server" metavar:"Guest" json:"-"`
	KEYS string `help:"Special keys to send, eg. ctrl, alt, f12, shift, etc, separated by \"-\""`
	Hold *uint  `help:"Hold key for specified milliseconds" json:"duration"`
}

type ServerShowOptions

type ServerShowOptions struct {
	ID       string `help:"ID or name of the server" json:"-"`
	WithMeta *bool  `help:"With meta data"`
}

type ServerStopOptions

type ServerStopOptions struct {
	ID    []string `help:"ID or Name of server" json:"-"`
	Force *bool    `help:"Stop server forcefully" json:"is_force"`
}

type ServerUpdateOptions

type ServerUpdateOptions struct {
	ID               []string `help:"IDs or Names of servers to update" json:"-"`
	Name             string   `help:"New name to change"`
	Vmem             string   `help:"Memory size" json:"vmem_size"`
	Ncpu             *int     `help:"CPU count" json:"vcpu_count"`
	Vga              string   `help:"VGA driver" choices:"std|vmware|cirrus|qxl"`
	Vdi              string   `help:"VDI protocol" choices:"vnc|spice"`
	Bios             string   `help:"BIOS" choices:"BIOS|UEFI"`
	Desc             string   `help:"Description" json:"description"`
	Boot             string   `help:"Boot device" choices:"disk|cdrom"`
	Delete           string   `help:"Lock server to prevent from deleting" choices:"enable|disable" json:"-"`
	ShutdownBehavior string   `help:"Behavior after VM server shutdown, stop or terminate server" choices:"stop|terminate"`
}

func (*ServerUpdateOptions) Params

func (opts *ServerUpdateOptions) Params() (*jsonutils.JSONDict, error)

type WebConsoleBaremetalOptions

type WebConsoleBaremetalOptions struct {
	WebConsoleOptions
	ID string `help:"Baremetal host id or name"`
}

func (*WebConsoleBaremetalOptions) Params

type WebConsoleOptions

type WebConsoleOptions struct {
	WebconsoleUrl string `help:"Frontend webconsole url" short-token:"w" default:"$WEBCONSOLE_URL"`
}

type WebConsoleSshOptions

type WebConsoleSshOptions struct {
	WebConsoleOptions
	IP string `help:"IP to connect"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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