Skip to content
Open
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
5 changes: 0 additions & 5 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -791,11 +791,6 @@ components:
items:
$ref: "#/components/schemas/ResourceProviderConfig"
type: array
secretless_auth_enabled:
description: |-
(Preview) When enabled, Datadog authenticates with this app registration using federated workload identity credentials instead of a client secret.
example: true
type: boolean
tenant_name:
description: Your Azure Active Directory ID.
example: "testc44-1234-5678-9101-cc00736ftest"
Expand Down
96 changes: 96 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81822,6 +81822,61 @@ components:
description: The title of the event.
example: "The event title"
type: string
ValidateV2Attributes:
description: Attributes of the API key validation response.
properties:
api_key_id:
description: The UUID of the API key.
example: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
type: string
api_key_scopes:
description: List of scope names associated with the API key.
example:
- "remote_config_read"
items:
type: string
type: array
valid:
description: Whether the API key is valid.
example: true
type: boolean
required:
- valid
- api_key_scopes
- api_key_id
type: object
ValidateV2Data:
description: Data object containing the API key validation result.
properties:
attributes:
$ref: "#/components/schemas/ValidateV2Attributes"
id:
description: The UUID of the organization associated with the API key.
example: "550e8400-e29b-41d4-a716-446655440000"
type: string
type:
$ref: "#/components/schemas/ValidateV2Type"
required:
- id
- type
- attributes
type: object
ValidateV2Response:
description: Response for the API key validation endpoint.
properties:
data:
$ref: "#/components/schemas/ValidateV2Data"
required:
- data
type: object
ValidateV2Type:
description: Resource type for the API key validation response.
enum:
- validate_v2
example: validate_v2
type: string
x-enum-varnames:
- ValidateV2
ValidationError:
description: Represents a single validation error, including a human-readable title and metadata.
properties:
Expand Down Expand Up @@ -134478,6 +134533,47 @@ paths:
operator: OR
permissions:
- teams_read
/api/v2/validate:
get:
description: Check if the API key is valid. Returns the organization UUID, API key ID, and associated scopes.
operationId: ValidateV2
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
api_key_id: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
api_key_scopes:
- "remote_config_read"
valid: true
id: "550e8400-e29b-41d4-a716-446655440000"
type: "validate_v2"
schema:
$ref: "#/components/schemas/ValidateV2Response"
description: OK
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Forbidden
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
summary: Validate API key
tags:
- Key Management
"x-permission":
operator: OPEN
permissions: []
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/widgets/{experience_type}:
get:
description: Search and list widgets for a given experience type. Supports filtering by widget type, creator, title, and tags, as well as sorting and pagination.
Expand Down
28 changes: 28 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36278,6 +36278,34 @@ datadog\_api\_client.v2.model.v2\_event\_response module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.validate\_v2\_attributes module
-------------------------------------------------------------

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

datadog\_api\_client.v2.model.validate\_v2\_data module
-------------------------------------------------------

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

datadog\_api\_client.v2.model.validate\_v2\_response module
-----------------------------------------------------------

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

datadog\_api\_client.v2.model.validate\_v2\_type module
-------------------------------------------------------

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

datadog\_api\_client.v2.model.validation\_error module
------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion examples/v1/azure-integration/UpdateAzureHostFilters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
namespace="Microsoft.Compute",
),
],
secretless_auth_enabled=True,
tenant_name="testc44-1234-5678-9101-cc00736ftest",
usage_metrics_enabled=True,
)
Expand Down
1 change: 0 additions & 1 deletion examples/v1/azure-integration/UpdateAzureIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
new_client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
new_tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
resource_collection_enabled=True,
secretless_auth_enabled=True,
tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
)

