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
28 changes: 28 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18761,6 +18761,13 @@ components:
format: date-time
readOnly: true
type: string
date_last_used:
description: Date the API Key was last used
example: '2020-11-27T10:00:00.000Z'
format: date-time
nullable: true
readOnly: true
type: string
key:
description: The API key.
readOnly: true
Expand Down Expand Up @@ -18819,6 +18826,13 @@ components:
minLength: 4
readOnly: true
type: string
last_used_at:
description: Last usage timestamp of the application key.
example: '2020-12-20T10:00:00.000Z'
format: date-time
nullable: true
readOnly: true
type: string
name:
description: Name of the application key.
example: Application Key for managing dashboards
Expand Down Expand Up @@ -34754,6 +34768,13 @@ components:
example: '2020-11-23T10:00:00.000Z'
readOnly: true
type: string
date_last_used:
description: Date the API Key was last used.
example: '2020-11-27T10:00:00.000Z'
format: date-time
nullable: true
readOnly: true
type: string
last4:
description: The last four characters of the API key.
example: abcd
Expand Down Expand Up @@ -34802,6 +34823,12 @@ components:
minLength: 4
readOnly: true
type: string
last_used_at:
description: Last usage timestamp of the application key.
example: '2020-12-20T10:00:00.000Z'
nullable: true
readOnly: true
type: string
name:
description: Name of the application key.
example: Application Key for managing dashboards
Expand Down Expand Up @@ -37778,6 +37805,7 @@ components:
- type
type: object
RoleAttributes:
additionalProperties: {}
description: Attributes of the role.
properties:
created_at:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
Get one application key owned by current user returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.key_management_api import KeyManagementApi

# there is a valid "application_key" in the system
APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = KeyManagementApi(api_client)
response = api_instance.get_current_user_application_key(
app_key_id="app_key_id",
app_key_id=APPLICATION_KEY_DATA_ID,
)

