Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add deleteCustomFramework endpoint #2351

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
108 changes: 108 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------------------------------

Expand Down Expand Up @@ -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
---------------------------------------------------------

Expand Down
17 changes: 17 additions & 0 deletions examples/v2/security-monitoring/DeleteCustomFramework.py
Original file line number Diff line number Diff line change
@@ -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)
63 changes: 63 additions & 0 deletions src/datadog_api_client/v2/api/security_monitoring_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
108 changes: 108 additions & 0 deletions src/datadog_api_client/v2/model/custom_framework_metadata.py
Original file line number Diff line number Diff line change
@@ -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_,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Code Quality Violation

Suggested change
self_,
self,
first parameter of a class function should be self (...read more)

In a class method (that is not a class method nor a static method), the first argument must be self by convention.

Learn More

View in Datadog  Leave us feedback  Documentation

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
Loading
Loading