openapi

package
v3.0.16+incompatible Latest Latest
Warning

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

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

Documentation

Overview

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

* Copyright (C) 1999-2019 Alibaba Group Holding Limited

Index

Constants

View Source
const (
	SecureFlagName   = "secure"
	ForceFlagName    = "force"
	EndpointFlagName = "endpoint"
	VersionFlagName  = "version"
	HeaderFlagName   = "header"
	BodyFlagName     = "body"
	BodyFileFlagName = "body-file"
	AcceptFlagName   = "accept"
	RoaFlagName      = "roa"
	DryRunFlagName   = "dryrun"
	QuietFlagName    = "quiet"
	OutputFlagName   = "output"
)

Variables

View Source
var PagerFlag = &cli.Flag{Category: "caller",
	Name:         "pager",
	Hidden:       false,
	AssignedMode: cli.AssignedRepeatable,
	Aliases:      []string{"--all-pages"},
	Short: i18n.T(
		"use `--pager` to merge pages for pageable APIs",
		"使用 `--pager` 在访问分页的API时合并结果分页"),
	Fields: []cli.Field{
		{Key: "path", Required: false},
		{Key: "PageNumber", DefaultValue: "PageNumber", Short: i18n.T(" PageNumber", "指定PageNumber的属性")},
		{Key: "PageSize", DefaultValue: "PageSize", Short: i18n.T("PageSize", "")},
		{Key: "TotalCount", DefaultValue: "TotalCount", Short: i18n.T("TotalCount", "")},
	},
	ExcludeWith: []string{WaiterFlag.Name},
}
View Source
var WaiterFlag = &cli.Flag{Category: "helper",
	Name:         "waiter",
	AssignedMode: cli.AssignedRepeatable,
	Short: i18n.T(
		"use `--waiter expr=<jmesPath> to=<value>` to pull api until result equal to expected value",
		"使用 `--waiter expr=<jmesPath> to=<value>` 来轮询调用OpenAPI,知道返回期望的值"),
	Long: i18n.T(
		"",
		""),
	Fields: []cli.Field{
		{Key: "expr", Required: true, Short: i18n.T("", "")},
		{Key: "to", Required: true, Short: i18n.T("", "")},
		{Key: "timeout", DefaultValue: "180", Short: i18n.T("", "")},
		{Key: "interval", DefaultValue: "5", Short: i18n.T("", "")},
	},
	ExcludeWith: []string{"pager"},
}

Functions

func AcceptFlag

func AcceptFlag(fs *cli.FlagSet) *cli.Flag

func AddFlags

func AddFlags(fs *cli.FlagSet)

func BodyFileFlag

func BodyFileFlag(fs *cli.FlagSet) *cli.Flag

func BodyFlag

func BodyFlag(fs *cli.FlagSet) *cli.Flag

func DryRunFlag

func DryRunFlag(fs *cli.FlagSet) *cli.Flag

func EndpointFlag

func EndpointFlag(fs *cli.FlagSet) *cli.Flag

func ForceFlag

func ForceFlag(fs *cli.FlagSet) *cli.Flag

func FormatJson

func FormatJson(content string) string

func HeaderFlag

func HeaderFlag(fs *cli.FlagSet) *cli.Flag

func NewAcceptFlag

func NewAcceptFlag() *cli.Flag

func NewBodyFileFlag

func NewBodyFileFlag() *cli.Flag

func NewBodyFlag

func NewBodyFlag() *cli.Flag

func NewDryRunFlag

func NewDryRunFlag() *cli.Flag

func NewEndpointFlag

func NewEndpointFlag() *cli.Flag

func NewForceFlag

func NewForceFlag() *cli.Flag

func NewHeaderFlag

func NewHeaderFlag() *cli.Flag

func NewOutputFlag

func NewOutputFlag() *cli.Flag

func NewQuietFlag

func NewQuietFlag() *cli.Flag

func NewRoaFlag

func NewRoaFlag() *cli.Flag

func NewSecureFlag

func NewSecureFlag() *cli.Flag

func NewVersionFlag

func NewVersionFlag() *cli.Flag

func OutputFlag

func OutputFlag(fs *cli.FlagSet) *cli.Flag

func QuietFlag

func QuietFlag(fs *cli.FlagSet) *cli.Flag

func RoaFlag

func RoaFlag(fs *cli.FlagSet) *cli.Flag

func SecureFlag

func SecureFlag(fs *cli.FlagSet) *cli.Flag

func VersionFlag

func VersionFlag(fs *cli.FlagSet) *cli.Flag

Types

type BasicInvoker

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

basic invoker to init common object and headers

func NewBasicInvoker

func NewBasicInvoker(cp *config.Profile) *BasicInvoker

