Lattice Hub 文档
HTTP OpenAPI治理

流量鉴权

调用鉴权规则与 release。

调用鉴权规则与 release。

默认 Base URL:http://127.0.0.1:8090。管理面接口需 Authorization(登录返回的 token)。

流量鉴权

流量鉴权:查询、创建/更新、删除与 releases(发布 / 回滚 / 停灰度)。body 为规则数组;字段以 specification 为准。

GET/naming/v1/traffic/security需要鉴权

查询流量鉴权

分页查询流量鉴权。

  • Authorizationheader · string必填

    登录返回的 token。

  • idquery · string可选

    按 ID。

  • namequery · string可选

    按名称。

  • namespacequery · string可选

    按命名空间。

  • servicequery · string可选

    按服务。

  • enablequery · bool可选

    是否启用。

  • offsetquery · integer可选

    偏移,默认 0。

  • limitquery · integer可选

    分页大小,常见上限 100。

请求示例
curl -sS 'http://127.0.0.1:8090/naming/v1/traffic/security?limit=20' \
  -H "Authorization: $TOKEN"
响应示例
{
  "code": 200000,
  "info": "execute success",
  "data": [{ "id": "...", "name": "demo", "enable": true }]
}
GET/naming/v1/traffic/security/detail需要鉴权

查询流量鉴权详情

按 id 等条件查单条详情。

  • Authorizationheader · string必填

    登录返回的 token。

  • idquery · string可选

    按 ID。

  • namequery · string可选

    按名称。

  • namespacequery · string可选

    按命名空间。

  • servicequery · string可选

    按服务。

  • enablequery · bool可选

    是否启用。

  • offsetquery · integer可选

    偏移,默认 0。

  • limitquery · integer可选

    分页大小,常见上限 100。

请求示例
curl -sS 'http://127.0.0.1:8090/naming/v1/traffic/security/detail?id=<id>' \
  -H "Authorization: $TOKEN"
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
POST/naming/v1/traffic/security需要鉴权

创建流量鉴权

