All URIs are relative to https://api.ionos.com/databases/mongodb
Method | HTTP request | Description |
---|---|---|
ClustersUsersDelete | Delete /clusters/{clusterId}/users/{username} | Delete a MongoDB User by ID |
ClustersUsersFindById | Get /clusters/{clusterId}/users/{username} | Get a MongoDB User by ID |
ClustersUsersGet | Get /clusters/{clusterId}/users | Get all Cluster Users |
ClustersUsersPatch | Patch /clusters/{clusterId}/users/{username} | Patch a MongoDB User by ID |
ClustersUsersPost | Post /clusters/{clusterId}/users | Create MongoDB User |
var result User = ClustersUsersDelete(ctx, clusterId, username)
.Execute()
Delete a MongoDB User by ID
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo"
)
func main() {
clusterId := "clusterId_example" // string | The unique ID of the cluster.
username := "username_example" // string | The authentication username.
configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := ionoscloud.NewAPIClient(configuration)
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)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
clusterId | string | The unique ID of the cluster. | |
username | string | The authentication username. |
Other parameters are passed through a pointer to an apiClustersUsersDeleteRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "UsersApiService.ClustersUsersDelete"
string.
Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
"UsersApiService.ClustersUsersDelete": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
"UsersApiService.ClustersUsersDelete": {
"port": "8443",
},
})
var result User = ClustersUsersFindById(ctx, clusterId, username)
.Execute()
Get a MongoDB User by ID
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo"
)
func main() {
clusterId := "clusterId_example" // string | The unique ID of the cluster.
username := "username_example" // string | The authentication username.
configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := ionoscloud.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)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
clusterId | string | The unique ID of the cluster. | |
username | string | The authentication username. |
Other parameters are passed through a pointer to an apiClustersUsersFindByIdRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "UsersApiService.ClustersUsersFindById"
string.
Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
"UsersApiService.ClustersUsersFindById": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
"UsersApiService.ClustersUsersFindById": {
"port": "8443",
},
})
var result UsersList = ClustersUsersGet(ctx, clusterId)
.Limit(limit)
.Offset(offset)
.Execute()
Get all Cluster Users
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo"
)
func main() {
clusterId := "clusterId_example" // string | The unique ID of the cluster.
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)
configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.UsersApi.ClustersUsersGet(context.Background(), clusterId).Limit(limit).Offset(offset).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)
}
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 apiClustersUsersGetRequest 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] |
- Content-Type: Not defined
- Accept: application/json
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "UsersApiService.ClustersUsersGet"
string.
Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
"UsersApiService.ClustersUsersGet": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
"UsersApiService.ClustersUsersGet": {
"port": "8443",
},
})
var result User = ClustersUsersPatch(ctx, clusterId, username)
.PatchUserRequest(patchUserRequest)
.Execute()
Patch a MongoDB User by ID
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo"
)
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 := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := ionoscloud.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)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
clusterId | string | The unique ID of the cluster. | |
username | string | The authentication username. |
Other parameters are passed through a pointer to an apiClustersUsersPatchRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
patchUserRequest | PatchUserRequest | Part of the MongoDB user which should be modified. |
- Content-Type: application/json
- Accept: application/json
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "UsersApiService.ClustersUsersPatch"
string.
Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
"UsersApiService.ClustersUsersPatch": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
"UsersApiService.ClustersUsersPatch": {
"port": "8443",
},
})
var result User = ClustersUsersPost(ctx, clusterId)
.User(user)
.Execute()
Create MongoDB User
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo"
)
func main() {
clusterId := "clusterId_example" // string | The unique ID of the cluster.
user := *openapiclient.NewUser() // User | The user to be created.
configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
apiClient := ionoscloud.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)
}
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 apiClustersUsersPostRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
user | User | The user to be created. |
- Content-Type: application/json
- Accept: application/json
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "UsersApiService.ClustersUsersPost"
string.
Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
"UsersApiService.ClustersUsersPost": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
"UsersApiService.ClustersUsersPost": {
"port": "8443",
},
})