Skip to content

Commit 1df6299

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 59a45be of spec repo
1 parent f942ef0 commit 1df6299

24 files changed

Lines changed: 2052 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 717 additions & 0 deletions
Large diffs are not rendered by default.

docs/datadog_api_client.v2.api.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,13 @@ datadog\_api\_client.v2.api.google\_chat\_integration\_api module
403403
:members:
404404
:show-inheritance:
405405

406+
datadog\_api\_client.v2.api.governance\_controls\_api module
407+
------------------------------------------------------------
408+
409+
.. automodule:: datadog_api_client.v2.api.governance_controls_api
410+
:members:
411+
:show-inheritance:
412+
406413
datadog\_api\_client.v2.api.governance\_insights\_api module
407414
------------------------------------------------------------
408415

docs/datadog_api_client.v2.model.rst

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16930,6 +16930,90 @@ datadog\_api\_client.v2.model.governance\_best\_practice\_definition module
1693016930
:members:
1693116931
:show-inheritance:
1693216932

16933+
datadog\_api\_client.v2.model.governance\_control\_attributes module
16934+
--------------------------------------------------------------------
16935+
16936+
.. automodule:: datadog_api_client.v2.model.governance_control_attributes
16937+
:members:
16938+
:show-inheritance:
16939+
16940+
datadog\_api\_client.v2.model.governance\_control\_data module
16941+
--------------------------------------------------------------
16942+
16943+
.. automodule:: datadog_api_client.v2.model.governance_control_data
16944+
:members:
16945+
:show-inheritance:
16946+
16947+
datadog\_api\_client.v2.model.governance\_control\_mitigation\_definition module
16948+
--------------------------------------------------------------------------------
16949+
16950+
.. automodule:: datadog_api_client.v2.model.governance_control_mitigation_definition
16951+
:members:
16952+
:show-inheritance:
16953+
16954+
datadog\_api\_client.v2.model.governance\_control\_parameter\_definition module
16955+
-------------------------------------------------------------------------------
16956+
16957+
.. automodule:: datadog_api_client.v2.model.governance_control_parameter_definition
16958+
:members:
16959+
:show-inheritance:
16960+
16961+
datadog\_api\_client.v2.model.governance\_control\_parameters\_map module
16962+
-------------------------------------------------------------------------
16963+
16964+
.. automodule:: datadog_api_client.v2.model.governance_control_parameters_map
16965+
:members:
16966+
:show-inheritance:
16967+
16968+
datadog\_api\_client.v2.model.governance\_control\_resource\_type module
16969+
------------------------------------------------------------------------
16970+
16971+
.. automodule:: datadog_api_client.v2.model.governance_control_resource_type
16972+
:members:
16973+
:show-inheritance:
16974+
16975+
datadog\_api\_client.v2.model.governance\_control\_response module
16976+
------------------------------------------------------------------
16977+
16978+
.. automodule:: datadog_api_client.v2.model.governance_control_response
16979+
:members:
16980+
:show-inheritance:
16981+
16982+
datadog\_api\_client.v2.model.governance\_control\_supported\_value module
16983+
--------------------------------------------------------------------------
16984+
16985+
.. automodule:: datadog_api_client.v2.model.governance_control_supported_value
16986+
:members:
16987+
:show-inheritance:
16988+
16989+
datadog\_api\_client.v2.model.governance\_control\_update\_attributes module
16990+
----------------------------------------------------------------------------
16991+
16992+
.. automodule:: datadog_api_client.v2.model.governance_control_update_attributes
16993+
:members:
16994+
:show-inheritance:
16995+
16996+
datadog\_api\_client.v2.model.governance\_control\_update\_data module
16997+
----------------------------------------------------------------------
16998+
16999+
.. automodule:: datadog_api_client.v2.model.governance_control_update_data
17000+
:members:
17001+
:show-inheritance:
17002+
17003+
datadog\_api\_client.v2.model.governance\_control\_update\_request module
17004+
-------------------------------------------------------------------------
17005+
17006+
.. automodule:: datadog_api_client.v2.model.governance_control_update_request
17007+
:members:
17008+
:show-inheritance:
17009+
17010+
datadog\_api\_client.v2.model.governance\_controls\_response module
17011+
-------------------------------------------------------------------
17012+
17013+
.. automodule:: datadog_api_client.v2.model.governance_controls_response
17014+
:members:
17015+
:show-inheritance:
17016+
1693317017
datadog\_api\_client.v2.model.governance\_insight\_attributes module
1693417018
--------------------------------------------------------------------
1693517019

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
Get a governance control returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.governance_controls_api import GovernanceControlsApi
7+
8+
configuration = Configuration()
9+
configuration.unstable_operations["get_governance_control"] = True
10+
with ApiClient(configuration) as api_client:
11+
api_instance = GovernanceControlsApi(api_client)
12+
response = api_instance.get_governance_control(
13+
detection_type="detection_type",
14+
)
15+
16+
print(response)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
List governance controls returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.governance_controls_api import GovernanceControlsApi
7+
8+
configuration = Configuration()
9+
configuration.unstable_operations["list_governance_controls"] = True
10+
with ApiClient(configuration) as api_client:
11+
api_instance = GovernanceControlsApi(api_client)
12+
response = api_instance.list_governance_controls()
13+
14+
print(response)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Update a governance control returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.governance_controls_api import GovernanceControlsApi
7+
from datadog_api_client.v2.model.governance_control_resource_type import GovernanceControlResourceType
8+
from datadog_api_client.v2.model.governance_control_update_attributes import GovernanceControlUpdateAttributes
9+
from datadog_api_client.v2.model.governance_control_update_data import GovernanceControlUpdateData
10+
from datadog_api_client.v2.model.governance_control_update_request import GovernanceControlUpdateRequest
11+
12+
body = GovernanceControlUpdateRequest(
13+
data=GovernanceControlUpdateData(
14+
attributes=GovernanceControlUpdateAttributes(
15+
detection_frequency="daily",
16+
mitigation_type="revoke_api_key",
17+
name="Unused API Keys",
18+
notification_frequency="daily",
19+
notification_type="slack",
20+
),
21+
id="0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
22+
type=GovernanceControlResourceType.GOVERNANCE_CONTROL,
23+
),
24+
)
25+
26+
configuration = Configuration()
27+
configuration.unstable_operations["update_governance_control"] = True
28+
with ApiClient(configuration) as api_client:
29+
api_instance = GovernanceControlsApi(api_client)
30+
response = api_instance.update_governance_control(detection_type="detection_type", body=body)
31+
32+
print(response)

