Documentation
¶
Index ¶
- Constants
- func AppTokenMiddleware(ctx context.Context, req *http.Request) (err error)
- func GetAppTokenHttp(ctx context.Context, clientID, clientSecret string) (*structs.AppTokenResp, error)
- func GetFaaSInfraPathSendLog() string
- func GetTimeoutCtx(ctx context.Context) (context.Context, context.CancelFunc)
- func IsSysError(errCode string) bool
- func SendLog(ctx context.Context, data interface{}) error
- func ServiceIDMiddleware(ctx context.Context, req *http.Request) error
- func SetCredentialToCtx(ctx context.Context, credential *AppCredential) context.Context
- func TenantAndUserMiddleware(ctx context.Context, req *http.Request) error
- func TimeoutDialer(cTimeout time.Duration, rwTimeout time.Duration) func(ctx context.Context, net, addr string) (c net.Conn, err error)
- type AppCredential
- type ClientType
- type HttpClient
- func (c *HttpClient) DeleteJson(ctx context.Context, path string, headers map[string][]string, ...) ([]byte, map[string]interface{}, error)
- func (c *HttpClient) Get(ctx context.Context, path string, headers map[string][]string, ...) ([]byte, map[string]interface{}, error)
- func (c *HttpClient) PatchJson(ctx context.Context, path string, headers map[string][]string, ...) ([]byte, map[string]interface{}, error)
- func (c *HttpClient) PostBson(ctx context.Context, path string, headers map[string][]string, ...) ([]byte, map[string]interface{}, error)
- func (c *HttpClient) PostFormData(ctx context.Context, path string, headers map[string][]string, ...) ([]byte, map[string]interface{}, error)
- func (c *HttpClient) PostJson(ctx context.Context, path string, headers map[string][]string, ...) ([]byte, map[string]interface{}, error)
- type ICredential
- type ReqMiddleWare
Constants ¶
View Source
const ( SuccessCode = "0" FaaSInfraFailCodeInternalError = "k_ec_000001" FaaSInfraFailCodeTokenExpire = "k_ident_013000" FaaSInfraFailCodeIllegalToken = "k_ident_013001" FaaSInfraFailCodeMissingToken = "k_fs_ec_100001" FaaSInfraFailCodeRateLimitError = "k_fs_ec_000004" )
View Source
const ( OpenapiPathGetToken = "/auth/v1/appToken" FaaSInfraPathSendLog = "/log/v1/namespaces/:namespace/logs/batchSend" )
View Source
const ( SCFileDownload = "" SCSuccess = "0" ECInternalError = "k_ec_000001" ECNoTenantID = "k_ec_000002" ECNoUserID = "k_ec_000003" ECUnknownError = "k_ec_000004" ECOpUnknownError = "k_op_ec_00001" ECSystemBusy = "k_op_ec_20001" ECSystemError = "k_op_ec_20002" ECRateLimitError = "k_op_ec_20003" ECTokenExpire = "k_ident_013000" ECIllegalToken = "k_ident_013001" ECMissingToken = "k_op_ec_10205" )
Variables ¶
This section is empty.
Functions ¶
func AppTokenMiddleware ¶
func GetAppTokenHttp ¶
func GetFaaSInfraPathSendLog ¶
func GetFaaSInfraPathSendLog() string
func GetTimeoutCtx ¶
func IsSysError ¶
func SetCredentialToCtx ¶
func SetCredentialToCtx(ctx context.Context, credential *AppCredential) context.Context
func TenantAndUserMiddleware ¶
Types ¶
type AppCredential ¶
type AppCredential struct {
// contains filtered or unexported fields
}
func NewAppCredential ¶
func NewAppCredential(id, secret string) *AppCredential
func (*AppCredential) GetTenantInfo ¶
type HttpClient ¶
type HttpClient struct { Type ClientType http.Client }
func GetFaaSInfraClient ¶
func GetFaaSInfraClient() *HttpClient
func GetOpenapiClient ¶
func GetOpenapiClient() *HttpClient
func (*HttpClient) DeleteJson ¶
func (c *HttpClient) DeleteJson(ctx context.Context, path string, headers map[string][]string, data interface{}, midList ...ReqMiddleWare) ([]byte, map[string]interface{}, error)
func (*HttpClient) Get ¶
func (c *HttpClient) Get(ctx context.Context, path string, headers map[string][]string, midList ...ReqMiddleWare) ([]byte, map[string]interface{}, error)
func (*HttpClient) PatchJson ¶
func (c *HttpClient) PatchJson(ctx context.Context, path string, headers map[string][]string, data interface{}, midList ...ReqMiddleWare) ([]byte, map[string]interface{}, error)
func (*HttpClient) PostBson ¶
func (c *HttpClient) PostBson(ctx context.Context, path string, headers map[string][]string, data interface{}, midList ...ReqMiddleWare) ([]byte, map[string]interface{}, error)
func (*HttpClient) PostFormData ¶
type ICredential ¶
type ICredential interface {
// contains filtered or unexported methods
}
Click to show internal directories.
Click to hide internal directories.