Queries forwarding rules.

Note You can call this operation to query only custom forwarding rules. The default forwarding rule cannot be queried.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListForwardingRules

The operation that you want to perform. Set the value to ListForwardingRules.

RegionId String Yes cn-hangzhou

The ID of the region where the Global Accelerator (GA) instance is deployed. Set the value to cn-hangzhou.

ClientToken String No 02fb3da4****

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length.

ListenerId String Yes lsr-bp1s0vzbi5bxlx5pw****

The ID of the listener.

AcceleratorId String Yes ga-bp17frjjh0udz4qzk****

The ID of the GA instance.

ForwardingRuleId String No frule-bp19a3t3yzr21q3****

The ID of the forwarding rule.

NextToken String No FFBBOCFx****

The token that is used to start the next query.

MaxResults Integer Yes 2

The maximum number of forwarding rules that can be queried.

Valid values: 1 to 100.

Response parameters

Parameter Type Example Description
RequestId String CFC67ED9-4AB1-431F-B6E3-A752B7B8CCD4

The ID of the request.

TotalCount Integer 1

The total number of forwarding rules.

NextToken String FFBBOCFx****

The token that is used to start the next query.

MaxResults Integer 2

The maximum number of forwarding rules that can be queried.

ForwardingRules Array of ForwardingRules

The information about the forwarding rules.

Priority Integer 5000

The order of the forwarding rule.

Note This parameter is not in effect. This parameter indicates only the order of the forwarding rule that appears in the GA console.
ForwardingRuleId String frule-bp19a3t3yzr21q3****

The ID of the forwarding rule.

ForwardingRuleName String auto_named_rule

The name of the forwarding rule.

ForwardingRuleStatus String active

The status of the forwarding rule.

  • active: The forwarding rule is normal.
  • configuring: The configuration of the forwarding rule is being modified.
RuleConditions Array of RuleConditions

The conditions that trigger the forwarding rule.

RuleConditionType String Host

The type of the forwarding condition.

  • Host: Requests are forwarded based on domain names.
  • Path: Requests are forwarded based on paths.
PathConfig Object

The configuration of the path.

Values Array of String /test

The path.

