Files
pyGoEdge-UserPanel/reference/goedge 文档/NSKeyService.md
2025-11-18 03:36:49 +08:00

3.7 KiB
Raw Blame History

NSKeyService

NS密钥相关服务


countAllNSKeys

计算密钥数量

  • 角色:admin, user
  • HTTPPOST https://backend.dooki.cloud/NSKeyService/countAllNSKeys
  • RPCrpc countAllNSKeys (CountAllNSKeysRequest) returns (RPCCountResponse);

请求对象 (CountAllNSKeysRequest)

{
  "nsDomainId": "int64",
  "nsZoneId": "int64"
}

响应对象 (RPCCountResponse)

{
  "count": "int64 // 数量"
}

调用示例

curl -X POST "https://backend.dooki.cloud/NSKeyService/countAllNSKeys" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

createNSKey

创建密钥

  • 角色:admin, user
  • HTTPPOST https://backend.dooki.cloud/NSKeyService/createNSKey
  • RPCrpc createNSKey (CreateNSKeyRequest) returns (CreateNSKeyResponse);

请求对象 (CreateNSKeyRequest)

{
  "nsDomainId": "int64",
  "nsZoneId": "int64",
  "name": "string // 名称",
  "algo": "string",
  "secret": "string",
  "secretType": "string"
}

响应对象 (CreateNSKeyResponse)

{
  "nsKeyId": "int64"
}

调用示例

curl -X POST "https://backend.dooki.cloud/NSKeyService/createNSKey" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

deleteNSKey

删除密钥

  • 角色:admin, user
  • HTTPPOST https://backend.dooki.cloud/NSKeyService/deleteNSKey
  • RPCrpc deleteNSKey (DeleteNSKeyRequest) returns (RPCSuccess);

请求对象 (DeleteNSKeyRequest)

{
  "nsKeyId": "int64"
}

响应对象 (RPCSuccess)

{}

调用示例

curl -X POST "https://backend.dooki.cloud/NSKeyService/deleteNSKey" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

findNSKey

查找单个密钥

  • 角色:admin, user
  • HTTPPOST https://backend.dooki.cloud/NSKeyService/findNSKey
  • RPCrpc findNSKey (FindNSKeyRequest) returns (FindNSKeyResponse);

请求对象 (FindNSKeyRequest)

{
  "nsKeyId": "int64"
}

响应对象 (FindNSKeyResponse)

{
  "nsKey": "NSKey"
}

调用示例

curl -X POST "https://backend.dooki.cloud/NSKeyService/findNSKey" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

listNSKeys

列出单页密钥

  • 角色:admin, user
  • HTTPPOST https://backend.dooki.cloud/NSKeyService/listNSKeys
  • RPCrpc listNSKeys (ListNSKeysRequest) returns (ListNSKeysResponse);

请求对象 (ListNSKeysRequest)

{
  "nsDomainId": "int64",
  "nsZoneId": "int64",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量通常不能小于0"
}

响应对象 (ListNSKeysResponse)

{
  "nsKeys": "[]NSKey"
}

调用示例

curl -X POST "https://backend.dooki.cloud/NSKeyService/listNSKeys" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

updateNSKey

修改密钥

  • 角色:admin, user
  • HTTPPOST https://backend.dooki.cloud/NSKeyService/updateNSKey
  • RPCrpc updateNSKey (UpdateNSKeyRequest) returns (RPCSuccess);

请求对象 (UpdateNSKeyRequest)

{
  "nsKeyId": "int64",
  "name": "string // 名称",
  "algo": "string",
  "secret": "string",
  "secretType": "string",
  "isOn": "bool // 是否启用"
}

响应对象 (RPCSuccess)

{}

调用示例

curl -X POST "https://backend.dooki.cloud/NSKeyService/updateNSKey" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'