写接口 body 多为 protobuf 消息数组;下列为单条对象字段(见 specification)。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · TrafficSecurityRule[]必填

    请求体为 TrafficSecurityRule 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • namebody · string必填

    规则名称

  • descriptionbody · string可选

    规则描述

  • prioritybody · uint32可选

    规则优先级

  • enablebody · bool可选

    是否启用

  • target_servicebody · DestinationService可选

    被调服务,规则只绑定到该服务

    • servicebody · string可选

      Main tuning service and namespace

    • namespacebody · string可选

      namespace

  • policiesbody · TrafficSecurityPolicy[]可选

    policies

    • apisbody · API[]可选

      apis

      • protocolbody · string可选

        API的协议,*或者为空代表全部

      • methodbody · string可选

        API的方法,*或者为空代表全部

      • pathbody · MatchString可选

        API的路径,支持多种匹配方式

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • traffic_match_rulebody · TrafficMatchRule可选

      主调、请求头、查询参数、路径、Cookie 等流量匹配条件

      • argumentsbody · SourceMatch[]可选

        arguments

        • typebody · enum(Type)可选

          type 枚举:CUSTOM | METHOD | HEADER | QUERY | CALLER_IP | PATH | COOKIE | CALLER_METADATA | CALLER_SERVICE

        • keybody · string可选

          header key or query key

        • valuebody · MatchString可选

          header value or query value

          • typebody · enum(MatchStringType)可选

            type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

          • valuebody · string可选

            value

          • value_typebody · enum(ValueType)可选

            value_type 枚举:TEXT | PARAMETER

      • random_percentbody · uint32可选

        随机百分比流量匹配, 1-100, 表示百分之几的流量会被匹配到, 默认值为 100

      • matchModebody · enum(TrafficMatchMode)可选

        matchMode 枚举:AND | OR

    • actionbody · enum(TrafficSecurityAction)可选

      命中该策略后的动作 枚举:TRAFFIC_SECURITY_ALLOW | TRAFFIC_SECURITY_DENY

    • reject_effectbody · TrafficSecurityRejectEffect可选

      拒绝调用时的响应效果,仅 action=DENY 时生效

      • codebody · string可选

        业务错误码

      • messagebody · string可选

        拒绝原因

    • managed_callerbody · ManagedCallerSelector可选

      托管身份模式下,从已认证主体中匹配可信来源服务。 不得从调用方自行填写的普通 Header 或 metadata 中取值。

      • any_authenticatedbody · bool可选

        接受任意已通过托管身份认证的服务。

      • callersbody · SourceService[]可选

        callers

        • servicebody · string可选

          Main tuning service and namespace

        • namespacebody · string可选

          namespace

  • metadatabody · map<string,string>可选

    metadata

  • authenticationbody · TrafficSecurityAuthentication可选

    规则级认证配置。历史规则缺少该字段时继续按旧请求匹配语义执行。

    • modebody · enum(TrafficSecurityAuthMode)可选

      mode 枚举:LEGACY_REQUEST_MATCH | MANAGED_IDENTITY | CUSTOM_HEADER

    • managed_identitybody · ManagedIdentityAuthentication可选

      managed_identity

    • custom_headerbody · CustomHeaderAuthentication可选

      custom_header

      • header_namebody · string可选

        header_name

      • valuebody · string可选

        仅由管理面创建/更新请求写入;control-plane 持久化前必须清空。

      • value_sha256body · string可选

        control-plane 生成的数据面精确验证摘要;管理面不得接受调用方写入。

  • namespacebody · string必填

    namespace identifies the environment that owns this rule.

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • trafficSecurityRulebody · TrafficSecurityRule可选

    返回中的 TrafficSecurityRule 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • namebody · string可选

      规则名称

    • descriptionbody · string可选

      规则描述

    • prioritybody · uint32可选

      规则优先级

    • enablebody · bool可选

      是否启用

    • target_servicebody · DestinationService可选

      被调服务,规则只绑定到该服务

      • servicebody · string可选

        Main tuning service and namespace

      • namespacebody · string可选

        namespace

    • policiesbody · TrafficSecurityPolicy[]可选

      policies

      • apisbody · API[]可选

        apis

        • protocolbody · string可选

          API的协议,*或者为空代表全部

        • methodbody · string可选

          API的方法,*或者为空代表全部

        • pathbody · MatchString可选

          API的路径,支持多种匹配方式

          • typebody · enum(MatchStringType)可选

            type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

          • valuebody · string可选

            value

          • value_typebody · enum(ValueType)可选

            value_type 枚举:TEXT | PARAMETER

      • traffic_match_rulebody · TrafficMatchRule可选

        主调、请求头、查询参数、路径、Cookie 等流量匹配条件

        • argumentsbody · SourceMatch[]可选

          arguments

          • typebody · enum(Type)可选

            type 枚举:CUSTOM | METHOD | HEADER | QUERY | CALLER_IP | PATH | COOKIE | CALLER_METADATA | CALLER_SERVICE

          • keybody · string可选

            header key or query key

          • valuebody · MatchString可选

            header value or query value

            • typebody · enum(MatchStringType)可选

              type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

            • valuebody · string可选

              value

            • value_typebody · enum(ValueType)可选

              value_type 枚举:TEXT | PARAMETER

        • random_percentbody · uint32可选

          随机百分比流量匹配, 1-100, 表示百分之几的流量会被匹配到, 默认值为 100

        • matchModebody · enum(TrafficMatchMode)可选

          matchMode 枚举:AND | OR

      • actionbody · enum(TrafficSecurityAction)可选

        命中该策略后的动作 枚举:TRAFFIC_SECURITY_ALLOW | TRAFFIC_SECURITY_DENY

      • reject_effectbody · TrafficSecurityRejectEffect可选

        拒绝调用时的响应效果,仅 action=DENY 时生效

        • codebody · string可选

          业务错误码

        • messagebody · string可选

          拒绝原因

      • managed_callerbody · ManagedCallerSelector可选

        托管身份模式下,从已认证主体中匹配可信来源服务。 不得从调用方自行填写的普通 Header 或 metadata 中取值。

        • any_authenticatedbody · bool可选

          接受任意已通过托管身份认证的服务。

        • callersbody · SourceService[]可选

          callers

          • servicebody · string可选

            Main tuning service and namespace

          • namespacebody · string可选

            namespace

    • ctimebody · string可选

      创建时间

    • mtimebody · string可选

      修改时间

    • metadatabody · map<string,string>可选

      metadata

    • revisionbody · string可选

      规则 revision

    • editablebody · bool可选

      规则的权限操作状态

    • deleteablebody · bool可选

      deleteable

    • authenticationbody · TrafficSecurityAuthentication可选

      规则级认证配置。历史规则缺少该字段时继续按旧请求匹配语义执行。

      • modebody · enum(TrafficSecurityAuthMode)可选

        mode 枚举:LEGACY_REQUEST_MATCH | MANAGED_IDENTITY | CUSTOM_HEADER

      • managed_identitybody · ManagedIdentityAuthentication可选

        managed_identity

      • custom_headerbody · CustomHeaderAuthentication可选

        custom_header

        • header_namebody · string可选

          header_name

        • valuebody · string可选

          仅由管理面创建/更新请求写入;control-plane 持久化前必须清空。

        • value_sha256body · string可选

          control-plane 生成的数据面精确验证摘要;管理面不得接受调用方写入。

    • namespacebody · string可选

      namespace identifies the environment that owns this rule.

