Skip to content

Commit 6c5b741

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 57136c6 of spec repo
1 parent e3f4f02 commit 6c5b741

15 files changed

Lines changed: 665 additions & 47 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82476,6 +82476,77 @@ components:
8247682476
description: The title of the event.
8247782477
example: "The event title"
8247882478
type: string
82479+
ValidateAPIKeyResponse:
82480+
description: Response object for the API and application key validation status check.
82481+
properties:
82482+
status:
82483+
$ref: "#/components/schemas/ValidateAPIKeyStatus"
82484+
required:
82485+
- status
82486+
type: object
82487+
ValidateAPIKeyStatus:
82488+
description: Status of the validation. Always `ok` when both the API key and the application key are valid.
82489+
enum:
82490+
- ok
82491+
example: ok
82492+
type: string
82493+
x-enum-varnames:
82494+
- OK
82495+
ValidateV2Attributes:
82496+
description: Attributes of the API key validation response.
82497+
properties:
82498+
api_key_id:
82499+
description: The UUID of the API key.
82500+
example: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
82501+
type: string
82502+
api_key_scopes:
82503+
description: List of scope names associated with the API key.
82504+
example:
82505+
- "remote_config_read"
82506+
items:
82507+
type: string
82508+
type: array
82509+
valid:
82510+
description: Whether the API key is valid.
82511+
example: true
82512+
type: boolean
82513+
required:
82514+
- valid
82515+
- api_key_scopes
82516+
- api_key_id
82517+
type: object
82518+
ValidateV2Data:
82519+
description: Data object containing the API key validation result.
82520+
properties:
82521+
attributes:
82522+
$ref: "#/components/schemas/ValidateV2Attributes"
82523+
id:
82524+
description: The UUID of the organization associated with the API key.
82525+
example: "550e8400-e29b-41d4-a716-446655440000"
82526+
type: string
82527+
type:
82528+
$ref: "#/components/schemas/ValidateV2Type"
82529+
required:
82530+
- id
82531+
- type
82532+
- attributes
82533+
type: object
82534+
ValidateV2Response:
82535+
description: Response for the API key validation endpoint.
82536+
properties:
82537+
data:
82538+
$ref: "#/components/schemas/ValidateV2Data"
82539+
required:
82540+
- data
82541+
type: object
82542+
ValidateV2Type:
82543+
description: Resource type for the API key validation response.
82544+
enum:
82545+
- validate_v2
82546+
example: validate_v2
82547+
type: string
82548+
x-enum-varnames:
82549+
- ValidateV2
8247982550
ValidationError:
8248082551
description: Represents a single validation error, including a human-readable title and metadata.
8248182552
properties:
@@ -145216,6 +145287,89 @@ paths:
145216145287
operator: OR
145217145288
permissions:
145218145289
- teams_read
145290+
/api/v2/validate:
145291+
get:
145292+
description: Check if the API key is valid. Returns the organization UUID, API key ID, and associated scopes.
145293+
operationId: Validate
145294+
responses:
145295+
"200":
145296+
content:
145297+
application/json:
145298+
examples:
145299+
default:
145300+
value:
145301+
data:
145302+
attributes:
145303+
api_key_id: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
145304+
api_key_scopes:
145305+
- "remote_config_read"
145306+
valid: true
145307+
id: "550e8400-e29b-41d4-a716-446655440000"
145308+
type: "validate_v2"
145309+
schema:
145310+
$ref: "#/components/schemas/ValidateV2Response"
145311+
description: OK
145312+
"403":
145313+
content:
145314+
application/json:
145315+
schema:
145316+
$ref: "#/components/schemas/JSONAPIErrorResponse"
145317+
description: Forbidden
145318+
"429":
145319+
$ref: "#/components/responses/TooManyRequestsResponse"
145320+
security:
145321+
- apiKeyAuth: []
145322+
summary: Validate API key
145323+
tags:
145324+
- Key Management
145325+
"x-permission":
145326+
operator: OPEN
145327+
permissions: []
145328+
x-unstable: |-
145329+
**Note**: This endpoint is in preview and is subject to change.
145330+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
145331+
/api/v2/validate_keys:
145332+
get:
145333+
description: |-
145334+
Check that the API key and application key used for the request are both valid.
145335+
Returns `{"status": "ok"}` on success, `401` or `403` otherwise. Useful as a
145336+
lightweight authentication probe before issuing other API calls that require
145337+
full credentials.
145338+
operationId: ValidateAPIKey
145339+
responses:
145340+
"200":
145341+
content:
145342+
application/json:
145343+
examples:
145344+
default:
145345+
value:
145346+
status: ok
145347+
schema:
145348+
$ref: "#/components/schemas/ValidateAPIKeyResponse"
145349+
description: OK
145350+
"401":
145351+
content:
145352+
application/json:
145353+
schema:
145354+
$ref: "#/components/schemas/APIErrorResponse"
145355+
description: Unauthorized
145356+
"403":
145357+
content:
145358+
application/json:
145359+
schema:
145360+
$ref: "#/components/schemas/APIErrorResponse"
145361+
description: Forbidden
145362+
"429":
145363+
$ref: "#/components/responses/TooManyRequestsResponse"
145364+
security:
145365+
- apiKeyAuth: []
145366+
appKeyAuth: []
145367+
summary: Validate API and application keys
145368+
tags:
145369+
- Key Management
145370+
"x-permission":
145371+
operator: OPEN
145372+
permissions: []
145219145373
/api/v2/web-integrations/{integration_name}/accounts:
145220145374
get:
145221145375
description: List accounts for a given web integration.

