cmd

package
v2.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IpCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
	var info = operations.IpQueryInfo{}
	var cmd = &cobra.Command{
		Use:   "ip <Ip1> [<Ip2> [<Ip3> ...]]]",
		Short: "Query the ip information",
		Run: func(cmd *cobra.Command, args []string) {
			cfg.CmdCfg.CmdId = docs.IPType
			info.Ips = args
			operations.IpQuery(cfg, info)
		},
	}
	return cmd
}
View Source
var QboxTokenCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
	var info = operations.QBoxTokenInfo{}
	var cmd = &cobra.Command{
		Use:   "qbox <Url>",
		Short: "Create QBox token",
		Run: func(cmd *cobra.Command, args []string) {
			cfg.CmdCfg.CmdId = docs.TokenType
			if len(args) > 0 {
				info.Url = args[0]
			}
			operations.CreateQBoxToken(cfg, info)
		},
	}

	cmd.Flags().StringVarP(&info.ContentType, "content-type", "t", conf.CONTENT_TYPE_JSON, "http request content type, application/json by default")
	cmd.Flags().StringVarP(&info.Body, "http-body", "b", "", "http request body, when content-type is application/x-www-form-urlencoded, http body must be specified")
	cmd.Flags().StringVarP(&info.AccessKey, "access-key", "a", "", "access key")
	cmd.Flags().StringVarP(&info.SecretKey, "secret-key", "s", "", "secret key")

	return cmd
}
View Source
var QiniuTokenCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
	var info = operations.QiniuTokenInfo{}
	var cmd = &cobra.Command{
		Use:   "qiniu <Url>",
		Short: "Create Qiniu Token",
		Run: func(cmd *cobra.Command, args []string) {
			cfg.CmdCfg.CmdId = docs.TokenType
			if len(args) > 0 {
				info.Url = args[0]
			}
			operations.CreateQiniuToken(cfg, info)
		},
	}

	cmd.Flags().StringVarP(&info.ContentType, "content-type", "t", conf.CONTENT_TYPE_JSON, "http request content type, application/json by default")
	cmd.Flags().StringVarP(&info.Body, "http-body", "b", "", "http request body, when content-type is application/x-www-form-urlencoded, http body must be specified")
	cmd.Flags().StringVarP(&info.AccessKey, "access-key", "a", "", "access key")
	cmd.Flags().StringVarP(&info.SecretKey, "secret-key", "s", "", "secret key")
	cmd.Flags().StringVarP(&info.Method, "method", "m", "GET", "http request method")

	return cmd
}
View Source
var TokenCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
	var cmd = &cobra.Command{
		Use:   "token",
		Short: "Token related command",
		Long:  "Create QBox token, Qiniu token and Upload token",
		Run: func(cmd *cobra.Command, args []string) {
			cfg.CmdCfg.CmdId = docs.TokenType
			operations.Token(cfg)
		},
	}

	cmd.AddCommand(
		QboxTokenCmdBuilder(cfg),
		QiniuTokenCmdBuilder(cfg),
		UploadTokenCmdBuilder(cfg),
	)
	return cmd
}
View Source
var UploadTokenCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
	var info = operations.UploadTokenInfo{}
	var cmd = &cobra.Command{
		Use:   "upload <PutPolicyJsonFile>",
		Short: "Create upload token using put policy",
		Run: func(cmd *cobra.Command, args []string) {
			cfg.CmdCfg.CmdId = docs.TokenType
			if len(args) > 0 {
				info.PutPolicyFilePath = args[0]
			}
			operations.CreateUploadToken(cfg, info)
		},
	}

	cmd.Flags().StringVarP(&info.AccessKey, "access-key", "a", "", "access key")
	cmd.Flags().StringVarP(&info.SecretKey, "secret-key", "s", "", "secret key")

	return cmd
}

Functions

func Execute added in v2.7.0

func Execute()

Types

type Loader added in v2.7.0

type Loader func(superCmd *cobra.Command, cfg *iqshell.Config)

Jump to

Keyboard shortcuts

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