Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type in Data Deletion API #2358

Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-17 19:31:42.049587",
"spec_repo_commit": "45186abe"
"regenerated": "2025-01-17 20:19:08.532230",
"spec_repo_commit": "4e5906d6"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-17 19:31:42.068225",
"spec_repo_commit": "45186abe"
"regenerated": "2025-01-17 20:19:08.546517",
"spec_repo_commit": "4e5906d6"
}
}
}
11 changes: 11 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7378,9 +7378,20 @@ components:
properties:
attributes:
$ref: '#/components/schemas/CreateDataDeletionRequestBodyAttributes'
type:
$ref: '#/components/schemas/CreateDataDeletionRequestBodyDataType'
required:
- attributes
- type
type: object
CreateDataDeletionRequestBodyDataType:
description: The deletion request type.
enum:
- create_deletion_req
example: create_deletion_req
type: string
x-enum-varnames:
- CREATE_DELETION_REQ
CreateDataDeletionResponseBody:
description: The response from the create data deletion request endpoint.
properties:
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2867,6 +2867,13 @@ datadog\_api\_client.v2.model.create\_data\_deletion\_request\_body\_data module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.create\_data\_deletion\_request\_body\_data\_type module
--------------------------------------------------------------------------------------

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

datadog\_api\_client.v2.model.create\_data\_deletion\_response\_body module
---------------------------------------------------------------------------

Expand Down
4 changes: 4 additions & 0 deletions examples/v2/data-deletion/CreateDataDeletionRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
CreateDataDeletionRequestBodyAttributes,
)
from datadog_api_client.v2.model.create_data_deletion_request_body_data import CreateDataDeletionRequestBodyData
from datadog_api_client.v2.model.create_data_deletion_request_body_data_type import (
CreateDataDeletionRequestBodyDataType,
)

body = CreateDataDeletionRequestBody(
data=CreateDataDeletionRequestBodyData(
Expand All @@ -24,6 +27,7 @@
),
to=1704063600000,
),
type=CreateDataDeletionRequestBodyDataType.CREATE_DELETION_REQ,
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
from datadog_api_client.v2.model.create_data_deletion_request_body_attributes import (
CreateDataDeletionRequestBodyAttributes,
)
from datadog_api_client.v2.model.create_data_deletion_request_body_data_type import (
CreateDataDeletionRequestBodyDataType,
)


class CreateDataDeletionRequestBodyData(ModelNormal):
Expand All @@ -23,22 +26,36 @@ def openapi_types(_):
from datadog_api_client.v2.model.create_data_deletion_request_body_attributes import (
CreateDataDeletionRequestBodyAttributes,
)
from datadog_api_client.v2.model.create_data_deletion_request_body_data_type import (
CreateDataDeletionRequestBodyDataType,
)

return {
"attributes": (CreateDataDeletionRequestBodyAttributes,),
"type": (CreateDataDeletionRequestBodyDataType,),
}

attribute_map = {
"attributes": "attributes",
"type": "type",
}

def __init__(self_, attributes: CreateDataDeletionRequestBodyAttributes, **kwargs):
def __init__(
self_,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Code Quality Violation

Suggested change
self_,
self,
first parameter of a class function should be self (...read more)

In a class method (that is not a class method nor a static method), the first argument must be self by convention.

Learn More

View in Datadog  Leave us feedback  Documentation

attributes: CreateDataDeletionRequestBodyAttributes,
type: CreateDataDeletionRequestBodyDataType,
**kwargs,
):
"""
Data needed to create a data deletion request.

:param attributes: Attributes for creating a data deletion request.
:type attributes: CreateDataDeletionRequestBodyAttributes

:param type: The deletion request type.
:type type: CreateDataDeletionRequestBodyDataType
"""
super().__init__(kwargs)

self_.attributes = attributes
self_.type = type
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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 (
ModelSimple,
cached_property,
)

from typing import ClassVar


class CreateDataDeletionRequestBodyDataType(ModelSimple):
"""
The deletion request type.

:param value: If omitted defaults to "create_deletion_req". Must be one of ["create_deletion_req"].
:type value: str
"""

