model

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TSFormat         = "ts"
	RelativeTSFormat = "relative_ts"
)
View Source
const (
	GetMethod    = "GET"
	PostMethod   = "POST"
	PatchMethod  = "PATCH"
	DeleteMethod = "DELETE"
)
View Source
const (
	// Put the parameter value in the context
	ContextDisposition = ParameterDisposition("context")
)

Variables

View Source
var Models []*Model

Functions

func AddContextValueSupplier

func AddContextValueSupplier(name string, supplier ContextValueSupplier)

func GetModelDir

func GetModelDir(url string) (string, error)

func Load

func Load(source Source) error

func RegisterAction

func RegisterAction(name string, action Action)

Types

type Action

type Action func(opts options.Interface, n *jnode.Node) (*jnode.Node, error)

type ColumnFormatter

type ColumnFormatter string

type CommandModel

type CommandModel struct {
	Type              string            `hcl:"type,label"`
	Name              string            `hcl:"name,label"`
	Use               *string           `hcl:"use"`
	Short             string            `hcl:"short"`
	Aliases           *[]string         `hcl:"aliases"`
	Path              *string           `hcl:"path"`
	Method            *string           `hcl:"method"`
	Parameters        []*ParameterModel `hcl:"parameter,block"`
	ClusterIDOptional *bool             `hcl:"cluster_id_optional"`
	AuthNotRequired   *bool             `hcl:"auth_not_required"`
	Unauthenticated   *bool             `hcl:"unauthenticated"`
	Result            *ResultModel      `hcl:"result,block"`
	Commands          []*CommandModel   `hcl:"command,block"`
	// contains filtered or unexported fields
}

func (*CommandModel) GetCommand

func (cm *CommandModel) GetCommand() *cobra.Command

func (*CommandModel) GetCommandType

func (cm *CommandModel) GetCommandType() CommandType

type CommandType

type CommandType string

func (CommandType) IsGroup

func (t CommandType) IsGroup() bool

type ContextValueSupplier

type ContextValueSupplier func(string) (string, error)

type ContextValues

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

func (*ContextValues) Get

func (c *ContextValues) Get(name string) (string, error)

func (*ContextValues) Set

func (c *ContextValues) Set(name, value string)

type GitSource

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

func (*GitSource) GetFileSystem

func (s *GitSource) GetFileSystem() http.FileSystem

func (*GitSource) GetPath

func (s *GitSource) GetPath(name string) string

func (*GitSource) GetVersion

func (s *GitSource) GetVersion(name string, content []byte) string

func (*GitSource) String

func (s *GitSource) String() string

type LocalAction

type LocalAction string

func (LocalAction) Run

func (a LocalAction) Run(opts options.Interface, n *jnode.Node) (*jnode.Node, error)

type Model

type Model struct {
	Command       CommandModel `hcl:"command,block"`
	APIPrefix     string       `hcl:"api_prefix"`
	MinCLIVersion *string      `hcl:"min_cli_version"`
	FileName      string
	Version       string
}

type ParameterDisposition

type ParameterDisposition string

What to do with a parameter. By default the parameter is put in the query string (for GET), or in the json body (everything else.)

type ParameterModel

type ParameterModel struct {
	Name         string  `hcl:"name,label"`
	Shorthand    *string `hcl:"shorthand"`
	Usage        *string `hcl:"usage"`
	Required     *bool   `hcl:"required"`
	ContextValue *string `hcl:"context_value"`
	DefaultValue *string `hcl:"default_value"`
	Disposition  *string `hcl:"disposition"`
}

type ResultModel

type ResultModel struct {
	Path        *[]string          `hcl:"path"`
	Columns     *[]string          `hcl:"columns"`
	WideColumns *[]string          `hcl:"wide_columns"`
	Sort        *[]string          `hcl:"sort_by"`
	Formatters  *map[string]string `hcl:"formatters"`
	LocalAction *string            `hcl:"local_action"`
}

type Source

type Source interface {
	GetFileSystem() http.FileSystem
	GetPath(file string) string
	GetVersion(file string, content []byte) string
	String() string
}

func GetEmbeddedSource

func GetEmbeddedSource() Source

func GetGitSource

func GetGitSource(url string) (Source, error)

Jump to

Keyboard shortcuts

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