var result User=ClustersUsersPatch(ctx, clusterId, username) .PatchUserRequest(patchUserRequest) .Execute()
Patch a MongoDB User by ID
Example
packagemainimport ("context""fmt""os" mongo "github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo""github.com/ionos-cloud/sdk-go-bundle/shared")funcmain() { 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
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
Other parameters are passed through a pointer to an apiClustersUsersPatchRequest struct via the builder pattern
var result User=ClustersUsersPost(ctx, clusterId) .User(user) .Execute()
Create MongoDB User
Example
packagemainimport ("context""fmt""os" mongo "github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo""github.com/ionos-cloud/sdk-go-bundle/shared")funcmain() { 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
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 apiClustersUsersPostRequest struct via the builder pattern