shell

package
v0.3.10-0-alpha.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(prefix string) *Command

type CommandOption

type CommandOption[OPT any] struct {
	*Command
	// contains filtered or unexported fields
}

func NewCO

func NewCO[OPT any](cmd *Command) *CommandOption[OPT]

NewCO returns a Command with Option

func (*CommandOption[OPT]) RawRun

func (co *CommandOption[OPT]) RawRun(suffix string, desc string, cb func(ICloudProvider, *OPT) error)

func (*CommandOption[OPT]) RequireHost

func (co *CommandOption[OPT]) RequireHost() *CommandOption[OPT]

func (*CommandOption[OPT]) RequireRegion

func (co *CommandOption[OPT]) RequireRegion() *CommandOption[OPT]

func (*CommandOption[OPT]) RequireZone

func (co *CommandOption[OPT]) RequireZone() *CommandOption[OPT]

func (*CommandOption[OPT]) Run

func (co *CommandOption[OPT]) Run(suffix string, desc string, cb func(ICloudProvider, *OPT) (any, error))

func (*CommandOption[OPT]) RunByHost

func (co *CommandOption[OPT]) RunByHost(
	suffix string, desc string,
	cb func(cloudprovider.ICloudHost, *OPT) (any, error),
)

func (*CommandOption[OPT]) RunByProvider

func (co *CommandOption[OPT]) RunByProvider(suffix string, desc string, cb func(cloudprovider.ICloudProvider, *OPT) (any, error))

func (*CommandOption[OPT]) RunByRegion

func (co *CommandOption[OPT]) RunByRegion(
	suffix string, desc string,
	cb func(cli cloudprovider.ICloudRegion, args *OPT) (any, error),
)

func (*CommandOption[OPT]) RunByZone

func (co *CommandOption[OPT]) RunByZone(
	suffix string, desc string,
	cb func(cloudprovider.ICloudZone, *OPT) (any, error),
)

func (*CommandOption[OPT]) UseGetterList

func (co *CommandOption[OPT]) UseGetterList() *CommandOption[OPT]

func (*CommandOption[OPT]) UseList

func (co *CommandOption[OPT]) UseList() *CommandOption[OPT]

type EmptyOption

type EmptyOption struct{}

type GlobalOptions

type GlobalOptions struct {
	Debug      bool   `help:"Debug mode"`
	SUBCOMMAND string `help:"Cloudmux client subcommand" subcommand:"true"`

	Provider string `help:"Cloud provider" required:"true" choices:"Aliyun|Aws|Azure|Qcloud"`

	CloudEnv  string `` /* 209-byte string literal not displayed */
	AccessKey string `help:"Access key" default:"$CLOUDMUX_ACCESS_KEY" metavar:"CLOUDMUX_ACCESS_KEY"`
	Secret    string `help:"Secret" default:"$CLOUDMUX_SECRET" metavar:"CLOUDMUX_SECRET"`
	Region    string `help:"Default region" default:"$CLOUDMUX_REGION" metavar:"CLOUDMUX_REGION" short-token:"r"`
}

type HostBaseOptions

type HostBaseOptions struct {
	ZoneBaseOptions
	Host string `help:"Host ID"`
}

func (HostBaseOptions) GetHostId

func (o HostBaseOptions) GetHostId() string

type ICloudProvider

type ICloudProvider interface {
	GetProvider() cloudprovider.ICloudProvider
	GetDefaultRegionId() string
}

func NewCloudProvider

func NewCloudProvider(opt *GlobalOptions) (ICloudProvider, error)

type IHostBaseOptions

type IHostBaseOptions interface {
	IZoneBaseOptions
	GetHostId() string
}

type IListOption

type IListOption interface {
	GetLimit() int
	GetOffset() int
	IsDetails() bool
	GetColumns() []string
}

type IRunner

type IRunner[O any, C any] interface {
	RequireRegion() IRunner[O, C]
	RequireZone() IRunner[O, C]
	RequireHost() IRunner[O, C]

	List(suffix, desc string, cb func(cli C, args *O) (any, error))
	GetterList(suffix, desc string, cb func(cli C, args *O) (any, error))
	Run(suffix, desc string, cb func(cli C, args *O) (any, error))
}

func ProviderR

func ProviderR[O any](cmd *Command) IRunner[O, cloudprovider.ICloudProvider]

func RegionR

func RegionR[O any](cmd *Command) IRunner[O, cloudprovider.ICloudRegion]

func ZoneR

func ZoneR[O any](cmd *Command) IRunner[O, cloudprovider.ICloudZone]

type IZoneBaseOptions

type IZoneBaseOptions interface {
	GetZoneId() string
}

type ListBaseOptions

type ListBaseOptions struct {
	Limit   int  `help:"Page size"`
	Offset  int  `help:"Page offset"`
	Details bool `help:"Show Details"`
}

func (ListBaseOptions) GetColumns

func (o ListBaseOptions) GetColumns() []string

func (ListBaseOptions) GetLimit

func (o ListBaseOptions) GetLimit() int

func (ListBaseOptions) GetOffset

func (o ListBaseOptions) GetOffset() int

func (ListBaseOptions) IsDetails

func (o ListBaseOptions) IsDetails() bool

type ObjectHeaderOptions

type ObjectHeaderOptions struct {
	CacheControl       string `help:"Cache-Control"`
	ContentType        string `help:"Content-Type"`
	ContentEncoding    string `help:"Content-Encoding"`
	ContentLanguage    string `help:"Content-Language"`
	ContentDisposition string `help:"Content-Disposition"`
	ContentMD5         string `help:"Content-MD5"`

	Meta []string `help:"header, common seperatored key and value, e.g. max-age:100"`
}

func (ObjectHeaderOptions) Options2Header

func (args ObjectHeaderOptions) Options2Header() http.Header

type SEmptyOptionRunner

type SEmptyOptionRunner[C any] struct {
	// contains filtered or unexported fields
}

func EmptyOptionRegionR

func EmptyOptionRegionR(prefix string) *SEmptyOptionRunner[cloudprovider.ICloudRegion]

func EmptyOptionRunner

func EmptyOptionRunner[C any](
	prefix string,
	rf func(*Command) IRunner[EmptyOption, C],
) *SEmptyOptionRunner[C]

func EmptyOptionZoneR

func EmptyOptionZoneR(prefix string) *SEmptyOptionRunner[cloudprovider.ICloudZone]

func (*SEmptyOptionRunner[C]) GetterList

func (er *SEmptyOptionRunner[C]) GetterList(suffix, desc string, cb func(cli C) (any, error))

func (*SEmptyOptionRunner[C]) List

func (er *SEmptyOptionRunner[C]) List(suffix, desc string, cb func(cli C) (any, error))

func (*SEmptyOptionRunner[C]) Run

func (er *SEmptyOptionRunner[C]) Run(suffix, desc string, cb func(cli C) (any, error))

type ZoneBaseOptions

type ZoneBaseOptions struct {
	Zone string `help:"Zone ID"`
}

func (ZoneBaseOptions) GetZoneId

func (o ZoneBaseOptions) GetZoneId() string

type ZoneListOptions

type ZoneListOptions struct {
	ListBaseOptions
}

func (ZoneListOptions) GetColumns

func (o ZoneListOptions) GetColumns() []string

Jump to

Keyboard shortcuts

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