Skip to content
Merged
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
65 changes: 65 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
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 @@ -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
-------------------------------------------------------------

Expand Down
14 changes: 14 additions & 0 deletions examples/v2/roles/ListRoleTemplates.py
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 29 additions & 0 deletions src/datadog_api_client/v2/api/roles_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,),
Expand Down Expand Up @@ -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,
Expand Down
40 changes: 40 additions & 0 deletions src/datadog_api_client/v2/model/role_template_array.py
Original file line number Diff line number Diff line change
@@ -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
64 changes: 64 additions & 0 deletions src/datadog_api_client/v2/model/role_template_data.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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)
35 changes: 35 additions & 0 deletions src/datadog_api_client/v2/model/role_template_data_type.py
Original file line number Diff line number Diff line change
@@ -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")
8 changes: 8 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -6821,6 +6825,10 @@
"RoleRelationships",
"RoleResponse",
"RoleResponseRelationships",
"RoleTemplateArray",
"RoleTemplateData",
"RoleTemplateDataAttributes",
"RoleTemplateDataType",
"RoleUpdateAttributes",
"RoleUpdateData",
"RoleUpdateRequest",
Expand Down
Loading