allowed_values = {
"create_deletion_req",
}
CREATE_DELETION_REQ: ClassVar["CreateDataDeletionRequestBodyDataType"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


CreateDataDeletionRequestBodyDataType.CREATE_DELETION_REQ = CreateDataDeletionRequestBodyDataType("create_deletion_req")
4 changes: 4 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@
CreateDataDeletionRequestBodyAttributes,
)
from datadog_api_client.v2.model.create_data_deletion_request_body_data import CreateDataDeletionRequestBodyData
from datadog_api_client.v2.model.create_data_deletion_request_body_data_type import (
CreateDataDeletionRequestBodyDataType,
)
from datadog_api_client.v2.model.create_data_deletion_response_body import CreateDataDeletionResponseBody
from datadog_api_client.v2.model.create_open_api_response import CreateOpenAPIResponse
from datadog_api_client.v2.model.create_open_api_response_attributes import CreateOpenAPIResponseAttributes
Expand Down Expand Up @@ -2777,6 +2780,7 @@
"CreateDataDeletionRequestBody",
"CreateDataDeletionRequestBodyAttributes",
"CreateDataDeletionRequestBodyData",
"CreateDataDeletionRequestBodyDataType",
"CreateDataDeletionResponseBody",
"CreateOpenAPIResponse",
"CreateOpenAPIResponseAttributes",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:41.160Z
2025-01-15T14:25:54.929Z
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:41.674Z
2025-01-15T14:26:08.930Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}}'
body: '{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000},"type":"create_deletion_req"}}'
headers:
accept:
- application/json
Expand All @@ -10,8 +10,8 @@ interactions:
uri: https://api.datadoghq.com/api/v2/deletion/data/logs
response:
body:
string: '{"data":{"id":"523","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:42.016613164Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:42.016613164Z"}},"meta":{"product":"logs"}}'
string: '{"data":{"id":"753","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:26:09.447960191Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:26:09.447960191Z"}},"meta":{"product":"logs"}}'
headers:
content-type:
- application/vnd.api+json
Expand All @@ -24,11 +24,11 @@ interactions:
accept:
- application/json
method: PUT
uri: https://api.datadoghq.com/api/v2/deletion/requests/523/cancel
uri: https://api.datadoghq.com/api/v2/deletion/requests/753/cancel
response:
body:
string: '{"data":{"id":"523","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:42.016613Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:42.384299Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
string: '{"data":{"id":"753","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:26:09.44796Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:26:10.016496Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
headers:
content-type:
- application/vnd.api+json
Expand All @@ -41,11 +41,11 @@ interactions:
accept:
- application/json
method: PUT
uri: https://api.datadoghq.com/api/v2/deletion/requests/523/cancel
uri: https://api.datadoghq.com/api/v2/deletion/requests/753/cancel
response:
body:
string: '{"data":{"id":"523","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:42.016613Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:42.384299Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
string: '{"data":{"id":"753","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:26:09.44796Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:26:10.016496Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
headers:
content-type:
- application/vnd.api+json
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:42.850Z
2025-01-15T14:26:26.195Z
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:43.197Z
2025-01-15T14:27:27.929Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}}'
body: '{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000},"type":"create_deletion_req"}}'
headers:
accept:
- application/json
Expand All @@ -10,8 +10,8 @@ interactions:
uri: https://api.datadoghq.com/api/v2/deletion/data/logs
response:
body:
string: '{"data":{"id":"524","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:43.527574137Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:43.527574137Z"}},"meta":{"product":"logs"}}'
string: '{"data":{"id":"754","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:27:28.457837225Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:27:28.457837225Z"}},"meta":{"product":"logs"}}'
headers:
content-type:
- application/vnd.api+json
Expand All @@ -24,11 +24,11 @@ interactions:
accept:
- application/json
method: PUT
uri: https://api.datadoghq.com/api/v2/deletion/requests/524/cancel
uri: https://api.datadoghq.com/api/v2/deletion/requests/754/cancel
response:
body:
string: '{"data":{"id":"524","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:43.527574Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:44.017414Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
string: '{"data":{"id":"754","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:27:28.457837Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:27:28.841156Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
headers:
content-type:
- application/vnd.api+json
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:44.038Z
2025-01-15T14:27:45.329Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{},"to":1704063600000}}}'
body: '{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{},"to":1704063600000},"type":"create_deletion_req"}}'
headers:
accept:
- application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:44.395Z
2025-01-15T14:28:03.053Z
Loading
Loading