GetConsumerAuthorizationRule - 获取消费者授权规则

更新时间:
复制 MD 格式

获取消费者授权规则。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

apig:GetConsumerAuthorizationRule

none

*Domain

acs:apig:{#regionId}:{#accountId}:consumer/{#ConsumerId}

无 无

请求语法

GET /v1/consumers/{consumerId}/authorization-rules/{consumerAuthorizationRuleId} HTTP/1.1

路径参数

名称

类型

必填

描述

示例值

consumerAuthorizationRuleId

string

否

根据特定的消费者授权规则 ID 过滤接口列表,响应中的接口列表仅包含已授权的接口。

car-ctgdn8em1hko5krqq03g

consumerId

string

否

消费者 ID。

cs-ctgdn2um1hkossul8gvg

请求参数

名称

类型

必填

描述

示例值

当前API无需请求参数

返回参数

名称

类型

描述

示例值

object

Schema of Response

requestId

string

Id of the request

53102737-1E4E-5A8B-8E0A-4184B0959B84

consumerId

string

消费者 ID。

cs-ctgdn2um1hkossul8gvg

consumerAuthorizationRuleId

string

根据特定的消费者授权规则 ID 过滤接口列表,响应中的接口列表仅包含已授权的接口。

car-ctgdn8em1hko5krqq03g

apiInfo HttpApiApiInfo

API 信息。

environmentInfo EnvironmentInfo

环境信息。

gatewayInfo GatewayInfo

网关信息。

resourceType

string

资源类型。

API

expireStatus

string

失效状态。

true

expireMode

string

失效模式。LongTerm、ShortTerm,二选一。

LongTerm

expireTimestamp

integer

到期时间。

1750852089975

createTimestamp

integer

创建时间戳。单位: 毫秒。

1750852089975

updateTimestamp

integer

更新时间戳。单位: 毫秒。

1750852089975

deployStatus

string

API 在当前环境的发布状态

""

示例

正常返回示例

JSON格式

{
  "requestId": "53102737-1E4E-5A8B-8E0A-4184B0959B84",
  "consumerId": "cs-ctgdn2um1hkossul8gvg",
  "consumerAuthorizationRuleId": "car-ctgdn8em1hko5krqq03g",
  "apiInfo": {
    "httpApiId": "api-xxx",
    "name": "test",
    "basePath": "/v1",
    "description": "测试专用API",
    "versionInfo": {
      "enable": true,
      "scheme": "Query",
      "headerName": "my-version",
      "queryName": "myVersion",
      "version": "v1"
    },
    "ingressInfo": {
      "sourceId": "src-xxx",
      "ingressClass": "mse",
      "watchNamespace": "default",
      "environmentInfo": {
        "environmentId": "env-xxx"
      },
      "k8sClusterInfo": {
        "clusterId": "ca435c77cba1547cca9311957bcxxxxxx"
      },
      "overrideIngressIp": true
    },
    "type": "Rest",
    "resourceGroupId": "rg-xxx",
    "enableAuth": true,
    "authConfig": {
      "authType": "Jwt",
      "authMode": "NoAuth"
    },
    "gatewayId": "gw-cpv4sqdl****",
    "modelCategory": "Text",
    "protocols": [
      "HTTP"
    ],
    "environments": [
      {
        "environmentId": "env-xxx",
        "backendScene": "SingleService",
        "backendType": "Service",
        "serviceConfigs": [
          {
            "gatewayServiceId": "gs-xxx",
            "name": "demo-service",
            "protocol": "HTTP",
            "port": "8080",
            "weight": 100,
            "version": "v1",
            "match": {
              "default": true,
              "conditions": [
                {
                  "type": "Query",
                  "key": "color",
                  "value": "gray",
                  "operator": "equal"
                }
              ]
            },
            "serviceId": "svc-xxx"
          }
        ],
        "customDomains": [
          {
            "domainId": "d-xxx",
            "name": "www.example.com",
            "protocol": "HTTP"
          }
        ],
        "name": "test",
        "alias": "test",
        "gatewayInfo": {
          "gatewayId": "gw-xxx",
          "name": "test",
          "gatewayEdition": "MultiTenantServerless"
        },
        "deployStatus": "Deployed",
        "subDomains": [
          {
            "domainId": "d-xxx",
            "name": "www.example.com",
            "protocol": "HTTP",
            "networkType": "Internet"
          }
        ]
      }
    ],
    "aiProtocols": [
      "OpenAI/v1"
    ],
    "deployConfigs": [
      {
        "environmentId": "env-xxx",
        "backendScene": "SingleService",
        "enableSystemModels": true,
        "systemModelTiers": [
          "economy"
        ],
        "autoDeploy": true,
        "gatewayId": "gw-xx",
        "dfpConfig": {
          "serviceId": "svc-cr8k0udlhtgt80sh7png"
        },
        "restApiRouteMode": "ordinary",
        "routeBackend": {
          "scene": "Single",
          "enableSystemModels": true,
          "services": [
            {
              "serviceId": "service-cq2bmmdlhtgj***",
              "modelName": "qwen-plus",
              "name": "item-service",
              "protocol": "HTTP",
              "port": 0,
              "weight": 49,
              "version": "v1",
              "sourceType": "MSE_NACOS",
              "groupName": "DEFAULT_GROUP",
              "namespace": "public",
              "httpDubboTranscoder": {
                "dubboServiceName": "com.example.DemoService",
                "dubboServiceVersion": "1.0.0",
                "dubboServiceGroup": "DEV",
                "methodMapList": [
                  {
                    "dubboMethodName": "sayName",
                    "httpMethod": "ALL_GET",
                    "methodPath": "/mytestzbk/sayhello",
                    "passThroughAllHeaders": "PASS_NOT",
                    "passThroughList": [
                      "[\"x-request-id\", \"x-tenant\"]"
                    ],
                    "paramMapsList": [
                      {
                        "extractKeySpec": "ALL_QUERY_PARAMETER",
                        "extractKey": "name",
                        "mappingType": "java.lang.String"
                      }
                    ]
                  }
                ]
              }
            }
          ]
        },
        "gatewayInfo": {
          "gatewayId": "gw-cq7og15lhtgi6qasrj60",
          "name": "apitest-gw",
          "vpcInfo": {
            "vpcId": "vpc-uf664nyle5kh***",
            "name": "商品中心预发环境专有网络"
          },
          "engineVersion": "2.0.7",
          "gatewayEdition": "MultiTenantServerless"
        },
        "mock": {
          "enable": false,
          "responseCode": 200,
          "responseContent": "Mock测试"
        },
        "gatewayType": "API",
        "customDomainIds": [
          "d-xxx"
        ],
        "envDomainIds": [
          "d-xxx"
        ],
        "serviceConfigs": [
          {
            "serviceId": "svc-xxx",
            "weight": 100,
            "modelNamePattern": "qwen-*",
            "modelName": "qwen-max",
            "capabilityTier": "standard",
            "intentCode": "INQUIRY",
            "match": {
              "default": true,
              "conditions": [
                {
                  "type": "Query",
                  "key": "color",
                  "value": "gray",
                  "operator": "equal"
                }
              ]
            },
            "port": 80,
            "protocol": "HTTP",
            "gatewayServiceId": "gw-svc-abc123",
            "name": "Qwen-Max-Service",
            "version": "V2",
            "multiServiceRouteStrategy": "ByWeight",
            "observabilityRouteConfig": {
              "mode": "LeastBusy",
              "rateLimit": 0.8,
              "queueSize": 100
            }
          }
        ],
        "policyConfigs": [
          {
            "type": "K8S",
            "enable": false,
            "semanticRouterConfig": {
              "timeoutMillisecond": 2000
            },
            "aiFallbackConfig": {
              "onlyRedirectUpstreamCode": true,
              "serviceConfigs": [
                {
                  "serviceId": "svc-bbb",
                  "name": "—",
                  "targetModelName": "qwen-max",
                  "passThroughModelName": false
                }
              ]
            },
            "aiSecurityGuardConfig": {
              "defaultGenerated": true,
              "longTermEnabled": true,
              "serviceAddress": "https://green-cip-vpc.cn-shanghai.aliyuncs.com",
              "checkRequest": true,
              "checkResponse": true,
              "checkRequestImage": false,
              "checkResponseImage": false,
              "requestCheckService": "query_security_check",
              "responseCheckService": "response_security_check",
              "requestImageCheckService": "img_query_guard",
              "responseImageCheckService": "img_response_guard",
              "riskAlertLevel": "high",
              "bufferLimit": 1000,
              "pluginStatus": {
                "serviceHealthy": true,
                "pluginId": "pi-xxx",
                "errorLogs": [
                  {
                    "key": "[{\"timestamp\":\"2026-06-29T10:00:00Z\",\"message\":\"redis connection timeout\"}]"
                  }
                ]
              },
              "consumerConfigBindings": [
                {
                  "matchType": "exact",
                  "name": "example-consumer",
                  "templateId": "apig_0123456789abcdef"
                }
              ],
              "consumerRiskLevel": [
                {
                  "name": "consumer-a",
                  "matchType": "exact",
                  "type": "ContentModeration",
                  "level": "high"
                }
              ],
              "consumerRequestCheckService": [
                {
                  "name": "consumer-a",
                  "requestCheckService": "query_security_check",
                  "requestImageCheckService": "img_query_guard",
                  "matchType": "exact",
                  "modalityType": "Text"
                }
              ],
              "consumerResponseCheckService": [
                {
                  "name": "consumer-a\n",
                  "responseCheckService": "query_security_check",
                  "responseImageCheckService": "img_query_guard\n",
                  "matchType": "exact",
                  "modalityType": "Text"
                }
              ],
              "riskConfig": [
                {
                  "type": "ContentModeration",
                  "level": "high",
                  "consumerRules": {
                    "pattern": "consumer-a",
                    "matchType": "Exact"
                  }
                }
              ]
            },
            "aiTokenRateLimitConfig": {
              "redisConfig": {
                "host": "r-xxx.redis.rds.aliyuncs.com",
                "port": 6379,
                "username": "user",
                "password": "pass",
                "timeout": 5000,
                "databaseNumber": 0
              },
              "pluginStatus": {
                "serviceHealthy": true,
                "pluginId": "pi-xxx",
                "errorLogs": [
                  {
                    "key": "[{\"timestamp\":\"2026-06-29T10:00:00Z\",\"message\":\"redis connection timeout\"}]"
                  }
                ]
              },
              "rules": [
                {
                  "limitType": "Consumer",
                  "matchKey": "X-API-Key",
                  "matchType": "Exact",
                  "matchValue": "consumer-a",
                  "limitMode": "TokenPerMinute",
                  "limitValue": 1000
                }
              ],
              "globalRules": [
                {
                  "limitType": "Consumer",
                  "matchKey": "X-API-Key",
                  "matchType": "Exact",
                  "matchValue": "consumer-a",
                  "limitMode": "TokenPerMinute",
                  "limitValue": 1000
                }
              ],
              "enableGlobalRules": true
            },
            "policyReference": {
              "policyId": "pol-9f2exxx",
              "policyAttachmentId": "pa-3c8ayyy"
            },
            "aiCacheConfig": {
              "cacheTTL": 3600,
              "redisConfig": {
                "host": "r-xxx.redis.rds.aliyuncs.com",
                "port": 6379,
                "username": "user",
                "password": "pass",
                "timeout": 5000,
                "databaseNumber": 0
              },
              "vectorConfig": {
                "type": "dashvector",
                "serviceHost": "vdb-xxx.dashvector.aliyuncs.com",
                "apiKey": "sk-xxx",
                "timeout": 5000,
                "collectionId": "col-xxx",
                "threshold": 0.95
              },
              "embeddingConfig": {
                "type": "dashscope",
                "serviceId": "svc-xxx",
                "timeout": 5000,
                "modelName": "text-embedding-v2"
              },
              "cacheKeyStrategy": "-",
              "cacheMode": "exact",
              "pluginStatus": {
                "serviceHealthy": true,
                "pluginId": "pi-xxx",
                "errorLogs": [
                  {
                    "key": "[{\"timestamp\":\"2026-06-29T10:00:00Z\",\"message\":\"redis connection timeout\"}]"
                  }
                ]
              }
            },
            "aiNetworkSearchConfig": {
              "needReference": true,
              "referenceFormat": "参考来源:\\n%s",
              "referenceLocation": "head",
              "defaultLang": "zh-CN",
              "defaultEnable": true,
              "searchFrom": [
                {
                  "type": "aliyunQuark",
                  "apiKey": "sk-xxx",
                  "count": 5,
                  "start": 0,
                  "timeoutMillisecond": 5000,
                  "optionArgs": {
                    "key": "{\"market\":\"zh-CN\"}"
                  },
                  "endpoint": "https://cloud-iqs.aliyuncs.com",
                  "contentMode": "summary",
                  "industry": "互联网",
                  "timeRange": "7d"
                }
              ],
              "searchEngineConfig": {
                "type": "aliyunQuark",
                "apiKey": "sk-xxx",
                "count": 5,
                "start": 0,
                "timeoutMillisecond": 5000,
                "optionArgs": {
                  "key": "{\"market\":\"zh-CN\"}"
                },
                "endpoint": "https://cloud-iqs.aliyuncs.com",
                "contentMode": "summary",
                "industry": "互联网",
                "timeRange": "7d"
              },
              "searchRewrite": {
                "enable": true,
                "serviceId": "svc-xxx",
                "modelName": "qwen-max",
                "timeoutMillisecond": 5000,
                "maxCount": 3
              }
            },
            "aiToolSelectionConfig": {
              "enableConditions": {
                "toolCountThreshold": 10
              },
              "toolReranking": {
                "modelService": {
                  "serviceId": "svc-xxx\n",
                  "modelName": "gte-rerank-v2",
                  "timeoutMillisecond": 5000
                },
                "filteringMethod": "topN",
                "topKPercent": 50,
                "topNCount": 5,
                "scoreThreshold": 0.5,
                "fallbackStrategy": "skip"
              },
              "queryRewriting": {
                "enabled": true,
                "modelService": {
                  "serviceId": "svc-xxx",
                  "modelName": "gte-rerank-v2",
                  "timeoutMillisecond": 5000
                },
                "promptConfig": {
                  "type": "builtIn",
                  "customPrompt": "请将以下用户问题改写为..."
                },
                "maxOutputTokens": 50,
                "triggerConditions": {
                  "messageCountThreshold": 1
                },
                "contextSelection": {
                  "type": "allMessages",
                  "value": 5
                },
                "fallbackStrategy": "skip"
              }
            },
            "aiStatisticsConfig": {
              "logRequestContent": true,
              "logResponseContent": true,
              "pathFieldConfigs": [
                {
                  "path": "/v1/chat/completions",
                  "fieldPaths": {
                    "key": {
                      "fieldKey": "question",
                      "jsonPath": "messages.#.content",
                      "rule": "append",
                      "name": "问题内容",
                      "description": "用户输入的问题内容",
                      "source": "request_body",
                      "category": "conversation",
                      "io": "request",
                      "sensitive": false,
                      "recordEnabled": true
                    }
                  }
                }
              ]
            }
          }
        ],
        "customDomainInfos": [
          {
            "domainId": "d-cshee6dlhtgk******",
            "name": "hello-server.com",
            "protocol": "HTTP"
          }
        ],
        "envDomainInfos": [
          {
            "domainId": "d-env-xxx",
            "name": "api.example.com",
            "protocol": "HTTPS"
          }
        ],
        "subDomains": [
          {
            "domainId": "d-csmn42um******",
            "name": "test",
            "protocol": "HTTP",
            "networkType": "Intranet"
          }
        ],
        "builtinRouteNames": [
          "[\"chat\",\"completions\"]"
        ]
      }
    ],
    "deployCntMap": {
      "key": {
        "deployedCnt": 3,
        "cnt": 10
      }
    },
    "agentProtocols": [
      "DashScope"
    ]
  },
  "environmentInfo": {
    "environmentId": "env-cq7l5s5lhtgi6qasrdc0",
    "name": "test",
    "alias": "测试环境",
    "description": "这是xxx的xx项目测试环境",
    "gatewayInfo": {
      "gatewayId": "gw-cq7og15lhtgi6qasrj60",
      "name": "apitest-gw",
      "vpcInfo": {
        "vpcId": "vpc-uf664nyle5kh***",
        "name": "商品中心预发环境专有网络"
      },
      "engineVersion": "2.0.7",
      "gatewayEdition": "MultiTenantServerless"
    },
    "subDomainInfos": [
      {
        "domainId": "d-cpudb0llhtgl2djvq2sg",
        "name": "abc.com",
        "protocol": "HTTP",
        "networkType": "Intranet"
      }
    ],
    "default": false,
    "createTimestamp": 1721116090326,
    "updateTimestamp": 1721116090326,
    "resourceGroupId": "rg-xxxx"
  },
  "gatewayInfo": {
    "gatewayId": "gw-cq7og15lhtgi6qasrj60",
    "name": "apitest-gw",
    "vpcInfo": {
      "vpcId": "vpc-uf664nyle5kh***",
      "name": "商品中心预发环境专有网络"
    },
    "engineVersion": "2.0.7",
    "gatewayEdition": "MultiTenantServerless"
  },
  "resourceType": "API",
  "expireStatus": "true",
  "expireMode": "LongTerm",
  "expireTimestamp": 1750852089975,
  "createTimestamp": 1750852089975,
  "updateTimestamp": 1750852089975,
  "deployStatus": "\"\""
}

错误码

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。