All URIs are relative to https://api.ionos.com/databases/mongodb
Method
HTTP request
Description
Delete /clusters/{clusterId}/users/{username}
Delete a MongoDB User by ID
Get /clusters/{clusterId}/users/{username}
Get /clusters/{clusterId}/users
Patch /clusters/{clusterId}/users/{username}
Patch a MongoDB User by ID
Post /clusters/{clusterId}/users
ClustersUsersDelete
var result User = ClustersUsersDelete(ctx, clusterId, username)
.Execute()
Delete a MongoDB User by ID
Example
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.
username := "username_example" // string | The authentication username.
configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := mongo.NewAPIClient(configuration)
resource, resp, err := apiClient.UsersApi.ClustersUsersDelete(context.Background(), clusterId, username).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ClustersUsersDelete``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
}
// response from `ClustersUsersDelete`: User
fmt.Fprintf(os.Stdout, "Response from `UsersApi.ClustersUsersDelete`: %v\n", resource)
}
Path Parameters
context for authentication, logging, cancellation, deadlines, tracing, etc.
The unique ID of the cluster.
The authentication username.
Other Parameters
Other parameters are passed through a pointer to an apiClustersUsersDeleteRequest struct via the builder pattern
Return type
User
Content-Type: Not defined
ClustersUsersFindById
var result User = ClustersUsersFindById(ctx, clusterId, username)
.Execute()
Get a MongoDB User by ID
Example
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.
username := "username_example" // string | The authentication username.
configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := mongo.NewAPIClient(configuration)
resource, resp, err := apiClient.UsersApi.ClustersUsersFindById(context.Background(), clusterId, username).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ClustersUsersFindById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
}
// response from `ClustersUsersFindById`: User
fmt.Fprintf(os.Stdout, "Response from `UsersApi.ClustersUsersFindById`: %v\n", resource)
}
Path Parameters
context for authentication, logging, cancellation, deadlines, tracing, etc.
The unique ID of the cluster.
The authentication username.
Other Parameters
Other parameters are passed through a pointer to an apiClustersUsersFindByIdRequest struct via the builder pattern
Return type
User
Content-Type: Not defined
ClustersUsersGet
var result UsersList = ClustersUsersGet(ctx, clusterId)
.Execute()
Get all Cluster Users
Example
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.UsersApi.ClustersUsersGet(context.Background(), clusterId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ClustersUsersGet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
}
// response from `ClustersUsersGet`: UsersList
fmt.Fprintf(os.Stdout, "Response from `UsersApi.ClustersUsersGet`: %v\n", resource)
}
Path Parameters
context for authentication, logging, cancellation, deadlines, tracing, etc.
The unique ID of the cluster.
Other Parameters
Other parameters are passed through a pointer to an apiClustersUsersGetRequest struct via the builder pattern
Return type
UsersList
Content-Type: Not defined
ClustersUsersPatch
var result User = ClustersUsersPatch(ctx, clusterId, username)
.PatchUserRequest(patchUserRequest)
.Execute()
Patch a MongoDB User by ID
Example
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.
username := "username_example" // string | The authentication username.
patchUserRequest := *openapiclient.NewPatchUserRequest() // PatchUserRequest | Part of the MongoDB user which should be modified.
configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := mongo.NewAPIClient(configuration)
resource, resp, err := apiClient.UsersApi.ClustersUsersPatch(context.Background(), clusterId, username).PatchUserRequest(patchUserRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ClustersUsersPatch``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
}
// response from `ClustersUsersPatch`: User
fmt.Fprintf(os.Stdout, "Response from `UsersApi.ClustersUsersPatch`: %v\n", resource)
}
Path Parameters
context for authentication, logging, cancellation, deadlines, tracing, etc.
The unique ID of the cluster.
The authentication username.
Other Parameters
Other parameters are passed through a pointer to an apiClustersUsersPatchRequest struct via the builder pattern
Part of the MongoDB user which should be modified.
Return type
User
Content-Type: application/json
ClustersUsersPost
var result User = ClustersUsersPost(ctx, clusterId)
.User(user)
.Execute()
Create MongoDB User
Example
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.
user := *openapiclient.NewUser() // User | The user to be created.
configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := mongo.NewAPIClient(configuration)
resource, resp, err := apiClient.UsersApi.ClustersUsersPost(context.Background(), clusterId).User(user).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ClustersUsersPost``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
}
// response from `ClustersUsersPost`: User
fmt.Fprintf(os.Stdout, "Response from `UsersApi.ClustersUsersPost`: %v\n", resource)
}
Path Parameters
context for authentication, logging, cancellation, deadlines, tracing, etc.
The unique ID of the cluster.
Other Parameters
Other parameters are passed through a pointer to an apiClustersUsersPostRequest struct via the builder pattern
Return type
User
Content-Type: application/json