All Products
Search
Document Center

Server Load Balancer:ListServerGroups

更新時間:Dec 02, 2024

Queries the server groups of a Gateway Load Balancer (GWLB) instance.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
gwlb:ListServerGroupsget
*ServerGroup
acs:gwlb:{#regionId}:{#accountId}:servergroup/*
*ServerGroup
acs:gwlb:{#regionId}:{#accountId}:servergroup/{#ServerGroupId}
*VPC
acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ServerGroupIdsarrayNo

The server group IDs.

You can specify at most 20 server group IDs in each call.

ServerGroupIdstringNo

The server group ID.

sgp-atstuj3rtoptyui****
ServerGroupNamesarrayNo

The server group names.

You can specify at most 20 server group names in each call.

ServerGroupNamestringNo

The server group name.

testServerGroupName
ServerGroupTypestringNo

The server group type. Valid values:

  • Instance: allows you to specify servers of the Ecs, Eni, or Eci type.
  • Ip: allows you to add servers of by specifying IP addresses.
Instance
ResourceGroupIdstringNo

The ID of the resource group to which the instance belongs.

rg-atstuj3rtop****
Tagarray<object>No

The tag keys.

You can specify at most 20 tags in each call.

TagModelobjectNo

The tag.

KeystringNo

The tag key. The tag key cannot be an empty string. The tag key can be up to 128 characters in length, and cannot start with acs: or aliyun. The tag key cannot contain http:// or https://.

testTagKey
ValuestringNo

The tag value. The tag value can be up to 256 characters in length and cannot contain http:// or https://.

testTagValue
VpcIdstringNo

The VPC ID.

vpc-bp15zckdt37pq72zv****
NextTokenstringNo

The pagination token that is used in the next request to retrieve a new page of results. Valid values:

  • If NextToken is empty, no next page exists.
  • If a value of NextToken is returned, the value indicates the token that is used for the next query.
FFmyTO70tTpLG6I3FmYAXGKPd****
MaxResultsintegerNo

The number of entries per page.

Valid values: 1 to 1000.

Default value: 20.

20
SkipintegerNo

The number of entries to be skipped in the call.

1

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

MaxResultsinteger

The number of entries per page.

Valid values: 1 to 1000.

20
NextTokenstring

A pagination token. It can be used in the next request to retrieve a new page of results. Valid values:

  • If NextToken is empty, no next page exists.
  • If a value of NextToken is returned, the value indicates the token that is used for the next query.
FFmyTO70tTpLG6I3FmYAXGKPd****
RequestIdstring

The request ID.

54B48E3D-DF70-471B-AA93-08E683A1B45
ServerGroupsarray<object>

The configurations of the server group.

serverGroupobject

The server group.

ConnectionDrainConfigobject

The configurations of connection draining.

ConnectionDrainEnabledboolean

Indicates whether connection draining is enabled. Valid values:

  • true
  • false
false
ConnectionDrainTimeoutinteger

The timeout period of connection draining.

Unit: seconds

Valid values: 1 to 3600.

300
CreateTimestring

The time when the resource was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

2024-08-05T18:24:07Z
HealthCheckConfigobject

The configuration of health checks.

HealthCheckConnectPortinteger

The backend server port that is used for health checks.

Valid values: 1 to 65535.

80
HealthCheckConnectTimeoutinteger

The maximum timeout period of a health check.

Unit: seconds

Valid values: 1 to 300.

5
HealthCheckDomainstring

The domain name that is used for health checks. Valid values:

  • $SERVER_IP: the internal IP address of a backend server.
  • domain: a domain name. The domain name must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), and periods (.).
Note This parameter takes effect only if you set HealthCheckProtocol to HTTP.
$SERVER_IP
HealthCheckEnabledboolean

Indicates whether the health check feature is enabled. Valid values:

  • true
  • false
true
HealthCheckHttpCodearray

The HTTP status codes that the system returns for health checks.

HealthCheckHttpCodestring

The HTTP status code to return for health checks. Separate multiple HTTP status codes with commas (,). Valid values:

  • http_2xx
  • http_3xx
  • http_4xx
  • http_5xx

Default value: http_2xx.

Note This parameter takes effect only if you set HealthCheckProtocol to HTTP.
http_2xx
HealthCheckIntervalinteger

The interval at which health checks are performed.

Unit: seconds

Valid values: 1 to 50.

10
HealthCheckPathstring

The URL that is used for health checks.

The URL must be 1 to 80 characters in length, and can contain letters, digits, and the following special characters: - / . % ? # & The URL must start with a forward slash (/).

Note This parameter takes effect only if you set HealthCheckProtocol to HTTP.
/test/index.html
HealthCheckProtocolstring

The protocol that is used for health checks. Valid values:

  • TCP: TCP health checks send TCP SYN packets to a backend server to check whether the port of the backend server is reachable.
  • HTTP: HTTP health checks simulate a process that uses a web browser to access resources by sending HEAD or GET requests to an instance. These requests are used to check whether the instance is healthy.
TCP
HealthyThresholdinteger

The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy. In this case, the health status changes from fail to success.

Valid values: 2 to 10.

2
UnhealthyThresholdinteger

The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy. In this case, the health status changes from success to fail.

Valid values: 2 to 10.

2
Protocolstring

The backend protocol. Valid values:

  • GENEVE.
GENEVE
RelatedLoadBalancerIdsarray

The IDs of the GWLB instances that are associated with the server group.

LoadBalancerIdstring

The ID of the GWLB instance that is associated with the server group.

gwlb-cp6prgqy40hols****
ResourceGroupIdstring

The resource group ID.

rg-atstuj3rtop****
Schedulerstring

The scheduling algorithm. Valid values:

  • 5TCH: indicates consistent hashing that is based on the following factors: source IP address, destination IP address, source port, protocol, and destination port. Requests that contain the same information based on the preceding factors are forwarded to the same backend server.
  • 3TCH: indicates consistent hashing that is based on the following factors: source IP address, destination IP address, and protocol. Requests that contain the same information based on the preceding factors are forwarded to the same backend server.
  • 2TCH: indicates consistent hashing that is based on the following factors: source IP address and destination IP address. Requests that contain the same information based on the preceding factors are forwarded to the same backend server.
5TCH
ServerCountinteger

The number of server groups.

2
ServerGroupIdstring

The server group ID.

sgp-atstuj3rtoptyui****
ServerGroupNamestring

The server group name.

testServerGroupName
ServerGroupStatusstring

The status of the server group. Valid values:

  • Creating
  • Available
  • Configuring
Available
ServerGroupTypestring

The server group type. Valid values:

  • Instance: allows you to specify servers of the Ecs, Eni, or Eci type.
  • Ip: allows you to add servers of by specifying IP addresses.
Instance
Tagsarray<object>

The tags.

TagModelobject

The tag.

Keystring

The tag key. The tag key cannot be an empty string. The tag key can be up to 128 characters in length, and cannot start with acs: or aliyun. The tag key cannot contain http:// or https://.

testTagKey
Valuestring

The tag value. The tag value can be up to 256 characters in length and cannot contain http:// or https://.

testTagValue
VpcIdstring

The VPC ID.

vpc-bp15zckdt37pq72zv****
TotalCountinteger

The total number of entries returned.

1

Examples

Sample success responses

JSONformat

{
  "MaxResults": 20,
  "NextToken": "FFmyTO70tTpLG6I3FmYAXGKPd****",
  "RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B45",
  "ServerGroups": [
    {
      "ConnectionDrainConfig": {
        "ConnectionDrainEnabled": false,
        "ConnectionDrainTimeout": 300
      },
      "CreateTime": "2024-08-05T18:24:07Z",
      "HealthCheckConfig": {
        "HealthCheckConnectPort": 80,
        "HealthCheckConnectTimeout": 5,
        "HealthCheckDomain": "$SERVER_IP",
        "HealthCheckEnabled": true,
        "HealthCheckHttpCode": [
          "http_2xx"
        ],
        "HealthCheckInterval": 10,
        "HealthCheckPath": "/test/index.html",
        "HealthCheckProtocol": "TCP",
        "HealthyThreshold": 2,
        "UnhealthyThreshold": 2
      },
      "Protocol": "GENEVE",
      "RelatedLoadBalancerIds": [
        "gwlb-cp6prgqy40hols****"
      ],
      "ResourceGroupId": "rg-atstuj3rtop****",
      "Scheduler": "5TCH",
      "ServerCount": 2,
      "ServerGroupId": "sgp-atstuj3rtoptyui****",
      "ServerGroupName": "testServerGroupName",
      "ServerGroupStatus": "Available",
      "ServerGroupType": "Instance",
      "Tags": [
        {
          "Key": "testTagKey",
          "Value": "testTagValue"
        }
      ],
      "VpcId": "vpc-bp15zckdt37pq72zv****"
    }
  ],
  "TotalCount": 1
}

Error codes

For a list of error codes, visit the Service error codes.