Skip to content

Commit 5a26905

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Document /api/v2/roles/templates (#2871)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 4b310ff commit 5a26905

File tree

12 files changed

+340
-0
lines changed

12 files changed

+340
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38435,6 +38435,49 @@ components:
3843538435
permissions:
3843638436
$ref: '#/components/schemas/RelationshipToPermissions'
3843738437
type: object
38438+
RoleTemplateArray:
38439+
description: The definition of `RoleTemplateArray` object.
38440+
properties:
38441+
data:
38442+
description: The `RoleTemplateArray` `data`.
38443+
items:
38444+
$ref: '#/components/schemas/RoleTemplateData'
38445+
type: array
38446+
required:
38447+
- data
38448+
type: object
38449+
RoleTemplateData:
38450+
description: The definition of `RoleTemplateData` object.
38451+
properties:
38452+
attributes:
38453+
$ref: '#/components/schemas/RoleTemplateDataAttributes'
38454+
id:
38455+
description: The `RoleTemplateData` `id`.
38456+
type: string
38457+
type:
38458+
$ref: '#/components/schemas/RoleTemplateDataType'
38459+
required:
38460+
- type
38461+
type: object
38462+
RoleTemplateDataAttributes:
38463+
description: The definition of `RoleTemplateDataAttributes` object.
38464+
properties:
38465+
description:
38466+
description: The `attributes` `description`.
38467+
type: string
38468+
name:
38469+
description: The `attributes` `name`.
38470+
type: string
38471+
type: object
38472+
RoleTemplateDataType:
38473+
default: roles
38474+
description: Roles resource type.
38475+
enum:
38476+
- roles
38477+
example: roles
38478+
type: string
38479+
x-enum-varnames:
38480+
- ROLES
3843838481
RoleUpdateAttributes:
3843938482
description: Attributes of the role.
3844038483
properties:
@@ -67658,6 +67701,28 @@ paths:
6765867701
operator: OR
6765967702
permissions:
6766067703
- user_access_manage
67704+
/api/v2/roles/templates:
67705+
get:
67706+
description: List all role templates
67707+
operationId: ListRoleTemplates
67708+
responses:
67709+
'200':
67710+
content:
67711+
application/json:
67712+
schema:
67713+
$ref: '#/components/schemas/RoleTemplateArray'
67714+
description: OK
67715+
'429':
67716+
$ref: '#/components/responses/TooManyRequestsResponse'
67717+
security:
67718+
- apiKeyAuth: []
67719+
appKeyAuth: []
67720+
- AuthZ:
67721+
- user_access_read
67722+
summary: List role templates
67723+
tags:
67724+
- Roles
67725+
x-unstable: '**Note**: This endpoint may be subject to changes.'
6766167726
/api/v2/roles/{role_id}:
6766267727
delete:
6766367728
description: Disables a role.

docs/datadog_api_client.v2.model.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16608,6 +16608,34 @@ datadog\_api\_client.v2.model.role\_response\_relationships module
1660816608
:members:
1660916609
:show-inheritance:
1661016610

16611+
datadog\_api\_client.v2.model.role\_template\_array module
16612+
----------------------------------------------------------
16613+
16614+
.. automodule:: datadog_api_client.v2.model.role_template_array
16615+
:members:
16616+
:show-inheritance:
16617+
16618+
datadog\_api\_client.v2.model.role\_template\_data module
16619+
---------------------------------------------------------
16620+
16621+
.. automodule:: datadog_api_client.v2.model.role_template_data
16622+
:members:
16623+
:show-inheritance:
16624+
16625+
datadog\_api\_client.v2.model.role\_template\_data\_attributes module
16626+
---------------------------------------------------------------------
16627+
16628+
.. automodule:: datadog_api_client.v2.model.role_template_data_attributes
16629+
:members:
16630+
:show-inheritance:
16631+
16632+
datadog\_api\_client.v2.model.role\_template\_data\_type module
16633+
---------------------------------------------------------------
16634+
16635+
.. automodule:: datadog_api_client.v2.model.role_template_data_type
16636+
:members:
16637+
:show-inheritance:
16638+
1661116639
datadog\_api\_client.v2.model.role\_update\_attributes module
1661216640
-------------------------------------------------------------
1661316641

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
List role templates returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.roles_api import RolesApi
7+
8+
configuration = Configuration()
9+
configuration.unstable_operations["list_role_templates"] = True
10+
with ApiClient(configuration) as api_client:
11+
api_instance = RolesApi(api_client)
12+
response = api_instance.list_role_templates()
13+
14+
print(response)

src/datadog_api_client/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ def __init__(
310310
"v2.update_monitor_user_template": False,
311311
"v2.validate_existing_monitor_user_template": False,
312312
"v2.validate_monitor_user_template": False,
313+
"v2.list_role_templates": False,
313314
"v2.create_pipeline": False,
314315
"v2.delete_pipeline": False,
315316
"v2.get_pipeline": False,

src/datadog_api_client/v2/api/roles_api.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from datadog_api_client.v2.model.roles_sort import RolesSort
1717
from datadog_api_client.v2.model.role_create_response import RoleCreateResponse
1818
from datadog_api_client.v2.model.role_create_request import RoleCreateRequest
19+
from datadog_api_client.v2.model.role_template_array import RoleTemplateArray
1920
from datadog_api_client.v2.model.role_response import RoleResponse
2021
from datadog_api_client.v2.model.role_update_response import RoleUpdateResponse
2122
from datadog_api_client.v2.model.role_update_request import RoleUpdateRequest
@@ -267,6 +268,22 @@ def __init__(self, api_client=None):
267268
api_client=api_client,
268269
)
269270

271+
self._list_role_templates_endpoint = _Endpoint(
272+
settings={
273+
"response_type": (RoleTemplateArray,),
274+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
275+
"endpoint_path": "/api/v2/roles/templates",
276+
"operation_id": "list_role_templates",
277+
"http_method": "GET",
278+
"version": "v2",
279+
},
280+
params_map={},
281+
headers_map={
282+
"accept": ["application/json"],
283+
},
284+
api_client=api_client,
285+
)
286+
270287
self._list_role_users_endpoint = _Endpoint(
271288
settings={
272289
"response_type": (UsersResponse,),
@@ -575,6 +592,18 @@ def list_roles(
575592

576593
return self._list_roles_endpoint.call_with_http_info(**kwargs)
577594

595+
def list_role_templates(
596+
self,
597+
) -> RoleTemplateArray:
598+
"""List role templates.
599+
600+
List all role templates
601+
602+
:rtype: RoleTemplateArray
603+
"""
604+
kwargs: Dict[str, Any] = {}
605+
return self._list_role_templates_endpoint.call_with_http_info(**kwargs)
606+
578607
def list_role_users(
579608
self,
580609
role_id: str,
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 List, 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.role_template_data import RoleTemplateData
16+
17+
18+
class RoleTemplateArray(ModelNormal):
19+
@cached_property
20+
def openapi_types(_):
21+
from datadog_api_client.v2.model.role_template_data import RoleTemplateData
22+
23+
return {
24+
"data": ([RoleTemplateData],),
25+
}
26+
27+
attribute_map = {
28+
"data": "data",
29+
}
30+
31+
def __init__(self_, data: List[RoleTemplateData], **kwargs):
32+
"""
33+
The definition of ``RoleTemplateArray`` object.
34+
35+
:param data: The ``RoleTemplateArray`` ``data``.
36+
:type data: [RoleTemplateData]
37+
"""
38+
super().__init__(kwargs)
39+
40+
self_.data = data
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.role_template_data_attributes import RoleTemplateDataAttributes
18+
from datadog_api_client.v2.model.role_template_data_type import RoleTemplateDataType
19+
20+
21+
class RoleTemplateData(ModelNormal):
22+
@cached_property
23+
def openapi_types(_):
24+
from datadog_api_client.v2.model.role_template_data_attributes import RoleTemplateDataAttributes
25+
from datadog_api_client.v2.model.role_template_data_type import RoleTemplateDataType
26+
27+
return {
28+
"attributes": (RoleTemplateDataAttributes,),
29+
"id": (str,),
30+
"type": (RoleTemplateDataType,),
31+
}
32+
33+
attribute_map = {
34+
"attributes": "attributes",
35+
"id": "id",
36+
"type": "type",
37+
}
38+
39+
def __init__(
40+
self_,
41+
type: RoleTemplateDataType,
42+
attributes: Union[RoleTemplateDataAttributes, UnsetType] = unset,
43+
id: Union[str, UnsetType] = unset,
44+
**kwargs,
45+
):
46+
"""
47+
The definition of ``RoleTemplateData`` object.
48+
49+
:param attributes: The definition of ``RoleTemplateDataAttributes`` object.
50+
:type attributes: RoleTemplateDataAttributes, optional
51+
52+
:param id: The ``RoleTemplateData`` ``id``.
53+
:type id: str, optional
54+
55+
:param type: Roles resource type.
56+
:type type: RoleTemplateDataType
57+
"""
58+
if attributes is not unset:
59+
kwargs["attributes"] = attributes
60+
if id is not unset:
61+
kwargs["id"] = id
62+
super().__init__(kwargs)
63+
64+
self_.type = type
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 Union
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
class RoleTemplateDataAttributes(ModelNormal):
17+
@cached_property
18+
def openapi_types(_):
19+
return {
20+
"description": (str,),
21+
"name": (str,),
22+
}
23+
24+
attribute_map = {
25+
"description": "description",
26+
"name": "name",
27+
}
28+
29+
def __init__(self_, description: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs):
30+
"""
31+
The definition of ``RoleTemplateDataAttributes`` object.
32+
33+
:param description: The ``attributes`` ``description``.
34+
:type description: str, optional
35+
36+
:param name: The ``attributes`` ``name``.
37+
:type name: str, optional
38+
"""
39+
if description is not unset:
40+
kwargs["description"] = description
41+
if name is not unset:
42+
kwargs["name"] = name
43+
super().__init__(kwargs)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class RoleTemplateDataType(ModelSimple):
16+
"""
17+
Roles resource type.
18+
19+
:param value: If omitted defaults to "roles". Must be one of ["roles"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"roles",
25+
}
26+
ROLES: ClassVar["RoleTemplateDataType"]
27+
28+
@cached_property
29+
def openapi_types(_):
30+
return {
31+
"value": (str,),
32+
}
33+
34+
35+
RoleTemplateDataType.ROLES = RoleTemplateDataType("roles")

src/datadog_api_client/v2/models/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3352,6 +3352,10 @@
33523352
from datadog_api_client.v2.model.role_relationships import RoleRelationships
33533353
from datadog_api_client.v2.model.role_response import RoleResponse
33543354
from datadog_api_client.v2.model.role_response_relationships import RoleResponseRelationships
3355+
from datadog_api_client.v2.model.role_template_array import RoleTemplateArray
3356+
from datadog_api_client.v2.model.role_template_data import RoleTemplateData
3357+
from datadog_api_client.v2.model.role_template_data_attributes import RoleTemplateDataAttributes
3358+
from datadog_api_client.v2.model.role_template_data_type import RoleTemplateDataType
33553359
from datadog_api_client.v2.model.role_update_attributes import RoleUpdateAttributes
33563360
from datadog_api_client.v2.model.role_update_data import RoleUpdateData
33573361
from datadog_api_client.v2.model.role_update_request import RoleUpdateRequest
@@ -6821,6 +6825,10 @@
68216825
"RoleRelationships",
68226826
"RoleResponse",
68236827
"RoleResponseRelationships",
6828+
"RoleTemplateArray",
6829+
"RoleTemplateData",
6830+
"RoleTemplateDataAttributes",
6831+
"RoleTemplateDataType",
68246832
"RoleUpdateAttributes",
68256833
"RoleUpdateData",
68266834
"RoleUpdateRequest",

0 commit comments

Comments
 (0)