ListClusters#

Description#

Describes the list of clusters.

Request Syntax#

GET /clusters?maxResults=maxResults&nextToken=nextToken HTTP/1.1

URI Request Parameters#

The request uses the following URI parameters.

  • maxResults — Maximum number of clusters whose descriptions are returned by ListClusters in paginated output.

    • Required: No

    • Type: Integer

    • Value range: Min — 1. Max — 100.

    • Default value: 100

  • NextTokenNextToken returned by a previous call (see Response Elements).

    • Type: String

    • Required: No

Request Parameters#

Request body is absent.

Response Syntax#

HTTP/1.1 200
Content-type: application/json

{
   "clusters": [ "string" ],
   "nextToken": "string"
}

Response Elements#

If the request is executed successfully, API will return an HTTP response with 200 code. The response contains the following data in JSON format.

  • clusters — List of names of all Kubernetes clusters.

    • Type: List of strings

  • NextToken — The token is returned only when the response cannot hold all the clusters that meet the criteria. To receive further data, the returned value must be passed as the NextToken parameter in the same request.

    • Type: String

Examples#

boto3 K2 Cloud boto3 Client
import boto3

session = boto3.Session(
   aws_access_key_id="<AWS_ACCESS_KEY_ID>",
   aws_secret_access_key="<AWS_SECRET_ACCESS_KEY>",
   region_name="",
)

eks_client = session.client(
   'eks',
   endpoint_url='https://eks.k2.cloud/',
)

eks_client.list_clusters()
c2-eks K2 Cloud API Client
c2-eks ListClusters
aws-cli
aws eks --endpoint https://eks.k2.cloud/ list-clusters