From 077a0d8716f421995004ffc1bedd11b96e98e1e6 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 2 Oct 2025 17:07:49 +0000 Subject: [PATCH] Regenerate client from commit 44dea02 of spec repo --- .generator/schemas/v2/openapi.yaml | 65 +++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 28 ++++++++ examples/v2/roles/ListRoleTemplates.py | 14 ++++ src/datadog_api_client/configuration.py | 1 + src/datadog_api_client/v2/api/roles_api.py | 29 +++++++++ .../v2/model/role_template_array.py | 40 ++++++++++++ .../v2/model/role_template_data.py | 64 ++++++++++++++++++ .../v2/model/role_template_data_attributes.py | 43 ++++++++++++ .../v2/model/role_template_data_type.py | 35 ++++++++++ src/datadog_api_client/v2/models/__init__.py | 8 +++ tests/v2/features/roles.feature | 7 ++ tests/v2/features/undo.json | 6 ++ 12 files changed, 340 insertions(+) create mode 100644 examples/v2/roles/ListRoleTemplates.py create mode 100644 src/datadog_api_client/v2/model/role_template_array.py create mode 100644 src/datadog_api_client/v2/model/role_template_data.py create mode 100644 src/datadog_api_client/v2/model/role_template_data_attributes.py create mode 100644 src/datadog_api_client/v2/model/role_template_data_type.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 72f8cd4581..3d27f6798c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -38435,6 +38435,49 @@ components: permissions: $ref: '#/components/schemas/RelationshipToPermissions' type: object + RoleTemplateArray: + description: The definition of `RoleTemplateArray` object. + properties: + data: + description: The `RoleTemplateArray` `data`. + items: + $ref: '#/components/schemas/RoleTemplateData' + type: array + required: + - data + type: object + RoleTemplateData: + description: The definition of `RoleTemplateData` object. + properties: + attributes: + $ref: '#/components/schemas/RoleTemplateDataAttributes' + id: + description: The `RoleTemplateData` `id`. + type: string + type: + $ref: '#/components/schemas/RoleTemplateDataType' + required: + - type + type: object + RoleTemplateDataAttributes: + description: The definition of `RoleTemplateDataAttributes` object. + properties: + description: + description: The `attributes` `description`. + type: string + name: + description: The `attributes` `name`. + type: string + type: object + RoleTemplateDataType: + default: roles + description: Roles resource type. + enum: + - roles + example: roles + type: string + x-enum-varnames: + - ROLES RoleUpdateAttributes: description: Attributes of the role. properties: @@ -67658,6 +67701,28 @@ paths: operator: OR permissions: - user_access_manage + /api/v2/roles/templates: + get: + description: List all role templates + operationId: ListRoleTemplates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RoleTemplateArray' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_read + summary: List role templates + tags: + - Roles + x-unstable: '**Note**: This endpoint may be subject to changes.' /api/v2/roles/{role_id}: delete: description: Disables a role. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 46aae7ec81..d1ebb453ef 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -16608,6 +16608,34 @@ datadog\_api\_client.v2.model.role\_response\_relationships module :members: :show-inheritance: +datadog\_api\_client.v2.model.role\_template\_array module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.role_template_array + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.role\_template\_data module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.role_template_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.role\_template\_data\_attributes module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.role_template_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.role\_template\_data\_type module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.role_template_data_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.role\_update\_attributes module ------------------------------------------------------------- diff --git a/examples/v2/roles/ListRoleTemplates.py b/examples/v2/roles/ListRoleTemplates.py new file mode 100644 index 0000000000..6014ff5daa --- /dev/null +++ b/examples/v2/roles/ListRoleTemplates.py @@ -0,0 +1,14 @@ +""" +List role templates returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.roles_api import RolesApi + +configuration = Configuration() +configuration.unstable_operations["list_role_templates"] = True +with ApiClient(configuration) as api_client: + api_instance = RolesApi(api_client) + response = api_instance.list_role_templates() + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index e96df7dd4f..dddfc62f47 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -310,6 +310,7 @@ def __init__( "v2.update_monitor_user_template": False, "v2.validate_existing_monitor_user_template": False, "v2.validate_monitor_user_template": False, + "v2.list_role_templates": False, "v2.create_pipeline": False, "v2.delete_pipeline": False, "v2.get_pipeline": False, diff --git a/src/datadog_api_client/v2/api/roles_api.py b/src/datadog_api_client/v2/api/roles_api.py index 0a421d0e2d..bb81e0e530 100644 --- a/src/datadog_api_client/v2/api/roles_api.py +++ b/src/datadog_api_client/v2/api/roles_api.py @@ -16,6 +16,7 @@ from datadog_api_client.v2.model.roles_sort import RolesSort from datadog_api_client.v2.model.role_create_response import RoleCreateResponse from datadog_api_client.v2.model.role_create_request import RoleCreateRequest +from datadog_api_client.v2.model.role_template_array import RoleTemplateArray from datadog_api_client.v2.model.role_response import RoleResponse from datadog_api_client.v2.model.role_update_response import RoleUpdateResponse from datadog_api_client.v2.model.role_update_request import RoleUpdateRequest @@ -267,6 +268,22 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_role_templates_endpoint = _Endpoint( + settings={ + "response_type": (RoleTemplateArray,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/roles/templates", + "operation_id": "list_role_templates", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_role_users_endpoint = _Endpoint( settings={ "response_type": (UsersResponse,), @@ -575,6 +592,18 @@ def list_roles( return self._list_roles_endpoint.call_with_http_info(**kwargs) + def list_role_templates( + self, + ) -> RoleTemplateArray: + """List role templates. + + List all role templates + + :rtype: RoleTemplateArray + """ + kwargs: Dict[str, Any] = {} + return self._list_role_templates_endpoint.call_with_http_info(**kwargs) + def list_role_users( self, role_id: str, diff --git a/src/datadog_api_client/v2/model/role_template_array.py b/src/datadog_api_client/v2/model/role_template_array.py new file mode 100644 index 0000000000..c672e3805f --- /dev/null +++ b/src/datadog_api_client/v2/model/role_template_array.py @@ -0,0 +1,40 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.role_template_data import RoleTemplateData + + +class RoleTemplateArray(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.role_template_data import RoleTemplateData + + return { + "data": ([RoleTemplateData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[RoleTemplateData], **kwargs): + """ + The definition of ``RoleTemplateArray`` object. + + :param data: The ``RoleTemplateArray`` ``data``. + :type data: [RoleTemplateData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/role_template_data.py b/src/datadog_api_client/v2/model/role_template_data.py new file mode 100644 index 0000000000..c1822468d7 --- /dev/null +++ b/src/datadog_api_client/v2/model/role_template_data.py @@ -0,0 +1,64 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.role_template_data_attributes import RoleTemplateDataAttributes + from datadog_api_client.v2.model.role_template_data_type import RoleTemplateDataType + + +class RoleTemplateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.role_template_data_attributes import RoleTemplateDataAttributes + from datadog_api_client.v2.model.role_template_data_type import RoleTemplateDataType + + return { + "attributes": (RoleTemplateDataAttributes,), + "id": (str,), + "type": (RoleTemplateDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + type: RoleTemplateDataType, + attributes: Union[RoleTemplateDataAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The definition of ``RoleTemplateData`` object. + + :param attributes: The definition of ``RoleTemplateDataAttributes`` object. + :type attributes: RoleTemplateDataAttributes, optional + + :param id: The ``RoleTemplateData`` ``id``. + :type id: str, optional + + :param type: Roles resource type. + :type type: RoleTemplateDataType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/role_template_data_attributes.py b/src/datadog_api_client/v2/model/role_template_data_attributes.py new file mode 100644 index 0000000000..9e08792d81 --- /dev/null +++ b/src/datadog_api_client/v2/model/role_template_data_attributes.py @@ -0,0 +1,43 @@ +# 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 Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class RoleTemplateDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "description": (str,), + "name": (str,), + } + + attribute_map = { + "description": "description", + "name": "name", + } + + def __init__(self_, description: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs): + """ + The definition of ``RoleTemplateDataAttributes`` object. + + :param description: The ``attributes`` ``description``. + :type description: str, optional + + :param name: The ``attributes`` ``name``. + :type name: str, optional + """ + if description is not unset: + kwargs["description"] = description + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/role_template_data_type.py b/src/datadog_api_client/v2/model/role_template_data_type.py new file mode 100644 index 0000000000..2bc350184e --- /dev/null +++ b/src/datadog_api_client/v2/model/role_template_data_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class RoleTemplateDataType(ModelSimple): + """ + Roles resource type. + + :param value: If omitted defaults to "roles". Must be one of ["roles"]. + :type value: str + """ + + allowed_values = { + "roles", + } + ROLES: ClassVar["RoleTemplateDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +RoleTemplateDataType.ROLES = RoleTemplateDataType("roles") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 04a8a449c6..b8bb7552ad 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3352,6 +3352,10 @@ from datadog_api_client.v2.model.role_relationships import RoleRelationships from datadog_api_client.v2.model.role_response import RoleResponse from datadog_api_client.v2.model.role_response_relationships import RoleResponseRelationships +from datadog_api_client.v2.model.role_template_array import RoleTemplateArray +from datadog_api_client.v2.model.role_template_data import RoleTemplateData +from datadog_api_client.v2.model.role_template_data_attributes import RoleTemplateDataAttributes +from datadog_api_client.v2.model.role_template_data_type import RoleTemplateDataType from datadog_api_client.v2.model.role_update_attributes import RoleUpdateAttributes from datadog_api_client.v2.model.role_update_data import RoleUpdateData from datadog_api_client.v2.model.role_update_request import RoleUpdateRequest @@ -6821,6 +6825,10 @@ "RoleRelationships", "RoleResponse", "RoleResponseRelationships", + "RoleTemplateArray", + "RoleTemplateData", + "RoleTemplateDataAttributes", + "RoleTemplateDataType", "RoleUpdateAttributes", "RoleUpdateData", "RoleUpdateRequest", diff --git a/tests/v2/features/roles.feature b/tests/v2/features/roles.feature index bc82e0b07e..4c62839977 100644 --- a/tests/v2/features/roles.feature +++ b/tests/v2/features/roles.feature @@ -216,6 +216,13 @@ Feature: Roles And the response "data" has item with field "attributes.restricted" with value false And the response "data" has item with field "attributes.name" with value "admin" + @generated @skip @team:DataDog/aaa-core-access + Scenario: List role templates returns "OK" response + Given operation "ListRoleTemplates" enabled + And new "ListRoleTemplates" request + When the request is sent + Then the response status is 200 OK + @team:DataDog/aaa-core-access Scenario: List roles returns "OK" response Given there is a valid "role" in the system diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 6fcf52fced..95d8a19dcb 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2869,6 +2869,12 @@ "type": "unsafe" } }, + "ListRoleTemplates": { + "tag": "Roles", + "undo": { + "type": "safe" + } + }, "DeleteRole": { "tag": "Roles", "undo": {