cli

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFile = "config.json"

Variables

This section is empty.

Functions

func GetServiceMapping

func GetServiceMapping(s string) (string, bool)

func WriteConfigToFile

func WriteConfigToFile(config *Configure) error

WriteConfigToFile store config

Types

type ApiInfo

type ApiInfo struct {
	Method      string
	ContentType string
	ServiceName string
	ParamTypes  map[string]string
}

type Command

type Command struct {
	Name string

	Run func(ctx *Context, args []string) error
	// contains filtered or unexported fields
}

func NewRootCommand

func NewRootCommand() *Command

func (*Command) Execute

func (c *Command) Execute(ctx *Context, args []string) error

func (*Command) GetFlags

func (c *Command) GetFlags() *FlagSet

func (*Command) HandleConfigureCommand

func (c *Command) HandleConfigureCommand(ctx *Context, args []string) (err error)

func (*Command) InitRootCommand

func (c *Command) InitRootCommand()

func (*Command) RootCommandRun

func (c *Command) RootCommandRun(ctx *Context, args []string) (err error)

type Configure

type Configure struct {
	Current  string              `json:"current"`
	Profiles map[string]*Profile `json:"profiles"`
}

func LoadConfig

func LoadConfig() *Configure

LoadConfig from CONFIG_FILE_DIR

func (*Configure) SetRandomCurrentProfile

func (config *Configure) SetRandomCurrentProfile()

type Context

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

func NewContext

func NewContext() *Context

func (*Context) SetCommand

func (c *Context) SetCommand(cmd *Command)

func (*Context) SetConfig

func (c *Context) SetConfig(cfg *Configure)

type Flag

type Flag struct {
	Name string
	// contains filtered or unexported fields
}

func (*Flag) GetValue

func (f *Flag) GetValue() string

func (*Flag) SetValue

func (f *Flag) SetValue(value string)

type FlagSet

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

func NewFlagSet

func NewFlagSet() *FlagSet

func (*FlagSet) AddByName

func (fs *FlagSet) AddByName(name string) (*Flag, error)

func (*FlagSet) AddFlag

func (fs *FlagSet) AddFlag(f *Flag)

func (*FlagSet) GetFlags

func (fs *FlagSet) GetFlags() []*Flag

type MetaInfo

type MetaInfo struct {
	Basic     *[]string
	Structure *map[string]MetaInfo
}

type Parser

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

func NewParser

func NewParser(args []string) *Parser

func (*Parser) ReadArgs

func (p *Parser) ReadArgs(ctx *Context) ([]string, error)

type Profile

type Profile struct {
	Name         string `json:"name"`
	Mode         string `json:"mode"`
	AccessKey    string `json:"access-key"`
	SecretKey    string `json:"secret-key"`
	Region       string `json:"region"`
	Endpoint     string `json:"endpoint"`
	SessionToken string `json:"session-token"`
	DisableSSL   bool   `json:"disable-ssl"`
}

func (Profile) String

func (p Profile) String() string

type RootSupport

type RootSupport struct {
	SupportSvc    []string
	SupportAction map[string]map[string]*ApiInfo
	Versions      map[string]string
}

func NewRootSupport

func NewRootSupport() *RootSupport

func (*RootSupport) GetAllAction

func (r *RootSupport) GetAllAction(svc string) []string

func (*RootSupport) GetAllSvc

func (r *RootSupport) GetAllSvc() []string

func (*RootSupport) GetApiInfo

func (r *RootSupport) GetApiInfo(svc string, action string) *ApiInfo

func (*RootSupport) GetVersion

func (r *RootSupport) GetVersion(svc string) string

func (*RootSupport) IsValidAction

func (r *RootSupport) IsValidAction(svc, action string) bool

func (*RootSupport) IsValidSvc

func (r *RootSupport) IsValidSvc(svc string) bool

type SdkClient

type SdkClient struct {
	Config  *volcengine.Config
	Session *session.Session
}

func NewSimpleClient

func NewSimpleClient(ctx *Context) (*SdkClient, error)

func (*SdkClient) CallSdk

func (s *SdkClient) CallSdk(info SdkClientInfo, input interface{}) (output *map[string]interface{}, err error)

type SdkClientInfo

type SdkClientInfo struct {
	ServiceName string
	Action      string
	Version     string
	Method      string
	ContentType string
}

type VestackMeta

type VestackMeta struct {
	ApiInfo  *ApiInfo
	Request  *MetaInfo
	Response *MetaInfo
}

Jump to

Keyboard shortcuts

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