Skip to content

Commit cfb5fce

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 611ff1a of spec repo
1 parent 110582d commit cfb5fce

File tree

7 files changed

+86
-10
lines changed

7 files changed

+86
-10
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17455,6 +17455,12 @@ components:
1745517455
format: date-time
1745617456
readOnly: true
1745717457
type: string
17458+
date_last_used:
17459+
description: Date the API Key was last used
17460+
example: '2020-11-27T10:00:00.000Z'
17461+
format: date-time
17462+
readOnly: true
17463+
type: string
1745817464
key:
1745917465
description: The API key.
1746017466
readOnly: true
@@ -17513,6 +17519,13 @@ components:
1751317519
minLength: 4
1751417520
readOnly: true
1751517521
type: string
17522+
last_used_at:
17523+
description: Last usage timestamp of the application key.
17524+
example: '2020-12-20T10:00:00.000Z'
17525+
format: date-time
17526+
nullable: true
17527+
readOnly: true
17528+
type: string
1751617529
name:
1751717530
description: Name of the application key.
1751817531
example: Application Key for managing dashboards
@@ -32380,6 +32393,12 @@ components:
3238032393
example: '2020-11-23T10:00:00.000Z'
3238132394
readOnly: true
3238232395
type: string
32396+
date_last_used:
32397+
description: Date the API Key was last used.
32398+
example: '2020-11-27T10:00:00.000Z'
32399+
format: date-time
32400+
readOnly: true
32401+
type: string
3238332402
last4:
3238432403
description: The last four characters of the API key.
3238532404
example: abcd
@@ -32428,6 +32447,12 @@ components:
3242832447
minLength: 4
3242932448
readOnly: true
3243032449
type: string
32450+
last_used_at:
32451+
description: Last usage timestamp of the application key.
32452+
example: '2020-12-20T10:00:00.000Z'
32453+
nullable: true
32454+
readOnly: true
32455+
type: string
3243132456
name:
3243232457
description: Name of the application key.
3243332458
example: Application Key for managing dashboards

