# Querying Forwarding Policies

#### Function

This API is used to query the forwarding policies. Filter query and pagination query are supported. Unless otherwise specified, exact match is applied.

#### 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.

#### URI

GET /v2.0/lbaas/l7policies

#### Request

Table 1 Parameter description
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
marker | No | String | Specifies the ID of the forwarding policy from which pagination query starts, that is, the ID of the last forwarding policy on the previous page. This parameter must be used together with limit.
limit | No | Integer | Specifies the number of forwarding policies on each page. If this parameter is not set, all forwarding policies are queried by default.
page_reverse | No | Boolean | 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 | No | String | Specifies the forwarding policy ID.
tenant_id | No | String | Specifies the ID of the project where the forwarding policy is used. The value contains a maximum of 255 characters.
name | No | String | Specifies the forwarding policy name. The value contains a maximum of 255 characters.
admin_state_up | No | Boolean | Specifies the administrative status of the forwarding policy. This parameter is reserved, and the default value is true.
description | No | String | Provides supplementary information about the forwarding policy. The value contains a maximum of 255 characters.
listener_id | No | String | Specifies the ID of the listener to which the forwarding policy is added.

action

No

String

Specifies whether requests are forwarded to another backend server group or redirected to an HTTPS listener.

The value can be one of the following:

- REDIRECT_TO_POOL: Requests are forwarded to the backend server group specified by redirect_pool_id.
- REDIRECT_TO_LISTENER: Requests are redirected from the HTTP listener specified by listener_id to the HTTPS listener specified by redirect_listener_id.

redirect_pool_id | No | String | Specifies the ID of the backend server group to which traffic is forwarded.
redirect_listener_id | No | String | Specifies the ID of the listener to which the traffic is redirected.
redirect_url | No | String | Specifies the URL to which traffic is redirected. This parameter is reserved. The value contains a maximum of 255 characters.
position | No | Integer | Specifies the forwarding priority. The value ranges from 1 to 100. The default value is 100. This parameter is reserved.
provisioning_status | No | String | This parameter is reserved, and its value can only be ACTIVE. It specifies the provisioning status of the forwarding policy.
display_all_rules | No | Boolean | Specifies whether to display all forwarding rules added to the forwarding policy. Value options: false: Forwarding rules will not be displayed, and only IDs are displayed. true: Forwarding rules will be displayed.

#### Response

Table 2 Response parameters
Parameter | Type | Description
--- | --- | ---
l7policies | Array | Lists the forwarding policies. For details, see Table 3.
l7policies_links | Array | 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 3 l7policy parameter description
Parameter | Type | Description
--- | --- | ---
id | String | Specifies the forwarding policy ID.
tenant_id | String | Specifies the ID of the project where the forwarding policy is used.
name | String | Specifies the forwarding policy name.

admin_state_up

Boolean

Specifies the administrative status of the forwarding policy.

This parameter is reserved. The value can be true or false.

- true: Enabled
- false: Disabled

description | String | Provides supplementary information about the forwarding policy.
listener_id | String | Specifies the ID of the listener to which the forwarding policy is added.

action

String

Specifies whether requests are forwarded to another backend server group or redirected to an HTTPS listener.

The value can be one of the following:

- REDIRECT_TO_POOL: Requests are forwarded to the backend server group specified by redirect_pool_id.
- REDIRECT_TO_LISTENER: Requests are redirected from the HTTP listener specified by listener_id to the HTTPS listener specified by redirect_listener_id.

redirect_pool_id | String | Specifies the ID of the backend server group to which traffic is forwarded.
redirect_listener_id | String | Specifies the ID of the listener to which the traffic is redirected.
redirect_url | String | Specifies the URL to which traffic is redirected. This parameter is reserved.
rules | Array | Lists the forwarding rules of the forwarding policy. For details, see Table 6.
position | Integer | Specifies the forwarding priority. The value ranges from 1 to 100. The default value is 100. This parameter is reserved.
provisioning_status | String | This parameter is reserved, and its value can only be ACTIVE. It specifies the provisioning status of the forwarding policy.

Table 4 rules parameter description
Parameter | Type | Description
--- | --- | ---
id | String | Lists the IDs of the forwarding rules in the forwarding policy.

Table 5 l7policies_links parameter description
Parameter | Type | Description
--- | --- | ---
href | String | Provides links to the previous or next page during pagination query, respectively.
rel | String | 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 Request

- Example request 1: Querying all forwarding policies

      GET https://{Endpoint}/v2.0/lbaas/l7policies