docs/datadog_api_client.v2.model.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36425,6 +36425,48 @@ datadog\_api\_client.v2.model.v2\_event\_response module
3642536425
:members:
3642636426
:show-inheritance:
3642736427

36428+
datadog\_api\_client.v2.model.validate\_api\_key\_response module
36429+
-----------------------------------------------------------------
36430+
36431+
.. automodule:: datadog_api_client.v2.model.validate_api_key_response
36432+
:members:
36433+
:show-inheritance:
36434+
36435+
datadog\_api\_client.v2.model.validate\_api\_key\_status module
36436+
---------------------------------------------------------------
36437+
36438+
.. automodule:: datadog_api_client.v2.model.validate_api_key_status
36439+
:members:
36440+
:show-inheritance:
36441+
36442+
datadog\_api\_client.v2.model.validate\_v2\_attributes module
36443+
-------------------------------------------------------------
36444+
36445+
.. automodule:: datadog_api_client.v2.model.validate_v2_attributes
36446+
:members:
36447+
:show-inheritance:
36448+
36449+
datadog\_api\_client.v2.model.validate\_v2\_data module
36450+
-------------------------------------------------------
36451+
36452+
.. automodule:: datadog_api_client.v2.model.validate_v2_data
36453+
:members:
36454+
:show-inheritance:
36455+
36456+
datadog\_api\_client.v2.model.validate\_v2\_response module
36457+
-----------------------------------------------------------
36458+
36459+
.. automodule:: datadog_api_client.v2.model.validate_v2_response
36460+
:members:
36461+
:show-inheritance:
36462+
36463+
datadog\_api\_client.v2.model.validate\_v2\_type module
36464+
-------------------------------------------------------
36465+
36466+
.. automodule:: datadog_api_client.v2.model.validate_v2_type
36467+
:members:
36468+
:show-inheritance:
36469+
3642836470
datadog\_api\_client.v2.model.validation\_error module
3642936471
------------------------------------------------------
3643036472

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
Validate API key returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.key_management_api import KeyManagementApi
7+
8+
configuration = Configuration()
9+
configuration.unstable_operations["validate"] = True
10+
with ApiClient(configuration) as api_client:
11+
api_instance = KeyManagementApi(api_client)
12+
response = api_instance.validate()
13+
14+
print(response)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Validate API and application keys returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.key_management_api import KeyManagementApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = KeyManagementApi(api_client)
11+
response = api_instance.validate_api_key()
12+
13+
print(response)

