Skip to content

读取受管账号当前凭据

读取指定主机受管账号当前生效的用户名和密码。响应包含敏感明文且禁止缓存,请仅在需要连接目标主机时调用。

更新于 查看 Markdown
GET/api/v1/hosts/{host_id}/managed-accounts/{account_id}/credentials
使用 App Header 签名或 App Secret需要 unsealed

Path 参数

account_id必填

string

受管账号 ID

示例:"019fb1a3-5b71-7af7-ae91-112233445566"

host_id必填

string

主机 ID

示例:"019fb1a2-53b0-70c5-993e-010203040506"

成功响应

HTTP 200

返回当前受管账号凭据

{
  "data": {
    "item": {
      "credential_version": 3,
      "password": "<当前账号密码>",
      "rotated_at": "2026-08-02T08:00:00Z",
      "username": "ops"
    }
  },
  "error": null,
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

失败响应

按 HTTP status 和 error.code 区分失败原因;响应始终使用统一 envelope。

HTTP 400 · integrity_failed

受管账号凭据完整性校验失败

{
  "data": null,
  "error": {
    "code": "integrity_failed",
    "details": {},
    "message": "受管账号凭据完整性校验失败"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 400 · invalid_request

请求参数或 JSON 请求体无效

{
  "data": null,
  "error": {
    "code": "invalid_request",
    "details": {},
    "message": "请求参数或 JSON 请求体无效"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 400 · not_initialized

系统尚未初始化

{
  "data": null,
  "error": {
    "code": "not_initialized",
    "details": {},
    "message": "系统尚未初始化"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 401 · replayed_request

签名请求的 nonce 已被使用

{
  "data": null,
  "error": {
    "code": "replayed_request",
    "details": {},
    "message": "签名请求的 nonce 已被使用"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 401 · unauthorized

App ID、App Secret 或签名无效,或者凭据已过期

{
  "data": null,
  "error": {
    "code": "unauthorized",
    "details": {},
    "message": "App ID、App Secret 或签名无效,或者凭据已过期"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 403 · forbidden

App 没有访问目标资源所需的权限

{
  "data": null,
  "error": {
    "code": "forbidden",
    "details": {},
    "message": "App 没有访问目标资源所需的权限"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 404 · host_account_not_found

目标主机账号不存在

{
  "data": null,
  "error": {
    "code": "host_account_not_found",
    "details": {},
    "message": "目标主机账号不存在"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 404 · key_not_found

解密受管账号凭据所需的密钥不存在

{
  "data": null,
  "error": {
    "code": "key_not_found",
    "details": {},
    "message": "解密受管账号凭据所需的密钥不存在"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 404 · not_found

主机或受管账号不存在

{
  "data": null,
  "error": {
    "code": "not_found",
    "details": {},
    "message": "主机或受管账号不存在"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 413 · request_body_too_large

请求体超过服务端限制

{
  "data": null,
  "error": {
    "code": "request_body_too_large",
    "details": {},
    "message": "请求体超过服务端限制"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 423 · sealed

系统处于封印状态

{
  "data": null,
  "error": {
    "code": "sealed",
    "details": {},
    "message": "系统处于封印状态"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 500 · internal_error

服务端无法完成请求

{
  "data": null,
  "error": {
    "code": "internal_error",
    "details": {},
    "message": "服务端无法完成请求"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 503 · crypto_unavailable

凭据解密服务暂不可用

{
  "data": null,
  "error": {
    "code": "crypto_unavailable",
    "details": {},
    "message": "凭据解密服务暂不可用"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 503 · leader_unavailable

高可用集群的 Leader 暂不可用

{
  "data": null,
  "error": {
    "code": "leader_unavailable",
    "details": {},
    "message": "高可用集群的 Leader 暂不可用"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 503 · maintenance_mode

系统处于维护模式

{
  "data": null,
  "error": {
    "code": "maintenance_mode",
    "details": {},
    "message": "系统处于维护模式"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close