• Elastic Load Balancing

elb
  1. Help Center
  2. Elastic Load Balancing
  3. API Reference
  4. Enhanced Load Balancer APIs
  5. L7 Rule (Forwarding Rule)
  6. Querying Forwarding Rules

Querying Forwarding Rules

Function

This API is used to query forwarding rules. Filter query and pagination query are supported.

URI

GET /v2.0/lbaas/l7policies/{l7policy_id}/rules

Table 1 Parameter description

Parameter

Type

Mandatory

Description

l7policy_id

Uuid

Yes

Specifies the forwarding policy ID.

Constraints

Parameters marker, limit, and page_reverse are used for pagination query. Parameters marker and page_reverse take effect only when they are used together with parameter limit.

Request

  • Request parameters
    Table 2 Parameter description

    Parameter

    Type

    Mandatory

    Description

    marker

    String

    No

    Specifies the ID of the forwarding rule from which pagination query starts, that is, the ID of the last forwarding rule on the previous page.

    This parameter must be used together with limit.

    limit

    Int

    No

    Specifies the number of forwarding rules on each page.

    The value ranges from 0 to intmax.

    page_reverse

    Bool

    No

    Specifies the page direction. The value can be true or false, and the default value is false. The last page in the list requested with page_reverse set to false will not contain the "next" link, and the last page in the list requested with page_reverse set to true will not contain the "previous" link.

    This parameter must be used together with limit.

    id

    Uuid

    No

    Specifies the forwarding rule ID.

    tenant_id

    String (255)

    No

    Specifies the ID of the project where the forwarding rule is used.

    admin_state_up

    Bool

    No

    Specifies the administrative status of the forwarding rule.

    The value can be true or false.

    This parameter is reserved and has been not used. The default value is true.

    type

    String

    No

    Specifies the match type of a forwarding rule.

    The value can be one of the following:

    • HOST_NAME: matches the domain name in the request.
    • PATH: matches the path in the request.

    The match type of a forwarding rule in the same forwarding policy must be unique.

    compare_type

    String

    No

    Specifies the match mode. The options are as follows:

    When type is set to HOST_NAME, the value of this parameter can only be the following:

    • EQUAL_TO: indicates exact match.

    When type is set to PATH, the value of this parameter can be one of the following:

    • REGEX: indicates regular expression match.
    • STARTS_WITH: indicates prefix match.
    • EQUAL_TO: indicates exact match.

    invert

    Bool

    No

    Specifies whether reverse match is supported.

    The value can be true or false. The default value is false.

    This parameter is reserved and has been not used.

    key

    String

    (255)

    No

    Specifies the key of the match content. The default value is null.

    This parameter is reserved and has been not used.

    value

    String

    (128)

    No

    Specifies the value of the match content.

    • When type is set to HOST_NAME, the value is a string of 1 to 100 characters, contains only letters, digits, hyphens (-), and periods (.), and must start with a letter or digit.
    • When type is set to PATH, the value is a string of a maximum of 128 characters. When the value of compare_type is set to STARTS_WITH or EQUAL_TO, the string must start with a slash (/) and can contain only letters, digits, and special characters _~';@^-%#&$.*+?,=!:|\/()[]{}

    provisioning_status

    String (16)

    No

    Specifies the provisioning status of the forwarding rule. The value can be ACTIVE, PENDING_CREATE, or ERROR.

    The default value is ACTIVE.

    This parameter is reserved and has been not used.

  • Example request
    GET https://{Endpoint}/v2.0/lbaas/l7policies/5ae0e1e7-5f0f-47a1-b39f-5d4c428a1586/rules

Response

  • Response parameters
    Table 3 Parameter description

    Parameter

    Type

    Description

    l7rules

    List

    Lists the forwarding rules. For details, see Table 4.

    Table 4 l7rule field description

    Parameter

    Type

    Description

    id

    Uuid

    Specifies the forwarding rule ID.

    tenant_id

    String (255)

    Specifies the ID of the project where the forwarding rule is used.

    admin_state_up

    Bool

    Specifies the administrative status of the forwarding rule.

    The value can be true or false.

    This parameter is reserved and has been not used. The default value is true.

    type

    String

    Specifies the match type of a forwarding rule.

    The value can be one of the following:

    • HOST_NAME: matches the domain name in the request.
    • PATH: matches the path in the request.

    compare_type

    String

    Specifies the match mode. The options are as follows:

    When type is set to HOST_NAME, the value of this parameter can only be the following:

    • EQUAL_TO: indicates exact match.

    When type is set to PATH, the value of this parameter can be one of the following:

    • REGEX: indicates regular expression match.
    • STARTS_WITH: indicates prefix match.
    • EQUAL_TO: indicates exact match.

    invert

    Bool

    Specifies whether reverse match is supported.

    The value can be true or false. The default value is false.

    This parameter is reserved and has been not used.

    key

    String (255)

    Specifies the key of the match content. The default value is null.

    This parameter is reserved and has been not used.

    value

    String (128)

    Specifies the value of the match content.

    • When type is set to HOST_NAME, the value is a string of 1 to 100 characters, contains only letters, digits, hyphens (-), and periods (.), and must start with a letter or digit.
    • When type is set to PATH, the value is a string of a maximum of 128 characters. When the value of compare_type is set to STARTS_WITH or EQUAL_TO, the string must start with a slash (/) and can contain only letters, digits, and special characters _~';@^-%#&$.*+?,=!:| \/()[]{}

    provisioning_status

    String (16)

    Specifies the provisioning status of the forwarding rule. The value can be ACTIVE, PENDING_CREATE, or ERROR.

    The default value is ACTIVE.

    This parameter is reserved and has been not used.

    rules_links

    List

    Provides links to the previous or next page during pagination query, respectively.

    This parameter exists only in the response body of pagination query.

    For details, see Table 5.

    Table 5 rules_links field description

    Parameter

    Type

    Description

    href

    string

    Provides links to the previous or next page during pagination query, respectively.

    rel

    String (255)

    Specifies the prompt of the previous or next page.

    The value can be next or previous. The value next indicates the href containing the URL of the next page, and previous indicates the href containing the URL of the previous page.

  • Example response
    {
        "rules": [
            {
                "compare_type": "EQUAL_TO", 
                "provisioning_status": "ACTIVE",
                "admin_state_up": true, 
                "tenant_id": "a31d2bdcf7604c0faaddb058e1e08819", 
                
                "invert": false, 
                "value": "www.test.com", 
                "key": null, 
                "type": "HOST_NAME", 
                "id": "67d8a8fa-b0dd-4bd4-a85b-671db19b2ef3"
            }, 
            {
                "compare_type": "EQUAL_TO",
                "provisioning_status": "ACTIVE", 
                "admin_state_up": true, 
                "tenant_id": "a31d2bdcf7604c0faaddb058e1e08819",
                
                "invert": false, 
                "value": "/aaa.html", 
                "key": null, 
                "type": "PATH", 
                "id": "f02b3bca-69d2-4335-a3fa-a8054e996213"
            }
        ]
    }

Response Codes

For details, see HTTP Status Codes for Enhanced Load Balancers.