请求示例
curl -sS -X POST 'http://127.0.0.1:8090/naming/v1/traffic/security' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"name":"demo-security","enable":true}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
PUT/naming/v1/traffic/security需要鉴权

更新流量鉴权

更新规则;body 为数组。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · TrafficSecurityRule[]必填

    请求体为 TrafficSecurityRule 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • namebody · string可选

    规则名称

  • descriptionbody · string可选

    规则描述

  • prioritybody · uint32可选

    规则优先级

  • enablebody · bool可选

    是否启用

  • target_servicebody · DestinationService可选

    被调服务,规则只绑定到该服务

    • servicebody · string可选

      Main tuning service and namespace

    • namespacebody · string可选

      namespace

  • policiesbody · TrafficSecurityPolicy[]可选

    policies

    • apisbody · API[]可选

      apis

      • protocolbody · string可选

        API的协议,*或者为空代表全部

      • methodbody · string可选

        API的方法,*或者为空代表全部

      • pathbody · MatchString可选

        API的路径,支持多种匹配方式

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • traffic_match_rulebody · TrafficMatchRule可选

      主调、请求头、查询参数、路径、Cookie 等流量匹配条件

      • argumentsbody · SourceMatch[]可选

        arguments

        • typebody · enum(Type)可选

          type 枚举:CUSTOM | METHOD | HEADER | QUERY | CALLER_IP | PATH | COOKIE | CALLER_METADATA | CALLER_SERVICE

        • keybody · string可选

          header key or query key

        • valuebody · MatchString可选

          header value or query value

          • typebody · enum(MatchStringType)可选

            type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

          • valuebody · string可选

            value

          • value_typebody · enum(ValueType)可选

            value_type 枚举:TEXT | PARAMETER

      • random_percentbody · uint32可选

        随机百分比流量匹配, 1-100, 表示百分之几的流量会被匹配到, 默认值为 100

      • matchModebody · enum(TrafficMatchMode)可选

        matchMode 枚举:AND | OR

    • actionbody · enum(TrafficSecurityAction)可选

      命中该策略后的动作 枚举:TRAFFIC_SECURITY_ALLOW | TRAFFIC_SECURITY_DENY

    • reject_effectbody · TrafficSecurityRejectEffect可选

      拒绝调用时的响应效果,仅 action=DENY 时生效

      • codebody · string可选

        业务错误码

      • messagebody · string可选

        拒绝原因

    • managed_callerbody · ManagedCallerSelector可选

      托管身份模式下,从已认证主体中匹配可信来源服务。 不得从调用方自行填写的普通 Header 或 metadata 中取值。

      • any_authenticatedbody · bool可选

        接受任意已通过托管身份认证的服务。

      • callersbody · SourceService[]可选

        callers

        • servicebody · string可选

          Main tuning service and namespace

        • namespacebody · string可选

          namespace

  • metadatabody · map<string,string>可选

    metadata

  • authenticationbody · TrafficSecurityAuthentication可选

    规则级认证配置。历史规则缺少该字段时继续按旧请求匹配语义执行。

    • modebody · enum(TrafficSecurityAuthMode)可选

      mode 枚举:LEGACY_REQUEST_MATCH | MANAGED_IDENTITY | CUSTOM_HEADER

    • managed_identitybody · ManagedIdentityAuthentication可选

      managed_identity

    • custom_headerbody · CustomHeaderAuthentication可选

      custom_header

      • header_namebody · string可选

        header_name

      • valuebody · string可选

        仅由管理面创建/更新请求写入;control-plane 持久化前必须清空。

      • value_sha256body · string可选

        control-plane 生成的数据面精确验证摘要;管理面不得接受调用方写入。

  • namespacebody · string可选

    namespace identifies the environment that owns this rule.

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • trafficSecurityRulebody · TrafficSecurityRule可选

    返回中的 TrafficSecurityRule 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • namebody · string可选

      规则名称

    • descriptionbody · string可选

      规则描述

    • prioritybody · uint32可选

      规则优先级

    • enablebody · bool可选

      是否启用

    • target_servicebody · DestinationService可选

      被调服务,规则只绑定到该服务

      • servicebody · string可选

        Main tuning service and namespace

      • namespacebody · string可选

        namespace

    • policiesbody · TrafficSecurityPolicy[]可选

      policies

      • apisbody · API[]可选

        apis

        • protocolbody · string可选

          API的协议,*或者为空代表全部

        • methodbody · string可选

          API的方法,*或者为空代表全部

        • pathbody · MatchString可选

          API的路径,支持多种匹配方式

          • typebody · enum(MatchStringType)可选

            type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

          • valuebody · string可选

            value

          • value_typebody · enum(ValueType)可选

            value_type 枚举:TEXT | PARAMETER

      • traffic_match_rulebody · TrafficMatchRule可选

        主调、请求头、查询参数、路径、Cookie 等流量匹配条件

        • argumentsbody · SourceMatch[]可选

          arguments

          • typebody · enum(Type)可选

            type 枚举:CUSTOM | METHOD | HEADER | QUERY | CALLER_IP | PATH | COOKIE | CALLER_METADATA | CALLER_SERVICE

          • keybody · string可选

            header key or query key

          • valuebody · MatchString可选

            header value or query value

            • typebody · enum(MatchStringType)可选

              type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

            • valuebody · string可选

              value

            • value_typebody · enum(ValueType)可选

              value_type 枚举:TEXT | PARAMETER

        • random_percentbody · uint32可选

          随机百分比流量匹配, 1-100, 表示百分之几的流量会被匹配到, 默认值为 100

        • matchModebody · enum(TrafficMatchMode)可选

          matchMode 枚举:AND | OR

      • actionbody · enum(TrafficSecurityAction)可选

        命中该策略后的动作 枚举:TRAFFIC_SECURITY_ALLOW | TRAFFIC_SECURITY_DENY

      • reject_effectbody · TrafficSecurityRejectEffect可选

        拒绝调用时的响应效果,仅 action=DENY 时生效

        • codebody · string可选

          业务错误码

        • messagebody · string可选

          拒绝原因

      • managed_callerbody · ManagedCallerSelector可选

        托管身份模式下,从已认证主体中匹配可信来源服务。 不得从调用方自行填写的普通 Header 或 metadata 中取值。

        • any_authenticatedbody · bool可选

          接受任意已通过托管身份认证的服务。

        • callersbody · SourceService[]可选

          callers

          • servicebody · string可选

            Main tuning service and namespace

          • namespacebody · string可选

            namespace

    • ctimebody · string可选

      创建时间

    • mtimebody · string可选

      修改时间

    • metadatabody · map<string,string>可选

      metadata

    • revisionbody · string可选

      规则 revision

    • editablebody · bool可选

      规则的权限操作状态

    • deleteablebody · bool可选

      deleteable

    • authenticationbody · TrafficSecurityAuthentication可选

      规则级认证配置。历史规则缺少该字段时继续按旧请求匹配语义执行。

      • modebody · enum(TrafficSecurityAuthMode)可选

        mode 枚举:LEGACY_REQUEST_MATCH | MANAGED_IDENTITY | CUSTOM_HEADER

      • managed_identitybody · ManagedIdentityAuthentication可选

        managed_identity

      • custom_headerbody · CustomHeaderAuthentication可选

        custom_header

        • header_namebody · string可选

          header_name

        • valuebody · string可选

          仅由管理面创建/更新请求写入;control-plane 持久化前必须清空。

        • value_sha256body · string可选

          control-plane 生成的数据面精确验证摘要;管理面不得接受调用方写入。

    • namespacebody · string可选

      namespace identifies the environment that owns this rule.