src/datadog_api_client/configuration.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,9 @@ def __init__(
544544
"v2.upsert_and_publish_form_version": False,
545545
"v2.upsert_form_version": False,
546546
"v2.update_org_saml_configurations": False,
547+
"v2.get_governance_control": False,
548+
"v2.list_governance_controls": False,
549+
"v2.update_governance_control": False,
547550
"v2.list_governance_insights": False,
548551
"v2.create_hamr_org_connection": False,
549552
"v2.get_hamr_org_connection": False,
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import Any, Dict
7+
8+
from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
9+
from datadog_api_client.configuration import Configuration
10+
from datadog_api_client.v2.model.governance_controls_response import GovernanceControlsResponse
11+
from datadog_api_client.v2.model.governance_control_response import GovernanceControlResponse
12+
from datadog_api_client.v2.model.governance_control_update_request import GovernanceControlUpdateRequest
13+
14+
15+
class GovernanceControlsApi:
16+
"""
17+
Governance Controls pair a detection definition with an organization's detection, notification,
18+
and mitigation configuration within the Governance Console. Each control reports how a class of
19+
governance issue (such as unused API keys or unqueried metrics) is detected and remediated, along
20+
with counts of active and mitigated detections.
21+
"""
22+
23+
def __init__(self, api_client=None):
24+
if api_client is None:
25+
api_client = ApiClient(Configuration())
26+
self.api_client = api_client
27+
28+
self._get_governance_control_endpoint = _Endpoint(
29+
settings={
30+
"response_type": (GovernanceControlResponse,),
31+
"auth": ["apiKeyAuth", "appKeyAuth"],
32+
"endpoint_path": "/api/v2/governance/control/{detection_type}",
33+
"operation_id": "get_governance_control",
34+
"http_method": "GET",
35+
"version": "v2",
36+
},
37+
params_map={
38+
"detection_type": {
39+
"required": True,
40+
"openapi_types": (str,),
41+
"attribute": "detection_type",
42+
"location": "path",
43+
},
44+
},
45+
headers_map={
46+
"accept": ["application/json"],
47+
},
48+
api_client=api_client,
49+
)
50+
51+
self._list_governance_controls_endpoint = _Endpoint(
52+
settings={
53+
"response_type": (GovernanceControlsResponse,),
54+
"auth": ["apiKeyAuth", "appKeyAuth"],
55+
"endpoint_path": "/api/v2/governance/control",
56+
"operation_id": "list_governance_controls",
57+
"http_method": "GET",
58+
"version": "v2",
59+
},
60+
params_map={},
61+
headers_map={
62+
"accept": ["application/json"],
63+
},
64+
api_client=api_client,
65+
)
66+
67+
self._update_governance_control_endpoint = _Endpoint(
68+
settings={
69+
"response_type": (GovernanceControlResponse,),
70+
"auth": ["apiKeyAuth", "appKeyAuth"],
71+
"endpoint_path": "/api/v2/governance/control/{detection_type}",
72+
"operation_id": "update_governance_control",
73+
"http_method": "PATCH",
74+
"version": "v2",
75+
},
76+
params_map={
77+
"detection_type": {
78+
"required": True,
79+
"openapi_types": (str,),
80+
"attribute": "detection_type",
81+
"location": "path",
82+
},
83+
"body": {
84+
"required": True,
85+
"openapi_types": (GovernanceControlUpdateRequest,),
86+
"location": "body",
87+
},
88+
},
89+
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
90+
api_client=api_client,
91+
)
92+
93+
def get_governance_control(
94+
self,
95+
detection_type: str,
96+
) -> GovernanceControlResponse:
97+
"""Get a governance control.
98+
99+
Retrieve a single governance control by its detection type, including the organization's current
100+
detection, notification, and mitigation configuration and detection counts.
101+
102+
:param detection_type: The detection type that identifies the control, for example ``unused_api_keys``.
103+
:type detection_type: str
104+
:rtype: GovernanceControlResponse
105+
"""
106+
kwargs: Dict[str, Any] = {}
107+
kwargs["detection_type"] = detection_type
108+
109+
return self._get_governance_control_endpoint.call_with_http_info(**kwargs)
110+
111+
def list_governance_controls(
112+
self,
113+
) -> GovernanceControlsResponse:
114+
"""List governance controls.
115+
116+
Retrieve the list of governance controls configured for the organization. Each control pairs a
117+
detection definition with the organization's current detection, notification, and mitigation
118+
configuration, along with counts of active and mitigated detections.
119+
120+
:rtype: GovernanceControlsResponse
121+
"""
122+
kwargs: Dict[str, Any] = {}
123+
return self._list_governance_controls_endpoint.call_with_http_info(**kwargs)
124+
125+
def update_governance_control(
126+
self,
127+
detection_type: str,
128+
body: GovernanceControlUpdateRequest,
129+
) -> GovernanceControlResponse:
130+
"""Update a governance control.
131+
132+
Update the detection, notification, and mitigation configuration of a governance control. Only
133+
the attributes present in the request are modified. Changing the mitigation type or its
134+
parameters may require additional permissions.
135+
136+
:param detection_type: The detection type that identifies the control, for example ``unused_api_keys``.
137+
:type detection_type: str
138+
:type body: GovernanceControlUpdateRequest
139+
:rtype: GovernanceControlResponse
140+
"""
141+
kwargs: Dict[str, Any] = {}
142+
kwargs["detection_type"] = detection_type
143+
144+
kwargs["body"] = body
145+
146+
return self._update_governance_control_endpoint.call_with_http_info(**kwargs)

src/datadog_api_client/v2/apis/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from datadog_api_client.v2.api.forms_api import FormsApi
5656
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi
5757
from datadog_api_client.v2.api.google_chat_integration_api import GoogleChatIntegrationApi
58+
from datadog_api_client.v2.api.governance_controls_api import GovernanceControlsApi
5859
from datadog_api_client.v2.api.governance_insights_api import GovernanceInsightsApi
5960
from datadog_api_client.v2.api.high_availability_multi_region_api import HighAvailabilityMultiRegionApi
6061
from datadog_api_client.v2.api.ip_allowlist_api import IPAllowlistApi
@@ -191,6 +192,7 @@
191192
"FormsApi",
192193
"GCPIntegrationApi",
193194
"GoogleChatIntegrationApi",
195+
"GovernanceControlsApi",
194196
"GovernanceInsightsApi",
195197
"HighAvailabilityMultiRegionApi",
196198
"IPAllowlistApi",

0 commit comments

Comments
 (0)