Updated on 2025-09-22 GMT+08:00

Updating a Load Balancer

Function

This API is used to update a load balancer.

Calling Method

For details, see Calling APIs.

URI

PUT /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

loadbalancer_id

Yes

String

Definition: Specifies the load balancer ID.

Constraints: N/A

Range: N/A

Default value: N/A

project_id

Yes

String

Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Constraints: N/A

Range: The value can contain a maximum of 32 characters, including digits and lowercase letters.

Default value: N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: Specifies the token used for IAM authentication.

Constraints: N/A

Range: N/A

Default value: N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

loadbalancer

Yes

UpdateLoadBalancerOption object

Definition: Specifies the parameters for updating a load balancer.

Constraints: N/A

Table 4 UpdateLoadBalancerOption

Parameter

Mandatory

Type

Description

name

No

String

Definition: Specifies the load balancer name.

Constraints: N/A

Range: The value can contain a maximum of 255 Unicode characters, including letters and more. It can be left blank.

Default value: N/A

admin_state_up

No

Boolean

Definition: Specifies whether the load balancer is enabled.

Range:

  • true: enabled

  • false: disabled

Constraints: N/A

Range: N/A

Default value: N/A

description

No

String

Definition: Provides supplementary information about the load balancer.

Constraints: N/A

Range: The value can contain a maximum of 255 Unicode characters, including letters and more. It can be left blank.

Default value: N/A

ipv6_vip_virsubnet_id

No

String

Definition: Specifies the ID of the IPv6 subnet where the load balancer is located. This subnet is also called the frontend subnet.

You can query parameter neutron_network_id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/subnets).

Updating ipv6_vip_virsubnet_id changes the IPv6 subnet where the load balancer is located, and new IPv6 addresses will be assigned to the load balancer. However, the IPv4 subnet will not change.

Constraints:

  • The subnet specified by ipv6_vip_virsubnet_id must be in the VPC specified by vpc_id, and this subnet must support IPv6.

  • This parameter can be updated only when guaranteed is set to true.

Range: The ID must be in UUID format and can contain up to 36 characters.

Default value: N/A

NOTE:
If this parameter is set to null, the IPv6 addresses will be unbound from the load balancer. Do not specify this parameter if no IPv6 subnet needs to be changed.

vip_subnet_cidr_id

No

String

Definition: Specifies the ID of the IPv4 subnet where the load balancer is located. This subnet is also called the frontend subnet.

You can query parameter neutron_subnet_id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/subnets).

Updating vip_subnet_cidr_id changes the IPv4 subnet where the load balancer is located, and new IPv4 addresses will be assigned to the load balancer. However, the IPv6 subnet will not change.

Constraints:

  • If vip_address is also specified, the IP address specified by vip_address must be in the subnet specified by vip_subnet_cidr_id.

  • The subnet specified by vip_subnet_cidr_id must in the VPC specified by vpc_id.

  • This parameter can be updated only when guaranteed is set to true.

Range: The ID must be in UUID format and can contain up to 36 characters.

Default value: N/A

NOTE:
If this parameter is set to null, the IPv4 addresses will be unbound from the load balancer. Do not specify this parameter if no IPv4 subnet needs to be changed.

vip_address

No

String

Definition: Specifies the private IPv4 address of the load balancer.

Constraints: The IP address must be from the IPv4 subnet where the load balancer resides and should not be occupied by other services.

Range: The IP address must be in [0-255].[0-255].[0-255].[0-255] format, for example, 192.168.1.1.

Default value: N/A

Note: This parameter can be updated only when guaranteed is set to true.

l4_flavor_id

No

String

Definition: Specifies the ID of a flavor at Layer 4.

