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
155 changes: 155 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3734,6 +3734,114 @@ components:
description: The `markdownTextAnnotation` `text`.
type: string
type: object
AnonymizeUserError:
description: Error encountered when anonymizing a specific user.
properties:
error:
description: Error message describing why anonymization failed.
example: ""
type: string
user_id:
description: UUID of the user that failed to be anonymized.
example: "00000000-0000-0000-0000-000000000000"
type: string
required:
- user_id
- error
type: object
AnonymizeUsersRequest:
description: Request body for anonymizing users.
properties:
data:
$ref: "#/components/schemas/AnonymizeUsersRequestData"
required:
- data
type: object
AnonymizeUsersRequestAttributes:
description: Attributes of an anonymize users request.
properties:
user_ids:
description: List of user IDs (UUIDs) to anonymize.
example:
- "00000000-0000-0000-0000-000000000000"
items:
example: "00000000-0000-0000-0000-000000000000"
type: string
type: array
required:
- user_ids
type: object
AnonymizeUsersRequestData:
description: Object to anonymize a list of users.
properties:
attributes:
$ref: "#/components/schemas/AnonymizeUsersRequestAttributes"
id:
description: Unique identifier for the request. Not used server-side.
example: "00000000-0000-0000-0000-000000000000"
type: string
type:
$ref: "#/components/schemas/AnonymizeUsersRequestType"
required:
- type
- attributes
type: object
AnonymizeUsersRequestType:
default: anonymize_users_request
description: Type of the anonymize users request.
enum:
- anonymize_users_request
example: anonymize_users_request
type: string
x-enum-varnames:
- ANONYMIZE_USERS_REQUEST
AnonymizeUsersResponse:
description: Response containing the result of an anonymize users request.
properties:
data:
$ref: "#/components/schemas/AnonymizeUsersResponseData"
type: object
AnonymizeUsersResponseAttributes:
description: Attributes of an anonymize users response.
properties:
anonymize_errors:
description: List of errors encountered during anonymization, one entry per failed user.
items:
$ref: "#/components/schemas/AnonymizeUserError"
type: array
anonymized_user_ids:
description: List of user IDs (UUIDs) that were successfully anonymized.
example:
- "00000000-0000-0000-0000-000000000000"
items:
example: "00000000-0000-0000-0000-000000000000"
type: string
type: array
required:
- anonymized_user_ids
- anonymize_errors
type: object
AnonymizeUsersResponseData:
description: Response data for anonymizing users.
properties:
attributes:
$ref: "#/components/schemas/AnonymizeUsersResponseAttributes"
id:
description: Unique identifier of the response.
example: "00000000-0000-0000-0000-000000000000"
type: string
type:
$ref: "#/components/schemas/AnonymizeUsersResponseType"
type: object
AnonymizeUsersResponseType:
default: anonymize_users_response
description: Type of the anonymize users response.
enum:
- anonymize_users_response
example: anonymize_users_response
type: string
x-enum-varnames:
- ANONYMIZE_USERS_RESPONSE
AnthropicAPIKey:
description: The definition of the `AnthropicAPIKey` object.
properties:
Expand Down Expand Up @@ -76578,6 +76686,53 @@ paths:
operator: OR
permissions:
- security_monitoring_findings_read
/api/v2/anonymize_users:
put:
description: |-
Anonymize a list of users, removing their personal data. This operation is irreversible.
Requires the `user_access_manage` permission.
operationId: AnonymizeUsers
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/AnonymizeUsersRequest"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/AnonymizeUsersResponse"
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
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- user_access_manage
summary: Anonymize users
tags:
- Users
x-codegen-request-body-name: body
x-permission:
operator: OR
permissions:
- user_access_manage
x-unstable: "**Note**: This endpoint is in Preview and may be subject to changes."
/api/v2/api_keys:
get:
description: List all API keys available for your account.
Expand Down
63 changes: 63 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,69 @@ datadog\_api\_client.v2.model.annotation\_markdown\_text\_annotation module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_user\_error module
-----------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_user_error
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_users\_request module
--------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_users_request
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_users\_request\_attributes module
--------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_users_request_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_users\_request\_data module
--------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_users_request_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_users\_request\_type module
--------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_users_request_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_users\_response module
---------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_users_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_users\_response\_attributes module
---------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_users_response_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_users\_response\_data module
---------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_users_response_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anonymize\_users\_response\_type module
---------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.anonymize_users_response_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.anthropic\_api\_key module
--------------------------------------------------------

