All Products
Search
Document Center

Microservices Engine:ListAnsServiceClusters

Last Updated:Nov 20, 2024

Queries the clusters of a Nacos service.

Operation description

Note The operation is not provided in Nacos SDKs. For information about Nacos SDKs, see the official documentation.

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
mse:ListAnsServiceClusterslist
*Cluster
acs:mse:{#regionId}:{#accountId}:instance/{#InstanceId}
*EngineNamespace
acs:mse:{#regionId}:{#accountId}:instance/{#InstanceId}/{#NamespaceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
PageNumintegerYes

The number of the page to return.

1
PageSizeintegerYes

The number of entries to return on each page.

10
ClusterIddeprecatedstringNo

The ID of the MSE cluster.

Note The MSE cluster is different from the cluster of the Nacos service.
mse-09k1q110q01
ServiceNamestringNo

The name of the service.

nacos.test.3
GroupNamestringNo

The name of the group.

DEFAULT_GROUP
NamespaceIdstringNo

The ID of the namespace.

12233****
ClusterNamestringNo

The alias of the cluster.

mse-7413****
InstanceIdstringNo

The ID of the instance.

mse_prepaid_public_cn-tl32a6****
AcceptLanguagestringNo

The language of the response. Valid values:

  • zh: Chinese
  • en: English
zh

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

Messagestring

The message returned.

The request was successfully processed.
RequestIdstring

The ID of the request.

52BA6DA6-A702-4362-A32F-DFF79655****
Dataobject

The data returned.

ProtectThresholdfloat

The protection threshold.

0
GroupNamestring

The service group to which the service belongs.

DEFAULT_GROUP
Clustersarray<object>

The cluster information.

NacosAnsClusterobject

The data structure.

DefaultCheckPortinteger

The default port used for a health check.

80
HealthCheckerTypestring

The type of the health check.

Heartbeat Reporting
UseIPPort4Checkboolean

Indicates whether an end-to-end health check was initiated by the server. This parameter is valid only if the service is not a temporary service.

true
ServiceNamestring

The full name of the service.

DEFAULT_GROUP@@nacos.test.3
Namestring

The cluster name.

test
DefaultPortinteger

The default port.

80
Metadataobject

The metadata of the cluster.

111
Namestring

The name of the service.

nacos.test.3
SelectorTypestring

The election mode.

none
Metadataobject

The metadata of the service.

111
Ephemeralboolean

Indicates whether the service is a temporary service. Valid values:

  • true: yes
  • false: no
true
Sourcestring

The source type of the service. Valid values:

  • console: The service was registered in the console.
  • sdk: The service was registered by using the SDK.
  • governance: The service was registered on Microservices Governance.
console
AppDetailobject

The information about the associated application for which Microservices Governance is enabled when the Source parameter is set to governance.

AppIdstring

The ID of the application for which Microservices Governance is enabled.

hkhon1po62@904cba2c0xxxxxx
AppNamestring

The name of the application for which Microservices Governance is enabled.

spring-cloud-b
Portinteger

The port number of the application for which Microservices Governance is enabled.

6001
CheckTypestring

The type of the health check. Valid values:

  • connection: connection status check
  • tcp: TCP connection check
  • http: HTTP connection check
connection
CheckPathstring

The path of the health check. This parameter is required only when the CheckType parameter is set to http.

/health
CheckTimeoutinteger

The timeout period of the health check response. Unit: seconds.

5
CheckInternalinteger

The health check interval. Unit: seconds.

2
HealthyCheckTimesinteger

The maximum number of health check retries when the instance state changes from unhealthy to healthy.

2
UnhealthyCheckTimesinteger

The maximum number of health check retries when the instance state changes from healthy to unhealthy.

2
ErrorCodestring

The error code returned if the request failed.

mse-100-000
Successboolean

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.
true
HttpCodestring

The HTTP status code.

200

Examples

Sample success responses

JSONformat

{
  "Message": "The request was successfully processed.\n",
  "RequestId": "52BA6DA6-A702-4362-A32F-DFF79655****",
  "Data": {
    "ProtectThreshold": 0,
    "GroupName": "DEFAULT_GROUP",
    "Clusters": [
      {
        "DefaultCheckPort": 80,
        "HealthCheckerType": "Heartbeat Reporting\n",
        "UseIPPort4Check": true,
        "ServiceName": "DEFAULT_GROUP@@nacos.test.3",
        "Name": "test",
        "DefaultPort": 80,
        "Metadata": 111
      }
    ],
    "Name": "nacos.test.3",
    "SelectorType": "none",
    "Metadata": 111,
    "Ephemeral": true,
    "Source": "console",
    "AppDetail": {
      "AppId": "hkhon1po62@904cba2c0xxxxxx",
      "AppName": "spring-cloud-b",
      "Port": 6001,
      "CheckType": "connection",
      "CheckPath": "/health",
      "CheckTimeout": 5,
      "CheckInternal": 2,
      "HealthyCheckTimes": 2,
      "UnhealthyCheckTimes": 2
    }
  },
  "ErrorCode": "mse-100-000",
  "Success": true,
  "HttpCode": "200"
}

Error codes

HTTP status codeError codeError messageDescription
400IllegalRequestInvalid request:%sInvalid request: %s
400InvalidParameterParameter error:%sRequest parameter error: %s
403NoPermissionYou are not authorized to perform this operation:%sYou do not have the permission to use this interface:%s
404NotFoundNot found:%sThe resource does not exist:%s
500InternalErrorConsole error. Try again later:%sConsole error. Try again later: %s

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

Change history

Change timeSummary of changesOperation
2023-06-14The response structure of the API has changedView Change Details
2023-05-17The Error code has changedView Change Details
2023-05-08API Description Update. The API operation is not deprecated.. The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedView Change Details