Expand Down
14 changes: 14 additions & 0 deletions examples/v2/key-management/ValidateV2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
Validate API key returns "OK" response
"""

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

configuration = Configuration()
configuration.unstable_operations["validate_v2"] = True
with ApiClient(configuration) as api_client:
api_instance = KeyManagementApi(api_client)
response = api_instance.validate_v2()

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def __init__(
"v2.update_llm_obs_experiment": False,
"v2.update_llm_obs_project": False,
"v2.anonymize_users": False,
"v2.validate_v2": False,
"v2.create_open_api": False,
"v2.delete_open_api": False,
"v2.get_open_api": False,
Expand Down
8 changes: 0 additions & 8 deletions src/datadog_api_client/v1/model/azure_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def openapi_types(_):
"new_tenant_name": (str,),
"resource_collection_enabled": (bool,),
"resource_provider_configs": ([ResourceProviderConfig],),
"secretless_auth_enabled": (bool,),
"tenant_name": (str,),
"usage_metrics_enabled": (bool,),
}
Expand All @@ -59,7 +58,6 @@ def openapi_types(_):
"new_tenant_name": "new_tenant_name",
"resource_collection_enabled": "resource_collection_enabled",
"resource_provider_configs": "resource_provider_configs",
"secretless_auth_enabled": "secretless_auth_enabled",
"tenant_name": "tenant_name",
"usage_metrics_enabled": "usage_metrics_enabled",
}
Expand All @@ -81,7 +79,6 @@ def __init__(
new_tenant_name: Union[str, UnsetType] = unset,
resource_collection_enabled: Union[bool, UnsetType] = unset,
resource_provider_configs: Union[List[ResourceProviderConfig], UnsetType] = unset,
secretless_auth_enabled: Union[bool, UnsetType] = unset,
tenant_name: Union[str, UnsetType] = unset,
usage_metrics_enabled: Union[bool, UnsetType] = unset,
**kwargs,
Expand Down Expand Up @@ -138,9 +135,6 @@ def __init__(
:param resource_provider_configs: Configuration settings applied to resources from the specified Azure resource providers.
:type resource_provider_configs: [ResourceProviderConfig], optional

:param secretless_auth_enabled: (Preview) When enabled, Datadog authenticates with this app registration using federated workload identity credentials instead of a client secret.
:type secretless_auth_enabled: bool, optional

:param tenant_name: Your Azure Active Directory ID.
:type tenant_name: str, optional

Expand Down Expand Up @@ -177,8 +171,6 @@ def __init__(
kwargs["resource_collection_enabled"] = resource_collection_enabled
if resource_provider_configs is not unset:
kwargs["resource_provider_configs"] = resource_provider_configs
if secretless_auth_enabled is not unset:
kwargs["secretless_auth_enabled"] = secretless_auth_enabled
if tenant_name is not unset:
kwargs["tenant_name"] = tenant_name
if usage_metrics_enabled is not unset:
Expand Down
29 changes: 29 additions & 0 deletions src/datadog_api_client/v2/api/key_management_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from datadog_api_client.v2.model.personal_access_token_create_request import PersonalAccessTokenCreateRequest
from datadog_api_client.v2.model.personal_access_token_response import PersonalAccessTokenResponse
from datadog_api_client.v2.model.personal_access_token_update_request import PersonalAccessTokenUpdateRequest
from datadog_api_client.v2.model.validate_v2_response import ValidateV2Response


class KeyManagementApi:
Expand Down Expand Up @@ -622,6 +623,22 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._validate_v2_endpoint = _Endpoint(
settings={
"response_type": (ValidateV2Response,),
"auth": ["apiKeyAuth"],
"endpoint_path": "/api/v2/validate",
"operation_id": "validate_v2",
"http_method": "GET",
"version": "v2",
},
params_map={},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

def create_api_key(
self,
body: APIKeyCreateRequest,
Expand Down Expand Up @@ -1145,3 +1162,15 @@ def update_personal_access_token(
kwargs["body"] = body

return self._update_personal_access_token_endpoint.call_with_http_info(**kwargs)

def validate_v2(
self,
) -> ValidateV2Response:
"""Validate API key.

Check if the API key is valid. Returns the organization UUID, API key ID, and associated scopes.

:rtype: ValidateV2Response
"""
kwargs: Dict[str, Any] = {}
return self._validate_v2_endpoint.call_with_http_info(**kwargs)
46 changes: 46 additions & 0 deletions src/datadog_api_client/v2/model/validate_v2_attributes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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 typing import List

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


class ValidateV2Attributes(ModelNormal):
@cached_property
def openapi_types(_):
return {
"api_key_id": (str,),
"api_key_scopes": ([str],),
"valid": (bool,),
}

attribute_map = {
"api_key_id": "api_key_id",
"api_key_scopes": "api_key_scopes",
"valid": "valid",
}

def __init__(self_, api_key_id: str, api_key_scopes: List[str], valid: bool, **kwargs):
"""
Attributes of the API key validation response.

:param api_key_id: The UUID of the API key.
:type api_key_id: str

:param api_key_scopes: List of scope names associated with the API key.
:type api_key_scopes: [str]

:param valid: Whether the API key is valid.
:type valid: bool
"""
super().__init__(kwargs)

self_.api_key_id = api_key_id
self_.api_key_scopes = api_key_scopes
self_.valid = valid
54 changes: 54 additions & 0 deletions src/datadog_api_client/v2/model/validate_v2_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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 typing import TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.validate_v2_attributes import ValidateV2Attributes
from datadog_api_client.v2.model.validate_v2_type import ValidateV2Type


class ValidateV2Data(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.validate_v2_attributes import ValidateV2Attributes
from datadog_api_client.v2.model.validate_v2_type import ValidateV2Type

return {
"attributes": (ValidateV2Attributes,),
"id": (str,),
"type": (ValidateV2Type,),
}

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

def __init__(self_, attributes: ValidateV2Attributes, id: str, type: ValidateV2Type, **kwargs):
"""
Data object containing the API key validation result.

:param attributes: Attributes of the API key validation response.
:type attributes: ValidateV2Attributes

:param id: The UUID of the organization associated with the API key.
:type id: str

:param type: Resource type for the API key validation response.
:type type: ValidateV2Type
"""
super().__init__(kwargs)

self_.attributes = attributes
self_.id = id
self_.type = type
Loading
Loading