> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Clusters

> SDK methods to list, retrieve, and manage Kubernetes clusters connected to TrueFoundry.

## Methods

<Accordion title="list">
  Retrieves a list of all latest Clusters. Pagination is available based on query parameters.

  #### Parameters

  <ParamField body="limit" type="typing.Optional[int]">
    Number of items per page
  </ParamField>

  <ParamField body="offset" type="typing.Optional[int]">
    Number of items to skip
  </ParamField>

  #### Returns

  <ResponseField name="SyncPager[Cluster, ListClustersResponse]" type="SyncPager[Cluster, ListClustersResponse]">
    [🔗 ListClustersResponse](/docs/truefoundry_sdk/types#listclustersresponse)

    Retrieve latest Clusters. If pagination parameters are provided, the response includes paginated data.
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.clusters.list(
      limit=10,
      offset=10,
  )

  # Iterate through results
  for item in response:
      print(item.name)

  # Or paginate page by page
  for page in response.iter_pages():
      for item in page:
          print(item.name)
  ```
</Accordion>

<Accordion title="create_or_update">
  Create or Update cluster with provided manifest

  #### Parameters

  <ParamField body="manifest" type="ClusterManifest" required>
    [🔗 ClusterManifest](/docs/truefoundry_sdk/types#clustermanifest)

    Cluster manifest
  </ParamField>

  <ParamField body="dry_run" type="typing.Optional[bool]">
    Dry run the cluster creation/update
  </ParamField>

  #### Returns

  <ResponseField name="GetClusterResponse" type="GetClusterResponse">
    [🔗 GetClusterResponse](/docs/truefoundry_sdk/types#getclusterresponse)

    Returns newly created/updated cluster on success
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.clusters.create_or_update(
      manifest={"key": "value"},
      dry_run=False,
  )
  ```
</Accordion>

<Accordion title="get">
  Get cluster associated with provided id

  #### Parameters

  <ParamField body="id" type="str" required>
    Cluster id of the cluster
  </ParamField>

  #### Returns

  <ResponseField name="GetClusterResponse" type="GetClusterResponse">
    [🔗 GetClusterResponse](/docs/truefoundry_sdk/types#getclusterresponse)

    Return the cluster associated with provided id
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.clusters.get(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="delete">
  Delete cluster associated with provided cluster id

  #### Parameters

  <ParamField body="id" type="str" required>
    Cluster id of the cluster
  </ParamField>

  #### Returns

  <ResponseField name="ClustersDeleteResponse" type="ClustersDeleteResponse">
    [🔗 ClustersDeleteResponse](/docs/truefoundry_sdk/types#clustersdeleteresponse)

    Returns success message on successful deletion
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.clusters.delete(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="get_addons">
  List addons for the provided cluster. Pagination is available based on query parameters.

  #### Parameters

  <ParamField body="id" type="str" required>
    Cluster id of the cluster
  </ParamField>

  <ParamField body="limit" type="typing.Optional[int]">
    Number of items per page
  </ParamField>

  <ParamField body="offset" type="typing.Optional[int]">
    Number of items to skip
  </ParamField>

  #### Returns

  <ResponseField name="ListClusterAddonsResponse" type="ListClusterAddonsResponse">
    [🔗 ListClusterAddonsResponse](/docs/truefoundry_sdk/types#listclusteraddonsresponse)

    Returns a paginated list of addons for the cluster
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.clusters.get_addons(
      id="id_value",
      limit=10,
      offset=10,
  )
  ```
</Accordion>

<Accordion title="is_connected">
  Get the status of provided cluster

  #### Parameters

  <ParamField body="id" type="str" required>
    Cluster id of the cluster
  </ParamField>

  #### Returns

  <ResponseField name="IsClusterConnectedResponse" type="IsClusterConnectedResponse">
    [🔗 IsClusterConnectedResponse](/docs/truefoundry_sdk/types#isclusterconnectedresponse)

    Returns the status of provided cluster
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.clusters.is_connected(
      id="id_value",
  )
  ```
</Accordion>