func (*BasicInvoker) Init

func (a *BasicInvoker) Init(ctx *cli.Context, product *meta.Product) error

type Commando

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

main entrance of aliyun cli

func NewCommando

func NewCommando(w io.Writer, profile config.Profile) *Commando

func (*Commando) InitWithCommand

func (c *Commando) InitWithCommand(cmd *cli.Command)

type ForceRpcInvoker

type ForceRpcInvoker struct {
	*BasicInvoker
	// contains filtered or unexported fields
}

func (*ForceRpcInvoker) Call

func (*ForceRpcInvoker) Prepare

func (a *ForceRpcInvoker) Prepare(ctx *cli.Context) error

type InvalidApiError

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

return when use unknown api

func (*InvalidApiError) Error

func (e *InvalidApiError) Error() string

func (*InvalidApiError) GetSuggestions

func (e *InvalidApiError) GetSuggestions() []string

type InvalidParameterError

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

return when use unknown parameter

func (*InvalidParameterError) Error

func (e *InvalidParameterError) Error() string

func (*InvalidParameterError) GetSuggestions

func (e *InvalidParameterError) GetSuggestions() []string

type InvalidProductError

type InvalidProductError struct {
	Code string
	// contains filtered or unexported fields
}

return when use unknown product

func (*InvalidProductError) Error

func (e *InvalidProductError) Error() string

func (*InvalidProductError) GetSuggestions

func (e *InvalidProductError) GetSuggestions() []string

type InvokeHelper

type InvokeHelper interface {
	CallWith(invoker Invoker) (string, error)
}

implementations - Waiter - Pager

type Invoker

type Invoker interface {
	Prepare(ctx *cli.Context) error
	Call() (*responses.CommonResponse, error)
	// contains filtered or unexported methods
}

implementations: - RpcInvoker, - RpcForceInvoker - RestfulInvoker

type Library

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

func NewLibrary

func NewLibrary(w io.Writer, lang string) *Library

func (*Library) GetApi

func (a *Library) GetApi(productCode string, version string, apiName string) (meta.Api, bool)

func (*Library) GetProduct

func (a *Library) GetProduct(productCode string) (meta.Product, bool)

func (*Library) GetProducts

func (a *Library) GetProducts() []meta.Product

func (*Library) PrintApiUsage

func (a *Library) PrintApiUsage(productCode string, apiName string) error

func (*Library) PrintProductUsage

func (a *Library) PrintProductUsage(productCode string, withApi bool) error

func (*Library) PrintProducts

func (a *Library) PrintProducts()

type OutputFilter

type OutputFilter interface {
	FilterOutput(input string) (string, error)
}

func GetOutputFilter

func GetOutputFilter(ctx *cli.Context) OutputFilter

func NewTableOutputFilter

func NewTableOutputFilter(ctx *cli.Context) OutputFilter

type Pager

type Pager struct {
	PageNumberFlag string
	PageSizeFlag   string

	PageNumberExpr string
	PageSizeExpr   string
	TotalCountExpr string

	PageSize int
	// contains filtered or unexported fields
}

func GetPager

func GetPager() *Pager

func (*Pager) CallWith

func (a *Pager) CallWith(invoker Invoker) (string, error)

func (*Pager) FeedResponse

func (a *Pager) FeedResponse(body string) error

func (*Pager) GetResponseCollection

func (a *Pager) GetResponseCollection() string

func (*Pager) HasMore

func (a *Pager) HasMore() bool

func (*Pager) MoveNextPage

func (a *Pager) MoveNextPage(request *requests.CommonRequest)

type RestfulInvoker

type RestfulInvoker struct {
	*BasicInvoker
	// contains filtered or unexported fields
}

func (*RestfulInvoker) Call

func (*RestfulInvoker) Prepare

func (a *RestfulInvoker) Prepare(ctx *cli.Context) error

type RpcInvoker

type RpcInvoker struct {
	*BasicInvoker
	// contains filtered or unexported fields
}

func (*RpcInvoker) Call

func (a *RpcInvoker) Call() (*responses.CommonResponse, error)

func (*RpcInvoker) Prepare

func (a *RpcInvoker) Prepare(ctx *cli.Context) error

type TableOutputFilter

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

func (*TableOutputFilter) FilterOutput

func (a *TableOutputFilter) FilterOutput(s string) (string, error)

func (*TableOutputFilter) FormatTable

func (a *TableOutputFilter) FormatTable(rowPath string, colNames []string, v interface{}) (string, error)

type Waiter

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

func GetWaiter

func GetWaiter() *Waiter

func (*Waiter) CallWith

func (a *Waiter) CallWith(invoker Invoker) (string, error)

Jump to

Keyboard shortcuts

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