Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 167 additions & 17 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81529,55 +81529,57 @@ components:
description: Attributes of user object returned by the API.
properties:
created_at:
description: Creation time of the user.
description: The ISO 8601 timestamp of when the user account was created.
format: date-time
type: string
disabled:
description: Whether the user is disabled.
description: Whether the user account is deactivated. Disabled users cannot log in.
type: boolean
email:
description: Email of the user.
description: The email address of the user, used for login and notifications.
type: string
handle:
description: Handle of the user.
description: The unique handle (username) of the user, typically matching their email prefix.
type: string
icon:
description: URL of the user's icon.
description: URL of the user's profile icon, typically a Gravatar URL derived from the email address.
type: string
last_login_time:
description: The last time the user logged in.
description: The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.
format: date-time
nullable: true
readOnly: true
type: string
mfa_enabled:
description: If user has MFA enabled.
description: Whether multi-factor authentication (MFA) is enabled for the user's account.
readOnly: true
type: boolean
modified_at:
description: Time that the user was last modified.
description: The ISO 8601 timestamp of when the user account was last modified.
format: date-time
type: string
name:
description: Name of the user.
description: The full display name of the user as shown in the Datadog UI.
nullable: true
type: string
service_account:
description: Whether the user is a service account.
description: |-
Whether this is a service account rather than a human user.
Service accounts are used for programmatic API access.
type: boolean
status:
description: Status of the user.
description: The current status of the user account (for example, `Active`, `Pending`, or `Disabled`).
type: string
title:
description: Title of the user.
description: The job title of the user (for example, "Senior Engineer" or "Product Manager").
nullable: true
type: string
uuid:
description: UUID of the user.
description: The globally unique identifier (UUID) of the user.
readOnly: true
type: string
verified:
description: Whether the user is verified.
description: Whether the user's email address has been verified.
type: boolean
type: object
UserAttributesStatus:
Expand Down Expand Up @@ -81979,13 +81981,23 @@ components:
description: Attributes of the edited user.
properties:
disabled:
description: If the user is enabled or disabled.
description: |-
When set to `true`, the user is deactivated and can no longer log in.
When `false`, the user is active.
type: boolean
email:
description: The email of the user.
description: |-
The email address of the user, used for login and notifications.
Must be a valid email format.
type: string
name:
description: The name of the user.
description: |-
The full display name of the user as shown in the Datadog UI.
Maximum 55 characters, cannot contain `<` or `>`.
type: string
title:
description: The job title of the user (for example, "Senior Engineer" or "Product Manager").
nullable: true
type: string
type: object
UserUpdateData:
Expand Down Expand Up @@ -96714,6 +96726,144 @@ paths:
$ref: "#/components/responses/TooManyRequestsResponse"
summary: Get all CSM Serverless Agents
tags: ["CSM Agents"]
/api/v2/current_user:
get:
description: |-
Get the user associated with the current authentication context.
The response includes the user's profile attributes (name, email, handle,
status, MFA state), along with related resources: the user's organization,
assigned roles with their granted permissions, and team-scoped roles.
No additional permissions are required beyond valid authentication.
operationId: GetCurrentUser
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
created_at: "2024-01-15T10:30:00+00:00"
disabled: false
email: jane.doe@example.com
handle: jane.doe
icon: "https://secure.gravatar.com/avatar/abc123"
mfa_enabled: true
modified_at: "2024-06-01T12:00:00+00:00"
name: Jane Doe
service_account: false
status: Active
title: Senior Engineer
verified: true
id: 00000000-0000-9999-0000-000000000000
type: users
included: []
schema:
$ref: "#/components/schemas/UserResponse"
description: OK
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/APIErrorResponse"
description: Authentication error
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
summary: Get current user
tags:
- Users
patch:
description: |-
Edit the profile of the currently authenticated user. Updatable fields
include `name`, `title`, `email`, and `disabled` status. The `id` field
in the request body must match the authenticated user's UUID; a mismatch
returns a 422 error. Email address changes are recorded in the audit trail.
Requires the `user_access_manage` permission.
operationId: UpdateCurrentUser
requestBody:
content:
application/json:
examples:
default:
value:
data:
attributes:
email: jane.doe@example.com
name: Jane Doe
title: Staff Engineer
id: 00000000-0000-9999-0000-000000000000
type: users
schema:
$ref: "#/components/schemas/UserUpdateRequest"
required: true
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
created_at: "2024-01-15T10:30:00+00:00"
disabled: false
email: jane.doe@example.com
handle: jane.doe
icon: "https://secure.gravatar.com/avatar/abc123"
mfa_enabled: true
modified_at: "2024-06-01T12:00:00+00:00"
name: Jane Doe
service_account: false
status: Active
title: Staff Engineer
verified: true
id: 00000000-0000-9999-0000-000000000000
type: users
included: []
schema:
$ref: "#/components/schemas/UserResponse"
description: OK
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/APIErrorResponse"
description: Bad Request
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/APIErrorResponse"
description: Authentication error
"404":
content:
application/json:
schema:
$ref: "#/components/schemas/APIErrorResponse"
description: Not found
"422":
content:
application/json:
schema:
$ref: "#/components/schemas/APIErrorResponse"
description: Unprocessable Entity
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
summary: Update current user
tags:
- Users
x-codegen-request-body-name: body
"x-permission":
operator: OR
permissions:
- user_access_manage
/api/v2/current_user/application_keys:
get:
description: List all application keys available for current user
Expand Down
13 changes: 13 additions & 0 deletions examples/v2/users/GetCurrentUser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
Get current user returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.users_api import UsersApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = UsersApi(api_client)
response = api_instance.get_current_user()

print(response)
27 changes: 27 additions & 0 deletions examples/v2/users/UpdateCurrentUser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Update current user returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.users_api import UsersApi
from datadog_api_client.v2.model.user_update_attributes import UserUpdateAttributes
from datadog_api_client.v2.model.user_update_data import UserUpdateData
from datadog_api_client.v2.model.user_update_request import UserUpdateRequest
from datadog_api_client.v2.model.users_type import UsersType

body = UserUpdateRequest(
data=UserUpdateData(
attributes=UserUpdateAttributes(
title=None,
),
id="00000000-0000-feed-0000-000000000000",
type=UsersType.USERS,
),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = UsersApi(api_client)
response = api_instance.update_current_user(body=body)

print(response)
Loading
Loading