请求示例
curl -sS -X PUT 'http://127.0.0.1:8090/naming/v1/traffic/security' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"name":"demo-security","enable":true}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
POST/naming/v1/traffic/security/delete需要鉴权

删除流量鉴权

删除规则;body 为含 id 的数组。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · TrafficSecurityRule[]必填

    请求体为 TrafficSecurityRule 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • namebody · string可选

    规则名称

  • descriptionbody · string可选

    规则描述

  • prioritybody · uint32可选

    规则优先级

  • enablebody · bool可选

    是否启用

  • target_servicebody · DestinationService可选

    被调服务,规则只绑定到该服务

    • servicebody · string可选

      Main tuning service and namespace

    • namespacebody · string可选

      namespace

  • policiesbody · TrafficSecurityPolicy[]可选

    policies

    • apisbody · API[]可选

      apis

      • protocolbody · string可选

        API的协议,*或者为空代表全部

      • methodbody · string可选

        API的方法,*或者为空代表全部

      • pathbody · MatchString可选

        API的路径,支持多种匹配方式

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • traffic_match_rulebody · TrafficMatchRule可选

      主调、请求头、查询参数、路径、Cookie 等流量匹配条件

      • argumentsbody · SourceMatch[]可选

        arguments

        • typebody · enum(Type)可选

          type 枚举:CUSTOM | METHOD | HEADER | QUERY | CALLER_IP | PATH | COOKIE | CALLER_METADATA | CALLER_SERVICE

        • keybody · string可选

          header key or query key

        • valuebody · MatchString可选

          header value or query value

          • typebody · enum(MatchStringType)可选

            type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

          • valuebody · string可选

            value

          • value_typebody · enum(ValueType)可选

            value_type 枚举:TEXT | PARAMETER

      • random_percentbody · uint32可选

        随机百分比流量匹配, 1-100, 表示百分之几的流量会被匹配到, 默认值为 100

      • matchModebody · enum(TrafficMatchMode)可选

        matchMode 枚举:AND | OR

    • actionbody · enum(TrafficSecurityAction)可选

      命中该策略后的动作 枚举:TRAFFIC_SECURITY_ALLOW | TRAFFIC_SECURITY_DENY

    • reject_effectbody · TrafficSecurityRejectEffect可选

      拒绝调用时的响应效果,仅 action=DENY 时生效

      • codebody · string可选

        业务错误码

      • messagebody · string可选

        拒绝原因

    • managed_callerbody · ManagedCallerSelector可选

      托管身份模式下,从已认证主体中匹配可信来源服务。 不得从调用方自行填写的普通 Header 或 metadata 中取值。

      • any_authenticatedbody · bool可选

        接受任意已通过托管身份认证的服务。

      • callersbody · SourceService[]可选

        callers

        • servicebody · string可选

          Main tuning service and namespace

        • namespacebody · string可选

          namespace

  • metadatabody · map<string,string>可选

    metadata

  • authenticationbody · TrafficSecurityAuthentication可选

    规则级认证配置。历史规则缺少该字段时继续按旧请求匹配语义执行。

    • modebody · enum(TrafficSecurityAuthMode)可选

      mode 枚举:LEGACY_REQUEST_MATCH | MANAGED_IDENTITY | CUSTOM_HEADER

    • managed_identitybody · ManagedIdentityAuthentication可选

      managed_identity

    • custom_headerbody · CustomHeaderAuthentication可选

      custom_header

      • header_namebody · string可选

        header_name

      • valuebody · string可选

        仅由管理面创建/更新请求写入;control-plane 持久化前必须清空。

      • value_sha256body · string可选

        control-plane 生成的数据面精确验证摘要;管理面不得接受调用方写入。

  • namespacebody · string可选

    namespace identifies the environment that owns this rule.

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • trafficSecurityRulebody · TrafficSecurityRule可选

    返回中的 TrafficSecurityRule 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • namebody · string可选

      规则名称

    • descriptionbody · string可选

      规则描述

    • prioritybody · uint32可选

      规则优先级

    • enablebody · bool可选

      是否启用

    • target_servicebody · DestinationService可选

      被调服务,规则只绑定到该服务

      • servicebody · string可选

        Main tuning service and namespace

      • namespacebody · string可选

        namespace

    • policiesbody · TrafficSecurityPolicy[]可选

      policies

      • apisbody · API[]可选

        apis

        • protocolbody · string可选

          API的协议,*或者为空代表全部

        • methodbody · string可选

          API的方法,*或者为空代表全部

        • pathbody · MatchString可选

          API的路径,支持多种匹配方式

          • typebody · enum(MatchStringType)可选

            type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

          • valuebody · string可选

            value

          • value_typebody · enum(ValueType)可选

            value_type 枚举:TEXT | PARAMETER

      • traffic_match_rulebody · TrafficMatchRule可选

        主调、请求头、查询参数、路径、Cookie 等流量匹配条件

        • argumentsbody · SourceMatch[]可选

          arguments

          • typebody · enum(Type)可选

            type 枚举:CUSTOM | METHOD | HEADER | QUERY | CALLER_IP | PATH | COOKIE | CALLER_METADATA | CALLER_SERVICE

          • keybody · string可选

            header key or query key

          • valuebody · MatchString可选

            header value or query value

            • typebody · enum(MatchStringType)可选

              type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

            • valuebody · string可选

              value

            • value_typebody · enum(ValueType)可选

              value_type 枚举:TEXT | PARAMETER

        • random_percentbody · uint32可选

          随机百分比流量匹配, 1-100, 表示百分之几的流量会被匹配到, 默认值为 100

        • matchModebody · enum(TrafficMatchMode)可选

          matchMode 枚举:AND | OR

      • actionbody · enum(TrafficSecurityAction)可选

        命中该策略后的动作 枚举:TRAFFIC_SECURITY_ALLOW | TRAFFIC_SECURITY_DENY

      • reject_effectbody · TrafficSecurityRejectEffect可选

        拒绝调用时的响应效果,仅 action=DENY 时生效

        • codebody · string可选

          业务错误码

        • messagebody · string可选

          拒绝原因

      • managed_callerbody · ManagedCallerSelector可选

        托管身份模式下,从已认证主体中匹配可信来源服务。 不得从调用方自行填写的普通 Header 或 metadata 中取值。

        • any_authenticatedbody · bool可选

          接受任意已通过托管身份认证的服务。

        • callersbody · SourceService[]可选

          callers

          • servicebody · string可选

            Main tuning service and namespace

          • namespacebody · string可选

            namespace

    • ctimebody · string可选

      创建时间

    • mtimebody · string可选

      修改时间

    • metadatabody · map<string,string>可选

      metadata

    • revisionbody · string可选

      规则 revision

    • editablebody · bool可选

      规则的权限操作状态

    • deleteablebody · bool可选

      deleteable

    • authenticationbody · TrafficSecurityAuthentication可选

      规则级认证配置。历史规则缺少该字段时继续按旧请求匹配语义执行。

      • modebody · enum(TrafficSecurityAuthMode)可选

        mode 枚举:LEGACY_REQUEST_MATCH | MANAGED_IDENTITY | CUSTOM_HEADER

      • managed_identitybody · ManagedIdentityAuthentication可选

        managed_identity

      • custom_headerbody · CustomHeaderAuthentication可选

        custom_header

        • header_namebody · string可选

          header_name

        • valuebody · string可选

          仅由管理面创建/更新请求写入;control-plane 持久化前必须清空。

        • value_sha256body · string可选

          control-plane 生成的数据面精确验证摘要;管理面不得接受调用方写入。

    • namespacebody · string可选

      namespace identifies the environment that owns this rule.

