# ClustersApi

All URIs are relative to *<https://api.ionos.com/databases/postgresql>*

| Method                                                        | HTTP request                                   | Description              |
| ------------------------------------------------------------- | ---------------------------------------------- | ------------------------ |
| [**ClusterPostgresVersionsGet**](#ClusterPostgresVersionsGet) | **Get** /clusters/{clusterId}/postgresversions | List PostgreSQL versions |
| [**ClustersDelete**](#ClustersDelete)                         | **Delete** /clusters/{clusterId}               | Delete a cluster         |
| [**ClustersFindById**](#ClustersFindById)                     | **Get** /clusters/{clusterId}                  | Fetch a cluster          |
| [**ClustersGet**](#ClustersGet)                               | **Get** /clusters                              | List clusters            |
| [**ClustersPatch**](#ClustersPatch)                           | **Patch** /clusters/{clusterId}                | Patch a cluster          |
| [**ClustersPost**](#ClustersPost)                             | **Post** /clusters                             | Create a cluster         |
| [**PostgresVersionsGet**](#PostgresVersionsGet)               | **Get** /clusters/postgresversions             | List PostgreSQL versions |

## ClusterPostgresVersionsGet

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

List PostgreSQL versions

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-postgres"
)

func main() {
    clusterId := "498ae72f-411f-11eb-9d07-046c59cc737e" // string | The unique ID of the cluster.

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

### Path Parameters

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

### Other Parameters

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

### Return type

[**PostgresVersionList**](/postgres-sdk-golang/models/postgresversionlist.md)

### HTTP request headers

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

## ClustersDelete

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

Delete a cluster

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-postgres"
)

func main() {
    clusterId := "498ae72f-411f-11eb-9d07-046c59cc737e" // string | The unique ID of the cluster.

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.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)
    }
    // response from `ClustersDelete`: ClusterResponse
    fmt.Fprintf(os.Stdout, "Response from `ClustersApi.ClustersDelete`: %v\n", resource)
}
```

### Path Parameters

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

### Other Parameters

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

### Return type

[**ClusterResponse**](/postgres-sdk-golang/models/clusterresponse.md)

### HTTP request headers

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

## ClustersFindById

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

Fetch a cluster

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-postgres"
)

func main() {
    clusterId := "498ae72f-411f-11eb-9d07-046c59cc737e" // string | The unique ID of the cluster.

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.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`: ClusterResponse
    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 unique ID of the cluster.                                               |       |

### Other Parameters

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

### Return type

[**ClusterResponse**](/postgres-sdk-golang/models/clusterresponse.md)

### HTTP request headers

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

## ClustersGet

```go
var result ClusterList = ClustersGet(ctx)
                      .Limit(limit)
                      .Offset(offset)
                      .FilterName(filterName)
                      .Execute()
```

List clusters

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-postgres"
)

func main() {
    limit := int32(100) // int32 | The maximum number of elements to return. Use together with 'offset' for pagination. (optional) (default to 100)
    offset := int32(200) // int32 | The first element to return. Use together with 'limit' for pagination. (optional) (default to 0)
    filterName := "filterName_example" // string | Response filter to list only the PostgreSQL clusters that contain the specified name. The value is case insensitive and matched on the 'displayName' field.  (optional)

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.ClustersApi.ClustersGet(context.Background()).Limit(limit).Offset(offset).FilterName(filterName).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`: ClusterList
    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             |
| -------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| **limit**      | **int32**  | The maximum number of elements to return. Use together with 'offset' for pagination.                                                                        | \[default to 100] |
| **offset**     | **int32**  | The first element to return. Use together with 'limit' for pagination.                                                                                      | \[default to 0]   |
| **filterName** | **string** | Response filter to list only the PostgreSQL clusters that contain the specified name. The value is case insensitive and matched on the 'displayName' field. |                   |

### Return type

[**ClusterList**](/postgres-sdk-golang/models/clusterlist.md)

### HTTP request headers

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

## ClustersPatch

```go
var result ClusterResponse = ClustersPatch(ctx, clusterId)
                      .PatchClusterRequest(patchClusterRequest)
                      .Execute()
```

Patch a cluster

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-postgres"
)

func main() {
    clusterId := "498ae72f-411f-11eb-9d07-046c59cc737e" // string | The unique ID of the cluster.
    patchClusterRequest := *openapiclient.NewPatchClusterRequest() // PatchClusterRequest | Part of the cluster which should be modified.

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

### Path Parameters

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

### Other Parameters

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

| Name                    | Type                                                                          | Description                                   | Notes |
| ----------------------- | ----------------------------------------------------------------------------- | --------------------------------------------- | ----- |
| **patchClusterRequest** | [**PatchClusterRequest**](/postgres-sdk-golang/models/patchclusterrequest.md) | Part of the cluster which should be modified. |       |

### Return type

[**ClusterResponse**](/postgres-sdk-golang/models/clusterresponse.md)

### HTTP request headers

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

## ClustersPost

```go
var result ClusterResponse = ClustersPost(ctx)
                      .CreateClusterRequest(createClusterRequest)
                      .Execute()
```

Create a cluster

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-postgres"
)

func main() {
    createClusterRequest := *openapiclient.NewCreateClusterRequest() // CreateClusterRequest | The cluster to be created.

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.ClustersApi.ClustersPost(context.Background()).CreateClusterRequest(createClusterRequest).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`: ClusterResponse
    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 |
| ------------------------ | ------------------------------------------------------------------------------- | -------------------------- | ----- |
| **createClusterRequest** | [**CreateClusterRequest**](/postgres-sdk-golang/models/createclusterrequest.md) | The cluster to be created. |       |

### Return type

[**ClusterResponse**](/postgres-sdk-golang/models/clusterresponse.md)

### HTTP request headers

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

## PostgresVersionsGet

```go
var result PostgresVersionList = PostgresVersionsGet(ctx)
                      .Execute()
```

List PostgreSQL versions

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-postgres"
)

func main() {

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

### Path Parameters

This endpoint does not need any parameter.

### Other Parameters

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

### Return type

[**PostgresVersionList**](/postgres-sdk-golang/models/postgresversionlist.md)

### HTTP request headers

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


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/postgres-sdk-golang/api/clustersapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
