All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ApiGateway::TrafficControl

Last Updated:Jul 10, 2024

ALIYUN::ApiGateway::TrafficControl is used to create a custom throttling policy.

Syntax

{
  "Type": "ALIYUN::ApiGateway::TrafficControl",
  "Properties": {
    "TrafficControlName": String,
    "Description": String,
    "UserDefault": String,
    "AppDefault": String,
    "TrafficControlUnit": String,
    "Special": List,
    "ApiDefault": Integer
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

ApiDefault

Integer

Yes

Yes

The default throttling value for each API.

None.

TrafficControlName

String

Yes

Yes

The name of the throttling policy.

The name must be 4 to 50 characters in length and can contain letters, digits, and underscores (_). The name cannot start with an underscore (_).

TrafficControlUnit

String

Yes

Yes

The unit of the throttling policy.

Valid values:

  • MINUTE

  • HOUR

  • DAY

AppDefault

String

No

Yes

The default throttling value for each application.

None.

Description

String

No

Yes

The description of the throttling policy.

None.

Special

List

No

Yes

The details of the special policy that you want to add to the custom throttling policy.

None.

UserDefault

String

No

Yes

The default throttling value for each user.

None.

Special syntax

"Special": {
  "SpecialType" : String,
  "SpecialKey" : String,
  "TrafficValue" : Integer
}

Special properties

Property

Type

Required

Editable

Description

Constraint

SpecialKey

String

Yes

No

The ID of the application or Alibaba Cloud account. Specify the value based on the value of SpecialType.

None.

SpecialType

String

Yes

No

The type of the special throttling policy.

Valid values:

  • APP

  • USER

TrafficValue

Integer

Yes

No

The special throttling value.

None.

Return values

Fn::GetAtt

TrafficControlId: the ID of the custom throttling policy.

Examples

Note

Change the values of masked parameters based on your business requirements.

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  AppId:
    Type: String
    Description: The ID of the application in the special throttling policy.
Resources:
  TrafficControl:
    Type: ALIYUN::ApiGateway::TrafficControl
    Properties:
      TrafficControlName: test_traffic_cont****
      TrafficControlUnit: MINUTE
      ApiDefault: 400
      UserDefault: 200
      AppDefault: 100
      Description: demo2
      Special:
        - SpecialType: APP
          SpecialKey:
            Ref: AppId
          TrafficValue: 80

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "AppId": {
      "Type": "String",
      "Description": "The ID of the application in the special throttling policy."
    }
  },
  "Resources": {
    "TrafficControl": {
      "Type": "ALIYUN::ApiGateway::TrafficControl",
      "Properties": {
        "TrafficControlName": "test_traffic_cont****",
        "TrafficControlUnit": "MINUTE",
        "ApiDefault": 400,
        "UserDefault": 200,
        "AppDefault": 100,
        "Description": "demo2",
        "Special": [
          {
            "SpecialType": "APP",
            "SpecialKey": {
              "Ref": "AppId"
            },
            "TrafficValue": 80
          }
        ]
      }
    }
  }
}