# Querying Whitelists

#### Function

This API is used to query the whitelists. 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/whitelists

#### Request

Table 1 Parameter description
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
marker | No | String | Specifies the ID of the whitelist from which pagination query starts, that is, the ID of the last whitelist on the previous page. This parameter must be used together with limit.
limit | No | Integer | Specifies the number of whitelists on each page. If this parameter is not set, all whitelists 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 whitelist ID.
tenant_id | No | String | Specifies the ID of the project where the whitelist is used. The value contains a maximum of 255 characters.
listener_id | No | String | Specifies the ID of the listener to which the whitelist is added.
enable_whitelist | No | Boolean | Specifies whether to enable access control. true: Access control is enabled. false: Access control is disabled.
whitelist | No | String | Specifies the IP addresses in the whitelist.

#### Response

Table 2 Response parameters
Parameter | Type | Description
--- | --- | ---
whitelists | Array | Lists the whitelists. For details, see Table 3.
whitelists_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 4.

Table 3 whitelist parameter description
Parameter | Type | Description
--- | --- | ---
id | String | Specifies the whitelist ID.
tenant_id | String | Specifies the ID of the project where the whitelist is used. The value contains a maximum of 255 characters.
listener_id | String | Specifies the ID of the listener to which the whitelist is added.
enable_whitelist | Bool | Specifies whether to enable access control. true: Access control is enabled. false: Access control is disabled.
whitelist | String | Specifies the IP addresses in the whitelist.

Table 4 whitelists_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 whitelists

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

- Example request 2: Querying the whitelists added to listener eabfefa3fd1740a88a47ad98e132d230

      GET https://{Endpoint}/v2.0/lbaas/whitelists?listener_id=eabfefa3fd1740a88a47ad98e132d230

#### Example Response

- Example response 1

      {
          "whitelists": [
              {
                  "id": "eabfefa3fd1740a88a47ad98e132d238",
                  "listener_id": "eabfefa3fd1740a88a47ad98e132d238",
                  "tenant_id": "eabfefa3fd1740a88a47ad98e132d238",
                  "enable_whitelist": true,
                  "whitelist": "192.168.11.1,192.168.0.1/24,192.168.201.18/8,100.164.0.1/24"
              },
              {
                  "id": "eabfefa3fd1740a88a47ad98e132d326",
                  "listener_id": "eabfefa3fd1740a88a47ad98e132d327",
                  "tenant_id": "eabfefa3fd1740a88a47ad98e132d436",
                  "enable_whitelist": true,
                  "whiltelist": "192.168.12.1,192.168.1.1/24,192.168.203.18/8,100.164.5.1/24"
              }
          ]
      }

- Example response 2

      {
          "whitelists": [
              {
                  "id": "eabfefa3fd1740a88a47ad98e132d238",
                  "listener_id": "eabfefa3fd1740a88a47ad98e132d230",
                  "tenant_id": "eabfefa3fd1740a88a47ad98e132d239",
                  "enable_whitelist": true,
                  "whitelist": "192.168.11.1,192.168.0.1/24,192.168.201.18/8,100.164.0.1/24"
              },
              {
                  "id": "eabfefa3fd1740a88a47ad98e132d326",
                  "listener_id": "eabfefa3fd1740a88a47ad98e132d327",
                  "tenant_id": "eabfefa3fd1740a88a47ad98e132d439",
                  "enable_whitelist": true,
                  "whiltelist": "192.168.12.1,192.168.1.1/24,192.168.203.18/8,100.164.5.1/24"
              }
          ]
      }

#### Status Code

For details, see HTTP Status Codes of Shared Load Balancers.

Parent topic: Whitelist