All URIs are relative to https://api.datadoghq.com
Method | HTTP request | Description |
---|---|---|
CreateUser | Post /api/v1/user | Create a user |
DisableUser | Delete /api/v1/user/{user_handle} | Disable a user |
GetUser | Get /api/v1/user/{user_handle} | Get user details |
ListUsers | Get /api/v1/user | List all users |
UpdateUser | Put /api/v1/user/{user_handle} | Update a user |
UserResponse CreateUser(ctx, body)
Create a user for your organization.
Note: Users can only be created with the admin access role if application keys belong to administrators.
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog ""
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
body := *datadog.NewUser() // User | User object that needs to be created.
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.UsersApi.CreateUser(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.CreateUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateUser`: UserResponse
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from UsersApi.CreateUser:\n%s\n", responseContent)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | Context for authentication, logging, cancellation, deadlines, tracing, etc. | |
body | User | User object that needs to be created. |
This endpoint does not have optional parameters.
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserDisableResponse DisableUser(ctx, userHandle)
Delete a user from an organization.
Note: This endpoint can only be used with application keys belonging to administrators.
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog ""
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
userHandle := "test@datadoghq.com" // string | The handle of the user.
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.UsersApi.DisableUser(ctx, userHandle)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.DisableUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DisableUser`: UserDisableResponse
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from UsersApi.DisableUser:\n%s\n", responseContent)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | Context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userHandle | string | The handle of the user. |
This endpoint does not have optional parameters.
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserResponse GetUser(ctx, userHandle)
Get a user's details.
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog ""
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
userHandle := "test@datadoghq.com" // string | The ID of the user.
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.UsersApi.GetUser(ctx, userHandle)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.GetUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetUser`: UserResponse
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from UsersApi.GetUser:\n%s\n", responseContent)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | Context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userHandle | string | The ID of the user. |
This endpoint does not have optional parameters.
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserListResponse ListUsers(ctx)
List all users for your organization.
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog ""
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.UsersApi.ListUsers(ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ListUsers`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListUsers`: UserListResponse
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from UsersApi.ListUsers:\n%s\n", responseContent)
}
This endpoint does not need any parameter.
This endpoint does not have optional parameters.
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserResponse UpdateUser(ctx, userHandle, body)
Update a user information.
Note: It can only be used with application keys belonging to administrators.
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog ""
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
userHandle := "test@datadoghq.com" // string | The ID of the user.
body := *datadog.NewUser() // User | Description of the update.
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.UsersApi.UpdateUser(ctx, userHandle, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.UpdateUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateUser`: UserResponse
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from UsersApi.UpdateUser:\n%s\n", responseContent)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | Context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userHandle | string | The ID of the user. | |
body | User | Description of the update. |
This endpoint does not have optional parameters.
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]