cmd

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Index

Constants

View Source
const ConfigFile = "config.json"

Variables

This section is empty.

Functions

func Execute

func Execute()

func GetServiceMapping

func GetServiceMapping(s string) (string, bool)

func GetSvcVersionMapping added in v1.0.5

func GetSvcVersionMapping(svc, version 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 ApiMeta

type ApiMeta struct {
	Request  *Meta
	Response *Meta
}

func (*ApiMeta) GetReqRequired

func (m *ApiMeta) GetReqRequired(pattern string) bool

func (*ApiMeta) GetReqTypeName

func (m *ApiMeta) GetReqTypeName(pattern string) string

type Configure

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

func LoadConfig

func LoadConfig() *Configure

LoadConfig from CONFIG_FILE_DIR(default ~/.volcengine)

func (*Configure) SetRandomCurrentProfile

func (config *Configure) SetRandomCurrentProfile()

type Context

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

func NewContext

func NewContext() *Context

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 Meta

type Meta struct {
	MetaTypes  map[string]*MetaType `json:"MetaTypes,omitempty"`
	ChildMetas map[string]*Meta     `json:"ChildMetas,omitempty"`
}

func (*Meta) GetReqBody

func (m *Meta) GetReqBody() map[string]interface{}

type MetaInfo

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

type MetaType

type MetaType struct {
	TypeName string `json:"TypeName,omitempty"`
	TypeOf   string `json:"TypeOf,omitempty"`
	Required bool   `json:"Required,omitempty"`
}

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

func (*Profile) ToMap

func (p *Profile) ToMap() map[string]interface{}

type RootSupport

type RootSupport struct {
	SupportSvc    []string
	SupportAction map[string]map[string]*VolcengineMeta
	Versions      map[string]string
	SupportTypes  map[string]map[string]*ApiMeta
}

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 VolcengineMeta

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

func (*VolcengineMeta) GetRequestParams

func (meta *VolcengineMeta) GetRequestParams(apiMeta *ApiMeta) (params []param)

Jump to

Keyboard shortcuts

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