云服务器内容精选

  • URI GET /v5/iot/{project_id}/routing-rule/flowcontrol-policy/{policy_id} 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 参数说明:项目ID。获取方法请参见 获取项目ID 。 policy_id 是 String 参数说明:数据流转流控策略id,用于唯一标识一个数据流转流控策略,在创建数据流转流控策略时由物联网平台分配获得。
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 policy_id String 参数说明:数据流转流控策略id,用于唯一标识一个数据流转流控策略,在创建数据流转流控策略时由物联网平台分配获得。 policy_name String 参数说明:数据流转流控策略名称。 取值范围:长度不超过256,只允许中文、字母、数字、以及_?'#().,&%@!-等字符的组合。 最小长度:1 最大长度:256 description String 参数说明:用户自定义的数据流转流控策略描述。 取值范围:长度不超过256,只允许中文、字母、数字、以及_?'#().,&%@!-等字符的组合。 最小长度:1 最大长度:256 scope String 参数说明:流控策略作用域. 取值范围: USER:租户级流控策略。 CHANNEL:转发通道级流控策略。 RULE:转发规则级流控策略。 ACTION:转发动作级流控策略。 scope_value String 参数说明:流控策略作用域附加值。 scope取值为USER时,可不携带该字段,表示租户级流控。 scope取值为CHANNEL时,取值范围:HTTP_FORWARDING、DIS_FORWARDING、OBS_FORWARDING、AMQP_FORWARDING、DMS_KAFKA_FORWARDING。 scope取值为RULE时,该字段为对应的ruleId。 scope取值为ACTION时,该字段为对应的actionId。 limit Integer 参数说明:数据转发流控大小。单位为tps,取值范围为1~1000的整数,默认为1000. 最小值:1 最大值:1000 缺省值:1000
  • 响应示例 状态码: 200 Ok { "policy_id" : "adadd5cb-6383-4b5b-a65c-f8c92fdf3c34", "policy_name" : "policyName", "description" : "description", "scope" : "CHANNEL", "scope_value" : "HTTP_FORWARDING", "limit" : 10 }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 否 String 参数说明:用户Token。通过调用IAM服务获取IAM用户Token接口获取,接口返回的响应消息头中“X-Subject-Token”就是需要获取的用户Token。简要的获取方法样例请参见 Token认证。 Instance-Id 否 String 参数说明:实例ID。物理多租下各实例的唯一标识,一般华为云租户无需携带该参数,仅在物理多租场景下从管理面访问API时需要携带该参数。您可以在IoTDA管理控制台界面,选择左侧导航栏“总览”页签查看当前实例的ID。
  • 响应示例 状态码: 200 OK { "total" : 1, "size" : 1, "throttles" : [ { "name" : "throttle_demo", "create_time" : "2020-07-31T08:44:02.205366118Z", "remark" : "Total: 800 calls/second; user: 500 calls/second; app: 300 calls/second; IP address: 600 calls/second", "type" : 1, "time_interval" : 1, "ip_call_limits" : 600, "app_call_limits" : 300, "time_unit" : "SECOND", "api_call_limits" : 800, "id" : "3437448ad06f4e0c91a224183116e965", "user_call_limits" : 500, "enable_adaptive_control" : "FALSE", "bind_num" : 0, "is_inclu_special_throttle" : 2 } ] } 状态码: 400 Bad Request { "error_code" : "APIG.2012", "error_msg" : "Invalid parameter value,parameterName:name. Please refer to the support documentation" } 状态码: 401 Unauthorized { "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" } 状态码: 403 Forbidden { "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method" } 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error" }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 size Integer 本次返回的列表长度 total Long 满足条件的记录数 throttles Array of ThrottlesInfo objects 本次查询到的流控策略列表 表5 ThrottlesInfo 参数 参数类型 描述 app_call_limits Integer APP流量限制是指一个API在时长之内被每个APP访问的次数上限,该数值不超过用户流量限制值。输入的值不超过2147483647。正整数。 name String 流控策略名称。支持汉字,英文,数字,下划线,且只能以英文和汉字开头,3 ~ 64字符。 说明: 中文字符必须为UTF-8或者unicode编码。 time_unit String 流控的时间单位 枚举值: SECOND MINUTE HOUR DAY remark String 流控策略描述字符长度不超过255。 说明: 中文字符必须为UTF-8或者unicode编码。 api_call_limits Integer API流量限制是指时长内一个API能够被访问的次数上限。该值不超过系统默认配额限制,系统默认配额为200tps,用户可根据实际情况修改该系统默认配额。输入的值不超过2147483647。正整数。 type Integer 流控策略的类型 1:基础,表示绑定到流控策略的单个API流控时间内能够被调用多少次。 2:共享,表示绑定到流控策略的所有API流控时间内能够被调用多少次。 枚举值: 1 2 enable_adaptive_control String 是否开启动态流控: TRUE FALSE 暂不支持 user_call_limits Integer 用户流量限制是指一个API在时长之内每一个用户能访问的次数上限,该数值不超过API流量限制值。输入的值不超过2147483647。正整数。 time_interval Integer 流量控制的时长单位。与“流量限制次数”配合使用,表示单位时间内的API请求次数上限。输入的值不超过2147483647。正整数。 ip_call_limits Integer 源IP流量限制是指一个API在时长之内被每个IP访问的次数上限,该数值不超过API流量限制值。输入的值不超过2147483647。正整数。 id String 流控策略的ID bind_num Integer 流控绑定的API数量 is_inclu_special_throttle Integer 是否包含特殊流控配置 1:包含 2:不包含 枚举值: 1 2 create_time String 创建时间 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 401 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 403 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 500 表9 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述
  • URI GET /v2/{project_id}/apigw/instances/{instance_id}/throttles 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID,获取方式请参见获取项目ID。 instance_id 是 String 实例ID,在API网关控制台的“实例信息”中获取。 表2 Query参数 参数 是否必选 参数类型 描述 offset 否 Long 偏移量,表示从此偏移量开始查询,偏移量小于0时,自动转换为0 缺省值:0 limit 否 Integer 每页显示的条目数量,条目数量小于等于0时,自动转换为20,条目数量大于500时,自动转换为500 最小值:1 最大值:500 缺省值:20 id 否 String 流控策略编号 name 否 String 流控策略名称 precise_search 否 String 指定需要精确匹配查找的参数名称,目前仅支持name
  • 响应示例 状态码: 200 OK { "total" : 1, "size" : 1, "throttles" : [ { "name" : "throttle_demo", "create_time" : "2020-07-31T08:44:02.205366118Z", "remark" : "Throttling Policy 1", "type" : 1, "time_interval" : 1, "ip_call_limits" : 600, "app_call_limits" : 300, "time_unit" : "SECOND", "api_call_limits" : 800, "id" : "3437448ad06f4e0c91a224183116e965", "user_call_limits" : 0, "enable_adaptive_control" : "FALSE", "bind_num" : 0, "is_inclu_special_throttle" : 2 } ] } 状态码: 400 Bad Request { "error_code" : "APIG.2012", "error_msg" : "Invalid parameter value,parameterName:name. Please refer to the support documentation" } 状态码: 401 Unauthorized { "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" } 状态码: 403 Forbidden { "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method" } 状态码: 404 Not Found { "error_code" : "APIG.3030", "error_msg" : "The instance does not exist;id:f0fa1789-3b76-433b-a787-9892951c620ec" } 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error" }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 size Integer 本次返回的列表长度 total Long 满足条件的记录数 throttles Array of ThrottlesInfo objects 本次查询到的流控策略列表 表5 ThrottlesInfo 参数 参数类型 描述 app_call_limits Integer APP流量限制是指一个API在时长之内被每个APP访问的次数上限,该数值不超过用户流量限制值。输入的值不超过2147483647。正整数。 name String 流控策略名称。支持汉字,英文,数字,下划线,且只能以英文和汉字开头,3 ~ 64字符。 说明: 中文字符必须为UTF-8或者unicode编码。 time_unit String 流控的时间单位 remark String 流控策略描述字符长度不超过255。 说明: 中文字符必须为UTF-8或者unicode编码。 api_call_limits Integer API流量限制是指时长内一个API能够被访问的次数上限。该值不超过系统默认配额限制,系统默认配额为200tps,用户可根据实际情况修改该系统默认配额。输入的值不超过2147483647。正整数。 type Integer 流控策略的类型 1:基础,表示绑定到流控策略的单个API流控时间内能够被调用多少次。 2:共享,表示绑定到流控策略的所有API流控时间内能够被调用多少次。 enable_adaptive_control String 是否开启动态流控: TRUE FALSE 暂不支持 user_call_limits Integer 用户流量限制是指一个API在时长之内每一个用户能访问的次数上限,该数值不超过API流量限制值。输入的值不超过2147483647。正整数。 time_interval Integer 流量控制的时长单位。与“流量限制次数”配合使用,表示单位时间内的API请求次数上限。输入的值不超过2147483647。正整数。 ip_call_limits Integer 源IP流量限制是指一个API在时长之内被每个IP访问的次数上限,该数值不超过API流量限制值。输入的值不超过2147483647。正整数。 id String 流控策略的ID bind_num Integer 流控绑定的API数量 is_inclu_special_throttle Integer 是否包含特殊流控配置 1:包含 2:不包含 create_time String 创建时间 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 401 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 403 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 404 表9 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 500 表10 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述
  • 响应示例 状态码: 200 OK { "name" : "throttle_demo", "create_time" : "2020-07-31T08:44:02.205366118Z", "remark" : "Throttling Policy 1", "type" : 1, "time_interval" : 1, "ip_call_limits" : 600, "app_call_limits" : 300, "time_unit" : "SECOND", "api_call_limits" : 800, "id" : "3437448ad06f4e0c91a224183116e965", "user_call_limits" : 0, "enable_adaptive_control" : "FALSE", "bind_num" : 0, "is_inclu_special_throttle" : 2 } 状态码: 401 Unauthorized { "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" } 状态码: 403 Forbidden { "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method" } 状态码: 404 Not Found { "error_code" : "APIG.3005", "error_msg" : "Request throttling policy 3437448ad06f4e0c91a224183116e965 does not exist" } 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error" }
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 app_call_limits Integer APP流量限制是指一个API在时长之内被每个APP访问的次数上限,该数值不超过用户流量限制值。输入的值不超过2147483647。正整数。 name String 流控策略名称。支持汉字,英文,数字,下划线,且只能以英文和汉字开头,3 ~ 64字符。 说明: 中文字符必须为UTF-8或者unicode编码。 time_unit String 流控的时间单位 remark String 流控策略描述字符长度不超过255。 说明: 中文字符必须为UTF-8或者unicode编码。 api_call_limits Integer API流量限制是指时长内一个API能够被访问的次数上限。该值不超过系统默认配额限制,系统默认配额为200tps,用户可根据实际情况修改该系统默认配额。输入的值不超过2147483647。正整数。 type Integer 流控策略的类型 1:基础,表示绑定到流控策略的单个API流控时间内能够被调用多少次。 2:共享,表示绑定到流控策略的所有API流控时间内能够被调用多少次。 enable_adaptive_control String 是否开启动态流控: TRUE FALSE 暂不支持 user_call_limits Integer 用户流量限制是指一个API在时长之内每一个用户能访问的次数上限,该数值不超过API流量限制值。输入的值不超过2147483647。正整数。 time_interval Integer 流量控制的时长单位。与“流量限制次数”配合使用,表示单位时间内的API请求次数上限。输入的值不超过2147483647。正整数。 ip_call_limits Integer 源IP流量限制是指一个API在时长之内被每个IP访问的次数上限,该数值不超过API流量限制值。输入的值不超过2147483647。正整数。 id String 流控策略的ID bind_num Integer 流控绑定的API数量 is_inclu_special_throttle Integer 是否包含特殊流控配置 1:包含 2:不包含 create_time String 创建时间 状态码: 401 表4 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 403 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 404 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 500 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述
  • 响应消息 表4 参数说明 参数 类型 说明 id String 流控策略的ID name String 流控策略的名称 api_call_limits Integer 单个API流控时间内能够被访问的次数限制 user_call_limits Integer 单个用户流控时间内能够访问API的次数限制 app_call_limits Integer 单个APP流控时间内能够访问API的次数限制 ip_call_limits Integer 单个IP流控时间内能够访问API的次数限制 time_interval Integer 流控的时长 time_unit String 流控的时间单位 remark String 描述 create_time Timestamp 创建时间 is_include_special_throttle Integer 是否包含特殊流控配置: 1:包含 2:不包含 type Integer 流控策略的类型,取值如下: 1 独享 2 共享 bind_num Integer 流控绑定的API数量 enable_adaptive_control String 是否开启动态流控: TRUE FALSE 暂不支持 响应消息样例: {"id": "0325b671-2d50-4614-9868-22102262695d","name": "每秒1000次","api_call_limits": 1000,"user_call_limits": 500,"app_call_limits": 300, "ip_call_limits": 600,"time_interval": 1,"time_unit": "SECOND","create_time": "2017-12-29T01:55:59Z","remark": "API每秒1000次,用户500次,APP300次,IP600次","is_inclu_special_throttle": 2, "type":1,"bind_num": 0, "enable_adaptive_control": "FALSE"}
  • 请求消息 表3 参数说明 参数 是否必选 类型 说明 name 是 String 流控策略名称。 支持汉字,英文,数字,下划线,且只能以英文和汉字开头,3 ~ 64字符。 说明: 中文字符必须为UTF-8或者unicode编码。 api_call_limits 是 Integer API流量限制是指时长内一个API能够被访问的次数上限。该值不超过系统默认配额限制,系统默认配额为200tps,用户可根据实际情况修改该系统默认配额。输入的值不超过2147483647。正整数。 user_call_limits 否 Integer 用户流量限制是指一个API在时长之内每一个用户能访问的次数上限,该数值不超过API流量限制值。输入的值不超过2147483647。正整数。 app_call_limits 否 Integer APP流量限制是指一个API在时长之内被每个APP访问的次数上限,该数值不超过用户流量限制值。输入的值不超过2147483647。正整数。 ip_call_limits 否 Integer 源IP流量限制是指一个API在时长之内被每个IP访问的次数上限,该数值不超过API流量限制值。输入的值不超过2147483647。正整数。 time_interval 是 Integer 流量控制的时长单位。与“流量限制次数”配合使用,表示单位时间内的API请求次数上限。输入的值不超过2147483647。正整数。 time_unit 是 String 流控的时间单位: SECOND MINUTE HOUR DAY remark 否 String 流控策略描述 字符长度不超过255。 说明: 中文字符必须为UTF-8或者unicode编码。 type 否 Integer 流控策略的类型,取值如下: 1:独享,表示绑定到流控策略的单个API流控时间内能够被调用多少次 2:共享,表示绑定到流控策略的所有API流控时间内能够被调用多少次 enable_adaptive_control 否 String 是否开启动态流控: TRUE FALSE 暂不支持 请求消息样例: {"api_call_limits": 1000, "user_call_limits": 500,"app_call_limits": 300, "ip_call_limits": 600,"name": "每秒1000次","remark": "API每秒1000次,用户500次,APP300次,IP600次","time_interval": 1,"time_unit": "SECOND"}
  • URI HTTP/HTTPS请求方法以及URI如下表所示。 表1 HTTP/HTTPS请求方法以及URI 请求方法 URI DELETE /v1/{project_id}/apigw/instances/{instance_id}/throttles/{id} URI中的参数说明如下表所示。 表2 参数说明 名称 是否必选 类型 说明 project_id 是 String 项目ID。可从控制台“我的凭证”中获取region下项目ID,管理员权限可查询。 instance_id 是 String 实例ID,可从API网关控制台的专享版实例信息中获取。 id 是 String 流控策略的ID。