更新时间:2024-05-22 GMT+08:00
分享

计算预占IP数

功能介绍

计算以下几种场景的预占用IP数量:

  • 计算创建LB的第一个七层监听器后总占用IP数量: 传入loadbalancer_id、l7_flavor_id为空、ip_target_enable不传或为false。

  • 计算LB规格变更或开启跨VPC后总占用IP数量: 传入参数loadbalancer_id,及l7_flavor_id不为空或ip_target_enable为true。

  • 计算创建LB所需IP数量:传入参数availability_zone_id, 及可选参数l7_flavor_id、ip_target_enable、ip_version,不能传loadbalancer_id。

说明:

  • 计算出来的预占IP数大于等于最终实际占用的IP数。

  • 总占用IP数量,即整个LB所占用的IP数量。

调用方法

请参见如何调用API

URI

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

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

所属项目id。

表2 Query参数

参数

是否必选

参数类型

描述

l7_flavor_id

String

负载均衡器七层规格的ID。传入该字段表示计算创建该规格的LB,或变更LB的原七层规格到该规格所需要的预占IP。

适用场景:创建负LB,变更LB规格。

ip_target_enable

Boolean

是否开启跨VPC转发。

取值true表示计算创建或变更为开启跨VPC转发的LB的预占IP。

取值false表示计算创建或变更为不开启跨VPC转发的LB的预占IP。不传等价false。

适用场景:创建LB,变更LB规格。

ip_version

Integer

负载均衡器IP地址类型,取值4,6 。

取值4表示计算创建支持IPv4地址的LB的预占IP。

取值6表示计算创建支持IPv6地址的LB的预占IP。

适用场景:创建LB。

loadbalancer_id

String

负载均衡器ID。计算LB规格变更或创建LB中的第一个七层监听器的预占IP。

适用场景:变更LB规格,创建LB中的第一个七层监听器。

availability_zone_id

Array

计算创建AZ列表为availability_zone_id的负载局衡器实例的预占IP。

适用场景:创建LB。

使用说明:传入loadbalancer_id时,该参数无效。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

IAM鉴权Token。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

preoccupy_ip

PreoccupyIp object

预占IP信息

request_id

String

请求ID。

注:自动生成 。

表5 PreoccupyIp

参数

参数类型

描述

total

Integer

预占IP总数

请求示例

  • 查询变更负载均衡的七层规格需要预占的ip数

    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"
    }
  • 查询创建一个双az且开启跨VPC的负载均衡需要预占的IP数

    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"
    }
  • 查询指定负载均衡中创建第一个7层监听器所需预占的IP数

    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"
    }

响应示例

状态码: 200

操作正常返回。

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

SDK代码示例