examples/v2/key-management/GetCurrentUserApplicationKey.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
Get one application key owned by current user returns "OK" response
33
"""
44

5+
from os import environ
56
from datadog_api_client import ApiClient, Configuration
67
from datadog_api_client.v2.api.key_management_api import KeyManagementApi
78

9+
# there is a valid "application_key" in the system
10+
APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]
11+
812
configuration = Configuration()
913
with ApiClient(configuration) as api_client:
1014
api_instance = KeyManagementApi(api_client)
1115
response = api_instance.get_current_user_application_key(
12-
app_key_id="app_key_id",
16+
app_key_id=APPLICATION_KEY_DATA_ID,
1317
)
1418

1519
print(response)

src/datadog_api_client/v2/model/full_api_key_attributes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def openapi_types(_):
2727
return {
2828
"category": (str,),
2929
"created_at": (datetime,),
30+
"date_last_used": (datetime,),
3031
"key": (str,),
3132
"last4": (str,),
3233
"modified_at": (datetime,),
@@ -37,6 +38,7 @@ def openapi_types(_):
3738
attribute_map = {
3839
"category": "category",
3940
"created_at": "created_at",
41+
"date_last_used": "date_last_used",
4042
"key": "key",
4143
"last4": "last4",
4244
"modified_at": "modified_at",
@@ -45,6 +47,7 @@ def openapi_types(_):
4547
}
4648
read_only_vars = {
4749
"created_at",
50+
"date_last_used",
4851
"key",
4952
"last4",
5053
"modified_at",
@@ -54,6 +57,7 @@ def __init__(
5457
self_,
5558
category: Union[str, UnsetType] = unset,
5659
created_at: Union[datetime, UnsetType] = unset,
60+
date_last_used: Union[datetime, UnsetType] = unset,
5761
key: Union[str, UnsetType] = unset,
5862
last4: Union[str, UnsetType] = unset,
5963
modified_at: Union[datetime, UnsetType] = unset,
@@ -70,6 +74,9 @@ def __init__(
7074
:param created_at: Creation date of the API key.
7175
:type created_at: datetime, optional
7276
77+
:param date_last_used: Date the API Key was last used
78+
:type date_last_used: datetime, optional
79+
7380
:param key: The API key.
7481
:type key: str, optional
7582
@@ -89,6 +96,8 @@ def __init__(
8996
kwargs["category"] = category
9097
if created_at is not unset:
9198
kwargs["created_at"] = created_at
99+
if date_last_used is not unset:
100+
kwargs["date_last_used"] = date_last_used
92101
if key is not unset:
93102
kwargs["key"] = key
94103
if last4 is not unset:

src/datadog_api_client/v2/model/full_application_key_attributes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def openapi_types(_):
2929
"created_at": (datetime,),
3030
"key": (str,),
3131
"last4": (str,),
32+
"last_used_at": (datetime, none_type),
3233
"name": (str,),
3334
"scopes": ([str], none_type),
3435
}
@@ -37,20 +38,23 @@ def openapi_types(_):
3738
"created_at": "created_at",
3839
"key": "key",
3940
"last4": "last4",
41+
"last_used_at": "last_used_at",
4042
"name": "name",
4143
"scopes": "scopes",
4244
}
4345
read_only_vars = {
4446
"created_at",
4547
"key",
4648
"last4",
49+
"last_used_at",
4750
}
4851

4952
def __init__(
5053
self_,
5154
created_at: Union[datetime, UnsetType] = unset,
5255
key: Union[str, UnsetType] = unset,
5356
last4: Union[str, UnsetType] = unset,
57+
last_used_at: Union[datetime, none_type, UnsetType] = unset,
5458
name: Union[str, UnsetType] = unset,
5559
scopes: Union[List[str], none_type, UnsetType] = unset,
5660
**kwargs,
@@ -67,6 +71,9 @@ def __init__(
6771
:param last4: The last four characters of the application key.
6872
:type last4: str, optional
6973
74+
:param last_used_at: Last usage timestamp of the application key.
75+
:type last_used_at: datetime, none_type, optional
76+
7077
:param name: Name of the application key.
7178
:type name: str, optional
7279
@@ -79,6 +86,8 @@ def __init__(
7986
kwargs["key"] = key
8087
if last4 is not unset:
8188
kwargs["last4"] = last4
89+
if last_used_at is not unset:
90+
kwargs["last_used_at"] = last_used_at
8291
if name is not unset:
8392
kwargs["name"] = name
8493
if scopes is not unset:

src/datadog_api_client/v2/model/partial_api_key_attributes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11+
datetime,
1112
unset,
1213
UnsetType,
1314
)
@@ -26,6 +27,7 @@ def openapi_types(_):
2627
return {
2728
"category": (str,),
2829
"created_at": (str,),
30+
"date_last_used": (datetime,),
2931
"last4": (str,),
3032
"modified_at": (str,),
3133
"name": (str,),
@@ -35,13 +37,15 @@ def openapi_types(_):
3537
attribute_map = {
3638
"category": "category",
3739
"created_at": "created_at",
40+
"date_last_used": "date_last_used",
3841
"last4": "last4",
3942
"modified_at": "modified_at",
4043
"name": "name",
4144
"remote_config_read_enabled": "remote_config_read_enabled",
4245
}
4346
read_only_vars = {
4447
"created_at",
48+
"date_last_used",
4549
"last4",
4650
"modified_at",
4751
}
@@ -50,6 +54,7 @@ def __init__(
5054
self_,
5155
category: Union[str, UnsetType] = unset,
5256
created_at: Union[str, UnsetType] = unset,
57+
date_last_used: Union[datetime, UnsetType] = unset,
5358
last4: Union[str, UnsetType] = unset,
5459
modified_at: Union[str, UnsetType] = unset,
5560
name: Union[str, UnsetType] = unset,
@@ -65,6 +70,9 @@ def __init__(
6570
:param created_at: Creation date of the API key.
6671
:type created_at: str, optional
6772
73+
:param date_last_used: Date the API Key was last used.
74+
:type date_last_used: datetime, optional
75+
6876
:param last4: The last four characters of the API key.
6977
:type last4: str, optional
7078
@@ -81,6 +89,8 @@ def __init__(
8189
kwargs["category"] = category
8290
if created_at is not unset:
8391
kwargs["created_at"] = created_at
92+
if date_last_used is not unset:
93+
kwargs["date_last_used"] = date_last_used
8494
if last4 is not unset:
8595
kwargs["last4"] = last4
8696
if modified_at is not unset:

src/datadog_api_client/v2/model/partial_application_key_attributes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,29 @@ def openapi_types(_):
2727
return {
2828
"created_at": (str,),
2929
"last4": (str,),
30+
"last_used_at": (str, none_type),
3031
"name": (str,),
3132
"scopes": ([str], none_type),
3233
}
3334

3435
attribute_map = {
3536
"created_at": "created_at",
3637
"last4": "last4",
38+
"last_used_at": "last_used_at",
3739
"name": "name",
3840
"scopes": "scopes",
3941
}
4042
read_only_vars = {
4143
"created_at",
4244
"last4",
45+
"last_used_at",
4346
}
4447

4548
def __init__(
4649
self_,
4750
created_at: Union[str, UnsetType] = unset,
4851
last4: Union[str, UnsetType] = unset,
52+
last_used_at: Union[str, none_type, UnsetType] = unset,
4953
name: Union[str, UnsetType] = unset,
5054
scopes: Union[List[str], none_type, UnsetType] = unset,
5155
**kwargs,
@@ -59,6 +63,9 @@ def __init__(
5963
:param last4: The last four characters of the application key.
6064
:type last4: str, optional
6165
66+
:param last_used_at: Last usage timestamp of the application key.
67+
:type last_used_at: str, none_type, optional
68+
6269
:param name: Name of the application key.
6370
:type name: str, optional
6471
@@ -69,6 +76,8 @@ def __init__(
6976
kwargs["created_at"] = created_at
7077
if last4 is not unset:
7178
kwargs["last4"] = last4
79+
if last_used_at is not unset:
80+
kwargs["last_used_at"] = last_used_at
7281
if name is not unset:
7382
kwargs["name"] = name
7483
if scopes is not unset:

tests/v2/features/key_management.feature

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ Feature: Key Management
182182
And the response "data.id" is equal to "{{ application_key.data.id }}"
183183
And the response "data.attributes.name" is equal to "{{ application_key.data.attributes.name }}-updated"
184184

185-
@generated @skip @team:DataDog/credentials-management
185+
@team:DataDog/credentials-management
186186
Scenario: Get API key returns "Not Found" response
187187
Given new "GetAPIKey" request
188-
And request contains "api_key_id" parameter from "REPLACE.ME"
188+
And request contains "api_key_id" parameter with value "invalidId"
189189
When the request is sent
190190
Then the response status is 404 Not Found
191191

@@ -198,6 +198,7 @@ Feature: Key Management
198198
Then the response status is 200 OK
199199
And the response "data.type" is equal to "api_keys"
200200
And the response "data.id" is equal to "{{ api_key.data.id }}"
201+
And the response "data.attributes" has field "date_last_used"
201202

202203
@generated @skip @team:DataDog/credentials-management
203204
Scenario: Get all API keys returns "Bad Request" response
@@ -213,6 +214,7 @@ Feature: Key Management
213214
When the request is sent
214215
Then the response status is 200 OK
215216
And the response "data[0].type" is equal to "api_keys"
217+
And the response "data[0].attributes" has field "date_last_used"
216218

217219
@generated @skip @team:DataDog/credentials-management
218220
Scenario: Get all application keys owned by current user returns "Bad Request" response
@@ -232,6 +234,7 @@ Feature: Key Management
232234
When the request is sent
233235
Then the response status is 200 OK
234236
And the response "data[0].type" is equal to "application_keys"
237+
And the response "data[0].attributes" has field "last_used_at"
235238

236239
@generated @skip @team:DataDog/credentials-management
237240
Scenario: Get all application keys returns "Bad Request" response
@@ -252,6 +255,7 @@ Feature: Key Management
252255
When the request is sent
253256
Then the response status is 200 OK
254257
And the response "data[0].type" is equal to "application_keys"
258+
And the response "data[0].attributes" has field "last_used_at"
255259

256260
@generated @skip @team:DataDog/credentials-management
257261
Scenario: Get an application key returns "Bad Request" response
@@ -260,10 +264,9 @@ Feature: Key Management
260264
When the request is sent
261265
Then the response status is 400 Bad Request
262266

263-
@generated @skip @team:DataDog/credentials-management
267+
@gteam:DataDog/credentials-management @team:DataDog/credentials-management
264268
Scenario: Get an application key returns "Not Found" response
265269
Given new "GetApplicationKey" request
266-
And request contains "app_key_id" parameter from "REPLACE.ME"
267270
When the request is sent
268271
Then the response status is 404 Not Found
269272

@@ -276,17 +279,24 @@ Feature: Key Management
276279
Then the response status is 200 OK
277280
And the response "data.type" is equal to "application_keys"
278281
And the response "data.id" has the same value as "application_key.data.id"
282+
And the response "data.attributes" has field "last_used_at"
279283

280-
@generated @skip @team:DataDog/credentials-management
284+
@team:DataDog/credentials-management
281285
Scenario: Get one application key owned by current user returns "Not Found" response
282286
Given new "GetCurrentUserApplicationKey" request
283-
And request contains "app_key_id" parameter from "REPLACE.ME"
287+
And request contains "app_key_id" parameter with value "incorrectId"
284288
When the request is sent
285289
Then the response status is 404 Not Found
286290

287-
@generated @skip @team:DataDog/credentials-management
291+
@team:DataDog/credentials-management
288292
Scenario: Get one application key owned by current user returns "OK" response
289-
Given new "GetCurrentUserApplicationKey" request
290-
And request contains "app_key_id" parameter from "REPLACE.ME"
293+
Given there is a valid "application_key" in the system
294+
And new "GetCurrentUserApplicationKey" request
295+
And request contains "app_key_id" parameter from "application_key.data.id"
291296
When the request is sent
292297
Then the response status is 200 OK
298+
And the response "data.type" is equal to "application_keys"
299+
And the response "data.id" is equal to "{{ application_key.data.id }}"
300+
And the response "data.attributes.name" is equal to "{{ application_key.data.attributes.name }}"
301+
And the response "data.attributes" has field "scopes"
302+
And the response "data.attributes" has field "last_used_at"

0 commit comments

Comments
 (0)