You can query parameter id in the response by calling the API (GET https://{ELB_Endpoint}/v3/{project_id}/elb/flavors?type=L4).

Constraints:

  • This parameter can be updated only when guaranteed is set to true.

  • If you change the flavor, you can select a higher or lower one. If you select a lower one, part of persistent connections will be interrupted.

  • If autoscaling.enable is set to true, changes to this parameter will not take effect.

  • If the flavor type is L4, the load balancer uses the fixed flavors and will be billed by the flavor you select.

  • If the flavor type is L4_elastic_max, the load balancer uses the elastic flavors and will be billed by how many LCUs you use.

Range: N/A

Default value: N/A

l7_flavor_id

No

String

Definition: Specifies the ID of a flavor at Layer 7.

You can query parameter id in the response by calling the API (GET https://{ELB_Endpoint}/v3/{project_id}/elb/flavors?type=L7).

Constraints:

  • This parameter can be updated only when guaranteed is set to true.

  • If you change the flavor, you can select a higher or lower one. If you select a lower one, part of persistent connections will be interrupted.

  • If autoscaling.enable is set to true, changes to this parameter will not take effect.

  • If the flavor type is L7, the load balancer uses the fixed flavors and will be billed by the flavor you select.

  • If the flavor type is L7_elastic_max, the load balancer uses the elastic flavors and will be billed by how many LCUs you use.

Range: N/A

Default value: N/A

ipv6_bandwidth

No

BandwidthRef object

Definition: Specifies the ID of the bandwidth.

Constraints:

  • This parameter is available only when you create or update a load balancer with a public address.

  • If you bind a new EIP to the load balancer and specify a shared bandwidth, this EIP will be added to the shared bandwidth.

ip_target_enable

No

Boolean

Definition: Specifies whether to add backend servers that are not in the load balancer's VPC.

If you set it to true, you can associate servers in a VPC connected through a VPC peering connection, in a VPC connected through a cloud connection, or in an on-premises data center at the other end of a Direct Connect or VPN connection, by using server IP addresses.

Constraints:

  • This function cannot be disabled once it is enabled.

  • If you want to enable IP as a Backend for a load balancer in a shared VPC, ensure that a VPC peering connection has been created to connect the VPCs. Otherwise, the communication will fail.

  • This function is supported only by dedicated load balancers.

Range:

  • true: This option will be enabled.

  • false: This option will be disabled.

Default value: N/A

elb_virsubnet_ids

No

Array of strings

Definition: Specifies the network IDs of subnets on the downstream plane.

You can query parameter neutron_network_id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/subnets).

Constraints:

  • If the IDs of the subnets bound to the load balancer are specified in elb_virsubnet_ids, the subnets will still be bound to the load balancer.

  • If the IDs of the subnets bound to the load balancer are not specified in elb_virsubnet_ids, the subnets will be unbound from the load balancers. Do not unbind the subnets that have been used by the load balancer. Otherwise, an error will be returned.

  • If the IDs of the subnets are specified in elb_virsubnet_ids, but not on the downstream plane, a new load balancer will be bound to the downstream plane.

  • All subnets specified by elb_virsubnet_ids must in the VPC where the load balancer works.

  • Edge subnets are not supported.

Range: N/A

Default value: N/A

deletion_protection_enable

No

Boolean

Definition: Specifies whether to enable deletion protection.

Constraints: Disable deletion protection or removal protection for your resources before deregistering your account.

Range: false (disable this option) or true (enable this option).

Default value: N/A

prepaid_options

No

PrepaidUpdateOption object

Definition: Specifies the prepaid billing configuration for updating a load balancer.

This parameter is unsupported. Please do not use it.

autoscaling

No

UpdateLoadbalancerAutoscalingOption object

Definition: Specifies information about elastic scaling. If elastic scaling is enabled, the load balancer flavors can be automatically adjusted based on incoming traffic.

Constraints:

  • This parameter is only available for whitelisted users.

  • If elastic scaling is enabled, l4_flavor_id indicates the ID of the maximum elastic flavor at Layer 4. l7_flavor_id indicates the ID of the maximum elastic flavor at Layer 7.

NOTE:
This parameter has been deprecated, but is retained for compatibility purposes. Using this parameter is not recommended. If this parameter is specified, the load balancer with minimum flavors will be created and you will be billed for the minimum flavors.

charge_mode

No

String

Definition: Specifies the charge mode of the load balancer.

Constraints: N/A

Range:

  • flavor: billed by the fixed flavor you select.

Default value: N/A

waf_failure_action

No

String

Definition: Specifies traffic distributing policies when the WAF is faulty.

Constraints: This parameter takes effect only when WAF is enabled for the load balancer.

Range: discard indicates traffic will not be distributed. forward indicates traffic will be distributed to the default backend servers.

Default value: forward

protection_status

No

String

Definition: Specifies the protection status.

Constraints: N/A

Range:

  • nonProtection: The resource is not protected.

  • consoleProtection: Modification is not allowed on the console.

Default value: N/A

protection_reason

No

String

Definition: Specifies why modification protection is enabled.

Constraints: This parameter is valid only when protection_status is set to consoleProtection.

Range: The value can contain a maximum of 255 Unicode characters, excluding angle brackets (<>).

Default value: N/A

ipv6_vip_address

No

String

Definition: Specifies the IPv6 address of the load balancer.

Constraints: N/A

Range: N/A

Default value: N/A

Table 5 BandwidthRef

Parameter

Mandatory

Type

Description

id

Yes

String

Definition: Specifies the ID of the shared bandwidth.

Constraints: N/A

Range: N/A

Default value: N/A

Table 6 PrepaidUpdateOption

Parameter

Mandatory

Type

Description

auto_pay

No

Boolean

Definition: Specifies whether the payment will be automatically deducted from your account balance when an order is submitted.

Constraints: If you use the automatic payment mode, only your account balance can be used. If you want to use a voucher, do not use the automatic payment mode, and select the voucher for the payment in the Billing Center.

Range:

  • true: The order will be automatically paid.

  • false: The order will not be automatically paid.

Default value: N/A

change_mode

No

String

Definition: Specifies the flavor change type.

Constraints: N/A

Range:

  • immediate: The flavor change is applied immediately.

  • delay: The flavor change is applied after the current subscription period ends.

Default value: N/A

period_num

No

Integer

Definition: Specifies the number of subscription periods. The value varies with the operation policy.

Constraints: This parameter takes effect only when change_mode is set to delay.

Range:

  • The value ranges from 1 to 9, if period_type is set to month.

  • The value ranges from 1 to 3, if period_type is set to year.

Default value: N/A

period_type

No

String

Definition: Specifies the subscription period type.

Constraints: This parameter takes effect only when change_mode is set to delay.

Range:

  • month: monthly subscription

  • year: yearly subscription

Default value: N/A

Table 7 UpdateLoadbalancerAutoscalingOption

Parameter

Mandatory

Type

Description

enable

Yes

Boolean

Definition: Specifies whether to enable elastic scaling for the load balancer.

Constraints: N/A

Range:

  • true: This option will be enabled.

  • false: This option will be disabled.

Default value: N/A

min_l7_flavor_id

No

String

Definition: Specifies the ID of the minimum elastic flavor at Layer 7.

Constraints: This parameter cannot be left blank if there are Layer 7 listeners.

Range: N/A

Default value: N/A

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

loadbalancer

LoadBalancer object

Definition: Specifies the load balancer.

request_id

String

Definition: Specifies the request ID.

Range: The value is automatically generated, and can contain characters including digits, lowercase letters, and hyphens (-).

Table 9 LoadBalancer

Parameter

Type

Description

id

String

Definition: Specifies the load balancer ID.

Range: N/A

description

String

Definition: Provides supplementary information about the load balancer.

Range: N/A

provisioning_status

String

Definition: Specifies the provisioning status of the load balancer.

Range:

  • ACTIVE: in use

  • PENDING_DELETE: deleting

admin_state_up

Boolean

Definition: Specifies whether the load balancer is enabled.

Range:

  • true: enabled

  • false: disabled

provider

String

Definition: Specifies the provider of the load balancer. The value is fixed to vlb.

Range: N/A

pools

Array of PoolRef objects

Definition: Lists the IDs of backend server groups associated with the load balancer.

listeners

Array of ListenerRef objects

Definition: Lists the IDs of listeners associated with the load balancer.

operating_status

String

Definition: Specifies the operating status of the load balancer.

Range:

  • ONLINE: The load balancer is online.

  • FROZEN: The load balancer is frozen.

name

String

Definition: Specifies the load balancer name.

Range: N/A

project_id

String

Definition: Specifies the ID of the project where the load balancer is used.

Range: N/A

vip_subnet_cidr_id

String

Definition: Specifies the ID of the IPv4 subnet where the load balancer is located. This subnet is also called the frontend subnet.

Range: N/A

vip_address

String

Definition: Specifies the private IPv4 address of the load balancer.

Range: N/A

vip_port_id

String

Definition: Specifies the ID of the port bound to the private IPv4 address of the load balancer.

Range: N/A

tags

Array of Tag objects

Definition: Specifies the tags added to the load balancer.

created_at

String

Definition: Specifies the time when the load balancer was created.

Range:

The value must be in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

updated_at

String

Definition: Specifies the time when the load balancer was updated.

Range:

The value must be in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

guaranteed

Boolean

Definition: Specifies whether the load balancer is a dedicated load balancer.

Range:

  • false: The load balancer is a shared load balancer.

  • true: The load balancer is a dedicated load balancer.

vpc_id

String

Definition: Specifies the ID of the VPC where the load balancer is located.

Range: N/A

eips

Array of EipInfo objects

Definition: Specifies the EIP bound to the load balancer.

NOTE:
This parameter has the same meaning as publicips.

ipv6_vip_address

String

Definition: Specifies the IPv6 address of the load balancer.

Range: N/A

ipv6_vip_virsubnet_id

String

Definition: Specifies the ID of the IPv6 subnet where the load balancer is located. This subnet is also called the frontend subnet.

Range: N/A

ipv6_vip_port_id

String

Definition: Specifies the ID of the port bound to the IPv6 address of the load balancer.

Range: N/A

availability_zone_list

Array of strings

Definition: Specifies the list of AZs where the load balancers are created.

Range: N/A

enterprise_project_id

String

Definition: Specifies the ID of the enterprise project.

Range:

  • 0: The resource belongs to the default enterprise project.

  • A string in UUID format indicates a non-default enterprise project.

billing_info

String

Definition: Provides resource billing information.

Range:

  • If the value is left blank, the resource is billed on a pay-per-use basis.

This parameter is unsupported. Please do not use it.

l4_flavor_id

String

Definition: Specifies the ID of a flavor at Layer 4.

If the current load balancer is an elastic flavor instance, this parameter defines the maximum elastic flavor at Layer 4.

Range: N/A

l4_scale_flavor_id

String

Definition: Specifies the ID of an elastic flavor at Layer 4.

Range: N/A

NOTE:
This parameter has been discarded. Do not use it.

l7_flavor_id

String

Definition: Specifies the ID of a flavor at Layer 7.

If the current load balancer is an elastic flavor instance, this parameter defines the maximum elastic flavor at Layer 7.

Range: N/A

l7_scale_flavor_id

String

Definition: Specifies the ID of an elastic flavor at Layer 7.

Range: N/A

NOTE:
This parameter has been discarded. Do not use it.

gw_flavor_id

String

Definition: Specifies the flavor ID of the gateway load balancer.

Range: N/A

This parameter is unsupported. Please do not use it.

loadbalancer_type

String

Definition: Specifies the load balancer type.

Range:

  • gateway: gateway load balancers

  • null: other types of load balancers

This parameter is unsupported. Please do not use it.

publicips

Array of PublicIpInfo objects

Definition: Specifies the EIP bound to the load balancer.

NOTE:
This parameter has the same meaning as eips.

global_eips

Array of GlobalEipInfo objects

Definition: Specifies the global EIP bound to the load balancer.

elb_virsubnet_ids

Array of strings

Definition: Specifies the network IDs of subnets on the downstream plane.

Range: N/A

elb_virsubnet_type

String

Definition: Specifies the type of the subnet on the downstream plane.

Range:

  • ipv4: IPv4 subnets

  • dualstack: subnets that support IPv4/IPv6 dual stack

ip_target_enable

Boolean

Definition: Specifies whether to add backend servers that are not in the load balancer's VPC.

If you set it to true, you can associate servers in a VPC connected through a VPC peering connection, in a VPC connected through a cloud connection, or in an on-premises data center at the other end of a Direct Connect or VPN connection, by using server IP addresses.

Range:

  • true: This option will be enabled.

  • false: This option will be disabled.

frozen_scene

String

Definition: Specifies the scenario where the load balancer is frozen.

If there are multiple scenarios, separate them with commas (,).

Range:

  • POLICE: The load balancer is frozen due to security reasons.

  • ILLEGAL: The load balancer is frozen due to violation of laws and regulations.

  • VERIFY: Your account has not completed real-name authentication.

  • PARTNER: The load balancer is frozen by the partner.

  • AREAR: The load balancer is frozen due to arrears.

deletion_protection_enable

Boolean

Definition: Specifies whether to enable deletion protection. This parameter is returned only when the deletion protection is enabled in the current region.

Range:

  • false: This option will be disabled.

  • true: This option will be enabled.

autoscaling

AutoscalingRef object

Definition: Specifies information about elastic scaling. If elastic scaling is enabled, the load balancer flavors can be automatically adjusted based on incoming traffic.

NOTE:
This parameter has been deprecated, but is retained for compatibility purposes. Using this parameter is not recommended. If this parameter is specified, the load balancer with minimum flavors will be created and you will be billed for the minimum flavors.

public_border_group

String

Definition: Specifies the public border group.

Range:

  • center: public border group of the central site

  • Edge site name: public border group of an edge site

charge_mode

String

Definition: Specifies the charge mode of the load balancer.

Range:

  • flavor: billed by the fixed flavor you select.

  • lcu: billed by how many LCUs you have used.

  • Null: If it is a shared load balancer, it is free. If it is a dedicated load balancer, it will be billed by the fixed flavor you select.

This parameter is unsupported. Please do not use it.

service_lb_mode

String

Definition: Specifies load balancer mode.

Range:

  • lb: Cross-tenant access is not supported.

  • ep: Cross-tenant access is supported.

This parameter is unsupported. Please do not use it.

instance_type

String

Definition: Specifies the internal service to which the load balancer belongs.

Range: N/A

This parameter is unsupported. Please do not use it.

instance_id

String

Definition: Specifies the ID of the instance with which the load balancer is associated.

Range: N/A

This parameter is unsupported. Please do not use it.

proxy_protocol_extensions

Array of ProxyProtocolExtension objects

Definition: Specifies the proxy protocol extension.

This parameter is unsupported. Please do not use it.

waf_failure_action

String

Definition: Specifies traffic distributing policies when the WAF is faulty.

Range: discard indicates traffic will not be distributed. forward indicates traffic will be distributed to the default backend servers.

protection_status

String

Definition: Specifies the protection status.

Range:

  • nonProtection: The resource is not protected.

  • consoleProtection: Modification is not allowed on the console.

protection_reason

String

Definition: Specifies why modification protection is enabled.

Range: The value can contain a maximum of 255 Unicode characters, excluding angle brackets (<>).

log_group_id

String

Definition: Specifies the ID of the log group that is associated with the load balancer.

Range: N/A

log_topic_id

String

Definition: Specifies the ID of the log topic that is associated with the load balancer.

Range: N/A

custom_qos_limit

CustomQosLimit object

Definition: Specifies the rate limit information of the ELB flavors.

Range: N/A

This parameter is unsupported. Please do not use it.

Table 10 PoolRef

Parameter

Type

Description

id

String

Definition: Specifies the backend server group ID.

Range: N/A

Table 11 ListenerRef

Parameter

Type

Description

id

String

Definition: Specifies the listener ID.

Range: N/A

Table 12 Tag

Parameter

Type

Description

key

String

Definition: Specifies the tag key.

Range: N/A

value

String

Definition: Specifies the tag value.

Range: N/A

Table 13 EipInfo

Parameter

Type

Description

eip_id

String

Definition: Specifies the EIP ID.

Range: N/A

eip_address

String

Definition: Specifies the EIP.

Range: N/A

ip_version

Integer

Definition: Specifies the IP address version.

Range:

  • 4: IPv4 addresses

  • 6: IPv6 addresses

Table 14 PublicIpInfo

Parameter

Type

Description

publicip_id

String

Definition: Specifies the EIP ID.

Range: N/A

publicip_address

String

Definition: Specifies the EIP.

Range: N/A

ip_version

Integer

Definition: Specifies the IP address version.

Range:

  • 4: IPv4 address

  • 6: IPv6 address

Table 15 GlobalEipInfo

Parameter

Type

Description

global_eip_id

String

Definition: Specifies the ID of the global EIP.

Range: N/A

global_eip_address

String

Definition: Specifies the global EIP.

Range: N/A

ip_version

Integer

Definition: Specifies the IP address version.

Range:

  • 4: IPv4 addresses

  • 6: IPv6 addresses

Table 16 AutoscalingRef

Parameter

Type

Description

enable

Boolean

Definition: Specifies whether to enable elastic scaling for the load balancer.

Range:

  • true: This option will be enabled.

  • false: This option will be disabled.

min_l7_flavor_id

String

Definition: Specifies the ID of the minimum elastic flavor at Layer 7.

Range: N/A

Table 17 ProxyProtocolExtension

Parameter

Type

Description

vip_address

String

Definition: Specifies the IPv4 address.

Constraints: N/A

Range: N/A

Default value: N/A

ipv6_vip_address

String

Definition: Specifies the IPv6 address.

Constraints: N/A

Range: N/A

Default value: N/A

extension

Extension object

Definition: Specifies the proxy protocol extension.

Constraints: N/A

Table 18 Extension

Parameter

Type

Description

ep_id

String

Definition: Specifies the VPC endpoint ID.

Constraints: N/A

Range: N/A

Default value: N/A

ep_service_id

String

Definition: Specifies the VPC endpoint service ID.

Constraints: N/A

Range: N/A

Default value: N/A

Table 19 CustomQosLimit

Parameter

Type

Description

l4

L4Limit object

Definition: Specifies the rate limit information of the ELB flavors at Layer 4.

l7

L7Limit object

Definition: Specifies the rate limit information of the ELB flavors at Layer 7.

Table 20 L4Limit

Parameter

Type

Description

connection

Integer

Definition: Specifies the maximum number of concurrent connections at Layer 4.

Range: N/A

cps

Integer

Definition: Specifies the maximum number of new connections at Layer 4.

Range: N/A

Table 21 L7Limit

Parameter

Type

Description

connection

Integer

Definition: Specifies the maximum number of concurrent connections at Layer 7.

Range: N/A

cps

Integer

Definition: Specifies the maximum number of new connections at Layer 7.

Range: N/A

Example Requests

Modifying the description and name of a load balancer

PUT https://{ELB_Endpoint}/v3/{project_id}/elb/loadbalancers/{loadbalancer_id}

{
  "loadbalancer" : {
    "description" : "loadbalancer",
    "name" : "loadbalancer-update"
  }
}

Example Responses

Status code: 200

Successful request.

{
  "request_id" : "010dad1e-32a3-4405-ab83-62a1fc5f8722",
  "loadbalancer" : {
    "id" : "2e073bf8-edfe-4e51-a699-d915b0b8af89",
    "project_id" : "b2782e6708b8475c993e6064bc456bf8",
    "name" : "loadbalancer-update",
    "description" : "loadbalancer",
    "vip_port_id" : null,
    "vip_address" : null,
    "admin_state_up" : true,
    "provisioning_status" : "ACTIVE",
    "operating_status" : "ONLINE",
    "listeners" : [ {
      "id" : "41937176-bf64-4b58-8e0d-9ff2d0d32c54"
    }, {
      "id" : "abc6ac93-ad0e-4765-bd5a-eec632efde56"
    }, {
      "id" : "b9d8ba97-6d60-467d-838d-f3550b54c22a"
    }, {
      "id" : "fd797ebd-263d-4b18-96e9-e9188d36c69e"
    } ],
    "pools" : [ {
      "id" : "0aabcaa8-c35c-4ddc-a60c-9032d0ac0b80"
    }, {
      "id" : "165d9092-396e-4a8d-b398-067496a447d2"
    } ],
    "tags" : [ ],
    "provider" : "vlb",
    "created_at" : "2019-04-20T03:10:37Z",
    "updated_at" : "2019-05-24T02:11:58Z",
    "vpc_id" : "2037c5bb-e04b-4de2-9300-9051af18e417",
    "enterprise_project_id" : "0",
    "availability_zone_list" : [ "AZ1", "AZ2", "dc3" ],
    "ipv6_vip_address" : null,
    "ipv6_vip_virsubnet_id" : null,
    "ipv6_vip_port_id" : null,
    "eips" : [ ],
    "guaranteed" : true,
    "billing_info" : null,
    "l4_flavor_id" : null,
    "l4_scale_flavor_id" : null,
    "l7_flavor_id" : null,
    "l7_scale_flavor_id" : null,
    "vip_subnet_cidr_id" : null,
    "deletion_protection_enable" : false,
    "public_border_group" : "center"
  }
}

SDK Sample Code

The SDK sample code is as follows.

Modifying the description and name of a load balancer

 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
53
54
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.*;


public class UpdateLoadBalancerSolution {

    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");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        ElbClient client = ElbClient.newBuilder()
                .withCredential(auth)
                .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                .build();
        UpdateLoadBalancerRequest request = new UpdateLoadBalancerRequest();
        request.withLoadbalancerId("{loadbalancer_id}");
        UpdateLoadBalancerRequestBody body = new UpdateLoadBalancerRequestBody();
        UpdateLoadBalancerOption loadbalancerbody = new UpdateLoadBalancerOption();
        loadbalancerbody.withName("loadbalancer-update")
            .withDescription("loadbalancer");
        body.withLoadbalancer(loadbalancerbody);
        request.withBody(body);
        try {
            UpdateLoadBalancerResponse response = client.updateLoadBalancer(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());
        }
    }
}

Modifying the description and name of a load balancer

 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
# coding: utf-8

import os
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 = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = ElbClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ElbRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = UpdateLoadBalancerRequest()
        request.loadbalancer_id = "{loadbalancer_id}"
        loadbalancerbody = UpdateLoadBalancerOption(
            name="loadbalancer-update",
            description="loadbalancer"
        )
        request.body = UpdateLoadBalancerRequestBody(
            loadbalancer=loadbalancerbody
        )
        response = client.update_load_balancer(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Modifying the description and name of a load balancer

 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
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")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := elb.NewElbClient(
        elb.ElbClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.UpdateLoadBalancerRequest{}
	request.LoadbalancerId = "{loadbalancer_id}"
	nameLoadbalancer:= "loadbalancer-update"
	descriptionLoadbalancer:= "loadbalancer"
	loadbalancerbody := &model.UpdateLoadBalancerOption{
		Name: &nameLoadbalancer,
		Description: &descriptionLoadbalancer,
	}
	request.Body = &model.UpdateLoadBalancerRequestBody{
		Loadbalancer: loadbalancerbody,
	}
	response, err := client.UpdateLoadBalancer(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Successful request.

Error Codes

See Error Codes.