You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ti...@apache.org on 2020/03/11 07:06:04 UTC
[servicecomb-kie] branch master updated: update open api,
delete unused code (#113)
This is an automated email from the ASF dual-hosted git repository.
tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-kie.git
The following commit(s) were added to refs/heads/master by this push:
new cd2aabb update open api, delete unused code (#113)
cd2aabb is described below
commit cd2aabbc070f33b963b8ee10d39d9401c5cb4408
Author: Shawn <xi...@gmail.com>
AuthorDate: Wed Mar 11 15:05:55 2020 +0800
update open api, delete unused code (#113)
* update open api, delete unused code
* update open api, delete unused code
---
docs/api.yaml | 186 +++++++++++++++------------------
docs/getstarted/verify.md | 4 +-
go.mod | 7 +-
go.sum | 45 ++++++++
pkg/common/common.go | 17 +--
pkg/model/kv.go | 20 ++++
server/resource/v1/common.go | 15 ++-
server/resource/v1/doc_struct.go | 18 ++--
server/resource/v1/history_resource.go | 11 +-
server/resource/v1/kv_resource.go | 126 +++++-----------------
10 files changed, 213 insertions(+), 236 deletions(-)
diff --git a/docs/api.yaml b/docs/api.yaml
index 64f2b33..cf15553 100644
--- a/docs/api.yaml
+++ b/docs/api.yaml
@@ -21,6 +21,22 @@ paths:
in: query
description: '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'
type: string
+ - name: match
+ in: query
+ description: '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'
+ type: string
+ - name: revision
+ in: query
+ description: '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'
+ type: string
+ - name: pageSize
+ in: query
+ description: pagination
+ type: string
+ - name: pageNum
+ in: query
+ description: pagination
+ type: string
consumes:
- '*/*'
produces:
@@ -30,28 +46,31 @@ paths:
'200':
description: ''
schema:
- $ref: '#/definitions/KVResponse'
+ $ref: '#/definitions/v1.DocResponseGetKey'
headers:
- X-RateLimit-Limit:
+ X-Kie-Revision:
+ description: 'cluster latest revision number, if key value is changed, it will increase.'
type: integer
- description: Request limit per hour.
'304':
description: empty body
+ '404':
+ description: ''
+ headers:
+ X-Kie-Revision:
+ description: 'cluster latest revision number, if key value is changed, it will increase.'
+ type: integer
delete:
- summary: 'delete key by kvID and labelID. Want better performance, give labelID'
+ summary: delete key by kv ID.
operationId: Delete
parameters:
- name: project
in: path
required: true
type: string
- - name: kvID
+ - name: kv_id
in: query
required: true
type: string
- - name: labelID
- in: query
- type: string
consumes:
- '*/*'
produces:
@@ -59,8 +78,6 @@ paths:
responses:
'204':
description: Delete success
- '400':
- description: 'Failed,check url'
'500':
description: Server error
'/v1/{project}/kie/kv/{key}':
@@ -80,6 +97,26 @@ paths:
in: query
description: 'label pairs,for example &label=service:order&label=version:1.0.0'
type: string
+ - name: wait
+ in: query
+ description: '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'
+ type: string
+ - name: match
+ in: query
+ description: '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'
+ type: string
+ - name: revision
+ in: query
+ description: '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'
+ type: string
+ - name: pageSize
+ in: query
+ description: pagination
+ type: string
+ - name: pageNum
+ in: query
+ description: pagination
+ type: string
consumes:
- '*/*'
produces:
@@ -89,11 +126,19 @@ paths:
'200':
description: get key value success
schema:
- type: array
- items:
- $ref: '#/definitions/KVResponse'
+ $ref: '#/definitions/v1.DocResponseGetKey'
+ headers:
+ X-Kie-Revision:
+ description: 'cluster latest revision number, if key value is changed, it will increase.'
+ type: integer
'304':
description: empty body
+ '404':
+ description: ''
+ headers:
+ X-Kie-Revision:
+ description: 'cluster latest revision number, if key value is changed, it will increase.'
+ type: integer
put:
summary: create or update key value
operationId: Put
@@ -121,24 +166,20 @@ paths:
'200':
description: ''
schema:
- $ref: '#/definitions/v1.KVBody'
- '/v1/{project}/kie/revision/{label_id}':
+ $ref: '#/definitions/v1.DocResponseSingleKey'
+ '/v1/{project}/kie/revision/{key_id}':
get:
- summary: get all revisions by label id
+ summary: get all revisions by key id
operationId: GetRevisions
parameters:
- name: project
in: path
required: true
type: string
- - name: label_id
+ - name: key_id
in: path
required: true
type: string
- - name: key
- in: query
- description: only return history about a specific key
- type: string
consumes:
- application/json
- text/yaml
@@ -147,106 +188,49 @@ paths:
- text/yaml
responses:
'200':
- description: 'true'
- schema:
- type: array
- items:
- $ref: '#/definitions/LabelHistoryResponse'
- '/v1/{project}/kie/summary':
- get:
- summary: 'search key values by labels combination, it returns multiple labels group'
- operationId: Search
- parameters:
- - name: project
- in: path
- required: true
- type: string
- - name: q
- in: query
- description: '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'
- type: string
- consumes:
- - '*/*'
- produces:
- - application/json
- - text/yaml
- responses:
- '200':
- description: get key value success
+ description: ''
schema:
type: array
items:
- $ref: '#/definitions/KVResponse'
+ $ref: '#/definitions/v1.DocResponseSingleKey'
definitions:
- KVDoc:
- type: object
- properties:
- _id:
- type: string
- check:
- type: string
- domain:
- type: string
- key:
- type: string
- label_id:
- type: string
- labels:
- type: object
- additionalProperties:
- type: string
- project:
- type: string
- revision:
- type: integer
- format: int32
- value:
- type: string
- value_type:
- type: string
- KVResponse:
+ v1.DocResponseGetKey:
type: object
properties:
data:
type: array
items:
- $ref: '#/definitions/KVDoc'
- label:
- $ref: '#/definitions/LabelDocResponse'
- num:
- type: integer
- format: int32
- size:
- type: integer
- format: int32
+ $ref: '#/definitions/v1.DocResponseSingleKey'
total:
type: integer
- format: int32
- LabelDocResponse:
+ format: int64
+ v1.DocResponseSingleKey:
type: object
properties:
- label_id:
+ create_revision:
+ type: integer
+ format: int64
+ create_time:
+ type: string
+ id:
+ type: string
+ key:
type: string
- labels:
- type: object
- additionalProperties:
- type: string
- LabelHistoryResponse:
- type: object
- properties:
- data:
- type: array
- items:
- $ref: '#/definitions/KVDoc'
label_id:
type: string
labels:
type: object
additionalProperties:
type: string
- revision:
+ update_revision:
type: integer
- format: int32
+ format: int64
+ update_time:
+ type: string
+ value:
+ type: string
+ value_type:
+ type: string
v1.KVBody:
type: object
properties:
@@ -256,5 +240,5 @@ definitions:
type: string
value:
type: string
- valueType:
+ value_type:
type: string
diff --git a/docs/getstarted/verify.md b/docs/getstarted/verify.md
index 5b802d6..44a5efc 100644
--- a/docs/getstarted/verify.md
+++ b/docs/getstarted/verify.md
@@ -27,4 +27,6 @@ response is
}
```
-the api docs is http://127.0.0.1:30110/apidocs.json
\ No newline at end of file
+Check open API doc
+- the api doc mounted to http://127.0.0.1:30110/apidocs.json
+- or see https://github.com/apache/servicecomb-kie/blob/master/docs/api.yaml
diff --git a/go.mod b/go.mod
index 4c0ea9e..b432bbf 100644
--- a/go.mod
+++ b/go.mod
@@ -2,10 +2,9 @@ module github.com/apache/servicecomb-kie
require (
github.com/DataDog/zstd v1.4.4 // indirect
- github.com/emicklei/go-restful v2.11.1+incompatible
- github.com/go-chassis/foundation v0.1.1-0.20191113114104-2b05871e9ec4
- github.com/go-chassis/go-archaius v1.0.0
- github.com/go-chassis/go-chassis v1.8.2-0.20191227102336-e3ac2ea137b1
+ github.com/emicklei/go-restful v2.12.0+incompatible
+ github.com/go-chassis/go-archaius v1.2.1-0.20200309104817-8c3d4e87d33c
+ github.com/go-chassis/go-chassis v1.8.2-0.20200310060113-4b383ba3d3f0
github.com/go-chassis/paas-lager v1.1.1
github.com/go-mesh/openlogging v1.0.1
github.com/hashicorp/mdns v1.0.1 // indirect
diff --git a/go.sum b/go.sum
index 96a71c3..11098bd 100644
--- a/go.sum
+++ b/go.sum
@@ -12,8 +12,10 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/DataDog/zstd v1.4.4 h1:+IawcoXhCBylN7ccwdwf8LOH2jKq7NavGpEPanrlTzE=
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
+github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
+github.com/Shonminh/apollo-client v0.2.0/go.mod h1:Jk6K99uIGxQm7Uyy1gCQTvM/kc1YLp4Qo9/jtGkEXvI=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA=
@@ -28,7 +30,9 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/cenkalti/backoff v2.0.0+incompatible h1:5IIPUHhlnUZbcHQsQou5k1Tn58nJkeJL9U+ig5CHJbY=
github.com/cenkalti/backoff v2.0.0+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
+github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/coocood/freecache v1.0.1/go.mod h1:ePwxCDzOYvARfHdr1pByNct1at3CoKnsipOHwKlNbzI=
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -40,25 +44,45 @@ github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb
github.com/emicklei/go-restful v2.8.0+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful v2.11.1+incompatible h1:CjKsv3uWcCMvySPQYKxO8XX3f9zD4FeZRsW4G0B4ffE=
github.com/emicklei/go-restful v2.11.1+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
+github.com/emicklei/go-restful v2.12.0+incompatible h1:SIvoTSbsMEwuM3dzFirLwKc4BH6VXP5CNf+G1FfJVr4=
+github.com/emicklei/go-restful v2.12.0+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
+github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
github.com/go-chassis/foundation v0.1.0/go.mod h1:21/ajGtgJlWTCeM0TxGJdRhO8bJkKirWyV8Stlh6g6c=
github.com/go-chassis/foundation v0.1.1-0.20191113114104-2b05871e9ec4 h1:wx8JXvg/n4i8acXsBJ5zIkiK7EO2kn/HuEjKK3kSgv8=
github.com/go-chassis/foundation v0.1.1-0.20191113114104-2b05871e9ec4/go.mod h1:21/ajGtgJlWTCeM0TxGJdRhO8bJkKirWyV8Stlh6g6c=
github.com/go-chassis/go-archaius v1.0.0 h1:grSgvtpJsyYk0+1UiSqShF6+Zv0L6SWdsOUNi49bVTQ=
github.com/go-chassis/go-archaius v1.0.0/go.mod h1:Px2evF91zbMr78UQ+lwehjEwXelwgvTtHzIeODsBEEE=
+github.com/go-chassis/go-archaius v1.0.1-0.20200121100918-32f6f1a3f33d h1:62TEFw6c0cSkknaNm56kXz95OedPcy+9EWb+shfjySM=
+github.com/go-chassis/go-archaius v1.0.1-0.20200121100918-32f6f1a3f33d/go.mod h1:Px2evF91zbMr78UQ+lwehjEwXelwgvTtHzIeODsBEEE=
+github.com/go-chassis/go-archaius v1.2.1-0.20200309024713-9fc5b70ee2df h1:ezv5b7FI5HdrD71McnIZaLsdtMF5+z2pIuwufK6Io+c=
+github.com/go-chassis/go-archaius v1.2.1-0.20200309024713-9fc5b70ee2df/go.mod h1:gVP52u/jCU0fgUjXdUW1VLp5YLLJ+Yl2zoOPrLM/WOM=
+github.com/go-chassis/go-archaius v1.2.1-0.20200309104817-8c3d4e87d33c h1:pimEM4Oy/Uf4xG4G7TrRUQbIRFAfHiarxDQQS2gmKaM=
+github.com/go-chassis/go-archaius v1.2.1-0.20200309104817-8c3d4e87d33c/go.mod h1:gVP52u/jCU0fgUjXdUW1VLp5YLLJ+Yl2zoOPrLM/WOM=
github.com/go-chassis/go-chassis v1.8.1 h1:YWCrVRwPHy2/JIxa3jUxjISH1Z9y93SvUuAkwXVC6kk=
github.com/go-chassis/go-chassis v1.8.1/go.mod h1:vI0rU2FNAtGi6owfYKXBVj6cvq633/n+8bqbsVfib7E=
github.com/go-chassis/go-chassis v1.8.2-0.20191227102336-e3ac2ea137b1 h1:7cVyV9MzmpzCPobya0nlxAkUTLPpT3iGmnvCAu5R/gE=
github.com/go-chassis/go-chassis v1.8.2-0.20191227102336-e3ac2ea137b1/go.mod h1:vI0rU2FNAtGi6owfYKXBVj6cvq633/n+8bqbsVfib7E=
+github.com/go-chassis/go-chassis v1.8.2-0.20200213090219-33eb773c9ac9 h1:cXUzViqOe7m1XQqmeHQ7QqjGSrH8Lh3tvbkpcCF74Zc=
+github.com/go-chassis/go-chassis v1.8.2-0.20200213090219-33eb773c9ac9/go.mod h1:Md4Oq1os4eR08IZRncJHixlow0trajz9KUlOBgZaY1c=
+github.com/go-chassis/go-chassis v1.8.2-0.20200309033031-047975282d7f h1:5ea5R56Hv+kkZXf36uyTHK4NW8d4VytavYS+EBgKjZg=
+github.com/go-chassis/go-chassis v1.8.2-0.20200309033031-047975282d7f/go.mod h1:Md4Oq1os4eR08IZRncJHixlow0trajz9KUlOBgZaY1c=
+github.com/go-chassis/go-chassis v1.8.2-0.20200309123010-e9952adf0aff h1:NoKQksHSaTv8QH7/zo2G1MOf4myfShT7IF19oydwa9Y=
+github.com/go-chassis/go-chassis v1.8.2-0.20200309123010-e9952adf0aff/go.mod h1:OSB9myPrtV+4CQs4aMwOl7Oh7mZG295aFZkjb7P98w8=
+github.com/go-chassis/go-chassis v1.8.2-0.20200310060113-4b383ba3d3f0 h1:YD9MtuYIpQb+EKxIzV/swdXUhnV5PtXtSW696JiwW1c=
+github.com/go-chassis/go-chassis v1.8.2-0.20200310060113-4b383ba3d3f0/go.mod h1:sFnVxSvprpy6umPFK4uSdfCDdfqdgbp3FdW/CG0VNnE=
github.com/go-chassis/go-chassis-config v0.15.0 h1:cTsUl7r3eo2tFoACHADnymwO/5ebb6RVNTj11kxjiZ8=
github.com/go-chassis/go-chassis-config v0.15.0/go.mod h1:yuaprnRdObPhYaHVKaocBQPoLfoBFaFmzApM2nRROws=
github.com/go-chassis/go-restful-swagger20 v1.0.2 h1:Zq74EQP7IjlJK/PnYP/rF3Ptk2QskZVPoNgiVwtvpFM=
github.com/go-chassis/go-restful-swagger20 v1.0.2/go.mod h1:ZK4hlfS6Q6E46ViezAjn6atrzoteyWl1OBEpUBn/36k=
+github.com/go-chassis/go-restful-swagger20 v1.0.3-0.20200310030431-17d80f34264f h1:5QmmNpVcGqIc6tuKNe5EAI4PA8Yn2EL9Oee7YdcJ4PE=
+github.com/go-chassis/go-restful-swagger20 v1.0.3-0.20200310030431-17d80f34264f/go.mod h1:eW62fYuzlNFDvIacB6AV8bhUDCTy4myfTCv0bT9Gbb0=
github.com/go-chassis/paas-lager v1.0.2-0.20190328010332-cf506050ddb2/go.mod h1:tILYbn3+0jjCxhY6/ue9L8eRq+VJ60U6VYIdugqchB4=
github.com/go-chassis/paas-lager v1.1.1 h1:/6wqawUGjPCpd57A/tzJzgC4MnEhNuigbayQS+2VWPQ=
github.com/go-chassis/paas-lager v1.1.1/go.mod h1:tILYbn3+0jjCxhY6/ue9L8eRq+VJ60U6VYIdugqchB4=
@@ -105,6 +129,7 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
@@ -164,6 +189,7 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
@@ -190,6 +216,8 @@ github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRU
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc=
+github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14 h1:9jZdLNd/P4+SfEJ0TNyxYpsK8N4GtfylBLqtbYN1sbA=
@@ -236,11 +264,13 @@ github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.9.1 h1:K47Rk0v/fkEfwfQet2KWhscE0cJzjgCCDBG2KHZoVno=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f h1:BVwpUVJDADN2ufcGik7W992pyps0wZ888b/y9GXcLTU=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d h1:GoAlyOgbOEIFdaDqxJVlbOQ1DtGmZWs/Qau0hIlk+WQ=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1 h1:/K3IL0Z1quvmJ7X0A1AwNEK7CRkVK3YwfOU/QAL4WGg=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
@@ -259,6 +289,7 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
+github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg=
github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
@@ -274,6 +305,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
+github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c h1:u40Z8hqBAAQyv+vATcGgV0YCnDjqSL7/q/JyPhhJSPk=
@@ -288,6 +320,8 @@ go.mongodb.org/mongo-driver v1.2.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qL
go.mongodb.org/mongo-driver v1.3.0 h1:ew6uUIeJOo+qdUUv7LxFCUhtWmVv7ZV/Xuy4FAUsw2E=
go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
+go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+go.uber.org/ratelimit v0.1.0/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@@ -300,6 +334,7 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -311,6 +346,8 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI=
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -333,11 +370,13 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191018095205-727590c5006e h1:ZtoklVMHQy6BFRHkbG6JzK+S6rX82//Yeok1vMlizfQ=
golang.org/x/sys v0.0.0-20191018095205-727590c5006e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -354,12 +393,15 @@ golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -375,6 +417,8 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
+gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
@@ -394,6 +438,7 @@ k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUc
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
+k8s.io/utils v0.0.0-20191114184206-e782cd3c129f h1:GiPwtSzdP43eI1hpPCbROQCCIgCuiMMNF8YUVLF3vJo=
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
k8s.io/utils v0.0.0-20191114200735-6ca3b61696b6 h1:p0Ai3qVtkbCG/Af26dBmU0E1W58NID3hSSh7cMyylpM=
k8s.io/utils v0.0.0-20191114200735-6ca3b61696b6/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
diff --git a/pkg/common/common.go b/pkg/common/common.go
index 4f2f34a..18cfc14 100644
--- a/pkg/common/common.go
+++ b/pkg/common/common.go
@@ -21,14 +21,15 @@ import "time"
//match mode
const (
- QueryParamQ = "q"
- QueryByLabelsCon = "&"
- QueryParamWait = "wait"
- QueryParamRev = "revision"
- QueryParamMatch = "match"
- QueryParamKeyID = "kv_id"
- QueryLimit = "limit"
- QueryOffset = "offset"
+ QueryParamQ = "q"
+ QueryByLabelsCon = "&"
+ QueryParamWait = "wait"
+ QueryParamRev = "revision"
+ QueryParamMatch = "match"
+ QueryParamKeyID = "kv_id"
+ QueryParamStatus = "status"
+ QueryParamPageNum = "pageNum"
+ QueryParamPageSize = "pageSize"
)
//http headers
diff --git a/pkg/model/kv.go b/pkg/model/kv.go
index d898329..42b1359 100644
--- a/pkg/model/kv.go
+++ b/pkg/model/kv.go
@@ -66,3 +66,23 @@ type PollingDetail struct {
ResponseHeader map[string][]string `json:"response_header,omitempty" yaml:"response_header,omitempty"`
ResponseCode int `json:"response_code,omitempty" yaml:"response_code,omitempty"`
}
+
+//DocResponseSingleKey is response doc
+type DocResponseSingleKey struct {
+ CreateRevision int64 `json:"create_revision"`
+ CreateTime string `json:"create_time"`
+ ID string `json:"id"`
+ Key string `json:"key"`
+ LabelID string `json:"label_id"`
+ Labels map[string]string `json:"labels"`
+ UpdateRevision int64 `json:"update_revision"`
+ UpdateTime string `json:"update_time"`
+ Value string `json:"value"`
+ ValueType string `json:"value_type"`
+}
+
+//DocResponseGetKey is response doc
+type DocResponseGetKey struct {
+ Data []*DocResponseSingleKey `json:"data"`
+ Total int64 `json:"total"`
+}
diff --git a/server/resource/v1/common.go b/server/resource/v1/common.go
index 2a5678c..d85aef4 100644
--- a/server/resource/v1/common.go
+++ b/server/resource/v1/common.go
@@ -38,15 +38,12 @@ import (
//const of server
const (
- HeaderUserAgent = "User-Agent"
- HeaderSessionID = "sessionID"
- QueryParameterStatus = "status"
- QueryParameterPageNum = "pageNum"
- QueryParameterPageSize = "pageSize"
- PathParameterProject = "project"
- PathParameterKey = "key"
- AttributeDomainKey = "domain"
- MsgLabelsNotFound = "can not find by labels"
+ HeaderUserAgent = "User-Agent"
+ HeaderSessionID = "sessionID"
+ PathParameterProject = "project"
+ PathParameterKey = "key"
+ AttributeDomainKey = "domain"
+ MsgLabelsNotFound = "can not find by labels"
)
//err
diff --git a/server/resource/v1/doc_struct.go b/server/resource/v1/doc_struct.go
index b8de013..6780fc2 100644
--- a/server/resource/v1/doc_struct.go
+++ b/server/resource/v1/doc_struct.go
@@ -32,11 +32,11 @@ var (
ParamType: goRestful.HeaderParameterKind,
Desc: "integer, default is 1, if you set match policy, you can set,depth to decide label number",
}
- DocHeaderRevision = &restful.Parameters{
- DataType: "string",
- Name: common.HeaderRevision,
- ParamType: goRestful.HeaderParameterKind,
- Desc: "integer, current revision of kie",
+ DocHeaderRevision = goRestful.Header{
+ Items: &goRestful.Items{
+ Type: "integer",
+ },
+ Description: "cluster latest revision number, if key value is changed, it will increase.",
}
)
@@ -91,15 +91,15 @@ var (
}
DocQueryLimitParameters = &restful.Parameters{
DataType: "string",
- Name: common.QueryLimit,
+ Name: common.QueryParamPageSize,
ParamType: goRestful.QueryParameterKind,
- Desc: "limit,for example &limit=10",
+ Desc: "pagination",
}
DocQueryOffsetParameters = &restful.Parameters{
DataType: "string",
- Name: common.QueryOffset,
+ Name: common.QueryParamPageNum,
ParamType: goRestful.QueryParameterKind,
- Desc: "offset,for example &offset=10",
+ Desc: "pagination",
}
)
diff --git a/server/resource/v1/history_resource.go b/server/resource/v1/history_resource.go
index 73ea442..6530165 100644
--- a/server/resource/v1/history_resource.go
+++ b/server/resource/v1/history_resource.go
@@ -18,10 +18,10 @@
package v1
import (
+ "github.com/apache/servicecomb-kie/pkg/model"
"net/http"
"github.com/apache/servicecomb-kie/pkg/common"
- "github.com/apache/servicecomb-kie/pkg/model"
"github.com/apache/servicecomb-kie/server/service"
goRestful "github.com/emicklei/go-restful"
@@ -37,8 +37,8 @@ type HistoryResource struct {
func (r *HistoryResource) GetRevisions(context *restful.Context) {
var err error
keyID := context.ReadPathParameter("key_id")
- pageNumStr := context.ReadQueryParameter("pageNum")
- pageSizeStr := context.ReadQueryParameter("pageSize")
+ pageNumStr := context.ReadQueryParameter(common.QueryParamPageNum)
+ pageSizeStr := context.ReadQueryParameter(common.QueryParamPageSize)
pageNum, pageSize, err := checkPagination(pageNumStr, pageSizeStr)
if err != nil {
WriteErrResponse(context, http.StatusBadRequest, err.Error(), common.ContentTypeText)
@@ -85,9 +85,8 @@ func (r *HistoryResource) URLPatterns() []restful.Route {
},
Returns: []*restful.Returns{
{
- Code: http.StatusOK,
- Message: "true",
- Model: []model.KVDoc{},
+ Code: http.StatusOK,
+ Model: []model.DocResponseSingleKey{},
},
},
Consumes: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
diff --git a/server/resource/v1/kv_resource.go b/server/resource/v1/kv_resource.go
index 2c36103..113e97c 100644
--- a/server/resource/v1/kv_resource.go
+++ b/server/resource/v1/kv_resource.go
@@ -105,15 +105,15 @@ func (r *KVResource) GetByKey(rctx *restful.Context) {
WriteErrResponse(rctx, http.StatusInternalServerError, common.MsgDomainMustNotBeEmpty, common.ContentTypeText)
return
}
- pageNumStr := rctx.ReadQueryParameter(QueryParameterPageNum)
- pageSizeStr := rctx.ReadQueryParameter(QueryParameterPageSize)
+ pageNumStr := rctx.ReadQueryParameter(common.QueryParamPageNum)
+ pageSizeStr := rctx.ReadQueryParameter(common.QueryParamPageSize)
pageNum, pageSize, err := checkPagination(pageNumStr, pageSizeStr)
if err != nil {
WriteErrResponse(rctx, http.StatusBadRequest, err.Error(), common.ContentTypeText)
return
}
insID := rctx.ReadHeader(HeaderSessionID)
- statusStr := rctx.ReadQueryParameter(QueryParameterStatus)
+ statusStr := rctx.ReadQueryParameter(common.QueryParamStatus)
status, err := checkStatus(statusStr)
if err != nil {
WriteErrResponse(rctx, http.StatusBadRequest, err.Error(), common.ContentTypeText)
@@ -136,15 +136,15 @@ func (r *KVResource) List(rctx *restful.Context) {
WriteErrResponse(rctx, http.StatusBadRequest, err.Error(), common.ContentTypeText)
return
}
- pageNumStr := rctx.ReadQueryParameter(QueryParameterPageNum)
- pageSizeStr := rctx.ReadQueryParameter(QueryParameterPageSize)
+ pageNumStr := rctx.ReadQueryParameter(common.QueryParamPageNum)
+ pageSizeStr := rctx.ReadQueryParameter(common.QueryParamPageSize)
pageNum, pageSize, err := checkPagination(pageNumStr, pageSizeStr)
if err != nil {
WriteErrResponse(rctx, http.StatusBadRequest, err.Error(), common.ContentTypeText)
return
}
sessionID := rctx.ReadHeader(HeaderSessionID)
- statusStr := rctx.ReadQueryParameter(QueryParameterStatus)
+ statusStr := rctx.ReadQueryParameter(common.QueryParamStatus)
status, err := checkStatus(statusStr)
if err != nil {
WriteErrResponse(rctx, http.StatusBadRequest, err.Error(), common.ContentTypeText)
@@ -244,75 +244,6 @@ func RecordPollingDetail(context *restful.Context, revStr, wait, domain, project
}
}
-//Search search key only by label
-func (r *KVResource) Search(context *restful.Context) {
- var err error
- labelCombinations, err := ReadLabelCombinations(context.ReadRestfulRequest())
- if err != nil {
- WriteErrResponse(context, http.StatusBadRequest, err.Error(), common.ContentTypeText)
- return
- }
- project := context.ReadPathParameter(PathParameterProject)
- domain := ReadDomain(context)
- if domain == nil {
- WriteErrResponse(context, http.StatusInternalServerError, common.MsgDomainMustNotBeEmpty, common.ContentTypeText)
- return
- }
- var kvs []*model.KVResponse
- pageNumStr := context.ReadQueryParameter(QueryParameterPageNum)
- pageSizeStr := context.ReadQueryParameter(QueryParameterPageSize)
- pageNum, pageSize, err := checkPagination(pageNumStr, pageSizeStr)
- if err != nil {
- WriteErrResponse(context, http.StatusBadRequest, err.Error(), common.ContentTypeText)
- return
- }
- if labelCombinations == nil {
- result, err := service.KVService.FindKV(context.Ctx, domain.(string), project,
- service.WithPageNum(pageNum),
- service.WithPageSize(pageSize))
- if err != nil {
- openlogging.Error(MsgLabelsNotFound, openlogging.WithTags(openlogging.Tags{
- "err": err.Error(),
- }))
- WriteErrResponse(context, http.StatusInternalServerError, err.Error(), common.ContentTypeText)
- return
- }
- kvs = append(kvs, result...)
- }
- for _, labels := range labelCombinations {
- openlogging.Debug("find by combination", openlogging.WithTags(openlogging.Tags{
- "q": labels,
- }))
- result, err := service.KVService.FindKV(context.Ctx, domain.(string), project,
- service.WithLabels(labels),
- service.WithPageNum(pageNum),
- service.WithPageSize(pageSize))
- if err != nil {
- if err == service.ErrKeyNotExists {
- continue
- } else {
- openlogging.Error(MsgLabelsNotFound, openlogging.WithTags(openlogging.Tags{
- "err": err.Error(),
- }))
- WriteErrResponse(context, http.StatusInternalServerError, err.Error(), common.ContentTypeText)
- return
- }
- }
- kvs = append(kvs, result...)
-
- }
- if len(kvs) == 0 {
- WriteErrResponse(context, http.StatusNotFound, "no kv found", common.ContentTypeText)
- return
- }
-
- err = writeResponse(context, kvs)
- if err != nil {
- openlogging.Error(err.Error())
- }
-
-}
-
//Delete deletes key by ids
func (r *KVResource) Delete(context *restful.Context) {
project := context.ReadPathParameter(PathParameterProject)
@@ -373,7 +304,7 @@ func (r *KVResource) URLPatterns() []restful.Route {
Returns: []*restful.Returns{
{
Code: http.StatusOK,
- Model: KVBody{},
+ Model: model.DocResponseSingleKey{},
},
},
Consumes: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
@@ -385,32 +316,26 @@ func (r *KVResource) URLPatterns() []restful.Route {
FuncDesc: "get key values by key and labels",
Parameters: []*restful.Parameters{
DocPathProject, DocPathKey, DocQueryLabelParameters, DocQueryWait, DocQueryMatch, DocQueryRev,
+ DocQueryLimitParameters, DocQueryOffsetParameters,
},
Returns: []*restful.Returns{
{
Code: http.StatusOK,
Message: "get key value success",
- Model: []model.KVResponse{},
+ Model: model.DocResponseGetKey{},
+ Headers: map[string]goRestful.Header{
+ common.HeaderRevision: DocHeaderRevision,
+ },
},
{
- Code: http.StatusNotModified,
- Message: "empty body",
+ Code: http.StatusNotFound,
+ Headers: map[string]goRestful.Header{
+ common.HeaderRevision: DocHeaderRevision,
+ },
},
- },
- Produces: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
- }, {
- Method: http.MethodGet,
- Path: "/v1/{project}/kie/summary",
- ResourceFunc: r.Search,
- FuncDesc: "search key values by labels combination, it returns multiple labels group",
- Parameters: []*restful.Parameters{
- DocPathProject, DocQueryCombination,
- },
- Returns: []*restful.Returns{
{
- Code: http.StatusOK,
- Message: "get key value success",
- Model: []model.KVResponse{},
+ Code: http.StatusNotModified,
+ Message: "empty body",
},
},
Produces: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
@@ -421,11 +346,20 @@ func (r *KVResource) URLPatterns() []restful.Route {
FuncDesc: "list key values by labels and key",
Parameters: []*restful.Parameters{
DocPathProject, DocQueryLabelParameters, DocQueryWait, DocQueryMatch, DocQueryRev,
+ DocQueryLimitParameters, DocQueryOffsetParameters,
},
Returns: []*restful.Returns{
{
Code: http.StatusOK,
- Model: model.KVResponse{},
+ Model: model.DocResponseGetKey{},
+ Headers: map[string]goRestful.Header{
+ common.HeaderRevision: DocHeaderRevision,
+ },
+ }, {
+ Code: http.StatusNotFound,
+ Headers: map[string]goRestful.Header{
+ common.HeaderRevision: DocHeaderRevision,
+ },
}, {
Code: http.StatusNotModified,
Message: "empty body",
@@ -447,10 +381,6 @@ func (r *KVResource) URLPatterns() []restful.Route {
Message: "Delete success",
},
{
- Code: http.StatusBadRequest,
- Message: "Failed,check url",
- },
- {
Code: http.StatusInternalServerError,
Message: "Server error",
},