Documentation ¶
Overview ¶
Package v1 hold http rest v1 API
Index ¶
- Constants
- Variables
- func ReadClaims(ctx context.Context) map[string]interface{}
- func ReadDomain(ctx context.Context) string
- func ReadLabelCombinations(req *goRestful.Request) ([]map[string]string, error)
- func WriteErrResponse(context *restful.Context, status int, msg string)
- type AdminResource
- type DeleteBody
- type ErrorMsg
- type HistoryResource
- type KVCreateBody
- type KVResource
- func (r *KVResource) Delete(rctx *restful.Context)
- func (r *KVResource) DeleteList(rctx *restful.Context)
- func (r *KVResource) Get(rctx *restful.Context)
- func (r *KVResource) List(rctx *restful.Context)
- func (r *KVResource) Post(rctx *restful.Context)
- func (r *KVResource) Put(rctx *restful.Context)
- func (r *KVResource) URLPatterns() []restful.Route
- type KVUpdateBody
Constants ¶
const ( HeaderUserAgent = "User-Agent" HeaderSessionID = "X-Session-Id" HeaderSessionGroup = "X-Session-Group" AttributeDomainKey = "domain" FmtReadRequestError = "decode request body failed: %v" )
const of server
Variables ¶
var ( DocHeaderDepth = &restful.Parameters{ DataType: "string", Name: common.HeaderDepth, ParamType: goRestful.HeaderParameterKind, Desc: "integer, default is 1, if you set match policy, you can set,depth to decide label number", } DocHeaderContentTypeJSONAndYaml = &restful.Parameters{ DataType: "string", Name: common.HeaderContentType, ParamType: goRestful.HeaderParameterKind, Required: true, Desc: "used to indicate the media type of the resource, the value can be application/json or text/yaml", } DocHeaderContentTypeJSON = &restful.Parameters{ DataType: "string", Name: common.HeaderContentType, ParamType: goRestful.HeaderParameterKind, Required: true, Desc: "used to indicate the media type of the resource, the value only can be application/json", } )
swagger doc request header params
var ( DocQueryCombination = &restful.Parameters{ DataType: "string", Name: common.QueryParamQ, ParamType: goRestful.QueryParameterKind, Desc: "the combination format is {label_key}:{label_value}+{label_key}:{label_value} " + "for example: /v1/test/kie/kv?q=app:mall&q=app:mall+service:cart, " + "that will query key values from 2 kinds of labels", } DocQueryWait = &restful.Parameters{ DataType: "string", Name: common.QueryParamWait, ParamType: goRestful.QueryParameterKind, Required: false, Desc: "wait until any kv changed. " + "for example wait=5s, server will not response until 5 seconds, during that time window, " + "if any kv changed, server will return 200 and kv list, otherwise return 304 and empty body", } DocQueryRev = &restful.Parameters{ DataType: "string", Name: common.QueryParamRev, ParamType: goRestful.QueryParameterKind, Required: false, Desc: "each time you query,server will return a number in header X-Kie-Revision. " + "you can record it in client side, use this number as param value. " + "if current revision is greater than it, server will return data", } DocQueryMatch = &restful.Parameters{ DataType: "string", Name: common.QueryParamMatch, ParamType: goRestful.QueryParameterKind, Required: false, Desc: "match works with label query param, it specifies label match pattern. " + "if it is empty, server will return kv which's labels partial match the label query param. " + "uf it is exact, server will return kv which's labels exact match the label query param", } DocQueryKeyParameters = &restful.Parameters{ DataType: "string", Name: common.QueryParamKey, ParamType: goRestful.QueryParameterKind, } DocQueryLabelParameters = &restful.Parameters{ DataType: "string", Name: "label", ParamType: goRestful.QueryParameterKind, Desc: "label pairs,for example &label=service:order&label=version:1.0.0", } DocQueryLimitParameters = &restful.Parameters{ DataType: "string", Name: common.QueryParamLimit, ParamType: goRestful.QueryParameterKind, Desc: "pagination", } DocQueryOffsetParameters = &restful.Parameters{ DataType: "string", Name: common.QueryParamOffset, ParamType: goRestful.QueryParameterKind, Desc: "pagination", } //polling data DocQuerySessionIDParameters = &restful.Parameters{ DataType: "string", Name: common.QueryParamSessionID, ParamType: goRestful.QueryParameterKind, Desc: "sessionId is the Unique identification of the client", } DocQueryIPParameters = &restful.Parameters{ DataType: "string", Name: common.QueryParamIP, ParamType: goRestful.QueryParameterKind, Desc: "client ip", } DocQueryURLPathParameters = &restful.Parameters{ DataType: "string", Name: common.QueryParamURLPath, ParamType: goRestful.QueryParameterKind, Desc: "address of the call", } DocQueryUserAgentParameters = &restful.Parameters{ DataType: "string", Name: common.QueryParamUserAgent, ParamType: goRestful.QueryParameterKind, Desc: "user agent of the call", } )
swagger doc query params
var ( DocPathProject = &restful.Parameters{ DataType: "string", Name: common.PathParameterProject, ParamType: goRestful.PathParameterKind, Required: true, } DocPathKeyID = &restful.Parameters{ DataType: "string", Name: common.PathParamKVID, ParamType: goRestful.PathParameterKind, Required: true, } )
swagger doc path params
var ( DocHeaderRevision = goRestful.Header{ Items: &goRestful.Items{ Type: "integer", }, Description: "cluster latest revision number, if key value is changed, it will increase.", } )
swagger doc response header params
var (
ErrInvalidRev = errors.New(common.MsgInvalidRev)
)
err
Functions ¶
func ReadClaims ¶ added in v0.2.0
ReadClaims get auth info
func ReadLabelCombinations ¶
ReadLabelCombinations get query combination from url q=app:default+service:payment&q=app:default
Types ¶
type AdminResource ¶ added in v0.2.0
type AdminResource struct { }
func (*AdminResource) HealthCheck ¶ added in v0.2.0
func (r *AdminResource) HealthCheck(context *restful.Context)
HealthCheck provider version info and time info
func (*AdminResource) URLPatterns ¶ added in v0.2.0
func (r *AdminResource) URLPatterns() []restful.Route
URLPatterns defined config operations
type DeleteBody ¶ added in v0.2.0
type DeleteBody struct {
IDs []string `json:"ids"`
}
DeleteBody is the request body struct of delete multiple kvs interface
type HistoryResource ¶
type HistoryResource struct { }
HistoryResource TODO
func (*HistoryResource) GetPollingData ¶ added in v0.2.0
func (r *HistoryResource) GetPollingData(context *restful.Context)
GetPollingData get the record of the get or list history
func (*HistoryResource) GetRevisions ¶ added in v0.2.0
func (r *HistoryResource) GetRevisions(context *restful.Context)
GetRevisions search key only by label
func (*HistoryResource) URLPatterns ¶
func (r *HistoryResource) URLPatterns() []restful.Route
URLPatterns defined config operations
type KVCreateBody ¶ added in v0.2.0
type KVCreateBody struct { Key string `json:"key"` Labels map[string]string `json:"labels"` Status string `json:"status"` Value string `json:"value"` ValueType string `json:"value_type"` }
KVCreateBody is open api doc
type KVResource ¶
type KVResource struct { }
KVResource has API about kv operations
func (*KVResource) Delete ¶
func (r *KVResource) Delete(rctx *restful.Context)
Delete deletes one kv by id
func (*KVResource) DeleteList ¶ added in v0.2.0
func (r *KVResource) DeleteList(rctx *restful.Context)
DeleteList deletes multiple kvs by ids
func (*KVResource) Get ¶ added in v0.2.0
func (r *KVResource) Get(rctx *restful.Context)
Get search key by kv id
func (*KVResource) List ¶ added in v0.2.0
func (r *KVResource) List(rctx *restful.Context)
List response kv list
func (*KVResource) Post ¶ added in v0.2.0
func (r *KVResource) Post(rctx *restful.Context)
Post create a kv
func (*KVResource) URLPatterns ¶
func (r *KVResource) URLPatterns() []restful.Route
URLPatterns defined config operations
type KVUpdateBody ¶ added in v0.2.0
KVUpdateBody is open api doc