- Example request 2: Querying forwarding policies through which requests are forwarded to the backend server group

      GET https://{Endpoint}/v2.0/lbaas/l7policies?action=REDIRECT_TO_POOL

#### Example Response

- Example response 1

      {
          "l7policies": [
              {
                  "redirect_pool_id": "431a03eb-81bb-408e-ae37-7ce19023692b",
                  "redirect_listener_id": null,
                  "description": "",
                  "admin_state_up": true,
                  "rules": [
                      {
                          "id": "67d8a8fa-b0dd-4bd4-a85b-671db19b2ef3"
                      },
                      {
                          "id": "f02b3bca-69d2-4335-a3fa-a8054e996213"
                      }
                  ],
                  "tenant_id": "a31d2bdcf7604c0faaddb058e1e08819",

                  "listener_id": "26058b64-6185-4e06-874e-4bd68b7633d0",
                  "redirect_url": null,
                  "action": "REDIRECT_TO_POOL",
                  "position": 2,
                  "provisioning_status": "ACTIVE",
                  "id": "5ae0e1e7-5f0f-47a1-b39f-5d4c428a1586",
                  "name": ""
              },
              {
                  "redirect_pool_id": "59eebd7b-c68f-4f8a-aa7f-e062e84c0690",
                  "redirect_listener_id": null,
                  "description": "",
                  "admin_state_up": true,
                  "rules": [
                      {
                          "id": "f4499f48-de3d-4efe-926d-926aa4d6aaf5"
                      }
                  ],
                  "tenant_id": "a31d2bdcf7604c0faaddb058e1e08819",
                  "listener_id": "e1310063-00de-4867-ab55-ccac4d9db364",
                  "redirect_url": null,
                  "action": "REDIRECT_TO_POOL",
                  "position": 1,
                  "provisioning_status": "ACTIVE",
                  "id": "6cfd9d89-1d7e-4d84-ae1f-a8c5ff126f72",
                  "name": ""
              }
          ],
          "l7policies_links": [
              {
              "href": "https://{Endpoint}/v2.0/lbaas/l7policies/061f461c-c7cf-47ab-9583-09be5076cd09/rules?marker=167c1a31-bc12-4c3d-9ad1-c9bf450df4ce&page_reverse=True",
              "rel": "previous"
              }
          ]
      }

- Example response 2

      {
          "l7policies": [
              {
                  "redirect_pool_id": "431a03eb-81bb-408e-ae37-7ce19023692b",
                  "redirect_listener_id": null,
                  "description": "",
                  "admin_state_up": true,
                  "rules": [
                      {
                          "id": "67d8a8fa-b0dd-4bd4-a85b-671db19b2ef3"
                      },
                      {
                          "id": "f02b3bca-69d2-4335-a3fa-a8054e996213"
                      }
                  ],
                  "tenant_id": "a31d2bdcf7604c0faaddb058e1e08819",

                  "listener_id": "26058b64-6185-4e06-874e-4bd68b7633d0",
                  "redirect_url": null,
                  "action": "REDIRECT_TO_POOL",
                  "position": 2,
                  "provisioning_status": "ACTIVE",
                  "id": "5ae0e1e7-5f0f-47a1-b39f-5d4c428a1586",
                  "name": ""
              },
              {
                  "redirect_pool_id": "59eebd7b-c68f-4f8a-aa7f-e062e84c0690",
                  "redirect_listener_id": null,
                  "description": "",
                  "admin_state_up": true,
                  "rules": [
                      {
                          "id": "f4499f48-de3d-4efe-926d-926aa4d6aaf5"
                      }
                  ],
                  "tenant_id": "a31d2bdcf7604c0faaddb058e1e08819",

                  "listener_id": "e1310063-00de-4867-ab55-ccac4d9db364",
                  "redirect_url": null,
                  "action": "REDIRECT_TO_POOL",
                  "position": 1,
                  "provisioning_status": "ACTIVE",
                  "id": "6cfd9d89-1d7e-4d84-ae1f-a8c5ff126f72",
                  "name": ""
              }
          ],
          "l7policies_links": [
              {
              "href": "https://{Endpoint}/v2.0/lbaas/l7policies/061f461c-c7cf-47ab-9583-09be5076cd09/rules?marker=167c1a31-bc12-4c3d-9ad1-c9bf450df4ce&page_reverse=True",
              "rel": "previous"
              }
          ]
      }

#### Status Code

For details, see Status Codes.

Parent topic: Forwarding Policy