请求示例
curl -sS -X POST 'http://127.0.0.1:8090/naming/v1/traffic/security/delete' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"id":"<rule-id>"}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
POST/naming/v1/traffic/security/releases需要鉴权

发布流量鉴权

发布 release,使客户端读到 active 视图。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · RuleRelease[]必填

    请求体为 RuleRelease 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • rule_idbody · string可选

    rule_id

  • rule_namebody · string可选

    rule_name

  • release_namebody · string可选

    release_name

  • descriptionbody · string可选

    description

  • release_typebody · string可选

    release_type

  • client_labelsbody · ClientLabel[]可选

    client_labels

    • keybody · string可选

      key

    • valuebody · MatchString可选

      value

      • typebody · enum(MatchStringType)可选

        type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

      • valuebody · string可选

        value

      • value_typebody · enum(ValueType)可选

        value_type 枚举:TEXT | PARAMETER

  • versionbody · uint64可选

    version

  • resourcebody · enum(RuleType)可选

    resource 枚举:

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • ruleReleasebody · RuleRelease可选

    返回中的 RuleRelease 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • rule_idbody · string可选

      rule_id

    • rule_namebody · string可选

      rule_name

    • release_namebody · string可选

      release_name

    • descriptionbody · string可选

      description

    • release_typebody · string可选

      release_type

    • client_labelsbody · ClientLabel[]可选

      client_labels

      • keybody · string可选

        key

      • valuebody · MatchString可选

        value

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • versionbody · uint64可选

      version

    • resourcebody · enum(RuleType)可选

      resource 枚举:

    • activebody · bool可选

      active

    • ctimebody · string可选

      ctime

    • mtimebody · string可选

      mtime

