Help Center/ Elastic IP/ API Reference/ API V3/ Bandwidths/ Querying Bandwidths (Old APIs)
Updated on 2025-02-08 GMT+08:00

Querying Bandwidths (Old APIs)

Function

This API is used to query bandwidths.

URI

GET /v3/{project_id}/eip-bandwidths

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

Maximum length: 32

Table 2 Query parameters

Parameter

Mandatory

Type

Description

limit

No

String

  • Number of records returned on each page.

  • The value ranges from 0 to 2000. The maximum value varies by region.

marker

No

String

  • Start resource ID of pagination query. If the parameter is left blank, only resources on the first page are queried.

Minimum length: 0

Maximum length: 36

id

No

String

  • Bandwidth ID, which uniquely identifies a bandwidth

bandwidth_type

No

String

  • Bandwidth type. The default value for a shared bandwidth is share.

  • The value can be share, bgp, telcom, or sbgp.

    • share: Shared bandwidth

    • bgp: Dynamic BGP

    • telcom: China Unicom

    • sbgp: Static BGP

name

No

String

  • Bandwidth name. You can filter by bandwidth name.

name_like

No

String

  • Fuzzy search by bandwidth name.

tenant_id

No

String

  • Filter by the tenant ID.

ingress_size

No

String

  • Filter by inbound bandwidth size.

admin_state

No

String

  • Filter by bandwidth status.

billing_info

No

String

  • Filter by billing information.

tags

No

String

  • Filter by tag.

enable_bandwidth_rules

No

String

  • Filter based on whether bandwidth rules are enabled.

  • The value can be true or false.

rule_quota

No

Integer

  • Filter by rule numbers.

public_border_group

No

String

  • Filter by border group.

charge_mode

No

String

  • Whether the bandwidth is billed by traffic, bandwidth, or 95th percentile bandwidth (enhanced).

  • Possible values can be bandwidth (billed by bandwidth), traffic (billed by traffic), or 95peak_plus (billed by enhanced 95th percentile bandwidth). If the value is an empty character string or no value is specified, value bandwidth is used.

  • Only the shared bandwidth supports 95peak_plus (billed by enhanced 95th percentile bandwidth). If you choose to be billed by 95th percentile bandwidth (enhanced), you need to specify the guaranteed bandwidth percentage. The default value is 20%.

size

No

String

  • Bandwidth size. The shared bandwidth has a minimum limit, which may vary by site. The default minimum value is 5 Mbit/s.

  • The value ranges from 5 Mbit/s to 2000 Mbit/s by default. (The specific range may vary depending on the configuration in each region. You can see the available bandwidth range on the management console.)

    The minimum increment for bandwidth adjustment varies by the bandwidth range.

  • The minimum increment is 1 Mbit/s if the allowed bandwidth ranges from 0 Mbit/s to 300 Mbit/s (with 300 Mbit/s included).

  • The minimum increment is 50 Mbit/s if the allowed bandwidth ranges from 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s included).

  • The minimum increment is 500 Mbit/s if the allowed bandwidth is greater than 1000 Mbit/s.

type

No

String

  • Whether the bandwidth is shared or dedicated.

  • The value can be PER or WHOLE.

    • WHOLE: Shared bandwidth

    • PER: Dedicated bandwidth

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

eip_bandwidths

Array of EipBandwidthResponseBody objects

Bandwidths

page_info

PageInfoDict object

Pagination page number information

request_id

String

Request ID

Table 4 EipBandwidthResponseBody

Parameter

Type

Description

admin_state

String

  • Bandwidth status

  • The value can be normal or freezed.

ingress_size

Integer

  • Inbound bandwidth size in Mbit/s

rule_quota

Integer

  • Number of bandwidth rules. The minimum value can be adjusted.

ratio_95peak_plus

Integer

  • Guaranteed rate of the enhanced 95th percentile bandwidth. The minimum rate is 20%.

enable_bandwidth_rules

Boolean

  • Whether to enable the bandwidth rules.

bandwidth_rules

Array of BandWidthRules objects

  • Bandwidth rules (This parameter is available only in CN East-Shanghai1.)

public_border_group

String

  • Whether it is a central or edge bandwidth. Value center indicates a central bandwidth.

bandwidth_type

String

  • Bandwidth type. The default value for a shared bandwidth is share.

  • The value can be share, bgp, telcom, or sbgp.

    share: Shared bandwidth

    bgp: Dynamic BGP

    telcom: China Unicom

    sbgp: Static BGP

Minimum length: 1

Maximum length: 36

billinginfo

String

  • Billing information

Minimum length: 0

Maximum length: 255

id

String

  • Bandwidth ID, which uniquely identifies a bandwidth

Minimum length: 1

Maximum length: 36

name

String

  • Bandwidth name

  • The value can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).

Minimum length: 1

Maximum length: 64

publicip_info

Array of PublicipInfoResponseBody objects

  • EIP associated with the bandwidth

  • The bandwidth, whose type is set to WHOLE, can be used by multiple EIPs. The bandwidth, whose type is set to PER, can be used by only one EIP.

type

String

  • Whether the bandwidth is shared or dedicated.

  • The value can be PER or WHOLE.

    The value WHOLE indicates the shared bandwidth, and the value PER indicates the dedicated bandwidth.

size

Integer

  • Bandwidth size

  • The value ranges from 5 Mbit/s to 2000 Mbit/s by default. (The specific range may vary depending on the configuration in each region. You can see the available bandwidth range on the management console.)

