Help Center/ Elastic Load Balance/ API Reference/ APIs (V3)/ Reserved IP Address/ Calculating the Number of Reserved IP Addresses
Updated on 2023-12-18 GMT+08:00

Calculating the Number of Reserved IP Addresses

Function

This API is used to calculate the number of reserved IP addresses in the following scenarios:

  • Calculate the number of IP addresses required for adding the first HTTP or HTTPS listener to a dedicated load balancer: loadbalancer_id is passed, l7_flavor_id is left blank, and ip_target_enable is not passed or is set to false.

  • Calculate the number of IP addresses required for changing the flavors of a dedicated load balancer or enabling IP as a Backend for a dedicated load balancer: loadbalancer_id is passed, and l7_flavor_id is not left blank or ip_target_enable is set to true.

  • Calculate the number of IP addresses required for creating a dedicated load balancer: availability_zone_id is passed, parameters l7_flavor_id, ip_target_enable, and ip_version are optional, and loadbalancer_id is not passed.

Note:

  • The number of reserved IP addresses in the query result is greater than that of the actually used IP addresses.

  • The number of reserved IP addresses is the number of IP addresses used by a dedicated load balancer.

Calling Method

For details, see Calling APIs.

URI

GET /v3/{project_id}/elb/preoccupy-ip-num

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

l7_flavor_id

No

String

Specifies the ID of the load balancer flavor at Layer 7.

If this parameter is passed, the number of reserved IP addresses required for creating a dedicated load balancer with a Layer-7 flavor or for changing the Layer 7 flavor of a dedicated load balancer will be calculated.

Application scenarios: creating a dedicated load balancer with a Layer-7 flavor or changing the Layer 7 flavors of a dedicated load balancer

ip_target_enable

No

Boolean

Specifies whether to enable IP as a Backend.

  • true: The number of reserved IP addresses required for creating a dedicated load balancer with IP as a Backend enabled or for enabling IP as a Backend for an existing dedicated load balancer will be calculated.

  • false: The number of reserved IP addresses required for creating a dedicated load balancer with IP as a Backend disabled or for disabling IP as a Backend for an existing dedicated load balancer will be calculated. If this parameter is not passed, IP as a Backend is disabled.

Application scenarios: creating a dedicated load balancer or changing the flavors of a dedicated load balancer

ip_version

No

Integer

Specifies the IP address version of the load balancer. The value can be 4 or 6.

  • 4: The number of reserved IPv4 addresses required for creating a dedicated load balancer will be calculated.

  • 6: The number of reserved IPv6 addresses required for creating a dedicated load balancer will be calculated.

Application scenario: creating a dedicated load balancer.

loadbalancer_id

No

String

Specifies the load balancer ID. The number of reserved IP addresses required for changing the flavors of a dedicated load balancer or for adding the first HTTP or HTTPS listener to a dedicated load balancer will be calculated.

Application scenario: changing the flavors of a dedicated load balancer or adding the first HTTP or HTTPS listener to a dedicated load balancer

availability_zone_id

No

Array

Calculates the number of reserved IP addresses required for creating a dedicated load balancer in the AZs specified by availability_zone_id.

Application scenario: creating a dedicated load balancer

Constraint: This parameter will not take effect when loadbalancer_id is passed.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the token used for IAM authentication.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

preoccupy_ip

PreoccupyIp object

Shows reserved IP address information.

request_id

String

Specifies the request ID. The value is automatically generated.

Table 5 PreoccupyIp

Parameter

Type

Description

total

Integer

Specifies the number of preoccupied IP addresses.

Example Requests

  • Querying the number of reserved IP addresses required for changing the Layer 7 flavor of a dedicated load balancer

    https://{ELB_Endpoint}/v3/060576782980d5762f9ec014dd2f1148/elb/preoccupy-ip-num?loadbalancer_id=aff4fc31-d635-4f59-a862-edadf32e407d&l7_flavor_id=0051bc4c-a562-4b7c-953b-a250b51d992b
    
    {
      "preoccupy_ip" : {
        "total" : 6
      },
      "request_id" : "8844e9a0-6a2d-44b7-aad9-15a7f75e4059"
    }
  • Querying the number of reserved IP addresses required for creating a dedicated load balancer that is deployed in two AZs and has IP as a Backend enabled

    GET /v3/{project_id}/elb/preoccupy-ip-num?l7_flavor_id=8278944d-f92c-4393-82b2-6fb9cc1d7e53&availability_zone_id=az1&availability_zone_id=az2&ip_target_enable=true
    
    {
      "preoccupy_ip" : {
        "total" : 20
      },
      "request_id" : "63388ec8-fa3c-4c99-b9c8-d2c83b2a9a68"
    }
  • Querying the number of reserved IP addresses required for adding the first HTTP or HTTPS listener to a dedicated load balancer

    GET /v3/{project_id}/elb/preoccupy-ip-num?loadbalancer_id=aff4fc31-d635-4f59-a862-edadf32e407d
    
    {
      "preoccupy_ip" : {
        "total" : 2
      },
      "request_id" : "febfce48-318d-45ba-a9d9-855462123f3b"
    }

Example Responses

Status code: 200

Successful request.

{
  "preoccupy_ip" : {
    "total" : 20
  },
  "request_id" : "63388ec8-fa3c-4c99-b9c8-d2c83b2a9a68"
}

Status Codes

Status Code

Description

200

Successful request.

Error Codes

See Error Codes.