Skip to content

Commit 9590079

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 7ac842c of spec repo
1 parent 481cb09 commit 9590079

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
@@ -82113,6 +82113,77 @@ components:
8211382113
description: The title of the event.
8211482114
example: "The event title"
8211582115
type: string
82116+
ValidateAPIKeyResponse:
82117+
description: Response object for the API and application key validation status check.
82118+
properties:
82119+
status:
82120+
$ref: "#/components/schemas/ValidateAPIKeyStatus"
82121+
required:
82122+
- status
82123+
type: object
82124+
ValidateAPIKeyStatus:
82125+
description: Status of the validation. Always `ok` when both the API key and the application key are valid.
82126+
enum:
82127+
- ok
82128+
example: ok
82129+
type: string
82130+
x-enum-varnames:
82131+
- OK
82132+
ValidateV2Attributes:
82133+
description: Attributes of the API key validation response.
82134+
properties:
82135+
api_key_id:
82136+
description: The UUID of the API key.
82137+
example: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
82138+
type: string
82139+
api_key_scopes:
82140+
description: List of scope names associated with the API key.
82141+
example:
82142+
- "remote_config_read"
82143+
items:
82144+
type: string
82145+
type: array
82146+
valid:
82147+
description: Whether the API key is valid.
82148+
example: true
82149+
type: boolean
82150+
required:
82151+
- valid
82152+
- api_key_scopes
82153+
- api_key_id
82154+
type: object
82155+
ValidateV2Data:
82156+
description: Data object containing the API key validation result.
82157+
properties:
82158+
attributes:
82159+
$ref: "#/components/schemas/ValidateV2Attributes"
82160+
id:
82161+
description: The UUID of the organization associated with the API key.
82162+
example: "550e8400-e29b-41d4-a716-446655440000"
82163+
type: string
82164+
type:
82165+
$ref: "#/components/schemas/ValidateV2Type"
82166+
required:
82167+
- id
82168+
- type
82169+
- attributes
82170+
type: object
82171+
ValidateV2Response:
82172+
description: Response for the API key validation endpoint.
82173+
properties:
82174+
data:
82175+
$ref: "#/components/schemas/ValidateV2Data"
82176+
required:
82177+
- data
82178+
type: object
82179+
ValidateV2Type:
82180+
description: Resource type for the API key validation response.
82181+
enum:
82182+
- validate_v2
82183+
example: validate_v2
82184+
type: string
82185+
x-enum-varnames:
82186+
- ValidateV2
8211682187
ValidationError:
8211782188
description: Represents a single validation error, including a human-readable title and metadata.
8211882189
properties:
@@ -144598,6 +144669,89 @@ paths:
144598144669
operator: OR
144599144670
permissions:
144600144671
- teams_read
144672+
/api/v2/validate:
144673+
get:
144674+
description: Check if the API key is valid. Returns the organization UUID, API key ID, and associated scopes.
144675+
operationId: Validate
144676+
responses:
144677+
"200":
144678+
content:
144679+
application/json:
144680+
examples:
144681+
default:
144682+
value:
144683+
data:
144684+
attributes:
144685+
api_key_id: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
144686+
api_key_scopes:
144687+
- "remote_config_read"
144688+
valid: true
144689+
id: "550e8400-e29b-41d4-a716-446655440000"
144690+
type: "validate_v2"
144691+
schema:
144692+
$ref: "#/components/schemas/ValidateV2Response"
144693+
description: OK
144694+
"403":
144695+
content:
144696+
application/json:
144697+
schema:
144698+
$ref: "#/components/schemas/JSONAPIErrorResponse"
144699+
description: Forbidden
144700+
"429":
144701+
$ref: "#/components/responses/TooManyRequestsResponse"
144702+
security:
144703+
- apiKeyAuth: []
144704+
summary: Validate API key
144705+
tags:
144706+
- Key Management
144707+
"x-permission":
144708+
operator: OPEN
144709+
permissions: []
144710+
x-unstable: |-
144711+
**Note**: This endpoint is in preview and is subject to change.
144712+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
144713+
/api/v2/validate_keys:
144714+
get:
144715+
description: |-
144716+
Check that the API key and application key used for the request are both valid.
144717+
Returns `{"status": "ok"}` on success, `401` or `403` otherwise. Useful as a
144718+
lightweight authentication probe before issuing other API calls that require
144719+
full credentials.
144720+
operationId: ValidateAPIKey
144721+
responses:
144722+
"200":
144723+
content:
144724+
application/json:
144725+
examples:
144726+
default:
144727+
value:
144728+
status: ok
144729+
schema:
144730+
$ref: "#/components/schemas/ValidateAPIKeyResponse"
144731+
description: OK
144732+
"401":
144733+
content:
144734+
application/json:
144735+
schema:
144736+
$ref: "#/components/schemas/APIErrorResponse"
144737+
description: Unauthorized
144738+
"403":
144739+
content:
144740+
application/json:
144741+
schema:
144742+
$ref: "#/components/schemas/APIErrorResponse"
144743+
description: Forbidden
144744+
"429":
144745+
$ref: "#/components/responses/TooManyRequestsResponse"
144746+
security:
144747+
- apiKeyAuth: []
144748+
appKeyAuth: []
144749+
summary: Validate API and application keys
144750+
tags:
144751+
- Key Management
144752+
"x-permission":
144753+
operator: OPEN
144754+
permissions: []
144601144755
/api/v2/web-integrations/{integration_name}/accounts:
144602144756
get:
144603144757
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
@@ -36320,6 +36320,48 @@ datadog\_api\_client.v2.model.v2\_event\_response module
3632036320
:members:
3632136321
:show-inheritance:
3632236322

36323+
datadog\_api\_client.v2.model.validate\_api\_key\_response module
36324+
-----------------------------------------------------------------
36325+
36326+
.. automodule:: datadog_api_client.v2.model.validate_api_key_response
36327+
:members:
36328+
:show-inheritance:
36329+
36330+
datadog\_api\_client.v2.model.validate\_api\_key\_status module
36331+
---------------------------------------------------------------
36332+
36333+
.. automodule:: datadog_api_client.v2.model.validate_api_key_status
36334+
:members:
36335+
:show-inheritance:
36336+
36337+
datadog\_api\_client.v2.model.validate\_v2\_attributes module
36338+
-------------------------------------------------------------
36339+
36340+
.. automodule:: datadog_api_client.v2.model.validate_v2_attributes
36341+
:members:
36342+
:show-inheritance:
36343+
36344+
datadog\_api\_client.v2.model.validate\_v2\_data module
36345+
-------------------------------------------------------
36346+
36347+
.. automodule:: datadog_api_client.v2.model.validate_v2_data
36348+
:members:
36349+
:show-inheritance:
36350+
36351+
datadog\_api\_client.v2.model.validate\_v2\_response module
36352+
-----------------------------------------------------------
36353+
36354+
.. automodule:: datadog_api_client.v2.model.validate_v2_response
36355+
:members:
36356+
:show-inheritance:
36357+
36358+
datadog\_api\_client.v2.model.validate\_v2\_type module
36359+
-------------------------------------------------------
36360+
36361+
.. automodule:: datadog_api_client.v2.model.validate_v2_type
36362+
:members:
36363+
:show-inheritance:
36364+
3632336365
datadog\_api\_client.v2.model.validation\_error module
3632436366
------------------------------------------------------
3632536367

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)