Skip to content
Merged
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
19 changes: 4 additions & 15 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44735,10 +44735,6 @@ components:
description: A human-readable description of what the control detects.
example: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials."
type: string
detection_frequency:
description: How often detections are evaluated for the control.
example: "daily"
type: string
detection_parameters:
$ref: "#/components/schemas/GovernanceControlParametersMap"
nullable: true
Expand Down Expand Up @@ -44808,7 +44804,6 @@ components:
- type
- priority
- detection_parameters
- detection_frequency
- mitigation_type
- mitigation_parameters
- created_at
Expand Down Expand Up @@ -45167,17 +45162,14 @@ components:
- label
type: object
GovernanceControlSupportedValueArray:
description: The supported values for an enumerated parameter.
description: The supported values for an enumerated parameter. `null` when the parameter is not an enumerated type.
items:
$ref: "#/components/schemas/GovernanceControlSupportedValue"
nullable: true
type: array
GovernanceControlUpdateAttributes:
description: The attributes of a governance control that can be updated. Only the attributes present in the request are modified.
properties:
detection_frequency:
description: How often detections should be evaluated for the control.
example: "daily"
type: string
detection_parameters:
$ref: "#/components/schemas/GovernanceControlParametersMap"
nullable: true
Expand Down Expand Up @@ -145322,7 +145314,6 @@ paths:
created_at: "2024-01-15T09:30:00Z"
created_by: "11111111-2222-3333-4444-555555555555"
description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials."
detection_frequency: "daily"
detection_parameters:
api_key_threshold: 30
insights: []
Expand Down Expand Up @@ -145352,7 +145343,7 @@ paths:
display_name: "Unused API Key Threshold"
name: "api_key_threshold"
required: false
supported_values: []
supported_values:
type: "integer"
type: "Proactive"
id: "unused_api_keys"
Expand Down Expand Up @@ -145422,7 +145413,6 @@ paths:
created_at: "2024-01-15T09:30:00Z"
created_by: "11111111-2222-3333-4444-555555555555"
description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials."
detection_frequency: "daily"
detection_parameters:
api_key_threshold: 30
insights: []
Expand All @@ -145442,7 +145432,7 @@ paths:
display_name: "Unused API Key Threshold"
name: "api_key_threshold"
required: false
supported_values: []
supported_values:
type: "integer"
type: "Proactive"
id: "unused_api_keys"
Expand Down Expand Up @@ -145533,7 +145523,6 @@ paths:
created_at: "2024-01-15T09:30:00Z"
created_by: "11111111-2222-3333-4444-555555555555"
description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials."
detection_frequency: "daily"
detection_parameters:
api_key_threshold: 60
insights: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
body = GovernanceControlUpdateRequest(
data=GovernanceControlUpdateData(
attributes=GovernanceControlUpdateAttributes(
detection_frequency="daily",
mitigation_type="revoke_api_key",
),
type=GovernanceControlResourceType.GOVERNANCE_CONTROL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def openapi_types(_):
"created_at": (datetime,),
"created_by": (str,),
"description": (str,),
"detection_frequency": (str,),
"detection_parameters": (GovernanceControlParametersMap,),
"insights": ([str],),
"last_detection_at": (datetime, none_type),
Expand All @@ -61,7 +60,6 @@ def openapi_types(_):
"created_at": "created_at",
"created_by": "created_by",
"description": "description",
"detection_frequency": "detection_frequency",
"detection_parameters": "detection_parameters",
"insights": "insights",
"last_detection_at": "last_detection_at",
Expand All @@ -85,7 +83,6 @@ def __init__(
created_at: datetime,
created_by: str,
description: str,
detection_frequency: str,
detection_parameters: GovernanceControlParametersMap,
insights: List[str],
last_detection_at: Union[datetime, none_type],
Expand Down Expand Up @@ -120,9 +117,6 @@ def __init__(
:param description: A human-readable description of what the control detects.
:type description: str

:param detection_frequency: How often detections are evaluated for the control.
:type detection_frequency: str

:param detection_parameters: A free-form map of parameter names to their configured values.
:type detection_parameters: GovernanceControlParametersMap

Expand Down Expand Up @@ -172,7 +166,6 @@ def __init__(
self_.created_at = created_at
self_.created_by = created_by
self_.description = description
self_.detection_frequency = detection_frequency
self_.detection_parameters = detection_parameters
self_.insights = insights
self_.last_detection_at = last_detection_at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Any, List, TYPE_CHECKING
from typing import Any, List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(
display_name: str,
name: str,
required: bool,
supported_values: List[GovernanceControlSupportedValue],
supported_values: Union[List[GovernanceControlSupportedValue], none_type],
type: str,
**kwargs,
):
Expand All @@ -84,8 +84,8 @@ def __init__(
:param required: Whether the parameter must be provided.
:type required: bool

:param supported_values: The supported values for an enumerated parameter.
:type supported_values: [GovernanceControlSupportedValue]
:param supported_values: The supported values for an enumerated parameter. ``null`` when the parameter is not an enumerated type.
:type supported_values: [GovernanceControlSupportedValue], none_type

:param type: The type of the parameter, such as ``integer`` , ``string`` , ``boolean`` , ``enum`` , or ``pattern_list``.
:type type: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,19 @@ def openapi_types(_):
from datadog_api_client.v2.model.governance_control_parameters_map import GovernanceControlParametersMap

return {
"detection_frequency": (str,),
"detection_parameters": (GovernanceControlParametersMap,),
"mitigation_parameters": (GovernanceControlParametersMap,),
"mitigation_type": (str,),
}

attribute_map = {
"detection_frequency": "detection_frequency",
"detection_parameters": "detection_parameters",
"mitigation_parameters": "mitigation_parameters",
"mitigation_type": "mitigation_type",
}

def __init__(
self_,
detection_frequency: Union[str, UnsetType] = unset,
detection_parameters: Union[GovernanceControlParametersMap, UnsetType] = unset,
mitigation_parameters: Union[GovernanceControlParametersMap, UnsetType] = unset,
mitigation_type: Union[str, UnsetType] = unset,
Expand All @@ -47,9 +44,6 @@ def __init__(
"""
The attributes of a governance control that can be updated. Only the attributes present in the request are modified.

:param detection_frequency: How often detections should be evaluated for the control.
:type detection_frequency: str, optional

:param detection_parameters: A free-form map of parameter names to their configured values.
:type detection_parameters: GovernanceControlParametersMap, optional

Expand All @@ -59,8 +53,6 @@ def __init__(
:param mitigation_type: The mitigation type to configure for the control.
:type mitigation_type: str, optional
"""
if detection_frequency is not unset:
kwargs["detection_frequency"] = detection_frequency
if detection_parameters is not unset:
kwargs["detection_parameters"] = detection_parameters
if mitigation_parameters is not unset:
Expand Down
6 changes: 3 additions & 3 deletions tests/v2/features/governance_console.feature
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Feature: Governance Console
Given operation "UpdateGovernanceControl" enabled
And new "UpdateGovernanceControl" request
And request contains "detection_type" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}}
And body with value {"data": {"attributes": {"mitigation_type": "revoke_api_key"}, "type": "governance_control"}}
When the request is sent
Then the response status is 400 Bad Request

Expand All @@ -184,7 +184,7 @@ Feature: Governance Console
Given operation "UpdateGovernanceControl" enabled
And new "UpdateGovernanceControl" request
And request contains "detection_type" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}}
And body with value {"data": {"attributes": {"mitigation_type": "revoke_api_key"}, "type": "governance_control"}}
When the request is sent
Then the response status is 404 Not Found

Expand All @@ -193,7 +193,7 @@ Feature: Governance Console
Given operation "UpdateGovernanceControl" enabled
And new "UpdateGovernanceControl" request
And request contains "detection_type" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}}
And body with value {"data": {"attributes": {"mitigation_type": "revoke_api_key"}, "type": "governance_control"}}
When the request is sent
Then the response status is 200 OK

Expand Down
Loading