Skip to content
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
717 changes: 717 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,13 @@ datadog\_api\_client.v2.api.google\_chat\_integration\_api module
:members:
:show-inheritance:

datadog\_api\_client.v2.api.governance\_controls\_api module
------------------------------------------------------------

.. automodule:: datadog_api_client.v2.api.governance_controls_api
:members:
:show-inheritance:

datadog\_api\_client.v2.api.governance\_insights\_api module
------------------------------------------------------------

Expand Down
84 changes: 84 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16930,6 +16930,90 @@ datadog\_api\_client.v2.model.governance\_best\_practice\_definition module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_attributes module
--------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_data module
--------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_mitigation\_definition module
--------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_mitigation_definition
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_parameter\_definition module
-------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_parameter_definition
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_parameters\_map module
-------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_parameters_map
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_resource\_type module
------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_resource_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_response module
------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_supported\_value module
--------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_supported_value
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_update\_attributes module
----------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_update_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_update\_data module
----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_update_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_control\_update\_request module
-------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_control_update_request
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_controls\_response module
-------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.governance_controls_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.governance\_insight\_attributes module
--------------------------------------------------------------------

Expand Down
16 changes: 16 additions & 0 deletions examples/v2/governance-controls/GetGovernanceControl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Get a governance control returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.governance_controls_api import GovernanceControlsApi

configuration = Configuration()
configuration.unstable_operations["get_governance_control"] = True
with ApiClient(configuration) as api_client:
api_instance = GovernanceControlsApi(api_client)
response = api_instance.get_governance_control(
detection_type="detection_type",
)

print(response)
14 changes: 14 additions & 0 deletions examples/v2/governance-controls/ListGovernanceControls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
List governance controls returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.governance_controls_api import GovernanceControlsApi

configuration = Configuration()
configuration.unstable_operations["list_governance_controls"] = True
with ApiClient(configuration) as api_client:
api_instance = GovernanceControlsApi(api_client)
response = api_instance.list_governance_controls()

print(response)
32 changes: 32 additions & 0 deletions examples/v2/governance-controls/UpdateGovernanceControl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
Update a governance control returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.governance_controls_api import GovernanceControlsApi
from datadog_api_client.v2.model.governance_control_resource_type import GovernanceControlResourceType
from datadog_api_client.v2.model.governance_control_update_attributes import GovernanceControlUpdateAttributes
from datadog_api_client.v2.model.governance_control_update_data import GovernanceControlUpdateData
from datadog_api_client.v2.model.governance_control_update_request import GovernanceControlUpdateRequest

body = GovernanceControlUpdateRequest(
data=GovernanceControlUpdateData(
attributes=GovernanceControlUpdateAttributes(
detection_frequency="daily",
mitigation_type="revoke_api_key",
name="Unused API Keys",
notification_frequency="daily",
notification_type="slack",
),
id="0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
type=GovernanceControlResourceType.GOVERNANCE_CONTROL,
),
)

configuration = Configuration()
configuration.unstable_operations["update_governance_control"] = True
with ApiClient(configuration) as api_client:
api_instance = GovernanceControlsApi(api_client)
response = api_instance.update_governance_control(detection_type="detection_type", body=body)

print(response)
3 changes: 3 additions & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ def __init__(
"v2.upsert_and_publish_form_version": False,
"v2.upsert_form_version": False,
"v2.update_org_saml_configurations": False,
"v2.get_governance_control": False,
"v2.list_governance_controls": False,
"v2.update_governance_control": False,
"v2.list_governance_insights": False,
"v2.create_hamr_org_connection": False,
"v2.get_hamr_org_connection": False,
Expand Down
146 changes: 146 additions & 0 deletions src/datadog_api_client/v2/api/governance_controls_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# 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, Dict

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.v2.model.governance_controls_response import GovernanceControlsResponse
from datadog_api_client.v2.model.governance_control_response import GovernanceControlResponse
from datadog_api_client.v2.model.governance_control_update_request import GovernanceControlUpdateRequest


class GovernanceControlsApi:
"""
Governance Controls pair a detection definition with an organization's detection, notification,
and mitigation configuration within the Governance Console. Each control reports how a class of
governance issue (such as unused API keys or unqueried metrics) is detected and remediated, along
with counts of active and mitigated detections.
"""

def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient(Configuration())
self.api_client = api_client

self._get_governance_control_endpoint = _Endpoint(
settings={
"response_type": (GovernanceControlResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/governance/control/{detection_type}",
"operation_id": "get_governance_control",
"http_method": "GET",
"version": "v2",
},
params_map={
"detection_type": {
"required": True,
"openapi_types": (str,),
"attribute": "detection_type",
"location": "path",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._list_governance_controls_endpoint = _Endpoint(
settings={
"response_type": (GovernanceControlsResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/governance/control",
"operation_id": "list_governance_controls",
"http_method": "GET",
"version": "v2",
},
params_map={},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._update_governance_control_endpoint = _Endpoint(
settings={
"response_type": (GovernanceControlResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/governance/control/{detection_type}",
"operation_id": "update_governance_control",
"http_method": "PATCH",
"version": "v2",
},
params_map={
"detection_type": {
"required": True,
"openapi_types": (str,),
"attribute": "detection_type",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (GovernanceControlUpdateRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

def get_governance_control(
self,
detection_type: str,
) -> GovernanceControlResponse:
"""Get a governance control.

Retrieve a single governance control by its detection type, including the organization's current
detection, notification, and mitigation configuration and detection counts.

:param detection_type: The detection type that identifies the control, for example ``unused_api_keys``.
:type detection_type: str
:rtype: GovernanceControlResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["detection_type"] = detection_type

return self._get_governance_control_endpoint.call_with_http_info(**kwargs)

def list_governance_controls(
self,
) -> GovernanceControlsResponse:
"""List governance controls.

Retrieve the list of governance controls configured for the organization. Each control pairs a
detection definition with the organization's current detection, notification, and mitigation
configuration, along with counts of active and mitigated detections.

:rtype: GovernanceControlsResponse
"""
kwargs: Dict[str, Any] = {}
return self._list_governance_controls_endpoint.call_with_http_info(**kwargs)

def update_governance_control(
self,
detection_type: str,
body: GovernanceControlUpdateRequest,
) -> GovernanceControlResponse:
"""Update a governance control.

Update the detection, notification, and mitigation configuration of a governance control. Only
the attributes present in the request are modified. Changing the mitigation type or its
parameters may require additional permissions.

:param detection_type: The detection type that identifies the control, for example ``unused_api_keys``.
:type detection_type: str
:type body: GovernanceControlUpdateRequest
:rtype: GovernanceControlResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["detection_type"] = detection_type

kwargs["body"] = body

return self._update_governance_control_endpoint.call_with_http_info(**kwargs)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
from datadog_api_client.v2.api.forms_api import FormsApi
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi
from datadog_api_client.v2.api.google_chat_integration_api import GoogleChatIntegrationApi
from datadog_api_client.v2.api.governance_controls_api import GovernanceControlsApi
from datadog_api_client.v2.api.governance_insights_api import GovernanceInsightsApi
from datadog_api_client.v2.api.high_availability_multi_region_api import HighAvailabilityMultiRegionApi
from datadog_api_client.v2.api.ip_allowlist_api import IPAllowlistApi
Expand Down Expand Up @@ -191,6 +192,7 @@
"FormsApi",
"GCPIntegrationApi",
"GoogleChatIntegrationApi",
"GovernanceControlsApi",
"GovernanceInsightsApi",
"HighAvailabilityMultiRegionApi",
"IPAllowlistApi",
Expand Down
Loading
Loading