print(response)
10 changes: 10 additions & 0 deletions src/datadog_api_client/v2/model/full_api_key_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ModelNormal,
cached_property,
datetime,
none_type,
unset,
UnsetType,
)
Expand All @@ -27,6 +28,7 @@ def openapi_types(_):
return {
"category": (str,),
"created_at": (datetime,),
"date_last_used": (datetime, none_type),
"key": (str,),
"last4": (str,),
"modified_at": (datetime,),
Expand All @@ -37,6 +39,7 @@ def openapi_types(_):
attribute_map = {
"category": "category",
"created_at": "created_at",
"date_last_used": "date_last_used",
"key": "key",
"last4": "last4",
"modified_at": "modified_at",
Expand All @@ -45,6 +48,7 @@ def openapi_types(_):
}
read_only_vars = {
"created_at",
"date_last_used",
"key",
"last4",
"modified_at",
Expand All @@ -54,6 +58,7 @@ def __init__(
self_,
category: Union[str, UnsetType] = unset,
created_at: Union[datetime, UnsetType] = unset,
date_last_used: Union[datetime, none_type, UnsetType] = unset,
key: Union[str, UnsetType] = unset,
last4: Union[str, UnsetType] = unset,
modified_at: Union[datetime, UnsetType] = unset,
Expand All @@ -70,6 +75,9 @@ def __init__(
:param created_at: Creation date of the API key.
:type created_at: datetime, optional

:param date_last_used: Date the API Key was last used
:type date_last_used: datetime, none_type, optional

:param key: The API key.
:type key: str, optional

Expand All @@ -89,6 +97,8 @@ def __init__(
kwargs["category"] = category
if created_at is not unset:
kwargs["created_at"] = created_at
if date_last_used is not unset:
kwargs["date_last_used"] = date_last_used
if key is not unset:
kwargs["key"] = key
if last4 is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def openapi_types(_):
"created_at": (datetime,),
"key": (str,),
"last4": (str,),
"last_used_at": (datetime, none_type),
"name": (str,),
"scopes": ([str], none_type),
}
Expand All @@ -37,20 +38,23 @@ def openapi_types(_):
"created_at": "created_at",
"key": "key",
"last4": "last4",
"last_used_at": "last_used_at",
"name": "name",
"scopes": "scopes",
}
read_only_vars = {
"created_at",
"key",
"last4",
"last_used_at",
}

def __init__(
self_,
created_at: Union[datetime, UnsetType] = unset,
key: Union[str, UnsetType] = unset,
last4: Union[str, UnsetType] = unset,
last_used_at: Union[datetime, none_type, UnsetType] = unset,
name: Union[str, UnsetType] = unset,
scopes: Union[List[str], none_type, UnsetType] = unset,
**kwargs,
Expand All @@ -67,6 +71,9 @@ def __init__(
:param last4: The last four characters of the application key.
:type last4: str, optional

:param last_used_at: Last usage timestamp of the application key.
:type last_used_at: datetime, none_type, optional

:param name: Name of the application key.
:type name: str, optional

Expand All @@ -79,6 +86,8 @@ def __init__(
kwargs["key"] = key
if last4 is not unset:
kwargs["last4"] = last4
if last_used_at is not unset:
kwargs["last_used_at"] = last_used_at
if name is not unset:
kwargs["name"] = name
if scopes is not unset:
Expand Down
11 changes: 11 additions & 0 deletions src/datadog_api_client/v2/model/partial_api_key_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
datetime,
none_type,
unset,
UnsetType,
)
Expand All @@ -26,6 +28,7 @@ def openapi_types(_):
return {
"category": (str,),
"created_at": (str,),
"date_last_used": (datetime, none_type),
"last4": (str,),
"modified_at": (str,),
"name": (str,),
Expand All @@ -35,13 +38,15 @@ def openapi_types(_):
attribute_map = {
"category": "category",
"created_at": "created_at",
"date_last_used": "date_last_used",
"last4": "last4",
"modified_at": "modified_at",
"name": "name",
"remote_config_read_enabled": "remote_config_read_enabled",
}
read_only_vars = {
"created_at",
"date_last_used",
"last4",
"modified_at",
}
Expand All @@ -50,6 +55,7 @@ def __init__(
self_,
category: Union[str, UnsetType] = unset,
created_at: Union[str, UnsetType] = unset,
date_last_used: Union[datetime, none_type, UnsetType] = unset,
last4: Union[str, UnsetType] = unset,
modified_at: Union[str, UnsetType] = unset,
name: Union[str, UnsetType] = unset,
Expand All @@ -65,6 +71,9 @@ def __init__(
:param created_at: Creation date of the API key.
:type created_at: str, optional

:param date_last_used: Date the API Key was last used.
:type date_last_used: datetime, none_type, optional

:param last4: The last four characters of the API key.
:type last4: str, optional

Expand All @@ -81,6 +90,8 @@ def __init__(
kwargs["category"] = category
if created_at is not unset:
kwargs["created_at"] = created_at
if date_last_used is not unset:
kwargs["date_last_used"] = date_last_used
if last4 is not unset:
kwargs["last4"] = last4
if modified_at is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,29 @@ def openapi_types(_):
return {
"created_at": (str,),
"last4": (str,),
"last_used_at": (str, none_type),
"name": (str,),
"scopes": ([str], none_type),
}

attribute_map = {
"created_at": "created_at",
"last4": "last4",
"last_used_at": "last_used_at",
"name": "name",
"scopes": "scopes",
}
read_only_vars = {
"created_at",
"last4",
"last_used_at",
}

def __init__(
self_,
created_at: Union[str, UnsetType] = unset,
last4: Union[str, UnsetType] = unset,
last_used_at: Union[str, none_type, UnsetType] = unset,
name: Union[str, UnsetType] = unset,
scopes: Union[List[str], none_type, UnsetType] = unset,
**kwargs,
Expand All @@ -59,6 +63,9 @@ def __init__(
:param last4: The last four characters of the application key.
:type last4: str, optional

:param last_used_at: Last usage timestamp of the application key.
:type last_used_at: str, none_type, optional

:param name: Name of the application key.
:type name: str, optional

Expand All @@ -69,6 +76,8 @@ def __init__(
kwargs["created_at"] = created_at
if last4 is not unset:
kwargs["last4"] = last4
if last_used_at is not unset:
kwargs["last_used_at"] = last_used_at
if name is not unset:
kwargs["name"] = name
if scopes is not unset:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-05-12T09:52:14.640Z
2025-09-08T09:24:43.356Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"data":{"attributes":{"name":"Test-Get_all_API_keys_returns_OK_response-1652349134"},"type":"api_keys"}}'
body: '{"data":{"attributes":{"name":"Test-Get_all_API_keys_returns_OK_response-1757323483"},"type":"api_keys"}}'
headers:
accept:
- application/json
Expand All @@ -10,7 +10,7 @@ interactions:
uri: https://api.datadoghq.com/api/v2/api_keys
response:
body:
string: '{"data":{"type":"api_keys","attributes":{"created_at":"2022-05-12T09:52:15.135884+00:00","key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","last4":"xxxx","modified_at":"2022-05-12T09:52:15.135884+00:00","name":"Test-Get_all_API_keys_returns_OK_response-1652349134"},"relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"leak_information":{"data":null}},"id":"32c723fd-9e78-4b1a-a1dd-fab7fe34e8e8"}}'
string: '{"data":{"type":"api_keys","attributes":{"created_at":"2025-09-08T09:24:43.558793+00:00","key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","last4":"xxxx","modified_at":"2025-09-08T09:24:43.558793+00:00","remote_config_read_enabled":true,"category":"default","name":"Test-Get_all_API_keys_returns_OK_response-1757323483"},"relationships":{"created_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"modified_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"leak_information":{"data":null}},"id":"84dbd164-f3f5-4f30-ac93-e12b27adeada"}}'
headers:
content-type:
- application/json
Expand All @@ -23,10 +23,12 @@ interactions:
accept:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v2/api_keys?filter=Test-Get_all_API_keys_returns_OK_response-1652349134
uri: https://api.datadoghq.com/api/v2/api_keys?filter=Test-Get_all_API_keys_returns_OK_response-1757323483
response:
body:
string: '{"meta":{"max_allowed":200,"page":{"total_filtered_count":1}},"data":[{"type":"api_keys","attributes":{"created_at":"2022-05-12T09:52:15.135884+00:00","last4":"xxxx","modified_at":"2022-05-12T09:52:15.135884+00:00","name":"Test-Get_all_API_keys_returns_OK_response-1652349134"},"relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"leak_information":{"data":null}},"id":"32c723fd-9e78-4b1a-a1dd-fab7fe34e8e8"}]}'
string: '{"data":[{"type":"api_keys","attributes":{"created_at":"2025-09-08T09:24:43.558793+00:00","last4":"xxxx","modified_at":"2025-09-08T09:24:43.558793+00:00","remote_config_read_enabled":true,"category":"default","name":"Test-Get_all_API_keys_returns_OK_response-1757323483","date_last_used":null,"used_in_last_24_hours":false,"last_used_date":{"timestamp":null,"description":"Timestamp
of when this key was last used in the past ninety (90) days, null if no recent
usage"}},"relationships":{"created_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"modified_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"leak_information":{"data":null}},"id":"84dbd164-f3f5-4f30-ac93-e12b27adeada"}],"meta":{"page":{"total_filtered_count":1},"max_allowed":200}}'
headers:
content-type:
- application/json
Expand All @@ -39,11 +41,13 @@ interactions:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/api_keys/32c723fd-9e78-4b1a-a1dd-fab7fe34e8e8
uri: https://api.datadoghq.com/api/v2/api_keys/84dbd164-f3f5-4f30-ac93-e12b27adeada
response:
body:
string: ''
headers: {}
headers:
content-type:
- text/html; charset=utf-8
status:
code: 204
message: No Content
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-10-16T13:23:16.735Z
2025-09-08T09:24:46.730Z
Loading