All URIs are relative to https://api.ionos.com/databases/mongodb
Method | HTTP request | Description |
---|---|---|
ClustersDelete | Delete /clusters/{clusterId} | Delete a Cluster |
ClustersFindById | Get /clusters/{clusterId} | Get a cluster by id |
ClustersGet | Get /clusters | Get Clusters |
ClustersPatch | Patch /clusters/{clusterId} | Patch a cluster |
ClustersPost | Post /clusters | Create a Cluster |
var result ClusterResponse = ClustersDelete(ctx, clusterId)
.Execute()
Delete a Cluster
package main
import (
"context"
"fmt"
"os"
mongo "github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo"
"github.com/ionos-cloud/sdk-go-bundle/shared"
)
func main() {
clusterId := "clusterId_example" // string | The unique ID 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)
}
// response from `ClustersDelete`: ClusterResponse
fmt.Fprintf(os.Stdout, "Response from `ClustersApi.ClustersDelete`: %v\n", resource)
}
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 are passed through a pointer to an apiClustersDeleteRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
var result ClusterResponse = ClustersFindById(ctx, clusterId)
.Execute()
Get a cluster by id
package main
import (
"context"
"fmt"
"os"
mongo "github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo"
"github.com/ionos-cloud/sdk-go-bundle/shared"
)
func main() {
clusterId := "clusterId_example" // string | The unique ID 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`: ClusterResponse
fmt.Fprintf(os.Stdout, "Response from `ClustersApi.ClustersFindById`: %v\n", resource)
}
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 are passed through a pointer to an apiClustersFindByIdRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
var result ClusterList = ClustersGet(ctx)
.Limit(limit)
.Offset(offset)
.FilterName(filterName)
.Execute()
Get Clusters
package main
import (
"context"
"fmt"
"os"
mongo "github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo"
"github.com/ionos-cloud/sdk-go-bundle/shared"
)
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 MongoDB clusters that contain the specified name. The value is case insensitive and matched on the 'displayName' field. (optional)
configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := mongo.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)
}
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 MongoDB clusters that contain the specified name. The value is case insensitive and matched on the 'displayName' field. |
- Content-Type: Not defined
- Accept: application/json
var result ClusterResponse = ClustersPatch(ctx, clusterId)
.PatchClusterRequest(patchClusterRequest)
.Execute()
Patch a cluster
package main
import (
"context"
"fmt"
"os"
mongo "github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo"
"github.com/ionos-cloud/sdk-go-bundle/shared"
)
func main() {
clusterId := "clusterId_example" // string | The unique ID of the cluster.
patchClusterRequest := *openapiclient.NewPatchClusterRequest() // PatchClusterRequest | Part of the cluster which should be modified.
configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := mongo.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)
}
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 are passed through a pointer to an apiClustersPatchRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
patchClusterRequest | PatchClusterRequest | Part of the cluster which should be modified. |
- Content-Type: application/json
- Accept: application/json
var result ClusterResponse = ClustersPost(ctx)
.CreateClusterRequest(createClusterRequest)
.Execute()
Create a Cluster
package main
import (
"context"
"fmt"
"os"
mongo "github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo"
"github.com/ionos-cloud/sdk-go-bundle/shared"
)
func main() {
createClusterRequest := *openapiclient.NewCreateClusterRequest() // CreateClusterRequest | The cluster to be created.
configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := mongo.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)
}
Other parameters are passed through a pointer to an apiClustersPostRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
createClusterRequest | CreateClusterRequest | The cluster to be created. |
- Content-Type: application/json
- Accept: application/json