diff --git a/.apigentools-info b/.apigentools-info index 3a7ce029ec..106856a9e2 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-06-17 09:21:24.214498", - "spec_repo_commit": "743cf92b" + "regenerated": "2024-06-18 16:37:19.527536", + "spec_repo_commit": "848af7a9" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-06-17 09:21:24.231452", - "spec_repo_commit": "743cf92b" + "regenerated": "2024-06-18 16:37:19.544104", + "spec_repo_commit": "848af7a9" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7d45c6982d..76b6b541b1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -373,6 +373,14 @@ components: required: true schema: type: string + OrgConfigName: + description: The name of an Org Config. + in: path + name: org_config_name + required: true + schema: + example: monitor_timezone + type: string PageNumber: description: Specific page number to return. in: query @@ -13822,6 +13830,104 @@ components: required: - data type: object + OrgConfigGetResponse: + description: A response with a single Org Config. + properties: + data: + $ref: '#/components/schemas/OrgConfigRead' + required: + - data + type: object + OrgConfigListResponse: + description: A response with multiple Org Configs. + properties: + data: + description: An array of Org Configs. + items: + $ref: '#/components/schemas/OrgConfigRead' + type: array + required: + - data + type: object + OrgConfigRead: + description: A single Org Config. + properties: + attributes: + $ref: '#/components/schemas/OrgConfigReadAttributes' + id: + description: A unique identifier for an Org Config. + example: abcd1234 + type: string + type: + $ref: '#/components/schemas/OrgConfigType' + required: + - id + - type + - attributes + type: object + OrgConfigReadAttributes: + description: Readable attributes of an Org Config. + properties: + description: + description: The description of an Org Config. + example: Frobulate the turbo encabulator manifold + type: string + modified_at: + description: The timestamp of the last Org Config update (if any). + format: date-time + nullable: true + type: string + name: + description: The machine-friendly name of an Org Config. + example: monitor_timezone + type: string + value: + description: The value of an Org Config. + value_type: + description: The type of an Org Config value. + example: bool + type: string + required: + - name + - description + - value_type + - value + type: object + OrgConfigType: + description: Data type of an Org Config. + enum: + - org_configs + example: org_configs + type: string + x-enum-varnames: + - ORG_CONFIGS + OrgConfigWrite: + description: An Org Config write operation. + properties: + attributes: + $ref: '#/components/schemas/OrgConfigWriteAttributes' + type: + $ref: '#/components/schemas/OrgConfigType' + required: + - type + - attributes + type: object + OrgConfigWriteAttributes: + description: Writable attributes of an Org Config. + properties: + value: + description: The value of an Org Config. + required: + - value + type: object + OrgConfigWriteRequest: + description: A request to update an Org Config. + properties: + data: + $ref: '#/components/schemas/OrgConfigWrite' + required: + - data + type: object Organization: description: Organization object. properties: @@ -30455,6 +30561,96 @@ paths: limitParam: page[limit] pageOffsetParam: page[offset] resultsPath: data + /api/v2/org_configs: + get: + description: Returns all Org Configs (name, description, and value). + operationId: ListOrgConfigs + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OrgConfigListResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List Org Configs + tags: + - Organizations + /api/v2/org_configs/{org_config_name}: + get: + description: Return the name, description, and value of a specific Org Config. + operationId: GetOrgConfig + parameters: + - $ref: '#/components/parameters/OrgConfigName' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OrgConfigGetResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a specific Org Config value + tags: + - Organizations + patch: + description: Update the value of a specific Org Config. + operationId: UpdateOrgConfig + parameters: + - $ref: '#/components/parameters/OrgConfigName' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OrgConfigWriteRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OrgConfigGetResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: Update a specific Org Config + tags: + - Organizations /api/v2/permissions: get: description: Returns a list of all permissions, including name, description, diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 2a2dd7dbfd..d795324bf8 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -6133,6 +6133,62 @@ opsgenie\_services\_response :members: :show-inheritance: +org\_config\_get\_response +-------------------------- + +.. automodule:: datadog_api_client.v2.model.org_config_get_response + :members: + :show-inheritance: + +org\_config\_list\_response +--------------------------- + +.. automodule:: datadog_api_client.v2.model.org_config_list_response + :members: + :show-inheritance: + +org\_config\_read +----------------- + +.. automodule:: datadog_api_client.v2.model.org_config_read + :members: + :show-inheritance: + +org\_config\_read\_attributes +----------------------------- + +.. automodule:: datadog_api_client.v2.model.org_config_read_attributes + :members: + :show-inheritance: + +org\_config\_type +----------------- + +.. automodule:: datadog_api_client.v2.model.org_config_type + :members: + :show-inheritance: + +org\_config\_write +------------------ + +.. automodule:: datadog_api_client.v2.model.org_config_write + :members: + :show-inheritance: + +org\_config\_write\_attributes +------------------------------ + +.. automodule:: datadog_api_client.v2.model.org_config_write_attributes + :members: + :show-inheritance: + +org\_config\_write\_request +--------------------------- + +.. automodule:: datadog_api_client.v2.model.org_config_write_request + :members: + :show-inheritance: + organization ------------ diff --git a/examples/v2/organizations/GetOrgConfig.py b/examples/v2/organizations/GetOrgConfig.py new file mode 100644 index 0000000000..e681773028 --- /dev/null +++ b/examples/v2/organizations/GetOrgConfig.py @@ -0,0 +1,15 @@ +""" +Get a specific Org Config value returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.organizations_api import OrganizationsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OrganizationsApi(api_client) + response = api_instance.get_org_config( + org_config_name="custom_roles", + ) + + print(response) diff --git a/examples/v2/organizations/ListOrgConfigs.py b/examples/v2/organizations/ListOrgConfigs.py new file mode 100644 index 0000000000..70c1013aae --- /dev/null +++ b/examples/v2/organizations/ListOrgConfigs.py @@ -0,0 +1,13 @@ +""" +List Org Configs returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.organizations_api import OrganizationsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OrganizationsApi(api_client) + response = api_instance.list_org_configs() + + print(response) diff --git a/examples/v2/organizations/UpdateOrgConfig.py b/examples/v2/organizations/UpdateOrgConfig.py new file mode 100644 index 0000000000..e177a78797 --- /dev/null +++ b/examples/v2/organizations/UpdateOrgConfig.py @@ -0,0 +1,26 @@ +""" +Update a specific Org Config returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.organizations_api import OrganizationsApi +from datadog_api_client.v2.model.org_config_type import OrgConfigType +from datadog_api_client.v2.model.org_config_write import OrgConfigWrite +from datadog_api_client.v2.model.org_config_write_attributes import OrgConfigWriteAttributes +from datadog_api_client.v2.model.org_config_write_request import OrgConfigWriteRequest + +body = OrgConfigWriteRequest( + data=OrgConfigWrite( + attributes=OrgConfigWriteAttributes( + value="UTC", + ), + type=OrgConfigType.ORG_CONFIGS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OrganizationsApi(api_client) + response = api_instance.update_org_config(org_config_name="monitor_timezone", body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/organizations_api.py b/src/datadog_api_client/v2/api/organizations_api.py index 4f6125c16e..8cd79ea9c0 100644 --- a/src/datadog_api_client/v2/api/organizations_api.py +++ b/src/datadog_api_client/v2/api/organizations_api.py @@ -12,6 +12,9 @@ UnsetType, unset, ) +from datadog_api_client.v2.model.org_config_list_response import OrgConfigListResponse +from datadog_api_client.v2.model.org_config_get_response import OrgConfigGetResponse +from datadog_api_client.v2.model.org_config_write_request import OrgConfigWriteRequest class OrganizationsApi: @@ -24,6 +27,71 @@ def __init__(self, api_client=None): api_client = ApiClient(Configuration()) self.api_client = api_client + self._get_org_config_endpoint = _Endpoint( + settings={ + "response_type": (OrgConfigGetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/org_configs/{org_config_name}", + "operation_id": "get_org_config", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "org_config_name": { + "required": True, + "openapi_types": (str,), + "attribute": "org_config_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_org_configs_endpoint = _Endpoint( + settings={ + "response_type": (OrgConfigListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/org_configs", + "operation_id": "list_org_configs", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_org_config_endpoint = _Endpoint( + settings={ + "response_type": (OrgConfigGetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/org_configs/{org_config_name}", + "operation_id": "update_org_config", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "org_config_name": { + "required": True, + "openapi_types": (str,), + "attribute": "org_config_name", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (OrgConfigWriteRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._upload_idp_metadata_endpoint = _Endpoint( settings={ "response_type": None, @@ -44,6 +112,56 @@ def __init__(self, api_client=None): api_client=api_client, ) + def get_org_config( + self, + org_config_name: str, + ) -> OrgConfigGetResponse: + """Get a specific Org Config value. + + Return the name, description, and value of a specific Org Config. + + :param org_config_name: The name of an Org Config. + :type org_config_name: str + :rtype: OrgConfigGetResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["org_config_name"] = org_config_name + + return self._get_org_config_endpoint.call_with_http_info(**kwargs) + + def list_org_configs( + self, + ) -> OrgConfigListResponse: + """List Org Configs. + + Returns all Org Configs (name, description, and value). + + :rtype: OrgConfigListResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_org_configs_endpoint.call_with_http_info(**kwargs) + + def update_org_config( + self, + org_config_name: str, + body: OrgConfigWriteRequest, + ) -> OrgConfigGetResponse: + """Update a specific Org Config. + + Update the value of a specific Org Config. + + :param org_config_name: The name of an Org Config. + :type org_config_name: str + :type body: OrgConfigWriteRequest + :rtype: OrgConfigGetResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["org_config_name"] = org_config_name + + kwargs["body"] = body + + return self._update_org_config_endpoint.call_with_http_info(**kwargs) + def upload_idp_metadata( self, *, diff --git a/src/datadog_api_client/v2/model/org_config_get_response.py b/src/datadog_api_client/v2/model/org_config_get_response.py new file mode 100644 index 0000000000..413ddd68cb --- /dev/null +++ b/src/datadog_api_client/v2/model/org_config_get_response.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.org_config_read import OrgConfigRead + + +class OrgConfigGetResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_config_read import OrgConfigRead + + return { + "data": (OrgConfigRead,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OrgConfigRead, **kwargs): + """ + A response with a single Org Config. + + :param data: A single Org Config. + :type data: OrgConfigRead + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/org_config_list_response.py b/src/datadog_api_client/v2/model/org_config_list_response.py new file mode 100644 index 0000000000..ba9927030b --- /dev/null +++ b/src/datadog_api_client/v2/model/org_config_list_response.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.org_config_read import OrgConfigRead + + +class OrgConfigListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_config_read import OrgConfigRead + + return { + "data": ([OrgConfigRead],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[OrgConfigRead], **kwargs): + """ + A response with multiple Org Configs. + + :param data: An array of Org Configs. + :type data: [OrgConfigRead] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/org_config_read.py b/src/datadog_api_client/v2/model/org_config_read.py new file mode 100644 index 0000000000..027eabf6a1 --- /dev/null +++ b/src/datadog_api_client/v2/model/org_config_read.py @@ -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.org_config_read_attributes import OrgConfigReadAttributes + from datadog_api_client.v2.model.org_config_type import OrgConfigType + + +class OrgConfigRead(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_config_read_attributes import OrgConfigReadAttributes + from datadog_api_client.v2.model.org_config_type import OrgConfigType + + return { + "attributes": (OrgConfigReadAttributes,), + "id": (str,), + "type": (OrgConfigType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: OrgConfigReadAttributes, id: str, type: OrgConfigType, **kwargs): + """ + A single Org Config. + + :param attributes: Readable attributes of an Org Config. + :type attributes: OrgConfigReadAttributes + + :param id: A unique identifier for an Org Config. + :type id: str + + :param type: Data type of an Org Config. + :type type: OrgConfigType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/org_config_read_attributes.py b/src/datadog_api_client/v2/model/org_config_read_attributes.py new file mode 100644 index 0000000000..d4fc8f32b4 --- /dev/null +++ b/src/datadog_api_client/v2/model/org_config_read_attributes.py @@ -0,0 +1,84 @@ +# 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 Any, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class OrgConfigReadAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "description": (str,), + "modified_at": (datetime, none_type), + "name": (str,), + "value": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ), + "value_type": (str,), + } + + attribute_map = { + "description": "description", + "modified_at": "modified_at", + "name": "name", + "value": "value", + "value_type": "value_type", + } + + def __init__( + self_, + description: str, + name: str, + value: Any, + value_type: str, + modified_at: Union[datetime, none_type, UnsetType] = unset, + **kwargs, + ): + """ + Readable attributes of an Org Config. + + :param description: The description of an Org Config. + :type description: str + + :param modified_at: The timestamp of the last Org Config update (if any). + :type modified_at: datetime, none_type, optional + + :param name: The machine-friendly name of an Org Config. + :type name: str + + :param value: The value of an Org Config. + :type value: bool, date, datetime, dict, float, int, list, str, UUID, none_type + + :param value_type: The type of an Org Config value. + :type value_type: str + """ + if modified_at is not unset: + kwargs["modified_at"] = modified_at + super().__init__(kwargs) + + self_.description = description + self_.name = name + self_.value = value + self_.value_type = value_type diff --git a/src/datadog_api_client/v2/model/org_config_type.py b/src/datadog_api_client/v2/model/org_config_type.py new file mode 100644 index 0000000000..6cdf8f4d05 --- /dev/null +++ b/src/datadog_api_client/v2/model/org_config_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 OrgConfigType(ModelSimple): + """ + Data type of an Org Config. + + :param value: If omitted defaults to "org_configs". Must be one of ["org_configs"]. + :type value: str + """ + + allowed_values = { + "org_configs", + } + ORG_CONFIGS: ClassVar["OrgConfigType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OrgConfigType.ORG_CONFIGS = OrgConfigType("org_configs") diff --git a/src/datadog_api_client/v2/model/org_config_write.py b/src/datadog_api_client/v2/model/org_config_write.py new file mode 100644 index 0000000000..734dd37ab9 --- /dev/null +++ b/src/datadog_api_client/v2/model/org_config_write.py @@ -0,0 +1,48 @@ +# 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.org_config_write_attributes import OrgConfigWriteAttributes + from datadog_api_client.v2.model.org_config_type import OrgConfigType + + +class OrgConfigWrite(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_config_write_attributes import OrgConfigWriteAttributes + from datadog_api_client.v2.model.org_config_type import OrgConfigType + + return { + "attributes": (OrgConfigWriteAttributes,), + "type": (OrgConfigType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: OrgConfigWriteAttributes, type: OrgConfigType, **kwargs): + """ + An Org Config write operation. + + :param attributes: Writable attributes of an Org Config. + :type attributes: OrgConfigWriteAttributes + + :param type: Data type of an Org Config. + :type type: OrgConfigType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/org_config_write_attributes.py b/src/datadog_api_client/v2/model/org_config_write_attributes.py new file mode 100644 index 0000000000..eff3a954f2 --- /dev/null +++ b/src/datadog_api_client/v2/model/org_config_write_attributes.py @@ -0,0 +1,49 @@ +# 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 Any + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + UUID, +) + + +class OrgConfigWriteAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "value": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ), + } + + attribute_map = { + "value": "value", + } + + def __init__(self_, value: Any, **kwargs): + """ + Writable attributes of an Org Config. + + :param value: The value of an Org Config. + :type value: bool, date, datetime, dict, float, int, list, str, UUID, none_type + """ + super().__init__(kwargs) + + self_.value = value diff --git a/src/datadog_api_client/v2/model/org_config_write_request.py b/src/datadog_api_client/v2/model/org_config_write_request.py new file mode 100644 index 0000000000..552eae5f4f --- /dev/null +++ b/src/datadog_api_client/v2/model/org_config_write_request.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.org_config_write import OrgConfigWrite + + +class OrgConfigWriteRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_config_write import OrgConfigWrite + + return { + "data": (OrgConfigWrite,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OrgConfigWrite, **kwargs): + """ + A request to update an Org Config. + + :param data: An Org Config write operation. + :type data: OrgConfigWrite + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 054b2a8991..831489db37 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1044,6 +1044,14 @@ from datadog_api_client.v2.model.opsgenie_service_update_data import OpsgenieServiceUpdateData from datadog_api_client.v2.model.opsgenie_service_update_request import OpsgenieServiceUpdateRequest from datadog_api_client.v2.model.opsgenie_services_response import OpsgenieServicesResponse +from datadog_api_client.v2.model.org_config_get_response import OrgConfigGetResponse +from datadog_api_client.v2.model.org_config_list_response import OrgConfigListResponse +from datadog_api_client.v2.model.org_config_read import OrgConfigRead +from datadog_api_client.v2.model.org_config_read_attributes import OrgConfigReadAttributes +from datadog_api_client.v2.model.org_config_type import OrgConfigType +from datadog_api_client.v2.model.org_config_write import OrgConfigWrite +from datadog_api_client.v2.model.org_config_write_attributes import OrgConfigWriteAttributes +from datadog_api_client.v2.model.org_config_write_request import OrgConfigWriteRequest from datadog_api_client.v2.model.organization import Organization from datadog_api_client.v2.model.organization_attributes import OrganizationAttributes from datadog_api_client.v2.model.organizations_type import OrganizationsType @@ -2690,6 +2698,14 @@ "OpsgenieServiceUpdateData", "OpsgenieServiceUpdateRequest", "OpsgenieServicesResponse", + "OrgConfigGetResponse", + "OrgConfigListResponse", + "OrgConfigRead", + "OrgConfigReadAttributes", + "OrgConfigType", + "OrgConfigWrite", + "OrgConfigWriteAttributes", + "OrgConfigWriteRequest", "Organization", "OrganizationAttributes", "OrganizationsType", diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_not_found_response.frozen new file mode 100644 index 0000000000..b8ca61f906 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_not_found_response.frozen @@ -0,0 +1 @@ +2024-06-12T14:43:53.056Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_not_found_response.yaml new file mode 100644 index 0000000000..342ef1a4eb --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_not_found_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/org_configs/i_dont_exist + response: + body: + string: '{"errors":["OrgConfig: i_dont_exist not found"]}' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_ok_response.frozen new file mode 100644 index 0000000000..03b64c4edd --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-06-12T14:43:53.592Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_ok_response.yaml new file mode 100644 index 0000000000..73e7b66bb2 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_specific_org_config_value_returns_ok_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/org_configs/custom_roles + response: + body: + string: '{"data":{"type":"org_configs","id":"d4a6259b-5599-5120-8bdb-22718cb09118","attributes":{"name":"custom_roles","description":"Enables + the custom roles (RBAC) UI.","value_type":"bool","value":false,"modified_at":null}}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_org_configs_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_org_configs_returns_ok_response.frozen new file mode 100644 index 0000000000..e428c0dfd6 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_org_configs_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-06-12T14:43:54.065Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_org_configs_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_org_configs_returns_ok_response.yaml new file mode 100644 index 0000000000..c9cdb42bfc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_org_configs_returns_ok_response.yaml @@ -0,0 +1,41 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/org_configs + response: + body: + string: '{"data":[{"type":"org_configs","id":"4c2b0cec-de6d-5030-b3fd-391b34ff99eb","attributes":{"name":"invalid_session_30_days","description":"Test + test test","value_type":"bool","value":true,"modified_at":null}},{"type":"org_configs","id":"ae6ea27d-7945-56c9-a12b-37fc3b094459","attributes":{"name":"my_new_org_config_key_name","description":"This + is a description","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"0e63d108-84c3-55c7-9767-e00b21e5bc30","attributes":{"name":"domain_allowlist","description":"domain + allowlist for emails to be sent","value_type":"email_domain_list","value":[],"modified_at":null}},{"type":"org_configs","id":"3081bbc5-6227-5e58-86e3-835fa2b72858","attributes":{"name":"enable_domain_allowlist","description":"domain + allowlist enablement for emails to be sent","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"86f9a647-f7f9-5181-aa4a-2530bdcb4374","attributes":{"name":"30d_invite_expiration","description":"This + will set the expiration date of Org invites to 30 days instead of the default + 2 days","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"5639dc2d-d96a-558a-b2bb-c563b5a7d609","attributes":{"name":"oauth_client_disallow_list","description":"Disallow + list for oauth clients users can authorize with in a given org.","value_type":"list","value":[],"modified_at":null}},{"type":"org_configs","id":"336c724c-521f-559e-9b43-28b38289ab64","attributes":{"name":"restrict_export_to_csv","description":"Disables + the ability to export Logs to CSV via the API and UI for all users of an org.","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"b2935166-5372-53a7-9c91-632d39c81dba","attributes":{"name":"pci_enabled","description":"pci + compliance is enabled for this org","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"bddab2d2-e3b8-5103-b74f-be209608a3cf","attributes":{"name":"invalid_session_forced_logout","description":"Force + reload on current_user 403 response / invalid session. Checked every minute.","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"d4a6259b-5599-5120-8bdb-22718cb09118","attributes":{"name":"custom_roles","description":"Enables + the custom roles (RBAC) UI.","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"61d24356-1d0a-51b2-ac77-16bddb9a4fbc","attributes":{"name":"log_anomaly_detection","description":"Whether + the API should return results for Logs Anomaly detection","value_type":"bool","value":true,"modified_at":null}},{"type":"org_configs","id":"4fcf5523-7578-5ebb-bf7f-cc0b96047ea5","attributes":{"name":"logs_has_set_flex_log_compute","description":"Org + config used to know an org has set flex log compute. This is useful to sync + the log query UI and preferred query storage type with flex log enablement.","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"1e20f9a8-ef08-5716-a466-d650854c9c62","attributes":{"name":"open_retentions","description":"Enables + users to set out of contract retentions.","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"87eeb191-0e80-575d-9b1f-2efed8aae16d","attributes":{"name":"admin_only_invites","description":"Restrict + user invites to only admins","value_type":"bool","value":false,"modified_at":null}},{"type":"org_configs","id":"47d07447-cee4-5f45-820a-3595c8c1ce21","attributes":{"name":"security_contacts","description":"List + of emails for security event notifications of an organization","value_type":"security_contacts_list","value":[],"modified_at":"2024-05-06T13:51:46.470206+00:00"}},{"type":"org_configs","id":"ba76efd8-79f3-52ee-8742-856c18e754c7","attributes":{"name":"teams_manage_membership","description":"Controls + who can manage membership for teams","value_type":"enum","value":"organization","modified_at":null}},{"type":"org_configs","id":"63be605e-4cc3-566b-94d8-475ab5137e25","attributes":{"name":"teams_edit_details","description":"Controls + who can edit team details","value_type":"enum","value":"members","modified_at":null}},{"type":"org_configs","id":"855e9fc7-449d-5fbf-9607-9f9bfca3dddf","attributes":{"name":"teams_provisioning_sources","description":"Determines + how users can be added to teams","value_type":"enum","value":"manually","modified_at":null}},{"type":"org_configs","id":"54efd4ec-bb21-5e8a-9cb8-712e18f8b6b7","attributes":{"name":"monitor_timezone","description":"Sets + the time zone used for monitoring alerts","value_type":"enum","value":"UTC","modified_at":null}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_bad_request_response.frozen new file mode 100644 index 0000000000..5d6bd0c787 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2024-06-12T14:43:54.474Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_bad_request_response.yaml new file mode 100644 index 0000000000..14f3517002 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_bad_request_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"value":"not-a-boolean"},"type":"org_configs"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/org_configs/custom_roles + response: + body: + string: '{"errors":["The value provided for parameter ''OrgConfig: not-a-boolean'' + is invalid"]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_not_found_response.frozen new file mode 100644 index 0000000000..8c54ec652a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_not_found_response.frozen @@ -0,0 +1 @@ +2024-06-12T14:43:54.951Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_not_found_response.yaml new file mode 100644 index 0000000000..61fc823451 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_not_found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"value":[]},"type":"org_configs"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/org_configs/i_dont_exist + response: + body: + string: '{"errors":["OrgConfig: i_dont_exist not found"]}' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_ok_response.frozen new file mode 100644 index 0000000000..3f77206fc1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-06-12T14:43:55.410Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_ok_response.yaml new file mode 100644 index 0000000000..ba59efeb73 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_specific_org_config_returns_ok_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: '{"data":{"attributes":{"value":"UTC"},"type":"org_configs"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/org_configs/monitor_timezone + response: + body: + string: '{"data":{"type":"org_configs","id":"54efd4ec-bb21-5e8a-9cb8-712e18f8b6b7","attributes":{"name":"monitor_timezone","description":"Sets + the time zone used for monitoring alerts","value_type":"enum","value":"UTC","modified_at":"2024-06-12T14:43:55.693935+00:00"}}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/organizations.feature b/tests/v2/features/organizations.feature index 57045426fd..ddec7484e7 100644 --- a/tests/v2/features/organizations.feature +++ b/tests/v2/features/organizations.feature @@ -7,21 +7,80 @@ Feature: Organizations Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "Organizations" API - And new "UploadIdPMetadata" request + + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Get a specific Org Config value returns "Bad Request" response + Given new "GetOrgConfig" request + And request contains "org_config_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/team-aaa-identity + Scenario: Get a specific Org Config value returns "Not Found" response + Given new "GetOrgConfig" request + And request contains "org_config_name" parameter with value "i_dont_exist" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/team-aaa-identity + Scenario: Get a specific Org Config value returns "OK" response + Given new "GetOrgConfig" request + And request contains "org_config_name" parameter with value "custom_roles" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/team-aaa-identity + Scenario: List Org Configs returns "Bad Request" response + Given new "ListOrgConfigs" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/team-aaa-identity + Scenario: List Org Configs returns "OK" response + Given new "ListOrgConfigs" request + When the request is sent + Then the response status is 200 OK + + @team:DataDog/team-aaa-identity + Scenario: Update a specific Org Config returns "Bad Request" response + Given new "UpdateOrgConfig" request + And request contains "org_config_name" parameter with value "custom_roles" + And body with value {"data": {"attributes": {"value": "not-a-boolean"}, "type": "org_configs"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/team-aaa-identity + Scenario: Update a specific Org Config returns "Not Found" response + Given new "UpdateOrgConfig" request + And request contains "org_config_name" parameter with value "i_dont_exist" + And body with value {"data": {"attributes": {"value": []}, "type": "org_configs"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/team-aaa-identity + Scenario: Update a specific Org Config returns "OK" response + Given new "UpdateOrgConfig" request + And request contains "org_config_name" parameter with value "monitor_timezone" + And body with value {"data": {"attributes": {"value": "UTC"}, "type": "org_configs"}} + When the request is sent + Then the response status is 200 OK @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-terraform-config @skip-typescript @skip-validation @team:DataDog/team-aaa-identity Scenario: Upload IdP metadata returns "Bad Request - caused by either malformed XML or invalid SAML IdP metadata" response - Given request contains "idp_file" parameter with value "fixtures/organizations/saml_configurations/invalid_idp_metadata.xml" + Given new "UploadIdPMetadata" request + And request contains "idp_file" parameter with value "fixtures/organizations/saml_configurations/invalid_idp_metadata.xml" When the request is sent Then the response status is 400 Bad Request - caused by either malformed XML or invalid SAML IdP metadata @generated @skip @team:DataDog/team-aaa-identity Scenario: Upload IdP metadata returns "Bad Request" response + Given new "UploadIdPMetadata" request When the request is sent Then the response status is 400 Bad Request @integration-only @skip-terraform-config @skip-validation @team:DataDog/team-aaa-identity Scenario: Upload IdP metadata returns "OK" response - Given request contains "idp_file" parameter with value "fixtures/organizations/saml_configurations/valid_idp_metadata.xml" + Given new "UploadIdPMetadata" request + And request contains "idp_file" parameter with value "fixtures/organizations/saml_configurations/valid_idp_metadata.xml" When the request is sent Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 226eb14565..0126ff4b81 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1297,6 +1297,24 @@ "type": "safe" } }, + "ListOrgConfigs": { + "tag": "Organizations", + "undo": { + "type": "safe" + } + }, + "GetOrgConfig": { + "tag": "Organizations", + "undo": { + "type": "safe" + } + }, + "UpdateOrgConfig": { + "tag": "Organizations", + "undo": { + "type": "idempotent" + } + }, "ListPermissions": { "tag": "Roles", "undo": {