请求示例
curl -sS -X POST 'http://127.0.0.1:8090/naming/v1/traffic/security/releases' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"id":"<rule-id>","release_type":"normal"}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
GET/naming/v1/traffic/security/releases需要鉴权

查询流量鉴权发布

查询已发布版本。

  • Authorizationheader · string必填

    登录返回的 token。

  • idquery · string可选

    规则 ID。

  • limitquery · integer可选

    分页大小。

请求示例
curl -sS 'http://127.0.0.1:8090/naming/v1/traffic/security/releases?limit=20' \
  -H "Authorization: $TOKEN"
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
PUT/naming/v1/traffic/security/releases/stopbeta需要鉴权

停止流量鉴权灰度

停止灰度 release。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · RuleRelease[]必填

    请求体为 RuleRelease 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • rule_idbody · string可选

    rule_id

  • rule_namebody · string可选

    rule_name

  • release_namebody · string可选

    release_name

  • descriptionbody · string可选

    description

  • release_typebody · string可选

    release_type

  • client_labelsbody · ClientLabel[]可选

    client_labels

    • keybody · string可选

      key

    • valuebody · MatchString可选

      value

      • typebody · enum(MatchStringType)可选

        type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

      • valuebody · string可选

        value

      • value_typebody · enum(ValueType)可选

        value_type 枚举:TEXT | PARAMETER

  • versionbody · uint64可选

    version

  • resourcebody · enum(RuleType)可选

    resource 枚举:

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • ruleReleasebody · RuleRelease可选

    返回中的 RuleRelease 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • rule_idbody · string可选

      rule_id

    • rule_namebody · string可选

      rule_name

    • release_namebody · string可选

      release_name

    • descriptionbody · string可选

      description

    • release_typebody · string可选

      release_type

    • client_labelsbody · ClientLabel[]可选

      client_labels

      • keybody · string可选

        key

      • valuebody · MatchString可选

        value

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • versionbody · uint64可选

      version

    • resourcebody · enum(RuleType)可选

      resource 枚举:

    • activebody · bool可选

      active

    • ctimebody · string可选

      ctime

    • mtimebody · string可选

      mtime

