> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/go/go-bundle/sdks/mongo/api/clustersapi.md).

# ClustersApi

All URIs are relative to *<https://mongodb.gb-bhx.ionos.com/v2>*

| Method                                    | HTTP request                     | Description           |
| ----------------------------------------- | -------------------------------- | --------------------- |
| [**ClustersDelete**](#ClustersDelete)     | **Delete** /clusters/{clusterId} | Delete Cluster        |
| [**ClustersFindById**](#ClustersFindById) | **Get** /clusters/{clusterId}    | Retrieve Cluster      |
| [**ClustersGet**](#ClustersGet)           | **Get** /clusters                | Retrieve all Clusters |
| [**ClustersPost**](#ClustersPost)         | **Post** /clusters               | Create Cluster        |
| [**ClustersPut**](#ClustersPut)           | **Put** /clusters/{clusterId}    | Ensure Cluster        |

## ClustersDelete

```go
var result  = ClustersDelete(ctx, clusterId)
                      .Execute()
```

Delete Cluster

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    mongo "github.com/ionos-cloud/sdk-go-bundle/products/mongo"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    clusterId := "e69b22a5-8fee-56b1-b6fb-4a07e4205ead" // string | The ID (UUID) of the Cluster.

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := mongo.NewAPIClient(configuration)
    resp, err := apiClient.ClustersApi.ClustersDelete(context.Background(), clusterId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ClustersApi.ClustersDelete``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
}
```

### Path Parameters

| Name          | Type                | Description                                                                 | Notes |
| ------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**       | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **clusterId** | **string**          | The ID (UUID) of the Cluster.                                               |       |

### Other Parameters

Other parameters are passed through a pointer to an apiClustersDeleteRequest struct via the builder pattern

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |

### Return type

(empty response body)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## ClustersFindById

```go
var result ClusterRead = ClustersFindById(ctx, clusterId)
                      .Execute()
```

Retrieve Cluster

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    mongo "github.com/ionos-cloud/sdk-go-bundle/products/mongo"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    clusterId := "e69b22a5-8fee-56b1-b6fb-4a07e4205ead" // string | The ID (UUID) of the Cluster.

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := mongo.NewAPIClient(configuration)
    resource, resp, err := apiClient.ClustersApi.ClustersFindById(context.Background(), clusterId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ClustersApi.ClustersFindById``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `ClustersFindById`: ClusterRead
    fmt.Fprintf(os.Stdout, "Response from `ClustersApi.ClustersFindById`: %v\n", resource)
}
```

### Path Parameters

| Name          | Type                | Description                                                                 | Notes |
| ------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**       | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **clusterId** | **string**          | The ID (UUID) of the Cluster.                                               |       |

### Other Parameters

Other parameters are passed through a pointer to an apiClustersFindByIdRequest struct via the builder pattern

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |

### Return type

[**ClusterRead**](https://github.com/ionos-cloud/sdk-go-bundle/tree/v2/products/dbaas/mongo/docs/models/ClusterRead.md)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## ClustersGet

```go
var result ClusterReadList = ClustersGet(ctx)
                      .Offset(offset)
                      .Limit(limit)
                      .FilterName(filterName)
                      .FilterState(filterState)
                      .FilterEdition(filterEdition)
                      .Execute()
```

Retrieve all Clusters

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    mongo "github.com/ionos-cloud/sdk-go-bundle/products/mongo"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    offset := int32(0) // int32 | The first element (of the total list of elements) to include in the response. Use this parameter together with the limit for pagination. (optional) (default to 0)
    limit := int32(100) // int32 | The maximum number of elements to return. Use this parameter together with the offset for pagination. (optional) (default to 100)
    filterName := "filterName_example" // string | Filters resources by name. It matches cluster names that contain the provided string. (optional)
    filterState := openapiclient.MongoClusterStates("PROVISIONING") // MongoClusterStates | Filters resources by state. (optional)
    filterEdition := openapiclient.MongoEdition("ENTERPRISE") // MongoEdition | Filters resources by edition. (optional)

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := mongo.NewAPIClient(configuration)
    resource, resp, err := apiClient.ClustersApi.ClustersGet(context.Background()).Offset(offset).Limit(limit).FilterName(filterName).FilterState(filterState).FilterEdition(filterEdition).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ClustersApi.ClustersGet``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `ClustersGet`: ClusterReadList
    fmt.Fprintf(os.Stdout, "Response from `ClustersApi.ClustersGet`: %v\n", resource)
}
```

### Path Parameters

### Other Parameters

Other parameters are passed through a pointer to an apiClustersGetRequest struct via the builder pattern

| Name              | Type                                                                                                                          | Description                                                                                                                              | Notes             |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| **offset**        | **int32**                                                                                                                     | The first element (of the total list of elements) to include in the response. Use this parameter together with the limit for pagination. | \[default to 0]   |
| **limit**         | **int32**                                                                                                                     | The maximum number of elements to return. Use this parameter together with the offset for pagination.                                    | \[default to 100] |
| **filterName**    | **string**                                                                                                                    | Filters resources by name. It matches cluster names that contain the provided string.                                                    |                   |
| **filterState**   | [**MongoClusterStates**](https://github.com/ionos-cloud/sdk-go-bundle/tree/v2/products/dbaas/mongo/docs/models/.md/README.md) | Filters resources by state.                                                                                                              |                   |
| **filterEdition** | [**MongoEdition**](https://github.com/ionos-cloud/sdk-go-bundle/tree/v2/products/dbaas/mongo/docs/models/.md/README.md)       | Filters resources by edition.                                                                                                            |                   |

### Return type

[**ClusterReadList**](https://github.com/ionos-cloud/sdk-go-bundle/tree/v2/products/dbaas/mongo/docs/models/ClusterReadList.md)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## ClustersPost

```go
var result ClusterRead = ClustersPost(ctx)
                      .ClusterCreate(clusterCreate)
                      .Execute()
```

Create Cluster

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    mongo "github.com/ionos-cloud/sdk-go-bundle/products/mongo"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    clusterCreate := *openapiclient.NewClusterCreate(openapiclient.ClusterCreate_properties{BusinessClusterCreate: openapiclient.NewBusinessClusterCreate("cms-prod", "7", *openapiclient.NewMongoClusterConnection("5a029f4a-72e5-11ec-90d6-0242ac120003", "2", []string{"192.168.2.101/24"}), *openapiclient.NewMaintenanceWindow("59459", openapiclient.DayOfTheWeek("Sunday")), *openapiclient.NewMongoUser("my_db_user", "my_database"), openapiclient.MongoEdition("ENTERPRISE"), "dcd31531-3ac8-11eb-9feb-046c59cc737e", int32(3), *openapiclient.NewClusterSnapshot("eu-south-2", int32(90)))}) // ClusterCreate | Cluster to create.

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := mongo.NewAPIClient(configuration)
    resource, resp, err := apiClient.ClustersApi.ClustersPost(context.Background()).ClusterCreate(clusterCreate).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ClustersApi.ClustersPost``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `ClustersPost`: ClusterRead
    fmt.Fprintf(os.Stdout, "Response from `ClustersApi.ClustersPost`: %v\n", resource)
}
```

### Path Parameters

### Other Parameters

Other parameters are passed through a pointer to an apiClustersPostRequest struct via the builder pattern

| Name              | Type                                                                                                                        | Description        | Notes |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
| **clusterCreate** | [**ClusterCreate**](https://github.com/ionos-cloud/sdk-go-bundle/tree/v2/products/dbaas/mongo/docs/models/ClusterCreate.md) | Cluster to create. |       |

### Return type

[**ClusterRead**](https://github.com/ionos-cloud/sdk-go-bundle/tree/v2/products/dbaas/mongo/docs/models/ClusterRead.md)

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## ClustersPut

```go
var result ClusterRead = ClustersPut(ctx, clusterId)
                      .ClusterEnsure(clusterEnsure)
                      .Execute()
```

Ensure Cluster

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    mongo "github.com/ionos-cloud/sdk-go-bundle/products/mongo"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    clusterId := "e69b22a5-8fee-56b1-b6fb-4a07e4205ead" // string | The ID (UUID) of the Cluster.
    clusterEnsure := *openapiclient.NewClusterEnsure("e69b22a5-8fee-56b1-b6fb-4a07e4205ead", openapiclient.Cluster{BusinessCluster: openapiclient.NewBusinessCluster("cms-prod", "7", *openapiclient.NewMongoClusterConnection("5a029f4a-72e5-11ec-90d6-0242ac120003", "2", []string{"192.168.2.101/24"}), *openapiclient.NewMaintenanceWindow("59459", openapiclient.DayOfTheWeek("Sunday")), openapiclient.MongoEdition("ENTERPRISE"), "dcd31531-3ac8-11eb-9feb-046c59cc737e", int32(3), *openapiclient.NewClusterSnapshot("eu-south-2", int32(90)))}) // ClusterEnsure | update Cluster

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := mongo.NewAPIClient(configuration)
    resource, resp, err := apiClient.ClustersApi.ClustersPut(context.Background(), clusterId).ClusterEnsure(clusterEnsure).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ClustersApi.ClustersPut``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `ClustersPut`: ClusterRead
    fmt.Fprintf(os.Stdout, "Response from `ClustersApi.ClustersPut`: %v\n", resource)
}
```

### Path Parameters

| Name          | Type                | Description                                                                 | Notes |
| ------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**       | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **clusterId** | **string**          | The ID (UUID) of the Cluster.                                               |       |

### Other Parameters

Other parameters are passed through a pointer to an apiClustersPutRequest struct via the builder pattern

| Name              | Type                                                                                                                        | Description    | Notes |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------- | -------------- | ----- |
| **clusterEnsure** | [**ClusterEnsure**](https://github.com/ionos-cloud/sdk-go-bundle/tree/v2/products/dbaas/mongo/docs/models/ClusterEnsure.md) | update Cluster |       |

### Return type

[**ClusterRead**](https://github.com/ionos-cloud/sdk-go-bundle/tree/v2/products/dbaas/mongo/docs/models/ClusterRead.md)

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/go/go-bundle/sdks/mongo/api/clustersapi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
