spacewander commented on code in PR #8394:
URL: https://github.com/apache/apisix/pull/8394#discussion_r1034316393
##########
docs/en/latest/admin-api.md:
##########
@@ -1119,3 +1120,62 @@ Route used in the [Stream Proxy](./stream-proxy.md).
To learn more about filtering in stream proxies, check
[this](./stream-proxy.md#more-route-match-options) document.
[Back to TOC](#table-of-contents)
+
+## kms
+
+**API**: /apisix/admin/kms/{secretmanager}/{id}
+
+kms means `Secrets Management`, which could use any secret manager supported,
e.g. `vault`.
+
+### Request Methods
+
+| Method | Request URI | Request Body | Description
|
+| ------ | ---------------------------------- | ------------ |
------------------------------------------------- |
+| GET | /apisix/admin/kms | NULL | Fetches a list of all
kms. |
+| GET | /apisix/admin/kms/{secretmanager}/{id} | NULL | Fetches
specified kms by id. |
+| PUT | /apisix/admin/kms/{secretmanager} | {...} |
Create new kms configuration. |
+| DELETE | /apisix/admin/kms/{secretmanager}/{id} | NULL | Removes the
kms with the specified id. |
+| PATCH | /apisix/admin/kms/{secretmanager}/{id} | {...} |
Updates the selected attributes of the specified, existing kms. To delete an
attribute, set value of attribute set to null. |
+| PATCH | /apisix/admin/kms/{secretmanager}/{id}/{path} | {...} |
Updates the attribute specified in the path. The values of other attributes
remain unchanged. |
+
+### Request Body Parameters
+
+When `{secretmanager}` is `vault`:
+
+| Parameter | Required | Type | Description
|
Example |
+| ----------- | -------- | ----------- |
------------------------------------------------------------------------------------------------------------------
| ------------------------------------------------ |
+| uri | True | URI | URI of the vault server.
|
|
+| prefix | True | string | key prefix
+| token | True | string | vault token. |
|
+| desc | False | Auxiliary | Description of usage scenarios.
|
kms xxxx |
Review Comment:
The kms_vault doesn't have desc field
##########
t/admin/kms.t:
##########
@@ -0,0 +1,221 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+
+repeat_each(1);
+no_long_string();
+no_root_location();
+no_shuffle();
+log_level("info");
+
+add_block_preprocessor(sub {
+ my ($block) = @_;
+
+ if (!$block->request) {
+ $block->set_value("request", "GET /t");
+ }
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: PUT
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local etcd = require("apisix.core.etcd")
+ local code, body = t('/apisix/admin/kms/vault/test1',
+ ngx.HTTP_PUT,
+ [[{
+ "uri": "http://127.0.0.1:12800/get",
+ "prefix" : "apisix",
+ "token" : "apisix"
+ }]],
+ [[{
+ "value": {
+ "uri": "http://127.0.0.1:12800/get",
+ "prefix" : "apisix",
+ "token" : "apisix"
+ },
+ "key": "/apisix/kms/vault/test1"
+ }]]
+ )
+
+ ngx.status = code
+ ngx.say(body)
+
+ local res = assert(etcd.get('/kms/vault/test1'))
+ local create_time = res.body.node.value.create_time
Review Comment:
Look like we need to add the xxx_time fields, otherwise, the test cases need
to be changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]