rest

package
v0.0.0-...-6a8978f Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 6 Imported by: 0

README

RESTful 客户端

对接用户中心 RESTful接口的客户端

http.Post("http://127.0.0.1:9010/maudit/api/v1/book", body)

k8s RESTful API

// RESTful 链式调用客户端 Reousrce("deploy").Namespace("system").LIST().Do().Error

封装一个链式的RESTful客户端:

client.POST("/xxxx").Header(k, v).Header(k,v).Body(payload).Do().To(resp).Error

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadClientFromEnv

func LoadClientFromEnv() error

Types

type ClientSet

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

func C

func C() *ClientSet

func NewClient

func NewClient(conf *Config) (*ClientSet, error)

func (*ClientSet) Token

func (c *ClientSet) Token() TokenService

type Config

type Config struct {
	Token      string `json:"token" toml:"token" yaml:"token" env:"MCENTER_TOKEN"`
	Address    string `json:"address" toml:"address" yaml:"address" env:"MCENTER_HTTP_ADDRESS" validate:"required"`
	PathPrefix string `json:"path_prefix" toml:"path_prefix" yaml:"path_prefix" env:"MCENTER_HTTP_PATH_PREFIX" validate:"required"`
}

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) Validate

func (c *Config) Validate() error

type TokenService

type TokenService interface {
	// 校验Token
	ValidateToken(context.Context, *token.ValidateTokenRequest) (*token.Token, error)
}

Jump to

Keyboard shortcuts

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