Skip to content
Merged
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
46 changes: 46 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226557,6 +226557,52 @@ paths:
tags:
- Rum Audience Management
x-unstable: "**Note**: This endpoint may be subject to changes."
/api/v2/product-analytics/users/{user_id}:
delete:
description: |-
Delete a Product Analytics user profile.
Deletion is asynchronous: the request is accepted and the profile is removed shortly after, usually within a few minutes.
This only deletes the user profile. To delete the RUM events of the user, use the RUM data deletion API.
operationId: DeleteUserProfile
parameters:
- description: The ID of the user to delete, as sent in the `usr.id` attribute.
in: path
name: user_id
required: true
schema:
example: user-1234
type: string
responses:
"202":
description: Deletion accepted; the profile will be removed asynchronously
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Bad Request
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Forbidden
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Delete a user profile
tags:
- Rum Audience Management
x-permission:
operator: OR
permissions:
- rum_apps_write
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/product-analytics/{entity}/mapping:
get:
description: Get entity mapping configuration including all available attributes and their properties
Expand Down
16 changes: 16 additions & 0 deletions examples/v2/rum-audience-management/DeleteUserProfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Delete a user profile returns "Deletion accepted; the profile will be removed asynchronously" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.rum_audience_management_api import RumAudienceManagementApi

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["delete_user_profile"] = True
with ApiClient(configuration) as api_client:
api_instance = RumAudienceManagementApi(api_client)
api_instance.delete_user_profile(
user_id="user-1234",
)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ def __init__(
"v2.query_product_analytics_sankey": False,
"v2.create_connection": False,
"v2.delete_connection": False,
"v2.delete_user_profile": False,
"v2.get_account_facet_info": False,
"v2.get_mapping": False,
"v2.get_user_facet_info": False,
Expand Down
42 changes: 42 additions & 0 deletions src/datadog_api_client/v2/api/rum_audience_management_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,29 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._delete_user_profile_endpoint = _Endpoint(
settings={
"response_type": None,
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/product-analytics/users/{user_id}",
"operation_id": "delete_user_profile",
"http_method": "DELETE",
"version": "v2",
},
params_map={
"user_id": {
"required": True,
"openapi_types": (str,),
"attribute": "user_id",
"location": "path",
},
},
headers_map={
"accept": ["*/*"],
},
api_client=api_client,
)

self._get_account_facet_info_endpoint = _Endpoint(
settings={
"response_type": (FacetInfoResponse,),
Expand Down Expand Up @@ -299,6 +322,25 @@ def delete_connection(

return self._delete_connection_endpoint.call_with_http_info(**kwargs)

def delete_user_profile(
self,
user_id: str,
) -> None:
"""Delete a user profile.

Delete a Product Analytics user profile.
Deletion is asynchronous: the request is accepted and the profile is removed shortly after, usually within a few minutes.
This only deletes the user profile. To delete the RUM events of the user, use the RUM data deletion API.

:param user_id: The ID of the user to delete, as sent in the ``usr.id`` attribute.
:type user_id: str
:rtype: None
"""
kwargs: Dict[str, Any] = {}
kwargs["user_id"] = user_id

return self._delete_user_profile_endpoint.call_with_http_info(**kwargs)

def get_account_facet_info(
self,
body: FacetInfoRequest,
Expand Down
16 changes: 16 additions & 0 deletions tests/v2/features/rum_audience_management.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ Feature: Rum Audience Management
When the request is sent
Then the response status is 201 Connection created successfully

@generated @skip @team:ddoghq/audience-management-backend @team:ddoghq/product-analytics-ingestion
Scenario: Delete a user profile returns "Bad Request" response
Given operation "DeleteUserProfile" enabled
And new "DeleteUserProfile" request
And request contains "user_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:ddoghq/audience-management-backend @team:ddoghq/product-analytics-ingestion
Scenario: Delete a user profile returns "Deletion accepted; the profile will be removed asynchronously" response
Given operation "DeleteUserProfile" enabled
And new "DeleteUserProfile" request
And request contains "user_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 202 Deletion accepted; the profile will be removed asynchronously

@generated @skip @team:ddoghq/audience-management-backend @team:ddoghq/product-analytics-ingestion
Scenario: Delete connection returns "Connection deleted successfully" response
Given operation "DeleteConnection" enabled
Expand Down
6 changes: 6 additions & 0 deletions tests/v2/features/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7535,6 +7535,12 @@
"type": "unsafe"
}
},
"DeleteUserProfile": {
"tag": "Rum Audience Management",
"undo": {
"type": "idempotent"
}
},
"GetMapping": {
"tag": "Rum Audience Management",
"undo": {
Expand Down
Loading