> ## Documentation Index
> Fetch the complete documentation index at: https://test-8ad8522e-feat-ai-sre.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 查看数据源详情

> 通过 ID 获取单个数据源的完整信息，包括 `payload` 配置及其中配置的连接与鉴权信息；请将该响应视为敏感信息，避免记录或转发。 支持诊断类型 redis_node、redis_sentinel、mongodb_mongod、mongodb_mongos 和 kafka；enabled 与 alerting_enabled 相互独立。

## 限制说明

| 项目   | 说明                             |
| ---- | ------------------------------ |
| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |
| 权限要求 | **数据源查看**（`monit`）             |

完整支持类型与凭据行为见请求/响应 Schema。仅诊断类型不能启用告警。创建时省略 enabled 默认为 true，更新时省略保留当前值；enabled 或 alerting\_enabled 的显式 null 非法。诊断密码及 Kafka 私钥在响应中省略，环境变量引用除外；更新时省略秘密字段保留原值，空字符串清除。其他数据源凭据可能返回，应作为敏感数据处理。


## OpenAPI

````yaml /api-reference/monitors.openapi.zh.json post /monit/datasource/info
openapi: 3.1.0
info:
  title: Flashduty 开放 API
  description: >-
    Flashduty 事件管理平台的公开 HTTP API —— 覆盖故障、通知模板、协作空间、值班排班、监控、RUM、以及平台管理。每次调用都需在
    query 中携带 `app_key`，该 key 在 Flashduty 控制台 账户 → APP Key 中签发。所有响应使用统一结构：成功时为
    `{ request_id, data }`，失败时为 `{ request_id, error }`。
  version: 1.0.0
servers:
  - url: https://api.flashcat.cloud
    description: Flashduty Open API
security:
  - AppKeyAuth: []
tags:
  - name: Monitors/告警规则
    description: 创建、管理和导出监控告警规则，查询规则统计和审计历史。
  - name: Monitors/告警数据源
    description: 管理监控告警规则用于查询指标的数据源。
  - name: Monitors/诊断分析
    description: Flashduty AI SRE 使用的诊断与查询接口——数据源即席查询、日志/指标诊断,以及监控对象侧的工具调用。
  - name: Monitors/通用工具
    description: 监控服务开通及数据预览工具。