Expand Down
30 changes: 30 additions & 0 deletions examples/v2/users/AnonymizeUsers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
Anonymize users 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.anonymize_users_request import AnonymizeUsersRequest
from datadog_api_client.v2.model.anonymize_users_request_attributes import AnonymizeUsersRequestAttributes
from datadog_api_client.v2.model.anonymize_users_request_data import AnonymizeUsersRequestData
from datadog_api_client.v2.model.anonymize_users_request_type import AnonymizeUsersRequestType

body = AnonymizeUsersRequest(
data=AnonymizeUsersRequestData(
attributes=AnonymizeUsersRequestAttributes(
user_ids=[
"00000000-0000-0000-0000-000000000000",
],
),
id="00000000-0000-0000-0000-000000000000",
type=AnonymizeUsersRequestType.ANONYMIZE_USERS_REQUEST,
),
)

configuration = Configuration()
configuration.unstable_operations["anonymize_users"] = True
with ApiClient(configuration) as api_client:
api_instance = UsersApi(api_client)
response = api_instance.anonymize_users(body=body)

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def __init__(
"v2.list_fleet_schedules": False,
"v2.trigger_fleet_schedule": False,
"v2.update_fleet_schedule": False,
"v2.anonymize_users": False,
"v2.create_open_api": False,
"v2.delete_open_api": False,
"v2.get_open_api": False,
Expand Down
39 changes: 39 additions & 0 deletions src/datadog_api_client/v2/api/users_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
UnsetType,
unset,
)
from datadog_api_client.v2.model.anonymize_users_response import AnonymizeUsersResponse
from datadog_api_client.v2.model.anonymize_users_request import AnonymizeUsersRequest
from datadog_api_client.v2.model.user_invitations_response import UserInvitationsResponse
from datadog_api_client.v2.model.user_invitations_request import UserInvitationsRequest
from datadog_api_client.v2.model.user_invitation_response import UserInvitationResponse
Expand All @@ -36,6 +38,26 @@ def __init__(self, api_client=None):
api_client = ApiClient(Configuration())
self.api_client = api_client

self._anonymize_users_endpoint = _Endpoint(
settings={
"response_type": (AnonymizeUsersResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/anonymize_users",
"operation_id": "anonymize_users",
"http_method": "PUT",
"version": "v2",
},
params_map={
"body": {
"required": True,
"openapi_types": (AnonymizeUsersRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

self._create_user_endpoint = _Endpoint(
settings={
"response_type": (UserResponse,),
Expand Down Expand Up @@ -264,6 +286,23 @@ def __init__(self, api_client=None):
api_client=api_client,
)

def anonymize_users(
self,
body: AnonymizeUsersRequest,
) -> AnonymizeUsersResponse:
"""Anonymize users.

Anonymize a list of users, removing their personal data. This operation is irreversible.
Requires the ``user_access_manage`` permission.

:type body: AnonymizeUsersRequest
:rtype: AnonymizeUsersResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["body"] = body

return self._anonymize_users_endpoint.call_with_http_info(**kwargs)

def create_user(
self,
body: UserCreateRequest,
Expand Down
39 changes: 39 additions & 0 deletions src/datadog_api_client/v2/model/anonymize_user_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


class AnonymizeUserError(ModelNormal):
@cached_property
def openapi_types(_):
return {
"error": (str,),
"user_id": (str,),
}

attribute_map = {
"error": "error",
"user_id": "user_id",
}

def __init__(self_, error: str, user_id: str, **kwargs):
"""
Error encountered when anonymizing a specific user.

:param error: Error message describing why anonymization failed.
:type error: str

:param user_id: UUID of the user that failed to be anonymized.
:type user_id: str
"""
super().__init__(kwargs)

self_.error = error
self_.user_id = user_id
Loading
Loading