Minimum value: 5

Maximum value: 2000

tenant_id

String

  • Project ID

tags

Array of strings

  • EIP tag

created_at

String

  • Time (UTC) when a resource is created. The format is YYYY-MM-DDTHH:MM:SS.

updated_at

String

  • Time (UTC) when a resource is updated. The format is YYYY-MM-DDTHH:MM:SS.

Table 5 BandWidthRules

Parameter

Type

Description

id

String

  • Bandwidth rule ID

Maximum length: 36

name

String

  • Bandwidth rule name

Minimum length: 0

Maximum length: 64

admin_state_up

Boolean

  • Configuration status. The value False indicates that the configuration does not take effect.

egress_size

Integer

  • Maximum outbound bandwidth in Mbit/s

  • The value range ranges from 0 to n, where n indicates the bandwidth size. If the value is set to 0, the maximum bandwidth size will be used.

Minimum value: 0

Default value: 0

egress_guarented_size

Integer

  • Guaranteed outbound bandwidth in Mbit/s

  • The value ranges from 0 to x, where x indicates the remaining bandwidth.

Minimum value: 0

Default value: 0

publicip_info

Array of PublicipInfoResponseBody objects

  • EIP associated with the bandwidth

  • The bandwidth, whose type is set to WHOLE, can be used by multiple EIPs. The bandwidth, whose type is set to PER, can be used by only one EIP.

Table 6 PublicipInfoResponseBody

Parameter

Type

Description

publicip_address

String

  • IPv4 or IPv6 EIP

publicip_id

String

  • ID of the IPv4 or IPv6 EIP that uses the bandwidth

Minimum length: 1

Maximum length: 36

publicip_type

String

  • EIP type

  • The value can be 5_bgp.

  • Constraints:

    • The configured value must be supported by the system.

    • publicip_id is an IPv4 port. If type is not specified, the default value is 5_bgp.

Maximum length: 36

publicipv6_address

String

  • Obtained EIP if IPv6 EIPs are available. This parameter does not exist if only IPv4 EIPs are available.

ip_version

Integer

  • IP address version

  • The value can be:

    4: IPv4

    6: IPv6

Table 7 PageInfoDict

Parameter

Type

Description

previous_marker

String

Marker value of the previous page

next_marker

String

Marker value of the next page

current_count

Integer

Total number of data records on the current page

Example Request

Query the bandwidths. You can filter the bandwidths based on the query field.

GET https://{Endpoint}/v3/{project_id}/eip-bandwidths?limit=3&marker=4779ab1c-7c1a-44b1-a02e-93dfc361b32d

Example Response

Status code: 200

Normal response to the GET operation

{
  "request_id" : "4e5945ddd409f306b3cb4fd921a45390",
  "eip_bandwidths" : [ {
    "name" : "bandwidth-838f",
    "id" : "08b4700e-cc3c-4aed-a35a-66022bcbd0f6",
    "tenant_id" : "cb576f8cf0df40b8bb6cea0a1765c569",
    "size" : 10,
    "bandwidth_type" : "bgp",
    "ratio_95peak_plus" : null,
    "admin_state" : "NORMAL",
    "ingress_size" : 10,
    "type" : "PER",
    "enable_bandwidth_rules" : false,
    "rule_quota" : 0,
    "created_at" : "2023-05-17T02:06:49Z",
    "updated_at" : "2023-05-17T02:06:49Z",
    "bandwidth_rules" : [ ],
    "publicip_info" : [ {
      "publicip_address" : "10.83.15.65",
      "publicip_type" : "5_bgp",
      "publicip_id" : "e73fcc26-c009-4ea3-9b57-d546359bda38",
      "ip_version" : 4,
      "publicipv6_address" : null
    } ],
    "tags" : [ ],
    "public_border_group" : "center"
  } ],
  "page_info" : [ {
    "next_marker" : "08b4700e-cc3c-4aed-a35a-66022bcbd0f6",
    "previous_marker" : "08b4700e-cc3c-4aed-a35a-66022bcbd0f6",
    "current_count" : 1
  } ]
}

SDK Sample Code

The sample code is as follows:

Java

 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 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.eip.v3.region.EipRegion;
import com.huaweicloud.sdk.eip.v3.*;
import com.huaweicloud.sdk.eip.v3.model.*;


public class ListEipBandwidthsSolution {

    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);

        EipClient client = EipClient.newBuilder()
                .withCredential(auth)
                .withRegion(EipRegion.valueOf("<YOUR REGION>"))
                .build();
        ListEipBandwidthsRequest request = new ListEipBandwidthsRequest();
        try {
            ListEipBandwidthsResponse response = client.listEipBandwidths(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());
        }
    }
}

Python

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

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkeip.v3.region.eip_region import EipRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkeip.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 = EipClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(EipRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListEipBandwidthsRequest()
        response = client.list_eip_bandwidths(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

 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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    eip "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/eip/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/eip/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/eip/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 := eip.NewEipClient(
        eip.EipClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListEipBandwidthsRequest{}
	response, err := client.ListEipBandwidths(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

More SDK Sample Code

For more SDK sample codes of programming languages, visit API Explorer and click the Sample Code tab. Example codes can be automatically generated.

Status Codes

Status Code

Description

200

Normal response to the GET operation

Error Codes

See Error Codes.