From 5f636b4ea6cc7c72ab423c4c766efa155b083e24 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 13 Jan 2025 22:03:00 +0000 Subject: [PATCH] Regenerate client from commit 5aa96e08 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 108 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 14 +++ .../DeleteCustomFramework.py | 17 +++ .../v2/api/security_monitoring_api.py | 63 ++++++++++ .../v2/model/custom_framework_metadata.py | 108 ++++++++++++++++++ .../model/delete_custom_framework_response.py | 42 +++++++ src/datadog_api_client/v2/models/__init__.py | 4 + tests/v2/features/security_monitoring.feature | 18 +++ tests/v2/features/undo.json | 6 + 10 files changed, 384 insertions(+), 4 deletions(-) create mode 100644 examples/v2/security-monitoring/DeleteCustomFramework.py create mode 100644 src/datadog_api_client/v2/model/custom_framework_metadata.py create mode 100644 src/datadog_api_client/v2/model/delete_custom_framework_response.py diff --git a/.apigentools-info b/.apigentools-info index 877598db7b..d013e06459 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-13 18:28:08.995813", - "spec_repo_commit": "3517c947" + "regenerated": "2025-01-13 22:02:26.852023", + "spec_repo_commit": "5aa96e08" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-13 18:28:09.011266", - "spec_repo_commit": "3517c947" + "regenerated": "2025-01-13 22:02:26.866361", + "spec_repo_commit": "5aa96e08" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7e519f9265..61a760d378 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -213,6 +213,27 @@ components: required: true schema: type: string + CustomFrameworkHandle: + description: The framework handle. + in: path + name: handle + required: true + schema: + type: string + CustomFrameworkOrgID: + description: The ID of the organization. + in: path + name: org_id + required: true + schema: + type: string + CustomFrameworkVersion: + description: The framework version. + in: path + name: version + required: true + schema: + type: string EntityID: description: UUID or Entity Ref. in: path @@ -8375,6 +8396,54 @@ components: $ref: '#/components/schemas/CustomDestinationResponseDefinition' type: array type: object + CustomFrameworkMetadata: + description: Response object for an organization's custom frameworks. + properties: + created_at: + description: Framework Creation Date + format: int64 + type: integer + created_by: + description: Framework Creator + type: string + description: + description: Framework Description + type: string + handle: + description: Framework Handle + example: '' + type: string + icon_url: + description: Framework Icon URL + type: string + id: + description: Custom Framework ID + example: '' + type: string + name: + description: Framework Name + example: '' + type: string + org_id: + description: Org ID + example: 0 + format: int64 + type: integer + updated_at: + description: Framework Update Date + format: int64 + type: integer + version: + description: Framework Version + example: '' + type: string + required: + - id + - org_id + - handle + - version + - name + type: object DORADeploymentRequest: description: Request to create a DORA deployment event. properties: @@ -9015,6 +9084,12 @@ components: type: string x-enum-varnames: - APPDEFINITIONS + DeleteCustomFrameworkResponse: + description: Delete a custom framework. + properties: + data: + $ref: '#/components/schemas/CustomFrameworkMetadata' + type: object DependencyLocation: description: Static library vulnerability location. properties: @@ -40135,6 +40210,39 @@ paths: operator: OR permissions: - org_management + /api/v2/orgs/{org_id}/cloud_security_management/custom_frameworks/{handle}/{version}: + delete: + description: Delete a custom framework. + operationId: DeleteCustomFramework + parameters: + - $ref: '#/components/parameters/CustomFrameworkOrgID' + - $ref: '#/components/parameters/CustomFrameworkHandle' + - $ref: '#/components/parameters/CustomFrameworkVersion' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteCustomFrameworkResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + $ref: '#/components/responses/BadRequestResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_rules_read + summary: Delete a custom framework + tags: + - Security Monitoring + x-permission: + operator: OR + permissions: + - security_monitoring_rules_read /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 ba92270028..27cfc60b48 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -3301,6 +3301,13 @@ datadog\_api\_client.v2.model.custom\_destinations\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.custom\_framework\_metadata module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_framework_metadata + :members: + :show-inheritance: + datadog\_api\_client.v2.model.cvss module ----------------------------------------- @@ -3476,6 +3483,13 @@ datadog\_api\_client.v2.model.delete\_apps\_response\_data\_items\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.delete\_custom\_framework\_response module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.delete_custom_framework_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.dependency\_location module --------------------------------------------------------- diff --git a/examples/v2/security-monitoring/DeleteCustomFramework.py b/examples/v2/security-monitoring/DeleteCustomFramework.py new file mode 100644 index 0000000000..ec06fd0585 --- /dev/null +++ b/examples/v2/security-monitoring/DeleteCustomFramework.py @@ -0,0 +1,17 @@ +""" +Delete a custom framework returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = SecurityMonitoringApi(api_client) + response = api_instance.delete_custom_framework( + org_id="org_id", + handle="handle", + version="version", + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/security_monitoring_api.py b/src/datadog_api_client/v2/api/security_monitoring_api.py index 2b60d768a5..0e93a24a16 100644 --- a/src/datadog_api_client/v2/api/security_monitoring_api.py +++ b/src/datadog_api_client/v2/api/security_monitoring_api.py @@ -15,6 +15,7 @@ UnsetType, unset, ) +from datadog_api_client.v2.model.delete_custom_framework_response import DeleteCustomFrameworkResponse from datadog_api_client.v2.model.list_findings_response import ListFindingsResponse from datadog_api_client.v2.model.finding_evaluation import FindingEvaluation from datadog_api_client.v2.model.finding_status import FindingStatus @@ -242,6 +243,41 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_custom_framework_endpoint = _Endpoint( + settings={ + "response_type": (DeleteCustomFrameworkResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/orgs/{org_id}/cloud_security_management/custom_frameworks/{handle}/{version}", + "operation_id": "delete_custom_framework", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "org_id": { + "required": True, + "openapi_types": (str,), + "attribute": "org_id", + "location": "path", + }, + "handle": { + "required": True, + "openapi_types": (str,), + "attribute": "handle", + "location": "path", + }, + "version": { + "required": True, + "openapi_types": (str,), + "attribute": "version", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._delete_historical_job_endpoint = _Endpoint( settings={ "response_type": None, @@ -1459,6 +1495,33 @@ def create_security_monitoring_suppression( return self._create_security_monitoring_suppression_endpoint.call_with_http_info(**kwargs) + def delete_custom_framework( + self, + org_id: str, + handle: str, + version: str, + ) -> DeleteCustomFrameworkResponse: + """Delete a custom framework. + + Delete a custom framework. + + :param org_id: The ID of the organization. + :type org_id: str + :param handle: The framework handle. + :type handle: str + :param version: The framework version. + :type version: str + :rtype: DeleteCustomFrameworkResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["org_id"] = org_id + + kwargs["handle"] = handle + + kwargs["version"] = version + + return self._delete_custom_framework_endpoint.call_with_http_info(**kwargs) + def delete_historical_job( self, job_id: str, diff --git a/src/datadog_api_client/v2/model/custom_framework_metadata.py b/src/datadog_api_client/v2/model/custom_framework_metadata.py new file mode 100644 index 0000000000..41b4d2b877 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_framework_metadata.py @@ -0,0 +1,108 @@ +# 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 CustomFrameworkMetadata(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (int,), + "created_by": (str,), + "description": (str,), + "handle": (str,), + "icon_url": (str,), + "id": (str,), + "name": (str,), + "org_id": (int,), + "updated_at": (int,), + "version": (str,), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "description": "description", + "handle": "handle", + "icon_url": "icon_url", + "id": "id", + "name": "name", + "org_id": "org_id", + "updated_at": "updated_at", + "version": "version", + } + + def __init__( + self_, + handle: str, + id: str, + name: str, + org_id: int, + version: str, + created_at: Union[int, UnsetType] = unset, + created_by: Union[str, UnsetType] = unset, + description: Union[str, UnsetType] = unset, + icon_url: Union[str, UnsetType] = unset, + updated_at: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Response object for an organization's custom frameworks. + + :param created_at: Framework Creation Date + :type created_at: int, optional + + :param created_by: Framework Creator + :type created_by: str, optional + + :param description: Framework Description + :type description: str, optional + + :param handle: Framework Handle + :type handle: str + + :param icon_url: Framework Icon URL + :type icon_url: str, optional + + :param id: Custom Framework ID + :type id: str + + :param name: Framework Name + :type name: str + + :param org_id: Org ID + :type org_id: int + + :param updated_at: Framework Update Date + :type updated_at: int, optional + + :param version: Framework Version + :type version: str + """ + if created_at is not unset: + kwargs["created_at"] = created_at + if created_by is not unset: + kwargs["created_by"] = created_by + if description is not unset: + kwargs["description"] = description + if icon_url is not unset: + kwargs["icon_url"] = icon_url + if updated_at is not unset: + kwargs["updated_at"] = updated_at + super().__init__(kwargs) + + self_.handle = handle + self_.id = id + self_.name = name + self_.org_id = org_id + self_.version = version diff --git a/src/datadog_api_client/v2/model/delete_custom_framework_response.py b/src/datadog_api_client/v2/model/delete_custom_framework_response.py new file mode 100644 index 0000000000..c8893b03e3 --- /dev/null +++ b/src/datadog_api_client/v2/model/delete_custom_framework_response.py @@ -0,0 +1,42 @@ +# 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.custom_framework_metadata import CustomFrameworkMetadata + + +class DeleteCustomFrameworkResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_framework_metadata import CustomFrameworkMetadata + + return { + "data": (CustomFrameworkMetadata,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CustomFrameworkMetadata, UnsetType] = unset, **kwargs): + """ + Delete a custom framework. + + :param data: Response object for an organization's custom frameworks. + :type data: CustomFrameworkMetadata, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index d0f3eee4b2..123e6174e2 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -611,6 +611,7 @@ CustomDestinationUpdateRequestDefinition, ) from datadog_api_client.v2.model.custom_destinations_response import CustomDestinationsResponse +from datadog_api_client.v2.model.custom_framework_metadata import CustomFrameworkMetadata from datadog_api_client.v2.model.dora_deployment_request import DORADeploymentRequest from datadog_api_client.v2.model.dora_deployment_request_attributes import DORADeploymentRequestAttributes from datadog_api_client.v2.model.dora_deployment_request_data import DORADeploymentRequestData @@ -648,6 +649,7 @@ from datadog_api_client.v2.model.delete_apps_response import DeleteAppsResponse from datadog_api_client.v2.model.delete_apps_response_data_items import DeleteAppsResponseDataItems from datadog_api_client.v2.model.delete_apps_response_data_items_type import DeleteAppsResponseDataItemsType +from datadog_api_client.v2.model.delete_custom_framework_response import DeleteCustomFrameworkResponse from datadog_api_client.v2.model.dependency_location import DependencyLocation from datadog_api_client.v2.model.deploy_app_response import DeployAppResponse from datadog_api_client.v2.model.deploy_app_response_data import DeployAppResponseData @@ -2801,6 +2803,7 @@ "CustomDestinationUpdateRequestAttributes", "CustomDestinationUpdateRequestDefinition", "CustomDestinationsResponse", + "CustomFrameworkMetadata", "DORADeploymentRequest", "DORADeploymentRequestAttributes", "DORADeploymentRequestData", @@ -2838,6 +2841,7 @@ "DeleteAppsResponse", "DeleteAppsResponseDataItems", "DeleteAppsResponseDataItemsType", + "DeleteCustomFrameworkResponse", "DependencyLocation", "DeployAppResponse", "DeployAppResponseData", diff --git a/tests/v2/features/security_monitoring.feature b/tests/v2/features/security_monitoring.feature index 362378f634..5723aa7f6e 100644 --- a/tests/v2/features/security_monitoring.feature +++ b/tests/v2/features/security_monitoring.feature @@ -296,6 +296,24 @@ Feature: Security Monitoring And the response "data.attributes.rule_query" is equal to "type:log_detection source:cloudtrail" And the response "data.attributes.data_exclusion_query" is equal to "account_id:12345" + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Delete a custom framework returns "Bad Request" response + Given new "DeleteCustomFramework" request + And request contains "org_id" parameter from "REPLACE.ME" + And request contains "handle" parameter from "REPLACE.ME" + And request contains "version" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Delete a custom framework returns "OK" response + Given new "DeleteCustomFramework" request + And request contains "org_id" parameter from "REPLACE.ME" + And request contains "handle" parameter from "REPLACE.ME" + And request contains "version" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/k9-cloud-security-platform Scenario: Delete a non existing rule returns "Not Found" response Given new "DeleteSecurityMonitoringRule" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index d6c6e9de87..8a7c3224ef 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1651,6 +1651,12 @@ "type": "idempotent" } }, + "DeleteCustomFramework": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListPermissions": { "tag": "Roles", "undo": {