SDK代码示例如下。

  • 查询变更负载均衡的七层规格需要预占的ip数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
    import com.huaweicloud.sdk.elb.v3.*;
    import com.huaweicloud.sdk.elb.v3.model.*;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CountPreoccupyIpNumSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
    
            ICredential auth = new BasicCredentials()
                    .withAk(ak)
                    .withSk(sk);
    
            ElbClient client = ElbClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                    .build();
            CountPreoccupyIpNumRequest request = new CountPreoccupyIpNumRequest();
            request.withL7FlavorId("<l7_flavor_id>");
            request.withIpTargetEnable(<ip_target_enable>);
            request.withIpVersion(<ip_version>);
            request.withLoadbalancerId("<loadbalancer_id>");
            request.withAvailabilityZoneId();
            try {
                CountPreoccupyIpNumResponse response = client.countPreoccupyIpNum(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 查询创建一个双az且开启跨VPC的负载均衡需要预占的IP数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
    import com.huaweicloud.sdk.elb.v3.*;
    import com.huaweicloud.sdk.elb.v3.model.*;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CountPreoccupyIpNumSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
    
            ICredential auth = new BasicCredentials()
                    .withAk(ak)
                    .withSk(sk);
    
            ElbClient client = ElbClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                    .build();
            CountPreoccupyIpNumRequest request = new CountPreoccupyIpNumRequest();
            request.withL7FlavorId("<l7_flavor_id>");
            request.withIpTargetEnable(<ip_target_enable>);
            request.withIpVersion(<ip_version>);
            request.withLoadbalancerId("<loadbalancer_id>");
            request.withAvailabilityZoneId();
            try {
                CountPreoccupyIpNumResponse response = client.countPreoccupyIpNum(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 查询指定负载均衡中创建第一个7层监听器所需预占的IP数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
    import com.huaweicloud.sdk.elb.v3.*;
    import com.huaweicloud.sdk.elb.v3.model.*;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CountPreoccupyIpNumSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
    
            ICredential auth = new BasicCredentials()
                    .withAk(ak)
                    .withSk(sk);
    
            ElbClient client = ElbClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                    .build();
            CountPreoccupyIpNumRequest request = new CountPreoccupyIpNumRequest();
            request.withL7FlavorId("<l7_flavor_id>");
            request.withIpTargetEnable(<ip_target_enable>);
            request.withIpVersion(<ip_version>);
            request.withLoadbalancerId("<loadbalancer_id>");
            request.withAvailabilityZoneId();
            try {
                CountPreoccupyIpNumResponse response = client.countPreoccupyIpNum(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 查询变更负载均衡的七层规格需要预占的ip数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    # coding: utf-8
    
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkelb.v3 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = __import__('os').getenv("CLOUD_SDK_AK")
        sk = __import__('os').getenv("CLOUD_SDK_SK")
    
        credentials = BasicCredentials(ak, sk) \
    
        client = ElbClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(ElbRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CountPreoccupyIpNumRequest()
            request.l7_flavor_id = "<l7_flavor_id>"
            request.ip_target_enable = <IpTargetEnable>
            request.ip_version = <ip_version>
            request.loadbalancer_id = "<loadbalancer_id>"
            request.availability_zone_id = 
            response = client.count_preoccupy_ip_num(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 查询创建一个双az且开启跨VPC的负载均衡需要预占的IP数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    # coding: utf-8
    
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkelb.v3 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = __import__('os').getenv("CLOUD_SDK_AK")
        sk = __import__('os').getenv("CLOUD_SDK_SK")
    
        credentials = BasicCredentials(ak, sk) \
    
        client = ElbClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(ElbRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CountPreoccupyIpNumRequest()
            request.l7_flavor_id = "<l7_flavor_id>"
            request.ip_target_enable = <IpTargetEnable>
            request.ip_version = <ip_version>
            request.loadbalancer_id = "<loadbalancer_id>"
            request.availability_zone_id = 
            response = client.count_preoccupy_ip_num(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 查询指定负载均衡中创建第一个7层监听器所需预占的IP数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    # coding: utf-8
    
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkelb.v3 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = __import__('os').getenv("CLOUD_SDK_AK")
        sk = __import__('os').getenv("CLOUD_SDK_SK")
    
        credentials = BasicCredentials(ak, sk) \
    
        client = ElbClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(ElbRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CountPreoccupyIpNumRequest()
            request.l7_flavor_id = "<l7_flavor_id>"
            request.ip_target_enable = <IpTargetEnable>
            request.ip_version = <ip_version>
            request.loadbalancer_id = "<loadbalancer_id>"
            request.availability_zone_id = 
            response = client.count_preoccupy_ip_num(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 查询变更负载均衡的七层规格需要预占的ip数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            Build()
    
        client := elb.NewElbClient(
            elb.ElbClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CountPreoccupyIpNumRequest{}
    	l7FlavorIdRequest:= "<l7_flavor_id>"
    	request.L7FlavorId = &l7FlavorIdRequest
    	ipTargetEnableRequest:= <ip_target_enable>
    	request.IpTargetEnable = &ipTargetEnableRequest
    	ipVersionRequest:= int32(<ip_version>)
    	request.IpVersion = &ipVersionRequest
    	loadbalancerIdRequest:= "<loadbalancer_id>"
    	request.LoadbalancerId = &loadbalancerIdRequest
    	response, err := client.CountPreoccupyIpNum(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • 查询创建一个双az且开启跨VPC的负载均衡需要预占的IP数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            Build()
    
        client := elb.NewElbClient(
            elb.ElbClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CountPreoccupyIpNumRequest{}
    	l7FlavorIdRequest:= "<l7_flavor_id>"
    	request.L7FlavorId = &l7FlavorIdRequest
    	ipTargetEnableRequest:= <ip_target_enable>
    	request.IpTargetEnable = &ipTargetEnableRequest
    	ipVersionRequest:= int32(<ip_version>)
    	request.IpVersion = &ipVersionRequest
    	loadbalancerIdRequest:= "<loadbalancer_id>"
    	request.LoadbalancerId = &loadbalancerIdRequest
    	response, err := client.CountPreoccupyIpNum(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • 查询指定负载均衡中创建第一个7层监听器所需预占的IP数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            Build()
    
        client := elb.NewElbClient(
            elb.ElbClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CountPreoccupyIpNumRequest{}
    	l7FlavorIdRequest:= "<l7_flavor_id>"
    	request.L7FlavorId = &l7FlavorIdRequest
    	ipTargetEnableRequest:= <ip_target_enable>
    	request.IpTargetEnable = &ipTargetEnableRequest
    	ipVersionRequest:= int32(<ip_version>)
    	request.IpVersion = &ipVersionRequest
    	loadbalancerIdRequest:= "<loadbalancer_id>"
    	request.LoadbalancerId = &loadbalancerIdRequest
    	response, err := client.CountPreoccupyIpNum(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

操作正常返回。

错误码

请参见错误码

分享:

    相关文档

    相关产品