paths:
  /monit/datasource/info:
    post:
      tags:
        - Monitors/告警数据源
      summary: 查看数据源详情
      description: >-
        通过 ID 获取单个数据源的完整信息，包括 `payload` 配置及其中配置的连接与鉴权信息；请将该响应视为敏感信息，避免记录或转发。
        支持诊断类型 redis_node、redis_sentinel、mongodb_mongod、mongodb_mongos 和
        kafka；enabled 与 alerting_enabled 相互独立。
      operationId: monit-datasource-read-info
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IDRequest'
            example:
              id: 10
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/DataSourceItem'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  id: 10
                  account_id: 10023
                  type_ident: prometheus
                  name: Prometheus Prod
                  enabled: true
                  note: Production Prometheus
                  address: http://prometheus.example.com:9090
                  payload:
                    prometheus:
                      basic_auth_enabled: false
                      basic_auth_username: ''
                      basic_auth_password: ''
                      tls_skip_verify: false
                  edge_cluster_name: default
                  updated_at: 1712000000
                  alerting_enabled: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    IDRequest:
      type: object
      required:
        - id
      description: 包含单个数字 ID 的请求。
      properties:
        id:
          type: integer
          format: uint64
          description: 目标资源的数字 ID，具体含义取决于所调用的接口（如数据源 ID、规则集 ID）。
    SuccessEnvelope:
      type: object
      description: >-
        成功响应结构。2xx 响应中 `request_id` 标识本次调用（同时出现在 `Flashcat-Request-Id`
        响应头中），`data` 为接口业务 payload。失败响应使用不同结构，参见 `ErrorResponse`。
      properties:
        request_id:
          type: string
          description: 本次请求的唯一 ID，也会在 Flashcat-Request-Id 响应头中返回。反馈问题时请一并附上。
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        data:
          description: 每个接口自己的业务 payload，详见各接口的 200 响应 schema。
      required:
        - request_id
        - data
    DataSourceItem:
      type: object
      description: 单个监控数据源。
      required:
        - id
        - account_id
        - type_ident
        - name
        - enabled
        - note
        - address
        - edge_cluster_name
        - updated_at
        - payload
        - alerting_enabled
      properties:
        id:
          type: integer
          format: uint64
          description: 唯一数据源 ID。
        account_id:
          type: integer
          format: uint64
          description: 账户 ID。
        type_ident:
          type: string
          description: >-
            数据源类型标识。支持：`prometheus`, `loki`, `mysql`, `oracle`, `postgres`,
            `clickhouse`, `elasticsearch`, `sls`, `tencent_cls`, `victorialogs`,
            `redis_node`, `redis_sentinel`, `mongodb_mongod`, `mongodb_mongos`,
            `kafka`。
        name:
          type: string
          description: 数据源显示名称。
        enabled:
          type: boolean
          description: 是否启用业务执行。停用时拒绝业务查询和工具调用；重新启用不改变 alerting_enabled。
        note:
          type: string
          description: 可选描述。
        address:
          type: string
          description: >-
            连接地址。Prometheus/Loki/VictoriaLogs 为 HTTP
            URL；MySQL/Oracle/Postgres/ClickHouse 为 `host:port`；SLS 为不含
            http/https 前缀的 endpoint。 Redis/MongoDB 诊断类型使用单个 host:port（IPv6
            加方括号），不接受 URI、userinfo 或查询参数。Kafka 使用 1–32 个不重复、逗号分隔的 host:port
            引导地址；payload 不含 broker 列表。规范化后最多 4096 个字符。
          maxLength: 4096
        payload:
          anyOf:
            - $ref: '#/components/schemas/DSPayload'
            - type: 'null'
          description: >-
            类型相关配置块，必须包含与 `type_ident` 匹配的键。`/monit/datasource/list` 响应中恒为
            `null`（列表查询不读取 payload 列）；创建/更新/详情响应中会返回。对于
            `tencent_cls`，`secret_key` 会被掩码为空字符串，除非其值为 `${env:...}` 引用。 诊断类型的
            password 和 Kafka tls_key 在响应中省略，${env:...}
            引用除外；更新时省略保留已保存的秘密，显式空字符串清除。其他配置字段保持原有行为。
        edge_cluster_name:
          type: string
          description: 负责使用该数据源评估规则的 Monitors Edge 集群名称。
        updated_at:
          type: integer
          format: int64
          description: 最后更新时间，Unix 时间戳（秒）。
        alerting_enabled:
          description: >-
            是否允许告警评估。告警同时要求 enabled=true 且类型支持告警。仅诊断类型固定为 false；false
            不阻断非告警查询或工具。
          type: boolean
    DSPayload:
      type: object
      description: 与类型相关的数据源配置，仅包含与 `type_ident` 匹配的配置块。
      properties:
        prometheus:
          $ref: '#/components/schemas/DSPrometheusConfig'
        loki:
          $ref: '#/components/schemas/DSLokiConfig'
        mysql:
          $ref: '#/components/schemas/DSMySQLConfig'
        oracle:
          $ref: '#/components/schemas/DSOracleConfig'
        postgres:
          $ref: '#/components/schemas/DSPostgresConfig'
        clickhouse:
          $ref: '#/components/schemas/DSClickHouseConfig'
        elasticsearch:
          $ref: '#/components/schemas/DSElasticSearchConfig'
        sls:
          $ref: '#/components/schemas/DSSLSConfig'
        victorialogs:
          $ref: '#/components/schemas/DSVictoriaLogsConfig'
        tencent_cls:
          $ref: '#/components/schemas/DSTencentCLSConfig'
          description: 腾讯云 CLS 凭证。`type_ident` 为 `tencent_cls` 时必填。
        kafka:
          $ref: '#/components/schemas/DSKafkaConfig'
          x-flashduty-preserve-absence: true
        mongodb_mongod:
          $ref: '#/components/schemas/DSMongoDBConfig'
          x-flashduty-preserve-absence: true
        mongodb_mongos:
          $ref: '#/components/schemas/DSMongoDBConfig'
          x-flashduty-preserve-absence: true
        redis_node:
          $ref: '#/components/schemas/DSRedisNodeConfig'
          x-flashduty-preserve-absence: true
        redis_sentinel:
          $ref: '#/components/schemas/DSRedisSentinelConfig'
          x-flashduty-preserve-absence: true
    ErrorResponse:
      type: object
      description: 错误响应结构。`error` 必填，`data` 不存在。
      properties:
        request_id:
          type: string
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
          description: 本次请求的唯一追踪 ID（trace ID），反馈问题时请提供该值以便检索日志。
        error:
          $ref: '#/components/schemas/DutyError'
      required:
        - request_id
        - error
    DSPrometheusConfig:
      type: object
      description: Prometheus 数据源配置，TLS 字段继承自 TLSClientConfig。
      properties:
        basic_auth_enabled:
          type: boolean
          description: 启用 HTTP Basic 认证。
        basic_auth_username:
          type: string
          description: Basic 认证用户名。
        basic_auth_password:
          type: string
          description: Basic 认证密码。
        headers:
          type: array
          items:
            type: string
          description: '自定义 HTTP 请求头，格式为 `Key: Value`。'
        params:
          type: array
          items:
            type: string
          description: 自定义查询参数，格式为 `key=value`。
        tls_ca:
          type: string
          description: PEM 格式的 CA 证书内容，用于校验服务端证书。
        tls_cert:
          type: string
          description: PEM 格式的客户端证书内容，用于双向 TLS；须与 `tls_key` 成对配置。
        tls_key:
          type: string
          description: PEM 格式的客户端私钥内容；须与 `tls_cert` 成对配置。
        tls_skip_verify:
          type: boolean
          description: 是否跳过服务端证书校验（不安全，仅用于自签名场景）。
        tls_server_name:
          type: string
          description: TLS 握手使用的 SNI / 证书校验主机名；留空时取连接地址中的主机名。
        tls_min_version:
          type: string
          description: >-
            最低 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制，且不得高于
            `tls_max_version`。
        tls_max_version:
          type: string
          description: 最高 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制。
    DSLokiConfig:
      type: object
      description: Loki 数据源配置，TLS 字段继承自 TLSClientConfig。
      properties:
        basic_auth_enabled:
          type: boolean
          description: >-
            是否启用 HTTP Basic Auth；为 `false` 时
            `basic_auth_username`/`basic_auth_password` 不生效。
        basic_auth_username:
          type: string
          description: Basic Auth 用户名，`basic_auth_enabled` 为 `true` 时生效。
        basic_auth_password:
          type: string
          description: Basic Auth 密码，`basic_auth_enabled` 为 `true` 时生效。
        headers:
          type: array
          items:
            type: string
          description: '附加到每个请求的自定义 HTTP 头列表，元素格式为 `Key: Value`；可用于租户头（如 `X-Scope-OrgID`）。'
        params:
          type: array
          items:
            type: string
          description: 附加到每个查询请求 URL 的自定义参数列表，元素格式为 `key=value`。
        tls_ca:
          type: string
          description: PEM 格式的 CA 证书内容，用于校验服务端证书。
        tls_cert:
          type: string
          description: PEM 格式的客户端证书内容，用于双向 TLS；须与 `tls_key` 成对配置。
        tls_key:
          type: string
          description: PEM 格式的客户端私钥内容；须与 `tls_cert` 成对配置。
        tls_skip_verify:
          type: boolean
          description: 是否跳过服务端证书校验（不安全，仅用于自签名场景）。
        tls_server_name:
          type: string
          description: TLS 握手使用的 SNI / 证书校验主机名；留空时取连接地址中的主机名。
        tls_min_version:
          type: string
          description: >-
            最低 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制，且不得高于
            `tls_max_version`。
        tls_max_version:
          type: string
          description: 最高 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制。
    DSMySQLConfig:
      type: object
      description: MySQL 数据源配置，TLS 字段继承自 TLSClientConfig。
      properties:
        username:
          type: string
          description: MySQL 认证用户名。
        password:
          type: string
          description: MySQL 认证密码。
        open_conns:
          type: integer
          description: 最大打开连接数。
        idle_conns:
          type: integer
          description: 最大空闲连接数。
        lifetime_seconds:
          type: integer
          format: int64
          description: 连接最大生命周期（秒）。
        timeout_mills:
          type: integer
          format: int64
          description: 查询超时时间（毫秒）。
        tls_mode:
          type: string
          enum:
            - disable
            - require
            - verify-full
          description: >-
            MySQL 连接的 TLS 模式。留空则保持旧的逐字段 TLS 行为。`disable` = 不使用 TLS（保存时清空全部
            `tls_*` 字段）；`require` = 使用 TLS 但不校验服务端证书；`verify-full` = 使用 TLS
            并校验服务端证书（CA 链与主机名）。MySQL 不提供 `verify-ca`——要校验 CA 就必须同时校验主机名。
        tls_ca:
          type: string
          description: >-
            PEM 格式的 CA 证书内容，用于校验服务端证书；仅在 `tls_mode` 为 `verify-full`（或旧版空
            `tls_mode`）时允许配置。
        tls_cert:
          type: string
          description: PEM 格式的客户端证书内容，用于双向 TLS；须与 `tls_key` 成对配置。
        tls_key:
          type: string
          description: PEM 格式的客户端私钥内容；须与 `tls_cert` 成对配置。
        tls_skip_verify:
          type: boolean
          description: >-
            是否跳过服务端证书校验；设置 `tls_mode` 时由 `tls_mode` 派生（`require` 视为
            `true`，`verify-full` 视为 `false`），仅旧版空 `tls_mode` 配置下手工生效。
        tls_server_name:
          type: string
          description: TLS 握手使用的 SNI / 证书校验主机名；留空时取连接地址中的主机名。
        tls_min_version:
          type: string
          description: >-
            最低 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制，且不得高于
            `tls_max_version`。
        tls_max_version:
          type: string
          description: 最高 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制。
    DSOracleConfig:
      type: object
      description: Oracle 数据源配置。
      properties:
        username:
          type: string
          description: Oracle 认证用户名。
        password:
          type: string
          description: Oracle 认证密码。
        options:
          type: object
          additionalProperties:
            type: string
          description: 额外连接参数（键值对）。
        open_conns:
          type: integer
          description: 连接池最大打开连接数；`0` 或省略时使用默认值 32。
        idle_conns:
          type: integer
          description: 连接池最大空闲连接数；`0` 或省略时使用默认值 4。
        lifetime_seconds:
          type: integer
          format: int64
          description: 连接最大存活时间（秒）；`0` 或省略时使用默认值 600（10 分钟）。
        timeout_mills:
          type: integer
          format: int64
          description: 单次查询超时时间（毫秒）；`0` 或省略时使用默认值 10000（10 秒）。
    DSPostgresConfig:
      type: object
      description: PostgreSQL 数据源配置。
      properties:
        username:
          type: string
          description: PostgreSQL 认证用户名。
        password:
          type: string
          description: PostgreSQL 认证密码。
        open_conns:
          type: integer
          description: 连接池最大打开连接数；`0` 或省略时使用默认值 32。
        idle_conns:
          type: integer
          description: 连接池最大空闲连接数；`0` 或省略时使用默认值 4。
        lifetime_seconds:
          type: integer
          format: int64
          description: 连接最大存活时间（秒）；`0` 或省略时使用默认值 600（10 分钟）。
        timeout_mills:
          type: integer
          format: int64
          description: 单次查询超时时间（毫秒）；`0` 或省略时使用默认值 10000（10 秒）。
        ssl_mode:
          type: string
          enum:
            - disable
            - require
            - verify-ca
            - verify-full
          description: >-
            PostgreSQL 连接的 SSL 模式。留空则保持由 `tls_ca` 推断的旧行为。`disable` = 不使用
            TLS（保存时清空全部 `tls_*` 字段）；`require` = 使用 TLS 但不校验服务端证书（不允许配置
            `tls_ca`）；`verify-ca` = 校验服务端证书 CA 链但不校验主机名；`verify-full` = 校验 CA
            链与主机名。
        tls_ca:
          type: string
          description: >-
            PEM 格式的 CA 证书内容，用于校验服务端证书；`ssl_mode` 为 `verify-ca`/`verify-full`
            时使用，为 `require` 时不允许配置。
        tls_cert:
          type: string
          description: PEM 格式的客户端证书内容，用于双向 TLS；须与 `tls_key` 成对配置。
        tls_key:
          type: string
          description: PEM 格式的客户端私钥内容；须与 `tls_cert` 成对配置。
    DSClickHouseConfig:
      type: object
      description: ClickHouse 数据源配置，TLS 字段继承自 TLSClientConfig。
      properties:
        database:
          type: string
          description: 认证用默认数据库。
        username:
          type: string
          description: ClickHouse 认证用户名。
        password:
          type: string
          description: ClickHouse 认证密码。
        open_conns:
          type: integer
          description: 连接池最大打开连接数；`0` 或省略时使用默认值 32。
        idle_conns:
          type: integer
          description: 连接池最大空闲连接数；`0` 或省略时使用默认值 4。
        lifetime_seconds:
          type: integer
          format: int64
          description: 连接最大存活时间（秒）；`0` 或省略时使用默认值 600（10 分钟）。
        timeout_mills:
          type: integer
          format: int64
          description: 单次查询超时时间（毫秒）；`0` 或省略时使用默认值 10000（10 秒）。
        max_execution_seconds:
          type: integer
          format: int64
          description: 最大查询执行时间（秒）。
        dial_timeout_mills:
          type: integer
          format: int64
          description: 拨号超时（毫秒）。
        tls_enabled:
          type: boolean
          description: 是否启用 TLS；为 `false` 时保存前会清空全部 `tls_*` 字段。
        tls_ca:
          type: string
          description: PEM 格式的 CA 证书内容，用于校验服务端证书。
        tls_cert:
          type: string
          description: PEM 格式的客户端证书内容，用于双向 TLS；须与 `tls_key` 成对配置。
        tls_key:
          type: string
          description: PEM 格式的客户端私钥内容；须与 `tls_cert` 成对配置。
        tls_skip_verify:
          type: boolean
          description: 是否跳过服务端证书校验（不安全，仅用于自签名场景）。
        tls_server_name:
          type: string
          description: TLS 握手使用的 SNI / 证书校验主机名；留空时取连接地址中的主机名。
        tls_min_version:
          type: string
          description: >-
            最低 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制，且不得高于
            `tls_max_version`。
        tls_max_version:
          type: string
          description: 最高 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制。
    DSElasticSearchConfig:
      type: object
      description: Elasticsearch 数据源配置。
      properties:
        deployment:
          type: string
          enum:
            - cloud
            - self-managed
          description: 部署类型。`cloud` 使用 Elastic Cloud；`self-managed` 使用自托管集群。
        timeout_mills:
          type: integer
          format: int64
          description: 单次查询超时时间（毫秒）；`0` 或省略时使用默认值 10000（10 秒）。
        cloud_id:
          type: string
          description: Elastic Cloud 部署 ID，仅用于 `cloud` 部署。
        api_key:
          type: string
          description: Elastic Cloud API 密钥，仅用于 `cloud` 部署。
        username:
          type: string
          description: '`self-managed` 部署的用户名。'
        password:
          type: string
          description: 自建集群（`self-managed`）的认证密码；配置了 `service_token` 时该字段不生效。
        service_token:
          type: string
          description: 服务令牌，若设置则覆盖用户名/密码认证。
        tls_ca:
          type: string
          description: PEM 格式的 CA 证书内容，用于校验 Elasticsearch 服务端证书。
        certificate_fingerprint:
          type: string
          description: Elasticsearch CA 证书的 SHA-256 指纹，用于校验服务端证书链（ES 8 默认安全配置的推荐方式）。
        headers:
          type: array
          items:
            type: string
          description: '附加到每个请求的自定义 HTTP 头列表，元素格式为 `Key: Value`。'
    DSSLSConfig:
      type: object
      description: 阿里云日志服务（SLS）数据源配置。
      properties:
        access_key_id:
          type: string
          description: 阿里云 Access Key ID。
        access_key_secret:
          type: string
          description: 阿里云 Access Key Secret。
        headers:
          type: array
          items:
            type: string
          description: 自定义 HTTP 请求头。
    DSVictoriaLogsConfig:
      type: object
      description: VictoriaLogs 数据源配置，TLS 字段继承自 TLSClientConfig。
      properties:
        basic_auth_enabled:
          type: boolean
          description: >-
            是否启用 HTTP Basic Auth；为 `false` 时
            `basic_auth_username`/`basic_auth_password` 不生效。
        basic_auth_username:
          type: string
          description: Basic Auth 用户名，`basic_auth_enabled` 为 `true` 时生效。
        basic_auth_password:
          type: string
          description: Basic Auth 密码，`basic_auth_enabled` 为 `true` 时生效。
        headers:
          type: array
          items:
            type: string
          description: >-
            附加到每个请求的自定义 HTTP 头列表，元素格式为 `Key: Value`；可用于租户头（如
            `AccountID`/`ProjectID`）。
        params:
          type: array
          items:
            type: string
          description: 附加到每个查询请求 URL 的自定义参数列表，元素格式为 `key=value`。
        tls_ca:
          type: string
          description: PEM 格式的 CA 证书内容，用于校验服务端证书。
        tls_cert:
          type: string
          description: PEM 格式的客户端证书内容，用于双向 TLS；须与 `tls_key` 成对配置。
        tls_key:
          type: string
          description: PEM 格式的客户端私钥内容；须与 `tls_cert` 成对配置。
        tls_skip_verify:
          type: boolean
          description: 是否跳过服务端证书校验（不安全，仅用于自签名场景）。
        tls_server_name:
          type: string
          description: TLS 握手使用的 SNI / 证书校验主机名；留空时取连接地址中的主机名。
        tls_min_version:
          type: string
          description: >-
            最低 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制，且不得高于
            `tls_max_version`。
        tls_max_version:
          type: string
          description: 最高 TLS 版本，可选 `1.0`、`1.1`、`1.2`、`1.3`；留空表示不限制。
    DSTencentCLSConfig:
      type: object
      description: 腾讯云日志服务（CLS）凭证配置。
      required:
        - secret_id
      properties:
        secret_id:
          type: string
          description: 腾讯云 API SecretId，创建和更新时均必填。支持 `${env:VAR}` 引用（在 edge 侧解析）。
        secret_key:
          type: string
          description: >-
            腾讯云 API SecretKey。创建时必填；更新时省略则保留已存储的密钥。支持 `${env:VAR}`
            引用。读取接口永不返回该值：响应中为空字符串，除非存储的值是 `${env:...}` 引用。
    DSKafkaConfig:
      description: 诊断数据源连接配置。
      properties:
        password:
          description: 认证密码，支持 ${env:NAME}。更新时省略保留；显式空字符串清除。响应中省略字面密码。
          type: string
          x-flashduty-preserve-absence: true
        sasl_mechanism:
          default: none
          description: SASL 机制：none（默认，不接受凭据）、plain、scram-sha-256、scram-sha-512（需要用户名与密码）。
          enum:
            - none
            - plain
            - scram-sha-256
            - scram-sha-512
          type: string
        timeout_ms:
          default: 5000
          description: 连接超时，单位毫秒；省略默认为 5000。
          maximum: 10000
          minimum: 1000
          type: integer
        tls_ca:
          description: PEM CA 证书或 ${env:NAME} 引用。
          type: string
        tls_cert:
          description: PEM 客户端证书或 ${env:NAME}，须配对配置 tls_cert 与 tls_key。
          type: string
        tls_enabled:
          default: false
          description: 是否启用 TLS，默认为 false。
          type: boolean
        tls_key:
          description: >-
            PEM 客户端私钥或 ${env:NAME}，须配对配置 tls_cert 与 tls_key。
            更新时省略保留，空字符串清除；响应中省略字面私钥。
          type: string
          x-flashduty-preserve-absence: true
        tls_max_version:
          description: 最高 TLS 版本：1.2 或 1.3；空值表示不限制，不能低于最低版本。
          type: string
        tls_min_version:
          description: 最低 TLS 版本：1.2（默认）或 1.3。
          type: string
        tls_server_name:
          type: string
          description: TLS 握手使用的 SNI / 证书校验主机名；留空时取连接地址中的主机名。
        tls_skip_verify:
          description: 启用 TLS 时是否跳过服务端证书验证。
          type: boolean
        username:
          description: 认证用户名，支持 ${env:NAME} 引用。
          type: string
      type: object
    DSMongoDBConfig:
      description: 诊断数据源连接配置。
      properties:
        auth_source:
          default: admin
          description: 认证数据库，默认为 admin。用户名与密码必须同时配置。不支持客户端证书。
          type: string
        password:
          description: 认证密码，支持 ${env:NAME}。更新时省略保留；显式空字符串清除。响应中省略字面密码。
          type: string
          x-flashduty-preserve-absence: true
        timeout_ms:
          default: 3000
          description: 连接超时，单位毫秒；省略默认为 3000。
          maximum: 10000
          minimum: 1000
          type: integer
        tls_ca:
          description: PEM CA 证书或 ${env:NAME} 引用。
          type: string
        tls_enabled:
          default: false
          description: 是否启用 TLS，默认为 false。
          type: boolean
        tls_max_version:
          description: 最高 TLS 版本：1.2 或 1.3；空值表示不限制，不能低于最低版本。
          type: string
        tls_min_version:
          description: 最低 TLS 版本：1.2（默认）或 1.3。
          type: string
        tls_server_name:
          type: string
          description: TLS 握手使用的 SNI / 证书校验主机名；留空时取连接地址中的主机名。
        tls_skip_verify:
          description: 启用 TLS 时是否跳过服务端证书验证。
          type: boolean
        username:
          description: 认证用户名，支持 ${env:NAME} 引用。
          type: string
      type: object
    DSRedisNodeConfig:
      description: 诊断数据源连接配置。
      properties:
        database:
          default: 0
          description: Redis 数据库编号，默认为 0。
          minimum: 0
          type: integer
        password:
          description: 认证密码，支持 ${env:NAME}。更新时省略保留；显式空字符串清除。响应中省略字面密码。
          type: string
          x-flashduty-preserve-absence: true
        timeout_ms:
          default: 3000
          description: 连接超时，单位毫秒；省略默认为 3000。
          maximum: 10000
          minimum: 1000
          type: integer
        username:
          description: 认证用户名，支持 ${env:NAME} 引用。
          type: string
      type: object
    DSRedisSentinelConfig:
      description: 诊断数据源连接配置。
      properties:
        password:
          description: 认证密码，支持 ${env:NAME}。更新时省略保留；显式空字符串清除。响应中省略字面密码。
          type: string
          x-flashduty-preserve-absence: true
        timeout_ms:
          default: 3000
          description: 连接超时，单位毫秒；省略默认为 3000。
          maximum: 10000
          minimum: 1000
          type: integer
        username:
          description: 认证用户名，支持 ${env:NAME} 引用。
          type: string
      type: object
    DutyError:
      type: object
      description: 响应结构中的错误 payload，仅在非 2xx 响应时出现。
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: 用户可读的错误描述，语言会跟随调用方的 Accept-Language。可能包含字段名、ID 等请求上下文。
          example: The specified parameter template_id is not valid.
        reason:
          description: 可选的机器可读拒绝原因，包含数据源工具错误；结合 HTTP 状态及 code 判断。
          type: string
          x-flashduty-preserve-absence: true
      required:
        - code
        - message
    ErrorCode:
      type: string
      description: >-
        Flashduty 错误码枚举。每个失败响应的 `error.code` 都是下列稳定值之一，HTTP 状态码仅作参考。


        | 错误码 | HTTP | 含义 |

        |---|---|---|

        | `OK` | 200 | 保留值，正常错误响应不会返回。 |

        | `InvalidParameter` | 400 | 必填参数缺失或未通过校验。 |

        | `BadRequest` | 400 | 通用的 400 错误，通常是请求本身不合法。 |

        | `InvalidContentType` | 400 | 请求头 `Content-Type` 不是 `application/json`。
        |

        | `ResourceNotFound` | 400 | 目标资源不存在。注意 HTTP 状态码是 400 而非 404（历史设计）。 |

        | `NoLicense` | 400 | 功能需要有效授权，但未找到可用的 license。 |

        | `ReferenceExist` | 400 | 该资源仍被其他实体引用，无法删除。 |

        | `Unauthorized` | 401 | `app_key` 缺失、无效或已过期。 |

        | `BalanceNotEnough` | 402 | 账户余额不足，无法执行需要计费的操作。 |

        | `AccessDenied` | 403 | 身份认证通过，但 RBAC 权限不足以执行该操作。 |

        | `RouteNotFound` | 404 | 请求的 URL 路径不是已知路由。 |

        | `MethodNotAllowed` | 405 | 当前路径不接受所使用的 HTTP 方法。 |

        | `UndonedOrderExist` | 409 | 账户存在未完成的订单，请稍后重试。 |

        | `RequestLocked` | 423 | 因连续失败被临时锁定。 |

        | `EntityTooLarge` | 413 | 请求体超过允许的最大长度。 |

        | `RequestTooFrequently` | 429 | 命中限流（全局、账户级或集成级）。 |

        | `RequestVerifyRequired` | 428 | 操作需要二次验证码，但未提供。 |

        | `DangerousOperation` | 428 | 危险操作，需要进行 MFA 验证。 |

        | `InternalError` | 500 | 服务端未预期错误。反馈问题请附上 `request_id`。 |

        | `ServiceUnavailable` | 503 | 后端依赖不可用，请稍后重试。 |
      enum:
        - OK
        - InvalidParameter
        - BadRequest
        - InvalidContentType
        - ResourceNotFound
        - NoLicense
        - ReferenceExist
        - Unauthorized
        - BalanceNotEnough
        - AccessDenied
        - RouteNotFound
        - MethodNotAllowed
        - UndonedOrderExist
        - RequestLocked
        - EntityTooLarge
        - RequestTooFrequently
        - RequestVerifyRequired
        - DangerousOperation
        - InternalError
        - ServiceUnavailable
      x-enumDescriptions:
        OK: 保留值，正常错误响应不会返回。
        InvalidParameter: 必填参数缺失或未通过校验。
        BadRequest: 通用的 400 错误，通常是请求本身不合法。
        InvalidContentType: 请求头 `Content-Type` 不是 `application/json`。
        ResourceNotFound: 目标资源不存在。注意 HTTP 状态码是 400 而非 404（历史设计）。
        NoLicense: 功能需要有效授权，但未找到可用的 license。
        ReferenceExist: 该资源仍被其他实体引用，无法删除。
        Unauthorized: '`app_key` 缺失、无效或已过期。'
        BalanceNotEnough: 账户余额不足，无法执行需要计费的操作。
        AccessDenied: 身份认证通过，但 RBAC 权限不足以执行该操作。
        RouteNotFound: 请求的 URL 路径不是已知路由。
        MethodNotAllowed: 当前路径不接受所使用的 HTTP 方法。
        UndonedOrderExist: 账户存在未完成的订单，请稍后重试。
        RequestLocked: 因连续失败被临时锁定。
        EntityTooLarge: 请求体超过允许的最大长度。
        RequestTooFrequently: 命中限流（全局、账户级或集成级）。
        RequestVerifyRequired: 操作需要二次验证码，但未提供。
        DangerousOperation: 危险操作，需要进行 MFA 验证。
        InternalError: 服务端未预期错误。反馈问题请附上 `request_id`。
        ServiceUnavailable: 后端依赖不可用，请稍后重试。
      example: InvalidParameter
  responses:
    BadRequest:
      description: 请求非法 — 通常是参数缺失或格式不正确。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingParameter:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InvalidParameter
                  message: The specified parameter is not valid.
    Unauthorized:
      description: app_key 缺失或无效。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingAppKey:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: Unauthorized
                  message: You are unauthorized.
    TooManyRequests:
      description: 命中限流。可能是全局 API 限流、账户级限流或集成级限流。限流按账户聚合。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: RequestTooFrequently
                  message: Request too frequently.
    ServerError:
      description: 服务端未预期错误。反馈问题时请携带 request_id。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InternalError
                  message: >-
                    We encountered an internal error, and it has been reported.
                    Please try again later.
  securitySchemes:
    AppKeyAuth:
      type: apiKey
      in: query
      name: app_key
      description: >-
        在 Flashduty 控制台 账户 → APP Key 中签发的 app_key。调用任何公开 API
        时都必须携带。它等同于所属账户的身份凭证，请妥善保管。

````