请求示例
curl -sS -X PUT 'http://127.0.0.1:8090/naming/v1/traffic/security/releases/stopbeta' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"id":"<rule-id>"}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
POST/naming/v1/traffic/security/releases/delete需要鉴权

删除发布

删除发布。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · RuleRelease[]必填

    请求体为 RuleRelease 的 JSON 数组;下列为单条字段。

  • idbody · string可选

    id

  • rule_idbody · string可选

    rule_id

  • rule_namebody · string可选

    rule_name

  • release_namebody · string可选

    release_name

  • descriptionbody · string可选

    description

  • release_typebody · string可选

    release_type

  • client_labelsbody · ClientLabel[]可选

    client_labels

    • keybody · string可选

      key

    • valuebody · MatchString可选

      value

      • typebody · enum(MatchStringType)可选

        type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

      • valuebody · string可选

        value

      • value_typebody · enum(ValueType)可选

        value_type 枚举:TEXT | PARAMETER

  • versionbody · uint64可选

    version

  • resourcebody · enum(RuleType)可选

    resource 枚举:

  • codebody · uint32必填

    业务码。

  • infobody · string可选

    提示信息。

  • RuleReleasebody · RuleRelease可选

    实体字段。

    • idbody · string可选

      id

    • rule_idbody · string可选

      rule_id

    • rule_namebody · string可选

      rule_name

    • release_namebody · string可选

      release_name

    • descriptionbody · string可选

      description

    • release_typebody · string可选

      release_type

    • client_labelsbody · ClientLabel[]可选

      client_labels

      • keybody · string可选

        key

      • valuebody · MatchString可选

        value

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • versionbody · uint64可选

      version

    • resourcebody · enum(RuleType)可选

      resource 枚举:

    • activebody · bool可选

      active

    • ctimebody · string可选

      ctime

    • mtimebody · string可选

      mtime

请求示例
curl -sS -X POST 'http://127.0.0.1:8090/naming/v1/traffic/security/releases/delete' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[]'
响应示例
{
  "code": 200000,
  "info": "execute success"
}

On this page