client

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsCurlCommand

func AsCurlCommand(request *gorequest.SuperAgent) (string, error)

AsCurlCommand returns a string representing the runnable `curl' command version of the request.

Types

type CallbackFunc

type CallbackFunc func(response gorequest.Response, v interface{}, body []byte, errs []error)

CallbackFunc is the func object of http callback

func NewMetricCallback

func NewMetricCallback(system string, start time.Time) CallbackFunc

NewMetricCallback will record the http request data into metrics

type ESBClient

type ESBClient interface {
	GetApplyURL(bkToken string, bkUsername string, body interface{}) (string, error)
}

ESBClient is the interface of esb

func NewESBClient

func NewESBClient(host string, appCode string, appSecret string) ESBClient

NewESBClient will create a esb client

type ESBResponse

type ESBResponse struct {
	Code    int                    `json:"code"`
	Result  bool                   `json:"result"`
	Message string                 `json:"message"`
	Data    map[string]interface{} `json:"data"`
}

ESBResponse is the struct of esb response

func (*ESBResponse) Error

func (r *ESBResponse) Error() error

Error will check if response fail

type IAMBackendBaseResponse

type IAMBackendBaseResponse struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

IAMBackendBaseResponse is the struct of iam backend response

func (*IAMBackendBaseResponse) Error

func (r *IAMBackendBaseResponse) Error() error

Error will check if the response with error

func (*IAMBackendBaseResponse) String

func (r *IAMBackendBaseResponse) String() string

String will return the detail text of the response

type IAMBackendClient

type IAMBackendClient interface {
	Ping() error
	GetToken() (token string, err error)

	PolicyQuery(body interface{}) (map[string]interface{}, error)
	PolicyQueryByActions(body interface{}) ([]map[string]interface{}, error)

	PolicyAuth(body interface{}) (data map[string]interface{}, err error)
	PolicyAuthByResources(body interface{}) (data map[string]interface{}, err error)
	PolicyAuthByActions(body interface{}) (data map[string]interface{}, err error)

	PolicyGet(policyID int64) (data map[string]interface{}, err error)
	PolicyList(body interface{}) (data map[string]interface{}, err error)
	PolicySubjects(policyIDs []int64) (data []map[string]interface{}, err error)
}

IAMBackendClient is the interface of iam backend client

func NewIAMBackendClient

func NewIAMBackendClient(host string, system string, appCode string, appSecret string) IAMBackendClient

NewIAMBackendClient will create a iam backend client

type Method

type Method string

Method is the type of http method

var (
	// POST http post
	POST Method = "POST"
	// GET http get
	GET Method = "GET"
)

Jump to

Keyboard shortcuts

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