src/datadog_api_client/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ def __init__(
295295
"v2.update_llm_obs_experiment": False,
296296
"v2.update_llm_obs_project": False,
297297
"v2.anonymize_users": False,
298+
"v2.validate": False,
298299
"v2.create_open_api": False,
299300
"v2.delete_open_api": False,
300301
"v2.get_open_api": False,

src/datadog_api_client/v2/api/key_management_api.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
from datadog_api_client.v2.model.personal_access_token_create_request import PersonalAccessTokenCreateRequest
2828
from datadog_api_client.v2.model.personal_access_token_response import PersonalAccessTokenResponse
2929
from datadog_api_client.v2.model.personal_access_token_update_request import PersonalAccessTokenUpdateRequest
30+
from datadog_api_client.v2.model.validate_v2_response import ValidateV2Response
31+
from datadog_api_client.v2.model.validate_api_key_response import ValidateAPIKeyResponse
3032

3133

3234
class KeyManagementApi:
@@ -622,6 +624,38 @@ def __init__(self, api_client=None):
622624
api_client=api_client,
623625
)
624626

627+
self._validate_endpoint = _Endpoint(
628+
settings={
629+
"response_type": (ValidateV2Response,),
630+
"auth": ["apiKeyAuth"],
631+
"endpoint_path": "/api/v2/validate",
632+
"operation_id": "validate",
633+
"http_method": "GET",
634+
"version": "v2",
635+
},
636+
params_map={},
637+
headers_map={
638+
"accept": ["application/json"],
639+
},
640+
api_client=api_client,
641+
)
642+
643+
self._validate_api_key_endpoint = _Endpoint(
644+
settings={
645+
"response_type": (ValidateAPIKeyResponse,),
646+
"auth": ["apiKeyAuth", "appKeyAuth"],
647+
"endpoint_path": "/api/v2/validate_keys",
648+
"operation_id": "validate_api_key",
649+
"http_method": "GET",
650+
"version": "v2",
651+
},
652+
params_map={},
653+
headers_map={
654+
"accept": ["application/json"],
655+
},
656+
api_client=api_client,
657+
)
658+
625659
def create_api_key(
626660
self,
627661
body: APIKeyCreateRequest,
@@ -1145,3 +1179,30 @@ def update_personal_access_token(
11451179
kwargs["body"] = body
11461180

11471181
return self._update_personal_access_token_endpoint.call_with_http_info(**kwargs)
1182+
1183+
def validate(
1184+
self,
1185+
) -> ValidateV2Response:
1186+
"""Validate API key.
1187+
1188+
Check if the API key is valid. Returns the organization UUID, API key ID, and associated scopes.
1189+
1190+
:rtype: ValidateV2Response
1191+
"""
1192+
kwargs: Dict[str, Any] = {}
1193+
return self._validate_endpoint.call_with_http_info(**kwargs)
1194+
1195+
def validate_api_key(
1196+
self,
1197+
) -> ValidateAPIKeyResponse:
1198+
"""Validate API and application keys.
1199+
1200+
Check that the API key and application key used for the request are both valid.
1201+
Returns ``{"status": "ok"}`` on success, ``401`` or ``403`` otherwise. Useful as a
1202+
lightweight authentication probe before issuing other API calls that require
1203+
full credentials.
1204+
1205+
:rtype: ValidateAPIKeyResponse
1206+
"""
1207+
kwargs: Dict[str, Any] = {}
1208+
return self._validate_api_key_endpoint.call_with_http_info(**kwargs)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
)
12+
13+
14+
if TYPE_CHECKING:
15+
from datadog_api_client.v2.model.validate_api_key_status import ValidateAPIKeyStatus
16+
17+
18+
class ValidateAPIKeyResponse(ModelNormal):
19+
@cached_property
20+
def openapi_types(_):
21+
from datadog_api_client.v2.model.validate_api_key_status import ValidateAPIKeyStatus
22+
23+
return {
24+
"status": (ValidateAPIKeyStatus,),
25+
}
26+
27+
attribute_map = {
28+
"status": "status",
29+
}
30+
31+
def __init__(self_, status: ValidateAPIKeyStatus, **kwargs):
32+
"""
33+
Response object for the API and application key validation status check.
34+
35+
:param status: Status of the validation. Always ``ok`` when both the API key and the application key are valid.
36+
:type status: ValidateAPIKeyStatus
37+
"""
38+
super().__init__(kwargs)
39+
40+
self_.status = status

0 commit comments

Comments
 (0)