The path must be 1 to 128 characters in length and must start with a forward slash (/). The path can contain letters, digits, dollar signs ($), hyphens (-), underscores (_), periods (.), plus signs (+), forward slashes (/), ampersands (&), tildes (~), at signs (@), colons (:), and apostrophes (').Supported wildcard characters are asterisks (*) and question marks (?).

HostConfig Object

The configuration of the domain name.

Values Array of String www.example.com

The domain name.

The domain name must be 3 to 128 characters in length and can contain letters, digits, hyphens (-), and periods (.).Supported wildcard characters are asterisks (*) and question marks (?).

RuleActions Array of RuleActions

The forwarding action.

Order Integer 1

The forwarding order.

Note This parameter is not in effect because a forwarding rule can be associated only with one endpoint group.
RuleActionType String ForwardGroup

The type of the forwarding action.

Default value: ForwardGroup.

ForwardGroupConfig Object

The configuration of the forwarding action.

ServerGroupTuples Array of ServerGroupTuples

The information about the endpoint group.

EndpointGroupId String epg-bp1ieei9664r5nv****

The ID of the endpoint group.

ListenerId String lsr-bp1s0vzbi5bxlx5****

The ID of the listener.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListForwardingRules
&RegionId=cn-hangzhou
&ClientToken=02fb3da4****
&ListenerId=lsr-bp1s0vzbi5bxlx5pw****
&AcceleratorId=ga-bp17frjjh0udz4qzk****
&ForwardingRuleId=frule-bp19a3t3yzr21q3****
&NextToken=FFBBOCFx****
&MaxResults=2
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListForwardingRulesResponse>
    <RequestId>CFC67ED9-4AB1-431F-B6E3-A752B7B8CCD4</RequestId>
    <TotalCount>1</TotalCount>
    <NextToken>FFBBOCFx****</NextToken>
    <MaxResults>2</MaxResults>
    <ForwardingRules>
        <Priority>5000</Priority>
        <ForwardingRuleId>frule-bp19a3t3yzr21q3****</ForwardingRuleId>
        <ForwardingRuleName>auto_named_rule</ForwardingRuleName>
        <ForwardingRuleStatus>active</ForwardingRuleStatus>
        <RuleConditions>
            <RuleConditionType>Host</RuleConditionType>
            <PathConfig>
                <Values>/test</Values>
            </PathConfig>
            <HostConfig>
                <Values>www.example.com</Values>
            </HostConfig>
        </RuleConditions>
        <RuleActions>
            <Order>1</Order>
            <RuleActionType>ForwardGroup</RuleActionType>
            <ForwardGroupConfig>
                <ServerGroupTuples>
                    <EndpointGroupId>epg-bp1ieei9664r5nv****</EndpointGroupId>
                </ServerGroupTuples>
            </ForwardGroupConfig>
        </RuleActions>
        <ListenerId>lsr-bp1s0vzbi5bxlx5****</ListenerId>
    </ForwardingRules>
</ListForwardingRulesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "CFC67ED9-4AB1-431F-B6E3-A752B7B8CCD4",
  "TotalCount" : 1,
  "NextToken" : "FFBBOCFx****",
  "MaxResults" : 2,
  "ForwardingRules" : [ {
    "Priority" : 5000,
    "ForwardingRuleId" : "frule-bp19a3t3yzr21q3****",
    "ForwardingRuleName" : "auto_named_rule",
    "ForwardingRuleStatus" : "active",
    "RuleConditions" : [ {
      "RuleConditionType" : "Host",
      "PathConfig" : {
        "Values" : [ "/test" ]
      },
      "HostConfig" : {
        "Values" : [ "www.example.com" ]
      }
    } ],
    "RuleActions" : [ {
      "Order" : 1,
      "RuleActionType" : "ForwardGroup",
      "ForwardGroupConfig" : {
        "ServerGroupTuples" : [ {
          "EndpointGroupId" : "epg-bp1ieei9664r5nv****"
        } ]
      }
    } ],
    "ListenerId" : "lsr-bp1s0vzbi5bxlx5****"
  } ]
}

Error codes

HTTP status code Error code Error message Description
400 NotExist.Listener The listener does not exist. The error message returned because the specified listener does not exist.
400 NotActive.Listener The state of the listener is not active. The error message returned because the specified listener is unstable.
400 NotExist.Accelerator The accelerated instance does not exist. The error message returned because the specified GA instance does not exist.
400 StateError.Accelerator The state of the accelerated instance is invalid. The error message returned because the specified GA instance is invalid.
400 NotExist.BusinessRegion The business region does not exist. The error message returned because the specified region does not exist.
400 NotExist.BasicBandwidthPackage You must specify the basic bandwidth package. The error message returned because the required basic bandwidth plan is not specified.
400 QuotaExceeded.EndPoint The maximum number of endpoints is exceeded. The error message returned because the number of endpoints reached the upper limit.
400 Exist.EndpointGroup The endpoint group already exists. The error message returned because the specified endpoint group exists.
400 NoPermission.VpcEndpoint You are not authorized to perform the operation. The error message returned because you are unauthorized to create the service-linked role. Contact the owner of the Alibaba Cloud account or the administrator to grant the user the AliyunGlobalAccelerationFullAccess permission or required custom permissions. The custom permissions allow you to create the service-linked role. A custom permission policy contains the following content: 1. Service name: vpcendpoint.ga.aliyuncs.com. 2. Service-linked role: AliyunServiceRoleForGaVpcEndpoint. 3. Required permission: ram:CreateServiceLinkedRole.

For a list of error codes, visit the API Error Center.