更新时间:2023-04-20 GMT+08:00
分享

APIG.Throttle

模型说明

流量控制可限制单位时间内API的被调用次数,保护后端服务。当API上线后,系统会默认给每个API提供一个访问控制策略,API提供者可以根据自身API的服务能力及负载情况变更这个访问控制策略。

模型属性

表1 模型定义属性说明

属性

是否必选

描述

timeInterval

流量控制的单位时间

参数类型:integer

取值说明:与"流量限制次数" 配合使用,表示单位时间内的API请求次数上限。输入的值为正整数且不超过2147483647。

取值约束:不超过2147483647的正整数

remark

流控策略描述

参数类型:string

取值说明:字符长度不超过255

取值约束:长度不超过255

使用建议:

name

流控策略名称

参数类型:string

取值说明:用户自定义

取值约束:长度为3 - 64位的字符串,字符串由中文、英文字母、数字、_ 组成,且以英文字母开头

使用建议:

apiCallLimits

API流量限制

参数类型:integer

取值说明:API流量限制是指时长内一个API能够被访问的次数上限。

取值约束:不超过2147483647的正整数

使用建议:

userCallLimits

用户流量限制

参数类型:integer

取值说明:用户流量限制是指一个API在时长之内每一个用户能访问的次数上限,该数值不超过API流量限制值。

取值约束:不超过2147483647的正整数

使用建议:

appCallLimits

APP流量限制

参数类型:integer

取值说明:APP流量限制是指一个API在时长之内被每个APP访问的次数上限,该数值不超过用户流量限制值。

取值约束:不超过2147483647的正整数

使用建议:

timeUnit

流控的时间单位

参数类型:string

取值说明:单位为 SECOND、MINUTE、HOUR 或 DAY

默认值:SECOND

取值约束:可取"SECOND", "MINUTE", "HOUR", "DAY"

使用建议:

关联关系

输出

属性

参数类型

描述

refName

string

流控名称

refID

string

流控ID

blueprint样例

inputs:
  apiName:
    default: api321b
  apigroupName:
    default: test_group321b
  throttleName:
    default: throttle321
node_templates:
  throttle1:
    type: HuaweiCloud.APIG.Throttle
    properties:
      name: 
        get_input: throttleName
      remark: test throttle of aos plugin
      apiCallLimits: 10
      appCallLimits: 7
      userCallLimits: 9
      timeInterval: 100
      timeUnit: MINUTE     
  api-group1:
    properties:
      name:
        get_input: apigroupName
      remark: test group of aos plugin
    type: HuaweiCloud.APIG.ApiGroup
  api1:
    properties:
      authType: NONE
      backendApi:
        remark: test backend
        reqMethod: GET
        reqProtocol: HTTP
        reqUri: '/test/{aaa}'
        timeout: 10000
        urlDomain: 192.145.47.226:12346
      backendType: HTTP
      cors: false
      groupId:
        get_attribute:
          - api-group1
          - refID
      matchMode: NORMAL
      name:
        get_input: apiName
      remark: test api of aos plugin
      reqMethod: GET
      reqProtocol: HTTP
      reqUri: '/test/{aaa}'
      strategyId: 
        get_attribute:
          - throttle1
          - refID
    requirements:
      - groupId:
          node: api-group1
      - strategyId:
          node: throttle1
    type: HuaweiCloud.APIG.API
tosca_definitions_version: huaweicloud_tosca_version_1_0
分享:

    相关文档

    相关产品