From 21ab61b017e21fe9b47677af34ac7ff4ab303d29 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 4 Aug 2026 14:00:24 +0000 Subject: [PATCH] Regenerate client from commit ba2d03b of spec repo --- .generator/schemas/v2/openapi.yaml | 2334 +++++++++++++---- docs/datadog_api_client.v2.api.rst | 13 +- docs/datadog_api_client.v2.model.rst | 321 ++- .../governance-console/GetGovernanceConfig.py | 14 + .../GetGovernanceControl.py | 6 +- ...etGovernanceControlNotificationSettings.py | 16 + .../GetGovernanceDetection.py | 16 + .../GetGovernanceNotificationSettings.py | 14 + .../ListGovernanceControlDetections.py | 16 + .../ListGovernanceControls.py | 6 +- .../ListGovernanceInsights.py | 6 +- .../ListGovernanceLimits.py | 14 + .../ListGovernanceResourceLimits.py | 14 + .../MitigateGovernanceDetections.py | 31 + .../UpdateGovernanceControl.py | 10 +- ...teGovernanceControlNotificationSettings.py | 47 + .../UpdateGovernanceDetection.py | 39 + .../UpdateGovernanceNotificationSettings.py | 35 + src/datadog_api_client/configuration.py | 13 +- .../v2/api/governance_console_api.py | 698 +++++ .../v2/api/governance_controls_api.py | 146 -- .../v2/api/governance_insights_api.py | 98 - src/datadog_api_client/v2/apis/__init__.py | 6 +- .../control_notification_event_setting.py | 52 + ...ontrol_notification_settings_attributes.py | 40 + .../control_notification_settings_data.py | 68 + ...rol_notification_settings_resource_type.py | 37 + .../control_notification_settings_response.py | 40 + ...notification_settings_update_attributes.py | 42 + ...ntrol_notification_settings_update_data.py | 64 + ...ol_notification_settings_update_request.py | 44 + .../v2/model/control_notification_target.py | 46 + .../model/control_notification_target_type.py | 44 + .../governance_best_practice_definition.py | 131 - .../v2/model/governance_config_attributes.py | 59 + .../v2/model/governance_config_data.py | 60 + .../v2/model/governance_config_response.py | 40 + ...governance_console_config_resource_type.py | 37 + .../v2/model/governance_control_attributes.py | 70 - .../v2/model/governance_control_data.py | 2 +- ...nce_control_detection_assignment_source.py | 44 + ...governance_control_detection_attributes.py | 180 ++ .../governance_control_detection_data.py | 66 + ...ernance_control_detection_resource_type.py | 37 + .../governance_control_detection_response.py | 40 + .../governance_control_detection_state.py | 53 + ...nce_control_detection_update_attributes.py | 75 + ...overnance_control_detection_update_data.py | 64 + ...rnance_control_detection_update_request.py | 44 + ...vernance_control_detection_update_state.py | 38 + .../governance_control_detections_response.py | 40 + ...overnance_control_mitigation_definition.py | 39 +- ...governance_control_parameter_definition.py | 7 - .../governance_control_update_attributes.py | 32 - .../model/governance_control_update_data.py | 8 - .../v2/model/governance_insight_attributes.py | 90 +- .../v2/model/governance_insight_data.py | 4 +- .../governance_insight_directionality.py | 41 + .../model/governance_insight_query_config.py | 23 +- .../v2/model/governance_limit_attributes.py | 109 + .../v2/model/governance_limit_data.py | 54 + .../v2/model/governance_limit_query.py | 45 + .../v2/model/governance_limit_query_config.py | 72 + .../model/governance_limit_resource_type.py | 35 + .../v2/model/governance_limits_response.py | 40 + .../v2/model/governance_mitigation_request.py | 40 + ...overnance_mitigation_request_attributes.py | 70 + .../governance_mitigation_request_data.py | 64 + ...rnance_notification_settings_attributes.py | 33 + .../governance_notification_settings_data.py | 68 + ...nce_notification_settings_resource_type.py | 37 + ...vernance_notification_settings_response.py | 40 + ...notification_settings_update_attributes.py | 36 + ...nance_notification_settings_update_data.py | 64 + ...ce_notification_settings_update_request.py | 44 + .../governance_resource_limit_attributes.py | 130 + .../model/governance_resource_limit_data.py | 62 + ...governance_resource_limit_resource_type.py | 35 + .../governance_resource_limits_response.py | 40 + src/datadog_api_client/v2/models/__init__.py | 118 +- tests/v2/features/governance_console.feature | 287 ++ tests/v2/features/governance_controls.feature | 77 - tests/v2/features/governance_insights.feature | 24 - tests/v2/features/undo.json | 74 +- 84 files changed, 6193 insertions(+), 1219 deletions(-) create mode 100644 examples/v2/governance-console/GetGovernanceConfig.py rename examples/v2/{governance-controls => governance-console}/GetGovernanceControl.py (64%) create mode 100644 examples/v2/governance-console/GetGovernanceControlNotificationSettings.py create mode 100644 examples/v2/governance-console/GetGovernanceDetection.py create mode 100644 examples/v2/governance-console/GetGovernanceNotificationSettings.py create mode 100644 examples/v2/governance-console/ListGovernanceControlDetections.py rename examples/v2/{governance-controls => governance-console}/ListGovernanceControls.py (61%) rename examples/v2/{governance-insights => governance-console}/ListGovernanceInsights.py (61%) create mode 100644 examples/v2/governance-console/ListGovernanceLimits.py create mode 100644 examples/v2/governance-console/ListGovernanceResourceLimits.py create mode 100644 examples/v2/governance-console/MitigateGovernanceDetections.py rename examples/v2/{governance-controls => governance-console}/UpdateGovernanceControl.py (74%) create mode 100644 examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.py create mode 100644 examples/v2/governance-console/UpdateGovernanceDetection.py create mode 100644 examples/v2/governance-console/UpdateGovernanceNotificationSettings.py create mode 100644 src/datadog_api_client/v2/api/governance_console_api.py delete mode 100644 src/datadog_api_client/v2/api/governance_controls_api.py delete mode 100644 src/datadog_api_client/v2/api/governance_insights_api.py create mode 100644 src/datadog_api_client/v2/model/control_notification_event_setting.py create mode 100644 src/datadog_api_client/v2/model/control_notification_settings_attributes.py create mode 100644 src/datadog_api_client/v2/model/control_notification_settings_data.py create mode 100644 src/datadog_api_client/v2/model/control_notification_settings_resource_type.py create mode 100644 src/datadog_api_client/v2/model/control_notification_settings_response.py create mode 100644 src/datadog_api_client/v2/model/control_notification_settings_update_attributes.py create mode 100644 src/datadog_api_client/v2/model/control_notification_settings_update_data.py create mode 100644 src/datadog_api_client/v2/model/control_notification_settings_update_request.py create mode 100644 src/datadog_api_client/v2/model/control_notification_target.py create mode 100644 src/datadog_api_client/v2/model/control_notification_target_type.py delete mode 100644 src/datadog_api_client/v2/model/governance_best_practice_definition.py create mode 100644 src/datadog_api_client/v2/model/governance_config_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_config_data.py create mode 100644 src/datadog_api_client/v2/model/governance_config_response.py create mode 100644 src/datadog_api_client/v2/model/governance_console_config_resource_type.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_assignment_source.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_data.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_resource_type.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_response.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_state.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_update_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_update_data.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_update_request.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detection_update_state.py create mode 100644 src/datadog_api_client/v2/model/governance_control_detections_response.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_directionality.py create mode 100644 src/datadog_api_client/v2/model/governance_limit_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_limit_data.py create mode 100644 src/datadog_api_client/v2/model/governance_limit_query.py create mode 100644 src/datadog_api_client/v2/model/governance_limit_query_config.py create mode 100644 src/datadog_api_client/v2/model/governance_limit_resource_type.py create mode 100644 src/datadog_api_client/v2/model/governance_limits_response.py create mode 100644 src/datadog_api_client/v2/model/governance_mitigation_request.py create mode 100644 src/datadog_api_client/v2/model/governance_mitigation_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_mitigation_request_data.py create mode 100644 src/datadog_api_client/v2/model/governance_notification_settings_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_notification_settings_data.py create mode 100644 src/datadog_api_client/v2/model/governance_notification_settings_resource_type.py create mode 100644 src/datadog_api_client/v2/model/governance_notification_settings_response.py create mode 100644 src/datadog_api_client/v2/model/governance_notification_settings_update_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_notification_settings_update_data.py create mode 100644 src/datadog_api_client/v2/model/governance_notification_settings_update_request.py create mode 100644 src/datadog_api_client/v2/model/governance_resource_limit_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_resource_limit_data.py create mode 100644 src/datadog_api_client/v2/model/governance_resource_limit_resource_type.py create mode 100644 src/datadog_api_client/v2/model/governance_resource_limits_response.py create mode 100644 tests/v2/features/governance_console.feature delete mode 100644 tests/v2/features/governance_controls.feature delete mode 100644 tests/v2/features/governance_insights.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d8f50ea930..e6fe89fd12 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21956,6 +21956,125 @@ components: - IDENTITY - GZIP - DEFLATE + ControlNotificationEventSetting: + description: The notification settings for a single event type on a control. + properties: + enabled: + description: Whether notifications are enabled for this event type. + example: true + type: boolean + event_type: + description: The event type the notification settings apply to, such as `new_detection`. + example: "new_detection" + type: string + targets: + $ref: "#/components/schemas/ControlNotificationTargetArray" + required: + - event_type + - enabled + - targets + type: object + ControlNotificationEventSettingsArray: + description: The notification settings for each supported event type on the control. + items: + $ref: "#/components/schemas/ControlNotificationEventSetting" + type: array + ControlNotificationSettingsAttributes: + description: The attributes of a governance control's notification settings. + properties: + event_settings: + $ref: "#/components/schemas/ControlNotificationEventSettingsArray" + required: + - event_settings + type: object + ControlNotificationSettingsData: + description: A control notification settings resource. + properties: + attributes: + $ref: "#/components/schemas/ControlNotificationSettingsAttributes" + id: + description: The detection type the notification settings apply to. + example: "unused_api_keys" + type: string + type: + $ref: "#/components/schemas/ControlNotificationSettingsResourceType" + required: + - id + - type + - attributes + type: object + ControlNotificationSettingsResourceType: + description: Control notification settings resource type. + enum: + - control_notification_settings + example: "control_notification_settings" + type: string + x-enum-varnames: + - CONTROL_NOTIFICATION_SETTINGS + ControlNotificationSettingsResponse: + description: The notification settings for a governance control. + properties: + data: + $ref: "#/components/schemas/ControlNotificationSettingsData" + required: + - data + type: object + ControlNotificationSettingsUpdateAttributes: + description: The attributes of a governance control's notification settings that can be updated. + properties: + event_settings: + $ref: "#/components/schemas/ControlNotificationEventSettingsArray" + type: object + ControlNotificationSettingsUpdateData: + description: The data of a control notification settings update request. + properties: + attributes: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateAttributes" + type: + $ref: "#/components/schemas/ControlNotificationSettingsResourceType" + required: + - type + type: object + ControlNotificationSettingsUpdateRequest: + description: A request to update the notification settings for a governance control. + properties: + data: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateData" + required: + - data + type: object + ControlNotificationTarget: + description: A destination that receives notifications for an event type. + properties: + handle: + description: The destination handle, such as an email address, Slack channel, or user handle. + example: "#governance-alerts" + type: string + type: + $ref: "#/components/schemas/ControlNotificationTargetType" + required: + - type + - handle + type: object + ControlNotificationTargetArray: + description: The destinations that receive notifications for an event type. + items: + $ref: "#/components/schemas/ControlNotificationTarget" + type: array + ControlNotificationTargetType: + description: The type of notification destination. + enum: + - email + - slack + - at_mention + - case + example: "slack" + type: string + x-enum-varnames: + - EMAIL + - SLACK + - AT_MENTION + - CASE ConvertJobResultsToSignalsAttributes: description: Attributes for converting historical job results to signals. properties: @@ -44130,91 +44249,68 @@ components: - id - type type: object - GovernanceBestPracticeDefinition: - description: |- - The best practice associated with an insight. Populated with the first active best practice - matched to the insight; `null` when no best practice is attached. + GovernanceConfigAttributes: + description: The attributes of a Governance Console configuration. properties: - category: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + enabled: + description: Whether the Governance Console is enabled for the organization. + example: true + type: boolean + usage_attribution_configured: + description: Whether usage attribution is configured for the organization. + example: true + type: boolean + xorg_insights_enabled: description: |- - The value driver the best practice is grouped under, such as `access_governance`, - `security`, `compliance`, or `operational_hygiene`. - example: "access_governance" - type: string - deep_link: - description: A relative link to the configuration page where the best practice can be acted upon. - example: "/organization-settings/users?status=inactive" - type: string - description: - description: The full rationale and guidance for the best practice. - example: "Review and deactivate users who have not logged in within the last 90 days." - type: string - detection_type: - description: An optional association to a control's detection type. `null` when not associated with a control. - example: - nullable: true - type: string + Whether the organization has opted in to sharing governance data with a managing org + for cross-org insights. + example: true + type: boolean + required: + - enabled + - assignment_notifications_enabled + - usage_attribution_configured + - xorg_insights_enabled + type: object + GovernanceConfigData: + description: A Governance Console configuration resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceConfigAttributes" id: - description: The unique identifier of the best practice. - example: "bp_monitor_inactive_users" - type: string - impact: - description: The expected impact of following the best practice. - example: "Reduces unauthorized access risk." - type: string - impact_hint: - description: |- - A priority hint for ordering best practices by expected impact. Lower values indicate - higher priority. - example: 1 - format: int64 - type: integer - permissions: - description: The permissions required for the user to act on the best practice. - example: - - "user_access_manage" - items: - description: A permission required to act on the best practice. - type: string - type: array - status: - description: Whether the best practice is currently `active` or `deprecated`. - example: "active" - type: string - summary: - description: A one-line explanation of why this best practice matters. - example: "Inactive users with access increase your security surface area." - type: string - title: - description: A short, human-readable name for the best practice. - example: "Monitor inactive users" - type: string - trigger_condition: description: |- - The condition that surfaces the best practice. For an `insight` trigger, the insight - slug; for a `static` trigger, a descriptive condition key. - example: "active_users" - type: string - trigger_type: - description: |- - How the best practice is surfaced. `insight` ties it to an insight; `static` surfaces it - unless its condition is met. - example: "insight" + The unique identifier of the organization the Governance Console configuration applies + to. May be the nil UUID (`00000000-0000-0000-0000-000000000000`) when the configuration + is not tied to a specific organization record. + example: "00000000-0000-0000-0000-000000000000" type: string + type: + $ref: "#/components/schemas/GovernanceConsoleConfigResourceType" required: - id - - title - - summary - - description - - category - - impact - - trigger_type - - trigger_condition - - deep_link - - permissions - - impact_hint - - status + - type + - attributes + type: object + GovernanceConfigResponse: + description: The Governance Console configuration for an organization. + properties: + data: + $ref: "#/components/schemas/GovernanceConfigData" + required: + - data type: object + GovernanceConsoleConfigResourceType: + description: Governance console config resource type. + enum: + - governance_console_config + example: "governance_console_config" + type: string + x-enum-varnames: + - GOVERNANCE_CONSOLE_CONFIG GovernanceControlAttributes: description: The attributes of a governance control. properties: @@ -44247,17 +44343,6 @@ components: detection_parameters: $ref: "#/components/schemas/GovernanceControlParametersMap" nullable: true - detection_type: - description: The detection type that uniquely identifies the control. - example: "unused_api_keys" - type: string - feature_flags: - description: The feature flags that gate the control. - example: [] - items: - description: A feature flag that gates the control. - type: string - type: array insights: description: The insight slugs associated with the control. example: [] @@ -44289,21 +44374,6 @@ components: description: Human-readable name of the control. example: "Unused API Keys" type: string - next_steps: - description: Guidance on the next steps to remediate detections for the control. - example: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - type: string - notification_frequency: - description: The configured notification frequency for the control. Empty when not configured. - example: "" - type: string - notification_parameters: - $ref: "#/components/schemas/GovernanceControlParametersMap" - nullable: true - notification_type: - description: The configured notification type for the control. Empty when not configured. - example: "" - type: string priority: description: The priority of the control, such as `High`. example: "High" @@ -44312,10 +44382,6 @@ components: description: The product the control belongs to. example: "api_keys" type: string - release_status: - description: The release status of the control, such as `prod` or `beta`. - example: "prod" - type: string resource_type: description: The type of resource the control evaluates. example: "api_key" @@ -44326,44 +44392,24 @@ components: type: string supported_detection_parameters: $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" - supported_notification_parameters: - $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" - task: - description: A short description of the remediation task for the control. - example: "Review and revoke unused API keys." - type: string type: description: The control type, such as `Proactive` or `Detection`. example: "Proactive" type: string - usage_concern: - description: The usage concern the control addresses, such as `Security` or `Cost Optimization`. - example: "Security" - type: string required: - name - description - - detection_type - supported_detection_parameters - - supported_notification_parameters - resource_type - resource_type_display_name - product - category - insights - mitigations - - task - - next_steps - - release_status - - feature_flags - type - priority - - usage_concern - detection_parameters - detection_frequency - - notification_type - - notification_parameters - - notification_frequency - mitigation_type - mitigation_parameters - created_at @@ -44378,8 +44424,8 @@ components: attributes: $ref: "#/components/schemas/GovernanceControlAttributes" id: - description: The unique identifier of the control. - example: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + description: The detection type that uniquely identifies the control. + example: "unused_api_keys" type: string type: $ref: "#/components/schemas/GovernanceControlResourceType" @@ -44388,13 +44434,217 @@ components: - type - attributes type: object + GovernanceControlDetectionAssignmentSource: + description: How the detection's current assignment was determined. Possible values are `auto_resolved`, `manual`, `reassigned`, and `cleared`. + enum: + - auto_resolved + - manual + - reassigned + - cleared + example: "manual" + type: string + x-enum-varnames: + - AUTO_RESOLVED + - MANUAL + - REASSIGNED + - CLEARED + GovernanceControlDetectionAttributes: + description: The attributes of a governance control detection. + properties: + assigned_team: + description: The identifier of the team the detection is assigned to, if any. + example: "platform-security" + type: string + assigned_to: + description: The identifier of the user the detection is assigned to, if any. + example: "11111111-2222-3333-4444-555555555555" + type: string + assignment_source: + $ref: "#/components/schemas/GovernanceControlDetectionAssignmentSource" + control_id: + deprecated: true + description: |- + DEPRECATED: mirrors `detection_type` for backward compatibility; use `detection_type` + instead. + example: "unused_api_keys" + type: string + created_at: + description: The date and time when the detection was created. + example: "2024-03-01T12:00:00Z" + format: date-time + type: string + detection_type: + description: The type of detection, which determines what condition was detected. + example: "unused_api_keys" + type: string + display_name: + description: The human-readable name of the detected resource. + example: "CI Deploy Key" + type: string + exception_at: + description: The date and time when the detection was marked as an exception, if applicable. + example: "2024-03-05T09:00:00Z" + format: date-time + type: string + exception_by: + description: The identifier of the user who marked the detection as an exception, if applicable. + example: "11111111-2222-3333-4444-555555555555" + type: string + metadata: + description: Free-form metadata associated with the detection. + example: + region: "us-east-1" + mitigate_after: + description: The date and time after which the detection is scheduled to be mitigated, if applicable. + example: "2024-03-15T00:00:00Z" + format: date-time + type: string + mitigated_at: + description: The date and time when the detection was mitigated, if applicable. + example: "2024-03-10T15:30:00Z" + format: date-time + type: string + priority: + description: The priority of the detection, if set. + example: 1 + format: int64 + type: integer + resource_id: + description: The identifier of the resource the detection applies to. + example: "api-key-12345" + type: string + resource_type: + description: The type of resource the detection applies to, for example `api_key` or `dashboard`. + example: "api_key" + type: string + state: + $ref: "#/components/schemas/GovernanceControlDetectionState" + required: + - state + - control_id + - resource_id + - detection_type + - resource_type + - display_name + - created_at + - assignment_source + - priority + type: object + GovernanceControlDetectionData: + description: A governance control detection resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceControlDetectionAttributes" + id: + description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: string + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - id + - type + - attributes + type: object + GovernanceControlDetectionResourceType: + description: Governance control detection resource type. + enum: + - governance_control_detection + example: "governance_control_detection" + type: string + x-enum-varnames: + - GOVERNANCE_CONTROL_DETECTION + GovernanceControlDetectionResponse: + description: A single governance control detection. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionData" + required: + - data + type: object + GovernanceControlDetectionState: + description: The current state of the detection. Possible values are `active`, `exception`, `mitigated`, `inactive`, `obsolete`, `resolved_externally`, and `mitigation_in_progress`. + enum: + - active + - exception + - mitigated + - inactive + - obsolete + - resolved_externally + - mitigation_in_progress + example: "active" + type: string + x-enum-varnames: + - ACTIVE + - EXCEPTION + - MITIGATED + - INACTIVE + - OBSOLETE + - RESOLVED_EXTERNALLY + - MITIGATION_IN_PROGRESS + GovernanceControlDetectionUpdateAttributes: + description: The attributes of a governance control detection that can be updated. Only the attributes present in the request are modified. + properties: + assigned_team: + description: The handle of the team the detection is assigned to. Set to an empty string to clear the assignment. + example: "platform-security" + type: string + assigned_to: + description: The UUID of the user the detection is assigned to. Set to an empty string to clear the assignment. + example: "11111111-2222-3333-4444-555555555555" + type: string + mitigate_after: + description: The timestamp after which the detection becomes eligible for mitigation. Used to defer mitigation to a later time. + example: "2024-03-15T00:00:00Z" + format: date-time + type: string + state: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateState" + type: object + GovernanceControlDetectionUpdateData: + description: The data of a governance control detection update request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateAttributes" + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - type + type: object + GovernanceControlDetectionUpdateRequest: + description: A request to update a governance control detection. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateData" + required: + - data + type: object + GovernanceControlDetectionUpdateState: + description: The new state to set for the detection. Set to `exception` to acknowledge the detection and exclude it from active counts, or `active` to reopen it. + enum: + - exception + - active + example: "exception" + type: string + x-enum-varnames: + - EXCEPTION + - ACTIVE + GovernanceControlDetectionsDataArray: + description: An array of governance control detection resources. + items: + $ref: "#/components/schemas/GovernanceControlDetectionData" + type: array + GovernanceControlDetectionsResponse: + description: A list of governance control detections. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionsDataArray" + required: + - data + type: object GovernanceControlMitigationDefinition: description: The definition of a mitigation available for a control. properties: - action_verb: - description: The verb describing the mitigation action, such as `revoke` or `delete`. - example: "revoke" - type: string description: description: A human-readable description of the mitigation. example: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." @@ -44408,21 +44658,10 @@ components: description: An execution mode the mitigation supports. type: string type: array - feature_flags: - description: The feature flags that gate the mitigation. - example: [] - items: - description: A feature flag that gates the mitigation. - type: string - type: array id: description: The unique identifier of the mitigation. example: "revoke_api_key" type: string - manual_mitigation_warning: - description: A warning shown to the user before applying the mitigation manually. - example: "These API keys will be revoked immediately upon confirmation. To revoke future API keys, you must go through this flow again." - type: string permissions: description: The permissions required to apply the mitigation. example: @@ -44432,10 +44671,6 @@ components: description: A permission required to apply the mitigation. type: string type: array - requires_ai: - description: Whether the mitigation requires AI to be enabled. - example: false - type: boolean supported_parameters: $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" title: @@ -44446,12 +44681,9 @@ components: - id - title - description - - action_verb - supported_parameters - permissions - - manual_mitigation_warning - - feature_flags - - requires_ai + - execution_modes type: object GovernanceControlMitigationDefinitionArray: description: The mitigations available for a control. @@ -44472,10 +44704,6 @@ components: description: The human-readable name of the parameter. example: "Unused API Key Threshold" type: string - hidden: - description: Whether the parameter is hidden from the UI. - example: false - type: boolean name: description: The machine-readable name of the parameter. example: "api_key_threshold" @@ -44496,7 +44724,6 @@ components: - description - type - required - - hidden - supported_values - default_value type: object @@ -44562,31 +44789,12 @@ components: description: The mitigation type to configure for the control. example: "revoke_api_key" type: string - name: - description: A new human-readable name for the control. - example: "Unused API Keys" - type: string - notification_frequency: - description: The notification frequency to configure for the control. - example: "daily" - type: string - notification_parameters: - $ref: "#/components/schemas/GovernanceControlParametersMap" - nullable: true - notification_type: - description: The notification type to configure for the control. - example: "slack" - type: string type: object GovernanceControlUpdateData: description: The data of a governance control update request. properties: attributes: $ref: "#/components/schemas/GovernanceControlUpdateAttributes" - id: - description: The unique identifier of the control. - example: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: string type: $ref: "#/components/schemas/GovernanceControlResourceType" required: @@ -44614,18 +44822,14 @@ components: - data type: object GovernanceInsightAttributes: - description: The attributes of a governance insight. + description: |- + The attributes of a governance insight. Exactly one of `metric_query`, `event_query`, + `usage_query`, `audit_query`, or `percentage_query` is populated, depending on the data + source the insight is computed from; the rest are `null`. properties: audit_query: $ref: "#/components/schemas/GovernanceInsightAuditQuery" nullable: true - best_practice: - $ref: "#/components/schemas/GovernanceBestPracticeDefinition" - nullable: true - deep_link: - description: A relative link to the product surface where the insight can be acted upon. - example: "" - type: string description: description: A human-readable description of what the insight measures. example: "Number of users who have used the Dashboard in the last 30 days" @@ -44640,14 +44844,6 @@ components: metric_query: $ref: "#/components/schemas/GovernanceInsightMetricQuery" nullable: true - old_value: - description: |- - The value of the insight over the previous comparison window. `null` when values were - not requested or could not be computed. - example: 3274 - format: double - nullable: true - type: number percentage_query: $ref: "#/components/schemas/GovernanceInsightPercentageQuery" nullable: true @@ -44658,17 +44854,6 @@ components: query_config: $ref: "#/components/schemas/GovernanceInsightQueryConfig" nullable: true - sort_order: - description: The relative order in which the insight should be displayed. - example: 1 - format: int64 - type: integer - state: - description: |- - The state of the insight. A `critical` insight receives extra UI treatment to draw - attention to it. - example: "critical" - type: string sub_product: description: The sub-product the insight belongs to, if any. example: "Indexes" @@ -44684,29 +44869,13 @@ components: usage_query: $ref: "#/components/schemas/GovernanceInsightUsageQuery" nullable: true - value: - description: The current value of the insight. `null` when values were not requested or could not be computed. - example: 3601 - format: double - nullable: true - type: number required: - display_name - product - - best_practice - sub_product - unit_name - description - time_range - - state - - deep_link - - value - - old_value - - metric_query - - event_query - - usage_query - - audit_query - - percentage_query type: object GovernanceInsightAuditCompute: description: The aggregation applied to an audit log query. @@ -44776,6 +44945,18 @@ components: - type - attributes type: object + GovernanceInsightDirectionality: + description: Whether an increase in the insight's value is good, bad, or neutral. + enum: + - neutral + - increase_better + - decrease_better + example: "neutral" + type: string + x-enum-varnames: + - NEUTRAL + - INCREASE_BETTER + - DECREASE_BETTER GovernanceInsightEventCompute: description: The aggregation applied to an event query. properties: @@ -44846,14 +45027,14 @@ components: - denominator_query type: object GovernanceInsightQueryConfig: - description: Query execution context that allows the frontend to execute insight queries directly. + description: Query execution context for running insight queries directly. properties: chart_type: - description: The chart type the frontend should use to render the insight. + description: The chart type used to render the insight. example: "line" type: string comparison_shift: - description: The window used for the previous value comparison, for example `week` or `month`. + description: The window used for the previous value comparison; for example, `week` or `month`. example: "month" type: string default_value: @@ -44862,11 +45043,7 @@ components: format: int64 type: integer directionality: - description: |- - Whether an increase in the value is good, bad, or neutral. One of `neutral`, - `increase_better`, or `decrease_better`. - example: "neutral" - type: string + $ref: "#/components/schemas/GovernanceInsightDirectionality" effective_time_window_days: description: The number of days the insight value is computed over. example: 30 @@ -44912,6 +45089,355 @@ components: required: - data type: object + GovernanceLimitAttributes: + description: The attributes of a usage limit. + properties: + description: + description: A description of what the limit measures. + example: "The number of log events indexed in the last 30 days." + type: string + display_name: + description: The human-readable name of the limit. + example: "Indexed Logs" + type: string + limit_type: + description: The type of limit, such as a rate limit or a usage limit. + example: "usage" + type: string + product: + description: The Datadog product the limit belongs to. + example: "logs" + type: string + query: + $ref: "#/components/schemas/GovernanceLimitQuery" + query_config: + $ref: "#/components/schemas/GovernanceLimitQueryConfig" + time_range: + description: The time range over which usage against the limit is measured. + example: "month" + type: string + times_hit_limit: + description: The number of times usage has reached the limit within the measured time range. + example: 2 + format: double + type: number + unit_name: + description: The unit in which the limit and its usage are measured. + example: "events" + type: string + usage_status: + description: The current usage status of the limit relative to its threshold. + example: "approaching" + type: string + required: + - display_name + - description + - product + - limit_type + - unit_name + - time_range + - query + - times_hit_limit + - usage_status + - query_config + type: object + GovernanceLimitData: + description: A usage limit resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceLimitAttributes" + id: + description: The unique identifier of the limit. + example: "logs_indexed_events" + type: string + type: + $ref: "#/components/schemas/GovernanceLimitResourceType" + required: + - id + - type + - attributes + type: object + GovernanceLimitQuery: + description: A metric query used to compute usage against a limit. + properties: + query: + description: The metric query expression used to compute the limit value. + example: "sum:datadog.estimated_usage.logs.ingested_events{*}" + type: string + reducer: + description: How the query results are aggregated into a single value (for example, sum, max, or avg). + example: "sum" + type: string + source: + description: The data source used to evaluate the metric query, such as metrics or events. + example: "metrics" + type: string + required: + - source + - query + - reducer + type: object + GovernanceLimitQueryConfig: + description: The query execution context used to visualize a limit and its usage. + properties: + chart_type: + description: The chart type used to visualize the limit and its usage. + example: "line" + type: string + comparison_shift: + description: The time shift applied to compare current usage against a prior period. + example: "month" + type: string + default_value: + description: The default value used for the limit when no explicit value is configured. + example: 0 + format: int64 + type: integer + directionality: + description: The direction in which usage approaches the limit, indicating whether higher or lower values are closer to the limit. + example: "increase_better" + type: string + effective_time_window_days: + description: The number of days of data the limit query evaluates over. + example: 30 + format: int64 + type: integer + type: object + GovernanceLimitResourceType: + description: Limit resource type. + enum: + - limit + example: "limit" + type: string + x-enum-varnames: + - LIMIT + GovernanceLimitsDataArray: + description: An array of usage limit resources. + items: + $ref: "#/components/schemas/GovernanceLimitData" + type: array + GovernanceLimitsResponse: + description: A list of usage limits. + properties: + data: + $ref: "#/components/schemas/GovernanceLimitsDataArray" + required: + - data + type: object + GovernanceMitigationRequest: + description: A request to mitigate a set of governance detections. + properties: + data: + $ref: "#/components/schemas/GovernanceMitigationRequestData" + required: + - data + type: object + GovernanceMitigationRequestAttributes: + description: The attributes of a governance mitigation request. + properties: + detection_ids: + description: The identifiers of the detections to mitigate in this request. + example: + - "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + items: + description: The identifier of a detection to mitigate in this request. + type: string + type: array + detection_type: + description: The detection type whose detections should be mitigated. + example: "unused_api_keys" + type: string + mitigation_parameters: + $ref: "#/components/schemas/GovernanceControlParametersMap" + nullable: true + mitigation_type: + description: The mitigation to apply to the selected detections. Defaults to the control's configured mitigation when omitted. + example: "revoke_api_key" + type: string + type: object + GovernanceMitigationRequestData: + description: The data of a governance mitigation request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceMitigationRequestAttributes" + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - type + type: object + GovernanceNotificationSettingsAttributes: + description: The attributes of the organization-wide governance notification settings. + properties: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + required: + - assignment_notifications_enabled + type: object + GovernanceNotificationSettingsData: + description: A governance notification settings resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceNotificationSettingsAttributes" + id: + description: The unique identifier of the organization the notification settings apply to. + example: "11111111-2222-3333-4444-555555555555" + type: string + type: + $ref: "#/components/schemas/GovernanceNotificationSettingsResourceType" + required: + - id + - type + - attributes + type: object + GovernanceNotificationSettingsResourceType: + description: Governance notification settings resource type. + enum: + - governance_notification_settings + example: "governance_notification_settings" + type: string + x-enum-varnames: + - GOVERNANCE_NOTIFICATION_SETTINGS + GovernanceNotificationSettingsResponse: + description: The organization-wide governance notification settings. + properties: + data: + $ref: "#/components/schemas/GovernanceNotificationSettingsData" + required: + - data + type: object + GovernanceNotificationSettingsUpdateAttributes: + description: The attributes of the governance notification settings that can be updated. Only the attributes present in the request are modified. + properties: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + type: object + GovernanceNotificationSettingsUpdateData: + description: The data of a governance notification settings update request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateAttributes" + type: + $ref: "#/components/schemas/GovernanceNotificationSettingsResourceType" + required: + - type + type: object + GovernanceNotificationSettingsUpdateRequest: + description: A request to update the organization-wide governance notification settings. + properties: + data: + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateData" + required: + - data + type: object + GovernanceResourceLimitAttributes: + description: The attributes of a governance resource limit. + properties: + current_limit: + description: The current limit configured for the resource. + example: 10000 + format: double + type: number + current_value: + description: The current value of the resource. + example: 8200 + format: double + type: number + default_current_value: + description: The default current value used when the resource value cannot be computed from the query. + example: 0 + format: double + type: number + default_limit_value: + description: The default limit value used when the limit cannot be computed from the query. + example: 0 + format: double + type: number + description: + description: A description of what the resource limit measures. + example: "The number of custom metrics in use against your contracted limit." + type: string + display_name: + description: The human-readable name of the resource limit. + example: "Custom Metrics" + type: string + limit_query: + $ref: "#/components/schemas/GovernanceLimitQuery" + product: + description: The Datadog product the resource limit belongs to. + example: "metrics" + type: string + query: + $ref: "#/components/schemas/GovernanceLimitQuery" + query_config: + $ref: "#/components/schemas/GovernanceLimitQueryConfig" + time_range: + description: The time range over which the resource value is measured. + example: "month" + type: string + unit_name: + description: The unit in which the resource value and limit are measured. + example: "metrics" + type: string + usage_status: + description: The current usage status of the resource relative to its limit. + example: "approaching" + type: string + required: + - display_name + - description + - product + - unit_name + - time_range + - current_value + - current_limit + - default_current_value + - default_limit_value + - query + - limit_query + - query_config + - usage_status + type: object + GovernanceResourceLimitData: + description: A governance resource limit resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceResourceLimitAttributes" + id: + description: The unique identifier of the resource limit. + example: "custom_metrics" + type: string + type: + $ref: "#/components/schemas/GovernanceResourceLimitResourceType" + required: + - id + - type + - attributes + type: object + GovernanceResourceLimitResourceType: + description: Resource limit resource type. + enum: + - resource-limit + example: "resource-limit" + type: string + x-enum-varnames: + - RESOURCE_LIMIT + GovernanceResourceLimitsDataArray: + description: An array of governance resource limit resources. + items: + $ref: "#/components/schemas/GovernanceResourceLimitData" + type: array + GovernanceResourceLimitsResponse: + description: A list of governance resource limits. + properties: + data: + $ref: "#/components/schemas/GovernanceResourceLimitsDataArray" + required: + - data + type: object GreyNoiseAPIKey: description: The definition of the `GreyNoiseAPIKey` object. properties: @@ -144178,6 +144704,61 @@ paths: operator: OR permissions: - user_access_read + /api/v2/governance/config: + get: + description: |- + Retrieve the Governance Console configuration for the organization, including whether the + Console is enabled, whether assignment notifications are enabled, and whether usage + attribution is configured. + operationId: GetGovernanceConfig + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assignment_notifications_enabled: true + enabled: true + usage_attribution_configured: true + xorg_insights_enabled: true + id: "00000000-0000-0000-0000-000000000000" + type: "governance_console_config" + schema: + $ref: "#/components/schemas/GovernanceConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get the Governance Console configuration + tags: + - Governance Console + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/governance/control: get: description: |- @@ -144202,60 +144783,37 @@ paths: detection_frequency: "daily" detection_parameters: api_key_threshold: 30 - detection_type: "unused_api_keys" - feature_flags: [] insights: [] last_detection_at: "2024-03-01T12:00:00Z" mitigated_detections_count: 3 mitigation_parameters: {} mitigation_type: "" mitigations: - - action_verb: "revoke" - description: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." + - description: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." execution_modes: - "manual" - "automatic" - feature_flags: [] id: "revoke_api_key" - manual_mitigation_warning: "These API keys will be revoked immediately upon confirmation. To revoke future API keys, you must go through this flow again." permissions: - "api_keys_write" - "api_keys_delete" - requires_ai: false supported_parameters: [] title: "Revoke Unused API Keys" name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" priority: "High" product: "api_keys" - release_status: "prod" resource_type: "api_key" resource_type_display_name: "API Key" supported_detection_parameters: - default_value: 30 description: "Number of days of inactivity before an API key is considered unused." display_name: "Unused API Key Threshold" - hidden: false name: "api_key_threshold" required: false supported_values: [] type: "integer" - supported_notification_parameters: - - default_value: false - description: "Enables the Governance Console to automatically assign ownership of detections based off of tagging and other internal heuristics." - display_name: "Automatic Ownership Assignment" - hidden: false - name: "governance_auto_assignment" - required: false - supported_values: [] - type: "boolean" - task: "Review and revoke unused API keys." type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + id: "unused_api_keys" type: "governance_control" schema: $ref: "#/components/schemas/GovernanceControlsResponse" @@ -144280,26 +144838,858 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: List governance controls + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List controls + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/control/{detection_type}: + get: + description: |- + Retrieve a single governance control by its detection type, including the organization's current + detection, notification, and mitigation configuration and detection counts. + operationId: GetGovernanceControl + parameters: + - description: The detection type that identifies the control, for example `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active_detections_count: 12 + category: "security" + 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: [] + last_detection_at: "2024-03-01T12:00:00Z" + mitigated_detections_count: 3 + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + mitigations: [] + name: "Unused API Keys" + priority: "High" + product: "api_keys" + resource_type: "api_key" + resource_type_display_name: "API Key" + supported_detection_parameters: + - default_value: 30 + description: "Number of days of inactivity before an API key is considered unused." + display_name: "Unused API Key Threshold" + name: "api_key_threshold" + required: false + supported_values: [] + type: "integer" + type: "Proactive" + id: "unused_api_keys" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a control + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: |- + 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. + operationId: UpdateGovernanceControl + parameters: + - description: The detection type that identifies the control, for example `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + detection_parameters: + api_key_threshold: 60 + mitigation_type: "revoke_api_key" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active_detections_count: 12 + category: "security" + 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: [] + last_detection_at: "2024-03-01T12:00:00Z" + mitigated_detections_count: 3 + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + mitigations: [] + name: "Unused API Keys" + priority: "High" + product: "api_keys" + resource_type: "api_key" + resource_type_display_name: "API Key" + supported_detection_parameters: [] + type: "Proactive" + id: "unused_api_keys" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update a control + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/control/{detection_type}/detections: + get: + description: |- + Retrieve the detections produced by the governance control with the given detection type. + Results can be filtered by state and free-text query, sorted, and paginated. + operationId: ListGovernanceControlDetections + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + - description: Restrict the results to detections in the given state. + example: "active" + in: query + name: filter[state] + required: false + schema: + type: string + - description: Restrict the results to detections matching the given free-text query. + example: "production" + in: query + name: filter[query] + required: false + schema: + type: string + - description: |- + A comma-separated list of attributes to sort detections by. Prefix an attribute with + `-` for descending order. + + The attributes available for sorting are `id`, `created_at`, `assigned_to`, + `detection_type`, `display_name`, `exception_at`, `mitigate_after`, `mitigated_at`, + `priority`, `resource_id`, and `state`. Defaults to `created_at,-id`. + example: "-created_at,-id" + in: query + name: sort + required: false + schema: + type: string + - description: "The zero-based index of the page to return; the first page is 0." + example: 0 + in: query + name: page[number] + required: false + schema: + default: 0 + format: int64 + type: integer + - description: The number of detections to return per page. + example: 50 + in: query + name: page[size] + required: false + schema: + format: int64 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List control detections + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/control/{detection_type}/notification_settings: + get: + description: |- + Retrieve the notification settings for the governance control with the given detection type, + including, for each supported event type, whether notifications are enabled and which + destinations receive them. + operationId: GetGovernanceControlNotificationSettings + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + id: "unused_api_keys" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get control notification settings + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + put: + description: |- + Replace the notification settings for the governance control with the given detection type, + setting, for each supported event type, whether notifications are enabled and which + destinations receive them. + operationId: UpdateGovernanceControlNotificationSettings + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + id: "unused_api_keys" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update control notification settings + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/detections/mitigate: + post: + description: |- + Apply a mitigation to a set of governance detections of a given detection type. When the + mitigation type is omitted, the control's configured mitigation is used. The request is + accepted for asynchronous processing. + operationId: MitigateGovernanceDetections + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + detection_ids: + - "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + detection_type: "unused_api_keys" + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceMitigationRequest" + required: true + responses: + "202": + description: Accepted + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Mitigate detections + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/detections/{detection_id}: + get: + description: Retrieve a single governance detection by its unique identifier. + operationId: GetGovernanceDetection + parameters: + - description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + in: path + name: detection_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a detection + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: |- + Update a governance detection by its unique identifier. Only the attributes present in the + request are modified, allowing a detection to be acknowledged as an exception, reopened, + reassigned, or deferred for mitigation. + operationId: UpdateGovernanceDetection + parameters: + - description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + in: path + name: detection_id + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_to: "11111111-2222-3333-4444-555555555555" + state: "exception" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update a detection + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/insights: + get: + description: |- + Retrieve the list of governance insights available to the organization. Each insight + reports the query used to compute it, so that the value can be computed client-side. + Insights can be filtered by product. + operationId: ListGovernanceInsights + parameters: + - description: |- + Restrict the results to insights belonging to the given products. May be repeated to + filter by multiple products. Matching is case-insensitive. + example: + - "Usage" + - "Logs Settings" + in: query + name: filter[product] + required: false + schema: + items: + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + audit_query: + description: "Number of custom metrics submitted by the organization." + display_name: "Custom Metrics" + event_query: + metric_query: + query: "sum:datadog.estimated_usage.metrics.custom{*}" + reducer: "sum" + source: "metrics" + percentage_query: + product: "Usage" + query_config: + chart_type: "line" + comparison_shift: "month" + directionality: "decrease_better" + effective_time_window_days: 30 + sub_product: "" + time_range: "month" + unit_name: "custom metrics" + usage_query: + id: "498ee21f-8037-48b8-a961-a488692902f4" + type: "insight" + - attributes: + audit_query: + compute: + aggregation: "cardinality" + interval: 86400000 + metric: "@usr.id" + indexes: + - "main" + query: "@evt.name:Dashboard" + source: "audit" + description: "Number of users who have used the Dashboard in the last 30 days" + display_name: "Active Users" + event_query: + metric_query: + percentage_query: + product: "Usage" + query_config: + chart_type: "line" + comparison_shift: "month" + directionality: "neutral" + effective_time_window_days: 30 + sub_product: "" + time_range: "month" + unit_name: "active users" + usage_query: + id: "a3248d1b-5578-4345-a34e-fe9657300f22" + type: "insight" + schema: + $ref: "#/components/schemas/GovernanceInsightsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - events_read + - metrics_read + summary: List insights tags: - - Governance Controls + - Governance Console + "x-permission": + operator: OR + permissions: + - metrics_read + - events_read + - audit_logs_read + - governance_console_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/governance/control/{detection_type}: + /api/v2/governance/limits: get: description: |- - Retrieve a single governance control by its detection type, including the organization's current - detection, notification, and mitigation configuration and detection counts. - operationId: GetGovernanceControl - parameters: - - description: The detection type that identifies the control, for example `unused_api_keys`. - example: "unused_api_keys" - in: path - name: detection_type - required: true - schema: - type: string + Retrieve the list of usage limits tracked for the organization in the Governance Console. + Each limit reports the query used to compute current usage, the unit and time range it is + measured over, and its current usage status. + operationId: ListGovernanceLimits responses: "200": content: @@ -144308,50 +145698,29 @@ paths: default: value: data: - attributes: - active_detections_count: 12 - category: "security" - 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 - detection_type: "unused_api_keys" - feature_flags: [] - insights: [] - last_detection_at: "2024-03-01T12:00:00Z" - mitigated_detections_count: 3 - mitigation_parameters: {} - mitigation_type: "revoke_api_key" - mitigations: [] - name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" - priority: "High" - product: "api_keys" - release_status: "prod" - resource_type: "api_key" - resource_type_display_name: "API Key" - supported_detection_parameters: - - default_value: 30 - description: "Number of days of inactivity before an API key is considered unused." - display_name: "Unused API Key Threshold" - hidden: false - name: "api_key_threshold" - required: false - supported_values: [] - type: "integer" - supported_notification_parameters: [] - task: "Review and revoke unused API keys." - type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: "governance_control" + - attributes: + description: "The number of log events indexed in the last 30 days." + display_name: "Indexed Logs" + limit_type: "usage" + product: "logs" + query: + query: "sum:datadog.estimated_usage.logs.ingested_events{*}" + reducer: "sum" + source: "metrics" + query_config: + chart_type: "line" + comparison_shift: "month" + default_value: 0 + directionality: "increase_better" + effective_time_window_days: 30 + time_range: "month" + times_hit_limit: 2 + unit_name: "events" + usage_status: "approaching" + id: "logs_indexed_events" + type: "limit" schema: - $ref: "#/components/schemas/GovernanceControlResponse" + $ref: "#/components/schemas/GovernanceLimitsResponse" description: OK "400": content: @@ -144371,34 +145740,82 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden - "404": + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List usage limits + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/notification_settings: + get: + description: |- + Retrieve the organization-wide governance notification settings, including whether users are + notified when detections are assigned to them. + operationId: GetGovernanceNotificationSettings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assignment_notifications_enabled: true + id: "11111111-2222-3333-4444-555555555555" + type: "governance_notification_settings" + schema: + $ref: "#/components/schemas/GovernanceNotificationSettingsResponse" + description: OK + "400": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: Get a governance control + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get notification settings tags: - - Governance Controls + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: description: |- - 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. - operationId: UpdateGovernanceControl - parameters: - - description: The detection type that identifies the control, for example `unused_api_keys`. - example: "unused_api_keys" - in: path - name: detection_type - required: true - schema: - type: string + Update the organization-wide governance notification settings. Only the attributes present in + the request are modified. + operationId: UpdateGovernanceNotificationSettings requestBody: content: application/json: @@ -144407,12 +145824,10 @@ paths: value: data: attributes: - detection_parameters: - api_key_threshold: 60 - mitigation_type: "revoke_api_key" - type: "governance_control" + assignment_notifications_enabled: true + type: "governance_notification_settings" schema: - $ref: "#/components/schemas/GovernanceControlUpdateRequest" + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateRequest" required: true responses: "200": @@ -144423,41 +145838,11 @@ paths: value: data: attributes: - active_detections_count: 12 - category: "security" - 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 - detection_type: "unused_api_keys" - feature_flags: [] - insights: [] - last_detection_at: "2024-03-01T12:00:00Z" - mitigated_detections_count: 3 - mitigation_parameters: {} - mitigation_type: "revoke_api_key" - mitigations: [] - name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" - priority: "High" - product: "api_keys" - release_status: "prod" - resource_type: "api_key" - resource_type_display_name: "API Key" - supported_detection_parameters: [] - supported_notification_parameters: [] - task: "Review and revoke unused API keys." - type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: "governance_control" + assignment_notifications_enabled: true + id: "11111111-2222-3333-4444-555555555555" + type: "governance_notification_settings" schema: - $ref: "#/components/schemas/GovernanceControlResponse" + $ref: "#/components/schemas/GovernanceNotificationSettingsResponse" description: OK "400": content: @@ -144477,60 +145862,30 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: Update a governance control + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update notification settings tags: - - Governance Controls + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_write x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/governance/insights: + /api/v2/governance/resource_limits: get: description: |- - Retrieve the list of governance insights available to the organization. By default, only - insight metadata is returned; pass `withValues=true` to also compute and include each - insight's current and previous values. Insights can be filtered by product. - operationId: ListGovernanceInsights - parameters: - - description: |- - Whether to compute and include the current and previous value of each insight. - Defaults to `false`, in which case only insight metadata is returned. - example: true - in: query - name: withValues - required: false - schema: - type: boolean - - description: |- - The UUID of the organization to compute insights for. Defaults to the organization of - the authenticated user. Used to retrieve insights for a child organization from a - parent organization. - example: "11111111-2222-3333-4444-555555555555" - in: query - name: orgUuid - required: false - schema: - type: string - - description: |- - Restrict the results to insights belonging to the given products. May be repeated to - filter by multiple products. Matching is case-insensitive. - example: - - "Usage" - - "Logs Settings" - in: query - name: filter[product] - required: false - schema: - items: - type: string - type: array + Retrieve the list of resource limits tracked for the organization in the Governance Console. + Each resource limit reports its current value and configured limit, the queries used to + compute them, and its current usage status. + operationId: ListGovernanceResourceLimits responses: "200": content: @@ -144540,59 +145895,34 @@ paths: value: data: - attributes: - audit_query: - best_practice: - deep_link: "" - description: "" - display_name: "Active Dashboards" - event_query: - metric_query: - old_value: 3274 - percentage_query: - product: "Usage" - state: "" - sub_product: "" - time_range: "" - unit_name: "active dashboards" - usage_query: - value: 3601 - id: "498ee21f-8037-48b8-a961-a488692902f4" - type: "insight" - - attributes: - audit_query: - best_practice: - category: "access_governance" - deep_link: "/organization-settings/users?status=inactive" - description: "Review and deactivate users who have not logged in within the last 90 days." - detection_type: - id: "bp_monitor_inactive_users" - impact: "Reduces unauthorized access risk." - impact_hint: 1 - permissions: - - "user_access_manage" - status: "active" - summary: "Inactive users with access increase your security surface area." - title: "Monitor inactive users" - trigger_condition: "active_users" - trigger_type: "insight" - deep_link: "" - description: "Number of users who have used the Dashboard in the last 30 days" - display_name: "Active Users" - event_query: - metric_query: - old_value: 1173 - percentage_query: - product: "Usage" - state: "" - sub_product: "" + current_limit: 10000 + current_value: 8200 + default_current_value: 0 + default_limit_value: 0 + description: "The number of custom metrics in use against your contracted limit." + display_name: "Custom Metrics" + limit_query: + query: "sum:datadog.contract.metrics.custom{*}" + reducer: "max" + source: "metrics" + product: "metrics" + query: + query: "sum:datadog.estimated_usage.metrics.custom{*}" + reducer: "sum" + source: "metrics" + query_config: + chart_type: "line" + comparison_shift: "month" + default_value: 0 + directionality: "decrease_better" + effective_time_window_days: 30 time_range: "month" - unit_name: "active users" - usage_query: - value: 1291 - id: "a3248d1b-5578-4345-a34e-fe9657300f22" - type: "insight" + unit_name: "metrics" + usage_status: "approaching" + id: "custom_metrics" + type: "resource-limit" schema: - $ref: "#/components/schemas/GovernanceInsightsResponse" + $ref: "#/components/schemas/GovernanceResourceLimitsResponse" description: OK "400": content: @@ -144614,9 +145944,17 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: List governance insights + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List resource limits tags: - - Governance Insights + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). @@ -204276,9 +205614,17 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: List tag policies tags: - Tag Policies + "x-permission": + operator: OR + permissions: + - telemetry_rules_read + - metrics_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). @@ -204367,9 +205713,16 @@ paths: description: Conflict "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Create a tag policy tags: - Tag Policies + "x-permission": + operator: AND + permissions: + - telemetry_rules_create x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). @@ -204424,9 +205777,16 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Delete a tag policy tags: - Tag Policies + "x-permission": + operator: AND + permissions: + - telemetry_rules_create x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). @@ -204536,9 +205896,17 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Get a tag policy tags: - Tag Policies + "x-permission": + operator: OR + permissions: + - telemetry_rules_read + - metrics_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). @@ -204627,9 +205995,16 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Update a tag policy tags: - Tag Policies + "x-permission": + operator: AND + permissions: + - telemetry_rules_create x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). @@ -204709,9 +206084,17 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Get a tag policy compliance score tags: - Tag Policies + "x-permission": + operator: OR + permissions: + - telemetry_rules_read + - metrics_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). @@ -210810,17 +212193,20 @@ tags: url: https://docs.datadoghq.com/integrations/google-hangouts-chat/ name: Google Chat Integration - description: |- - 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. - name: Governance Controls - - description: |- - Governance Insights surface key usage, configuration, and best-practice signals for an - organization within the Governance Console. Each insight reports a current value (and, - optionally, a previous value for comparison) along with the query used to compute it, so - that the Console can render trends and highlight areas that need attention. - name: Governance Insights + The Governance Console finds issues that build up across a Datadog organization over time, + such as API keys nobody uses, users who no longer need access, or custom metrics that are + never queried, and tracks them through to a fix. + + These endpoints allow you to: + + - Read insights: measures of how your organization uses Datadog, each with the query behind it. + - Configure controls: the rules deciding how one kind of issue is found and what is done about it. + - Act on detections: the issues a control found. Assign, defer, accept as an exception, or fix. + - Manage settings: organization-wide configuration, usage and resource limits, and notifications. + + See the [Governance Console page](https://docs.datadoghq.com/account_management/governance_console/) + for more information. + name: Governance Console - description: |- Configure High Availability Multi-Region (HAMR) connections between Datadog organizations. HAMR provides disaster recovery capabilities by maintaining synchronized data between primary diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index c36b5b3450..c74f2573bf 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -410,17 +410,10 @@ 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 ------------------------------------------------------------- +datadog\_api\_client.v2.api.governance\_console\_api module +----------------------------------------------------------- -.. automodule:: datadog_api_client.v2.api.governance_insights_api +.. automodule:: datadog_api_client.v2.api.governance_console_api :members: :show-inheritance: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 465a9e2c9c..e59261e807 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -8236,6 +8236,76 @@ datadog\_api\_client.v2.model.content\_encoding module :members: :show-inheritance: +datadog\_api\_client.v2.model.control\_notification\_event\_setting module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.control_notification_event_setting + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_settings\_attributes module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.control_notification_settings_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_settings\_data module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.control_notification_settings_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_settings\_resource\_type module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.control_notification_settings_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_settings\_response module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.control_notification_settings_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_settings\_update\_attributes module +---------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.control_notification_settings_update_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_settings\_update\_data module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.control_notification_settings_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_settings\_update\_request module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.control_notification_settings_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_target module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.control_notification_target + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.control\_notification\_target\_type module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.control_notification_target_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.convert\_job\_results\_to\_signals\_attributes module ----------------------------------------------------------------------------------- @@ -17784,10 +17854,31 @@ datadog\_api\_client.v2.model.google\_meet\_configuration\_reference\_data modul :members: :show-inheritance: -datadog\_api\_client.v2.model.governance\_best\_practice\_definition module ---------------------------------------------------------------------------- +datadog\_api\_client.v2.model.governance\_config\_attributes module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_config_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_config\_data module +------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.governance_best_practice_definition +.. automodule:: datadog_api_client.v2.model.governance_config_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_config\_response module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_config_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_console\_config\_resource\_type module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_console_config_resource_type :members: :show-inheritance: @@ -17805,6 +17896,83 @@ datadog\_api\_client.v2.model.governance\_control\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.governance\_control\_detection\_assignment\_source module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_assignment_source + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_attributes module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_data module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_resource\_type module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_response module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_state module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_state + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_update\_attributes module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_update_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_update\_data module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_update\_request module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detection\_update\_state module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_control_detection_update_state + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_control\_detections\_response module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.governance_control_detections_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.governance\_control\_mitigation\_definition module -------------------------------------------------------------------------------- @@ -17903,6 +18071,13 @@ datadog\_api\_client.v2.model.governance\_insight\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.governance\_insight\_directionality module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.governance_insight_directionality + :members: + :show-inheritance: + datadog\_api\_client.v2.model.governance\_insight\_event\_compute module ------------------------------------------------------------------------ @@ -17959,6 +18134,146 @@ datadog\_api\_client.v2.model.governance\_insights\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.governance\_limit\_attributes module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.governance_limit_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_limit\_data module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.governance_limit_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_limit\_query module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_limit_query + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_limit\_query\_config module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_limit_query_config + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_limit\_resource\_type module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_limit_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_limits\_response module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_limits_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_mitigation\_request module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_mitigation_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_mitigation\_request\_attributes module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_mitigation_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_mitigation\_request\_data module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_mitigation_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_notification\_settings\_attributes module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_notification_settings_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_notification\_settings\_data module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_notification_settings_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_notification\_settings\_resource\_type module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_notification_settings_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_notification\_settings\_response module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_notification_settings_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_notification\_settings\_update\_attributes module +------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_notification_settings_update_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_notification\_settings\_update\_data module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_notification_settings_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_notification\_settings\_update\_request module +---------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_notification_settings_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_resource\_limit\_attributes module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_resource_limit_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_resource\_limit\_data module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_resource_limit_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_resource\_limit\_resource\_type module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_resource_limit_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_resource\_limits\_response module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_resource_limits_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.grey\_noise\_api\_key module ---------------------------------------------------------- diff --git a/examples/v2/governance-console/GetGovernanceConfig.py b/examples/v2/governance-console/GetGovernanceConfig.py new file mode 100644 index 0000000000..a09691d51b --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceConfig.py @@ -0,0 +1,14 @@ +""" +Get the Governance Console configuration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi + +configuration = Configuration() +configuration.unstable_operations["get_governance_config"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.get_governance_config() + + print(response) diff --git a/examples/v2/governance-controls/GetGovernanceControl.py b/examples/v2/governance-console/GetGovernanceControl.py similarity index 64% rename from examples/v2/governance-controls/GetGovernanceControl.py rename to examples/v2/governance-console/GetGovernanceControl.py index c958545e3e..559857afed 100644 --- a/examples/v2/governance-controls/GetGovernanceControl.py +++ b/examples/v2/governance-console/GetGovernanceControl.py @@ -1,14 +1,14 @@ """ -Get a governance control returns "OK" response +Get a 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.api.governance_console_api import GovernanceConsoleApi configuration = Configuration() configuration.unstable_operations["get_governance_control"] = True with ApiClient(configuration) as api_client: - api_instance = GovernanceControlsApi(api_client) + api_instance = GovernanceConsoleApi(api_client) response = api_instance.get_governance_control( detection_type="detection_type", ) diff --git a/examples/v2/governance-console/GetGovernanceControlNotificationSettings.py b/examples/v2/governance-console/GetGovernanceControlNotificationSettings.py new file mode 100644 index 0000000000..5b27e00e11 --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceControlNotificationSettings.py @@ -0,0 +1,16 @@ +""" +Get control notification settings returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi + +configuration = Configuration() +configuration.unstable_operations["get_governance_control_notification_settings"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.get_governance_control_notification_settings( + detection_type="detection_type", + ) + + print(response) diff --git a/examples/v2/governance-console/GetGovernanceDetection.py b/examples/v2/governance-console/GetGovernanceDetection.py new file mode 100644 index 0000000000..d42a6c0d5a --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceDetection.py @@ -0,0 +1,16 @@ +""" +Get a detection returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi + +configuration = Configuration() +configuration.unstable_operations["get_governance_detection"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.get_governance_detection( + detection_id="detection_id", + ) + + print(response) diff --git a/examples/v2/governance-console/GetGovernanceNotificationSettings.py b/examples/v2/governance-console/GetGovernanceNotificationSettings.py new file mode 100644 index 0000000000..dcc81b7b06 --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceNotificationSettings.py @@ -0,0 +1,14 @@ +""" +Get notification settings returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi + +configuration = Configuration() +configuration.unstable_operations["get_governance_notification_settings"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.get_governance_notification_settings() + + print(response) diff --git a/examples/v2/governance-console/ListGovernanceControlDetections.py b/examples/v2/governance-console/ListGovernanceControlDetections.py new file mode 100644 index 0000000000..1dd867e2a7 --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceControlDetections.py @@ -0,0 +1,16 @@ +""" +List control detections returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi + +configuration = Configuration() +configuration.unstable_operations["list_governance_control_detections"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.list_governance_control_detections( + detection_type="detection_type", + ) + + print(response) diff --git a/examples/v2/governance-controls/ListGovernanceControls.py b/examples/v2/governance-console/ListGovernanceControls.py similarity index 61% rename from examples/v2/governance-controls/ListGovernanceControls.py rename to examples/v2/governance-console/ListGovernanceControls.py index 32f54398f4..2ed0e86580 100644 --- a/examples/v2/governance-controls/ListGovernanceControls.py +++ b/examples/v2/governance-console/ListGovernanceControls.py @@ -1,14 +1,14 @@ """ -List governance controls returns "OK" response +List controls 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.api.governance_console_api import GovernanceConsoleApi configuration = Configuration() configuration.unstable_operations["list_governance_controls"] = True with ApiClient(configuration) as api_client: - api_instance = GovernanceControlsApi(api_client) + api_instance = GovernanceConsoleApi(api_client) response = api_instance.list_governance_controls() print(response) diff --git a/examples/v2/governance-insights/ListGovernanceInsights.py b/examples/v2/governance-console/ListGovernanceInsights.py similarity index 61% rename from examples/v2/governance-insights/ListGovernanceInsights.py rename to examples/v2/governance-console/ListGovernanceInsights.py index e59895372a..327e478766 100644 --- a/examples/v2/governance-insights/ListGovernanceInsights.py +++ b/examples/v2/governance-console/ListGovernanceInsights.py @@ -1,14 +1,14 @@ """ -List governance insights returns "OK" response +List insights returns "OK" response """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.governance_insights_api import GovernanceInsightsApi +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi configuration = Configuration() configuration.unstable_operations["list_governance_insights"] = True with ApiClient(configuration) as api_client: - api_instance = GovernanceInsightsApi(api_client) + api_instance = GovernanceConsoleApi(api_client) response = api_instance.list_governance_insights() print(response) diff --git a/examples/v2/governance-console/ListGovernanceLimits.py b/examples/v2/governance-console/ListGovernanceLimits.py new file mode 100644 index 0000000000..c13ab5ce70 --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceLimits.py @@ -0,0 +1,14 @@ +""" +List usage limits returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi + +configuration = Configuration() +configuration.unstable_operations["list_governance_limits"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.list_governance_limits() + + print(response) diff --git a/examples/v2/governance-console/ListGovernanceResourceLimits.py b/examples/v2/governance-console/ListGovernanceResourceLimits.py new file mode 100644 index 0000000000..25c9cb3626 --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceResourceLimits.py @@ -0,0 +1,14 @@ +""" +List resource limits returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi + +configuration = Configuration() +configuration.unstable_operations["list_governance_resource_limits"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.list_governance_resource_limits() + + print(response) diff --git a/examples/v2/governance-console/MitigateGovernanceDetections.py b/examples/v2/governance-console/MitigateGovernanceDetections.py new file mode 100644 index 0000000000..a55978697b --- /dev/null +++ b/examples/v2/governance-console/MitigateGovernanceDetections.py @@ -0,0 +1,31 @@ +""" +Mitigate detections returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi +from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, +) +from datadog_api_client.v2.model.governance_mitigation_request import GovernanceMitigationRequest +from datadog_api_client.v2.model.governance_mitigation_request_attributes import GovernanceMitigationRequestAttributes +from datadog_api_client.v2.model.governance_mitigation_request_data import GovernanceMitigationRequestData + +body = GovernanceMitigationRequest( + data=GovernanceMitigationRequestData( + attributes=GovernanceMitigationRequestAttributes( + detection_ids=[ + "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d", + ], + detection_type="unused_api_keys", + mitigation_type="revoke_api_key", + ), + type=GovernanceControlDetectionResourceType.GOVERNANCE_CONTROL_DETECTION, + ), +) + +configuration = Configuration() +configuration.unstable_operations["mitigate_governance_detections"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + api_instance.mitigate_governance_detections(body=body) diff --git a/examples/v2/governance-controls/UpdateGovernanceControl.py b/examples/v2/governance-console/UpdateGovernanceControl.py similarity index 74% rename from examples/v2/governance-controls/UpdateGovernanceControl.py rename to examples/v2/governance-console/UpdateGovernanceControl.py index 3567269f7a..9a578c446d 100644 --- a/examples/v2/governance-controls/UpdateGovernanceControl.py +++ b/examples/v2/governance-console/UpdateGovernanceControl.py @@ -1,9 +1,9 @@ """ -Update a governance control returns "OK" response +Update a 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.api.governance_console_api import GovernanceConsoleApi 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 @@ -14,11 +14,7 @@ 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, ), ) @@ -26,7 +22,7 @@ configuration = Configuration() configuration.unstable_operations["update_governance_control"] = True with ApiClient(configuration) as api_client: - api_instance = GovernanceControlsApi(api_client) + api_instance = GovernanceConsoleApi(api_client) response = api_instance.update_governance_control(detection_type="detection_type", body=body) print(response) diff --git a/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.py b/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.py new file mode 100644 index 0000000000..abd1e18d90 --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.py @@ -0,0 +1,47 @@ +""" +Update control notification settings returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi +from datadog_api_client.v2.model.control_notification_event_setting import ControlNotificationEventSetting +from datadog_api_client.v2.model.control_notification_settings_resource_type import ( + ControlNotificationSettingsResourceType, +) +from datadog_api_client.v2.model.control_notification_settings_update_attributes import ( + ControlNotificationSettingsUpdateAttributes, +) +from datadog_api_client.v2.model.control_notification_settings_update_data import ControlNotificationSettingsUpdateData +from datadog_api_client.v2.model.control_notification_settings_update_request import ( + ControlNotificationSettingsUpdateRequest, +) +from datadog_api_client.v2.model.control_notification_target import ControlNotificationTarget +from datadog_api_client.v2.model.control_notification_target_type import ControlNotificationTargetType + +body = ControlNotificationSettingsUpdateRequest( + data=ControlNotificationSettingsUpdateData( + attributes=ControlNotificationSettingsUpdateAttributes( + event_settings=[ + ControlNotificationEventSetting( + enabled=True, + event_type="new_detection", + targets=[ + ControlNotificationTarget( + handle="#governance-alerts", + type=ControlNotificationTargetType.SLACK, + ), + ], + ), + ], + ), + type=ControlNotificationSettingsResourceType.CONTROL_NOTIFICATION_SETTINGS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_governance_control_notification_settings"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.update_governance_control_notification_settings(detection_type="detection_type", body=body) + + print(response) diff --git a/examples/v2/governance-console/UpdateGovernanceDetection.py b/examples/v2/governance-console/UpdateGovernanceDetection.py new file mode 100644 index 0000000000..f61b427e0d --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceDetection.py @@ -0,0 +1,39 @@ +""" +Update a detection returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi +from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, +) +from datadog_api_client.v2.model.governance_control_detection_update_attributes import ( + GovernanceControlDetectionUpdateAttributes, +) +from datadog_api_client.v2.model.governance_control_detection_update_data import GovernanceControlDetectionUpdateData +from datadog_api_client.v2.model.governance_control_detection_update_request import ( + GovernanceControlDetectionUpdateRequest, +) +from datadog_api_client.v2.model.governance_control_detection_update_state import GovernanceControlDetectionUpdateState +from datetime import datetime +from dateutil.tz import tzutc + +body = GovernanceControlDetectionUpdateRequest( + data=GovernanceControlDetectionUpdateData( + attributes=GovernanceControlDetectionUpdateAttributes( + assigned_team="platform-security", + assigned_to="11111111-2222-3333-4444-555555555555", + mitigate_after=datetime(2024, 3, 15, 0, 0, tzinfo=tzutc()), + state=GovernanceControlDetectionUpdateState.EXCEPTION, + ), + type=GovernanceControlDetectionResourceType.GOVERNANCE_CONTROL_DETECTION, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_governance_detection"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.update_governance_detection(detection_id="detection_id", body=body) + + print(response) diff --git a/examples/v2/governance-console/UpdateGovernanceNotificationSettings.py b/examples/v2/governance-console/UpdateGovernanceNotificationSettings.py new file mode 100644 index 0000000000..311df0db45 --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceNotificationSettings.py @@ -0,0 +1,35 @@ +""" +Update notification settings returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi +from datadog_api_client.v2.model.governance_notification_settings_resource_type import ( + GovernanceNotificationSettingsResourceType, +) +from datadog_api_client.v2.model.governance_notification_settings_update_attributes import ( + GovernanceNotificationSettingsUpdateAttributes, +) +from datadog_api_client.v2.model.governance_notification_settings_update_data import ( + GovernanceNotificationSettingsUpdateData, +) +from datadog_api_client.v2.model.governance_notification_settings_update_request import ( + GovernanceNotificationSettingsUpdateRequest, +) + +body = GovernanceNotificationSettingsUpdateRequest( + data=GovernanceNotificationSettingsUpdateData( + attributes=GovernanceNotificationSettingsUpdateAttributes( + assignment_notifications_enabled=True, + ), + type=GovernanceNotificationSettingsResourceType.GOVERNANCE_NOTIFICATION_SETTINGS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_governance_notification_settings"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceConsoleApi(api_client) + response = api_instance.update_governance_notification_settings(body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index e9ae82408c..e008f4578b 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -506,10 +506,21 @@ def __init__( "v2.upsert_and_publish_form_version": False, "v2.upsert_form_version": False, "v2.update_org_saml_configurations": False, + "v2.get_governance_config": False, "v2.get_governance_control": False, + "v2.get_governance_control_notification_settings": False, + "v2.get_governance_detection": False, + "v2.get_governance_notification_settings": False, + "v2.list_governance_control_detections": False, "v2.list_governance_controls": False, - "v2.update_governance_control": False, "v2.list_governance_insights": False, + "v2.list_governance_limits": False, + "v2.list_governance_resource_limits": False, + "v2.mitigate_governance_detections": False, + "v2.update_governance_control": False, + "v2.update_governance_control_notification_settings": False, + "v2.update_governance_detection": False, + "v2.update_governance_notification_settings": False, "v2.create_hamr_org_connection": False, "v2.get_hamr_org_connection": False, "v2.delete_entity_integration_config": False, diff --git a/src/datadog_api_client/v2/api/governance_console_api.py b/src/datadog_api_client/v2/api/governance_console_api.py new file mode 100644 index 0000000000..237f99c761 --- /dev/null +++ b/src/datadog_api_client/v2/api/governance_console_api.py @@ -0,0 +1,698 @@ +# 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, List, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) +from datadog_api_client.v2.model.governance_config_response import GovernanceConfigResponse +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 +from datadog_api_client.v2.model.governance_control_detections_response import GovernanceControlDetectionsResponse +from datadog_api_client.v2.model.control_notification_settings_response import ControlNotificationSettingsResponse +from datadog_api_client.v2.model.control_notification_settings_update_request import ( + ControlNotificationSettingsUpdateRequest, +) +from datadog_api_client.v2.model.governance_mitigation_request import GovernanceMitigationRequest +from datadog_api_client.v2.model.governance_control_detection_response import GovernanceControlDetectionResponse +from datadog_api_client.v2.model.governance_control_detection_update_request import ( + GovernanceControlDetectionUpdateRequest, +) +from datadog_api_client.v2.model.governance_insights_response import GovernanceInsightsResponse +from datadog_api_client.v2.model.governance_limits_response import GovernanceLimitsResponse +from datadog_api_client.v2.model.governance_notification_settings_response import GovernanceNotificationSettingsResponse +from datadog_api_client.v2.model.governance_notification_settings_update_request import ( + GovernanceNotificationSettingsUpdateRequest, +) +from datadog_api_client.v2.model.governance_resource_limits_response import GovernanceResourceLimitsResponse + + +class GovernanceConsoleApi: + """ + The Governance Console finds issues that build up across a Datadog organization over time, + such as API keys nobody uses, users who no longer need access, or custom metrics that are + never queried, and tracks them through to a fix. + + These endpoints allow you to: + + * Read insights: measures of how your organization uses Datadog, each with the query behind it. + * Configure controls: the rules deciding how one kind of issue is found and what is done about it. + * Act on detections: the issues a control found. Assign, defer, accept as an exception, or fix. + * Manage settings: organization-wide configuration, usage and resource limits, and notifications. + + See the `Governance Console page `_ + for more information. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._get_governance_config_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceConfigResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/config", + "operation_id": "get_governance_config", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_governance_control_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceControlResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "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._get_governance_control_notification_settings_endpoint = _Endpoint( + settings={ + "response_type": (ControlNotificationSettingsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/control/{detection_type}/notification_settings", + "operation_id": "get_governance_control_notification_settings", + "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._get_governance_detection_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceControlDetectionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/detections/{detection_id}", + "operation_id": "get_governance_detection", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "detection_id": { + "required": True, + "openapi_types": (str,), + "attribute": "detection_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_governance_notification_settings_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceNotificationSettingsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/notification_settings", + "operation_id": "get_governance_notification_settings", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_governance_control_detections_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceControlDetectionsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/control/{detection_type}/detections", + "operation_id": "list_governance_control_detections", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "detection_type": { + "required": True, + "openapi_types": (str,), + "attribute": "detection_type", + "location": "path", + }, + "filter_state": { + "openapi_types": (str,), + "attribute": "filter[state]", + "location": "query", + }, + "filter_query": { + "openapi_types": (str,), + "attribute": "filter[query]", + "location": "query", + }, + "sort": { + "openapi_types": (str,), + "attribute": "sort", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + "page_size": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_governance_controls_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceControlsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "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._list_governance_insights_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceInsightsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/insights", + "operation_id": "list_governance_insights", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_product": { + "openapi_types": ([str],), + "attribute": "filter[product]", + "location": "query", + "collection_format": "multi", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_governance_limits_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceLimitsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/limits", + "operation_id": "list_governance_limits", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_governance_resource_limits_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceResourceLimitsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/resource_limits", + "operation_id": "list_governance_resource_limits", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._mitigate_governance_detections_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/detections/mitigate", + "operation_id": "mitigate_governance_detections", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (GovernanceMitigationRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._update_governance_control_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceControlResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "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, + ) + + self._update_governance_control_notification_settings_endpoint = _Endpoint( + settings={ + "response_type": (ControlNotificationSettingsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/control/{detection_type}/notification_settings", + "operation_id": "update_governance_control_notification_settings", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "detection_type": { + "required": True, + "openapi_types": (str,), + "attribute": "detection_type", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (ControlNotificationSettingsUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._update_governance_detection_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceControlDetectionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/detections/{detection_id}", + "operation_id": "update_governance_detection", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "detection_id": { + "required": True, + "openapi_types": (str,), + "attribute": "detection_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (GovernanceControlDetectionUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._update_governance_notification_settings_endpoint = _Endpoint( + settings={ + "response_type": (GovernanceNotificationSettingsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/governance/notification_settings", + "operation_id": "update_governance_notification_settings", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (GovernanceNotificationSettingsUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def get_governance_config( + self, + ) -> GovernanceConfigResponse: + """Get the Governance Console configuration. + + Retrieve the Governance Console configuration for the organization, including whether the + Console is enabled, whether assignment notifications are enabled, and whether usage + attribution is configured. + + :rtype: GovernanceConfigResponse + """ + kwargs: Dict[str, Any] = {} + return self._get_governance_config_endpoint.call_with_http_info(**kwargs) + + def get_governance_control( + self, + detection_type: str, + ) -> GovernanceControlResponse: + """Get a 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 get_governance_control_notification_settings( + self, + detection_type: str, + ) -> ControlNotificationSettingsResponse: + """Get control notification settings. + + Retrieve the notification settings for the governance control with the given detection type, + including, for each supported event type, whether notifications are enabled and which + destinations receive them. + + :param detection_type: The detection type that identifies the control; for example, ``unused_api_keys``. + :type detection_type: str + :rtype: ControlNotificationSettingsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["detection_type"] = detection_type + + return self._get_governance_control_notification_settings_endpoint.call_with_http_info(**kwargs) + + def get_governance_detection( + self, + detection_id: str, + ) -> GovernanceControlDetectionResponse: + """Get a detection. + + Retrieve a single governance detection by its unique identifier. + + :param detection_id: The unique identifier of the detection. + :type detection_id: str + :rtype: GovernanceControlDetectionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["detection_id"] = detection_id + + return self._get_governance_detection_endpoint.call_with_http_info(**kwargs) + + def get_governance_notification_settings( + self, + ) -> GovernanceNotificationSettingsResponse: + """Get notification settings. + + Retrieve the organization-wide governance notification settings, including whether users are + notified when detections are assigned to them. + + :rtype: GovernanceNotificationSettingsResponse + """ + kwargs: Dict[str, Any] = {} + return self._get_governance_notification_settings_endpoint.call_with_http_info(**kwargs) + + def list_governance_control_detections( + self, + detection_type: str, + *, + filter_state: Union[str, UnsetType] = unset, + filter_query: Union[str, UnsetType] = unset, + sort: Union[str, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + ) -> GovernanceControlDetectionsResponse: + """List control detections. + + Retrieve the detections produced by the governance control with the given detection type. + Results can be filtered by state and free-text query, sorted, and paginated. + + :param detection_type: The detection type that identifies the control; for example, ``unused_api_keys``. + :type detection_type: str + :param filter_state: Restrict the results to detections in the given state. + :type filter_state: str, optional + :param filter_query: Restrict the results to detections matching the given free-text query. + :type filter_query: str, optional + :param sort: A comma-separated list of attributes to sort detections by. Prefix an attribute with + ``-`` for descending order. + + The attributes available for sorting are ``id`` , ``created_at`` , ``assigned_to`` , + ``detection_type`` , ``display_name`` , ``exception_at`` , ``mitigate_after`` , ``mitigated_at`` , + ``priority`` , ``resource_id`` , and ``state``. Defaults to ``created_at,-id``. + :type sort: str, optional + :param page_number: The zero-based index of the page to return; the first page is 0. + :type page_number: int, optional + :param page_size: The number of detections to return per page. + :type page_size: int, optional + :rtype: GovernanceControlDetectionsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["detection_type"] = detection_type + + if filter_state is not unset: + kwargs["filter_state"] = filter_state + + if filter_query is not unset: + kwargs["filter_query"] = filter_query + + if sort is not unset: + kwargs["sort"] = sort + + if page_number is not unset: + kwargs["page_number"] = page_number + + if page_size is not unset: + kwargs["page_size"] = page_size + + return self._list_governance_control_detections_endpoint.call_with_http_info(**kwargs) + + def list_governance_controls( + self, + ) -> GovernanceControlsResponse: + """List 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 list_governance_insights( + self, + *, + filter_product: Union[List[str], UnsetType] = unset, + ) -> GovernanceInsightsResponse: + """List insights. + + Retrieve the list of governance insights available to the organization. Each insight + reports the query used to compute it, so that the value can be computed client-side. + Insights can be filtered by product. + + :param filter_product: Restrict the results to insights belonging to the given products. May be repeated to + filter by multiple products. Matching is case-insensitive. + :type filter_product: [str], optional + :rtype: GovernanceInsightsResponse + """ + kwargs: Dict[str, Any] = {} + if filter_product is not unset: + kwargs["filter_product"] = filter_product + + return self._list_governance_insights_endpoint.call_with_http_info(**kwargs) + + def list_governance_limits( + self, + ) -> GovernanceLimitsResponse: + """List usage limits. + + Retrieve the list of usage limits tracked for the organization in the Governance Console. + Each limit reports the query used to compute current usage, the unit and time range it is + measured over, and its current usage status. + + :rtype: GovernanceLimitsResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_governance_limits_endpoint.call_with_http_info(**kwargs) + + def list_governance_resource_limits( + self, + ) -> GovernanceResourceLimitsResponse: + """List resource limits. + + Retrieve the list of resource limits tracked for the organization in the Governance Console. + Each resource limit reports its current value and configured limit, the queries used to + compute them, and its current usage status. + + :rtype: GovernanceResourceLimitsResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_governance_resource_limits_endpoint.call_with_http_info(**kwargs) + + def mitigate_governance_detections( + self, + body: GovernanceMitigationRequest, + ) -> None: + """Mitigate detections. + + Apply a mitigation to a set of governance detections of a given detection type. When the + mitigation type is omitted, the control's configured mitigation is used. The request is + accepted for asynchronous processing. + + :type body: GovernanceMitigationRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._mitigate_governance_detections_endpoint.call_with_http_info(**kwargs) + + def update_governance_control( + self, + detection_type: str, + body: GovernanceControlUpdateRequest, + ) -> GovernanceControlResponse: + """Update a 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) + + def update_governance_control_notification_settings( + self, + detection_type: str, + body: ControlNotificationSettingsUpdateRequest, + ) -> ControlNotificationSettingsResponse: + """Update control notification settings. + + Replace the notification settings for the governance control with the given detection type, + setting, for each supported event type, whether notifications are enabled and which + destinations receive them. + + :param detection_type: The detection type that identifies the control; for example, ``unused_api_keys``. + :type detection_type: str + :type body: ControlNotificationSettingsUpdateRequest + :rtype: ControlNotificationSettingsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["detection_type"] = detection_type + + kwargs["body"] = body + + return self._update_governance_control_notification_settings_endpoint.call_with_http_info(**kwargs) + + def update_governance_detection( + self, + detection_id: str, + body: GovernanceControlDetectionUpdateRequest, + ) -> GovernanceControlDetectionResponse: + """Update a detection. + + Update a governance detection by its unique identifier. Only the attributes present in the + request are modified, allowing a detection to be acknowledged as an exception, reopened, + reassigned, or deferred for mitigation. + + :param detection_id: The unique identifier of the detection. + :type detection_id: str + :type body: GovernanceControlDetectionUpdateRequest + :rtype: GovernanceControlDetectionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["detection_id"] = detection_id + + kwargs["body"] = body + + return self._update_governance_detection_endpoint.call_with_http_info(**kwargs) + + def update_governance_notification_settings( + self, + body: GovernanceNotificationSettingsUpdateRequest, + ) -> GovernanceNotificationSettingsResponse: + """Update notification settings. + + Update the organization-wide governance notification settings. Only the attributes present in + the request are modified. + + :type body: GovernanceNotificationSettingsUpdateRequest + :rtype: GovernanceNotificationSettingsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._update_governance_notification_settings_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/api/governance_controls_api.py b/src/datadog_api_client/v2/api/governance_controls_api.py deleted file mode 100644 index 445f511093..0000000000 --- a/src/datadog_api_client/v2/api/governance_controls_api.py +++ /dev/null @@ -1,146 +0,0 @@ -# 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) diff --git a/src/datadog_api_client/v2/api/governance_insights_api.py b/src/datadog_api_client/v2/api/governance_insights_api.py deleted file mode 100644 index 5b1d2db7ff..0000000000 --- a/src/datadog_api_client/v2/api/governance_insights_api.py +++ /dev/null @@ -1,98 +0,0 @@ -# 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, List, Union - -from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint -from datadog_api_client.configuration import Configuration -from datadog_api_client.model_utils import ( - UnsetType, - unset, -) -from datadog_api_client.v2.model.governance_insights_response import GovernanceInsightsResponse - - -class GovernanceInsightsApi: - """ - Governance Insights surface key usage, configuration, and best-practice signals for an - organization within the Governance Console. Each insight reports a current value (and, - optionally, a previous value for comparison) along with the query used to compute it, so - that the Console can render trends and highlight areas that need attention. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient(Configuration()) - self.api_client = api_client - - self._list_governance_insights_endpoint = _Endpoint( - settings={ - "response_type": (GovernanceInsightsResponse,), - "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/governance/insights", - "operation_id": "list_governance_insights", - "http_method": "GET", - "version": "v2", - }, - params_map={ - "with_values": { - "openapi_types": (bool,), - "attribute": "withValues", - "location": "query", - }, - "org_uuid": { - "openapi_types": (str,), - "attribute": "orgUuid", - "location": "query", - }, - "filter_product": { - "openapi_types": ([str],), - "attribute": "filter[product]", - "location": "query", - "collection_format": "multi", - }, - }, - headers_map={ - "accept": ["application/json"], - }, - api_client=api_client, - ) - - def list_governance_insights( - self, - *, - with_values: Union[bool, UnsetType] = unset, - org_uuid: Union[str, UnsetType] = unset, - filter_product: Union[List[str], UnsetType] = unset, - ) -> GovernanceInsightsResponse: - """List governance insights. - - Retrieve the list of governance insights available to the organization. By default, only - insight metadata is returned; pass ``withValues=true`` to also compute and include each - insight's current and previous values. Insights can be filtered by product. - - :param with_values: Whether to compute and include the current and previous value of each insight. - Defaults to ``false`` , in which case only insight metadata is returned. - :type with_values: bool, optional - :param org_uuid: The UUID of the organization to compute insights for. Defaults to the organization of - the authenticated user. Used to retrieve insights for a child organization from a - parent organization. - :type org_uuid: str, optional - :param filter_product: Restrict the results to insights belonging to the given products. May be repeated to - filter by multiple products. Matching is case-insensitive. - :type filter_product: [str], optional - :rtype: GovernanceInsightsResponse - """ - kwargs: Dict[str, Any] = {} - if with_values is not unset: - kwargs["with_values"] = with_values - - if org_uuid is not unset: - kwargs["org_uuid"] = org_uuid - - if filter_product is not unset: - kwargs["filter_product"] = filter_product - - return self._list_governance_insights_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 58c3089c38..c6b9db7d12 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -56,8 +56,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.governance_console_api import GovernanceConsoleApi from datadog_api_client.v2.api.high_availability_multi_region_api import HighAvailabilityMultiRegionApi from datadog_api_client.v2.api.ip_allowlist_api import IPAllowlistApi from datadog_api_client.v2.api.identity_providers_api import IdentityProvidersApi @@ -200,8 +199,7 @@ "FormsApi", "GCPIntegrationApi", "GoogleChatIntegrationApi", - "GovernanceControlsApi", - "GovernanceInsightsApi", + "GovernanceConsoleApi", "HighAvailabilityMultiRegionApi", "IPAllowlistApi", "IdentityProvidersApi", diff --git a/src/datadog_api_client/v2/model/control_notification_event_setting.py b/src/datadog_api_client/v2/model/control_notification_event_setting.py new file mode 100644 index 0000000000..caa90637e7 --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_event_setting.py @@ -0,0 +1,52 @@ +# 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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.control_notification_target import ControlNotificationTarget + + +class ControlNotificationEventSetting(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.control_notification_target import ControlNotificationTarget + + return { + "enabled": (bool,), + "event_type": (str,), + "targets": ([ControlNotificationTarget],), + } + + attribute_map = { + "enabled": "enabled", + "event_type": "event_type", + "targets": "targets", + } + + def __init__(self_, enabled: bool, event_type: str, targets: List[ControlNotificationTarget], **kwargs): + """ + The notification settings for a single event type on a control. + + :param enabled: Whether notifications are enabled for this event type. + :type enabled: bool + + :param event_type: The event type the notification settings apply to, such as ``new_detection``. + :type event_type: str + + :param targets: The destinations that receive notifications for an event type. + :type targets: [ControlNotificationTarget] + """ + super().__init__(kwargs) + + self_.enabled = enabled + self_.event_type = event_type + self_.targets = targets diff --git a/src/datadog_api_client/v2/model/control_notification_settings_attributes.py b/src/datadog_api_client/v2/model/control_notification_settings_attributes.py new file mode 100644 index 0000000000..62e7ff6443 --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_settings_attributes.py @@ -0,0 +1,40 @@ +# 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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.control_notification_event_setting import ControlNotificationEventSetting + + +class ControlNotificationSettingsAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.control_notification_event_setting import ControlNotificationEventSetting + + return { + "event_settings": ([ControlNotificationEventSetting],), + } + + attribute_map = { + "event_settings": "event_settings", + } + + def __init__(self_, event_settings: List[ControlNotificationEventSetting], **kwargs): + """ + The attributes of a governance control's notification settings. + + :param event_settings: The notification settings for each supported event type on the control. + :type event_settings: [ControlNotificationEventSetting] + """ + super().__init__(kwargs) + + self_.event_settings = event_settings diff --git a/src/datadog_api_client/v2/model/control_notification_settings_data.py b/src/datadog_api_client/v2/model/control_notification_settings_data.py new file mode 100644 index 0000000000..701a72c253 --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_settings_data.py @@ -0,0 +1,68 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.control_notification_settings_attributes import ( + ControlNotificationSettingsAttributes, + ) + from datadog_api_client.v2.model.control_notification_settings_resource_type import ( + ControlNotificationSettingsResourceType, + ) + + +class ControlNotificationSettingsData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.control_notification_settings_attributes import ( + ControlNotificationSettingsAttributes, + ) + from datadog_api_client.v2.model.control_notification_settings_resource_type import ( + ControlNotificationSettingsResourceType, + ) + + return { + "attributes": (ControlNotificationSettingsAttributes,), + "id": (str,), + "type": (ControlNotificationSettingsResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: ControlNotificationSettingsAttributes, + id: str, + type: ControlNotificationSettingsResourceType, + **kwargs, + ): + """ + A control notification settings resource. + + :param attributes: The attributes of a governance control's notification settings. + :type attributes: ControlNotificationSettingsAttributes + + :param id: The detection type the notification settings apply to. + :type id: str + + :param type: Control notification settings resource type. + :type type: ControlNotificationSettingsResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/control_notification_settings_resource_type.py b/src/datadog_api_client/v2/model/control_notification_settings_resource_type.py new file mode 100644 index 0000000000..087a0eba7c --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_settings_resource_type.py @@ -0,0 +1,37 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ControlNotificationSettingsResourceType(ModelSimple): + """ + Control notification settings resource type. + + :param value: If omitted defaults to "control_notification_settings". Must be one of ["control_notification_settings"]. + :type value: str + """ + + allowed_values = { + "control_notification_settings", + } + CONTROL_NOTIFICATION_SETTINGS: ClassVar["ControlNotificationSettingsResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ControlNotificationSettingsResourceType.CONTROL_NOTIFICATION_SETTINGS = ControlNotificationSettingsResourceType( + "control_notification_settings" +) diff --git a/src/datadog_api_client/v2/model/control_notification_settings_response.py b/src/datadog_api_client/v2/model/control_notification_settings_response.py new file mode 100644 index 0000000000..5cb621a17d --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_settings_response.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.control_notification_settings_data import ControlNotificationSettingsData + + +class ControlNotificationSettingsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.control_notification_settings_data import ControlNotificationSettingsData + + return { + "data": (ControlNotificationSettingsData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ControlNotificationSettingsData, **kwargs): + """ + The notification settings for a governance control. + + :param data: A control notification settings resource. + :type data: ControlNotificationSettingsData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/control_notification_settings_update_attributes.py b/src/datadog_api_client/v2/model/control_notification_settings_update_attributes.py new file mode 100644 index 0000000000..7cd726e168 --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_settings_update_attributes.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 List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.control_notification_event_setting import ControlNotificationEventSetting + + +class ControlNotificationSettingsUpdateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.control_notification_event_setting import ControlNotificationEventSetting + + return { + "event_settings": ([ControlNotificationEventSetting],), + } + + attribute_map = { + "event_settings": "event_settings", + } + + def __init__(self_, event_settings: Union[List[ControlNotificationEventSetting], UnsetType] = unset, **kwargs): + """ + The attributes of a governance control's notification settings that can be updated. + + :param event_settings: The notification settings for each supported event type on the control. + :type event_settings: [ControlNotificationEventSetting], optional + """ + if event_settings is not unset: + kwargs["event_settings"] = event_settings + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/control_notification_settings_update_data.py b/src/datadog_api_client/v2/model/control_notification_settings_update_data.py new file mode 100644 index 0000000000..250b90219f --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_settings_update_data.py @@ -0,0 +1,64 @@ +# 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.control_notification_settings_update_attributes import ( + ControlNotificationSettingsUpdateAttributes, + ) + from datadog_api_client.v2.model.control_notification_settings_resource_type import ( + ControlNotificationSettingsResourceType, + ) + + +class ControlNotificationSettingsUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.control_notification_settings_update_attributes import ( + ControlNotificationSettingsUpdateAttributes, + ) + from datadog_api_client.v2.model.control_notification_settings_resource_type import ( + ControlNotificationSettingsResourceType, + ) + + return { + "attributes": (ControlNotificationSettingsUpdateAttributes,), + "type": (ControlNotificationSettingsResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + type: ControlNotificationSettingsResourceType, + attributes: Union[ControlNotificationSettingsUpdateAttributes, UnsetType] = unset, + **kwargs, + ): + """ + The data of a control notification settings update request. + + :param attributes: The attributes of a governance control's notification settings that can be updated. + :type attributes: ControlNotificationSettingsUpdateAttributes, optional + + :param type: Control notification settings resource type. + :type type: ControlNotificationSettingsResourceType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/control_notification_settings_update_request.py b/src/datadog_api_client/v2/model/control_notification_settings_update_request.py new file mode 100644 index 0000000000..484413ab5a --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_settings_update_request.py @@ -0,0 +1,44 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.control_notification_settings_update_data import ( + ControlNotificationSettingsUpdateData, + ) + + +class ControlNotificationSettingsUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.control_notification_settings_update_data import ( + ControlNotificationSettingsUpdateData, + ) + + return { + "data": (ControlNotificationSettingsUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ControlNotificationSettingsUpdateData, **kwargs): + """ + A request to update the notification settings for a governance control. + + :param data: The data of a control notification settings update request. + :type data: ControlNotificationSettingsUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/control_notification_target.py b/src/datadog_api_client/v2/model/control_notification_target.py new file mode 100644 index 0000000000..d1d6011816 --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_target.py @@ -0,0 +1,46 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.control_notification_target_type import ControlNotificationTargetType + + +class ControlNotificationTarget(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.control_notification_target_type import ControlNotificationTargetType + + return { + "handle": (str,), + "type": (ControlNotificationTargetType,), + } + + attribute_map = { + "handle": "handle", + "type": "type", + } + + def __init__(self_, handle: str, type: ControlNotificationTargetType, **kwargs): + """ + A destination that receives notifications for an event type. + + :param handle: The destination handle, such as an email address, Slack channel, or user handle. + :type handle: str + + :param type: The type of notification destination. + :type type: ControlNotificationTargetType + """ + super().__init__(kwargs) + + self_.handle = handle + self_.type = type diff --git a/src/datadog_api_client/v2/model/control_notification_target_type.py b/src/datadog_api_client/v2/model/control_notification_target_type.py new file mode 100644 index 0000000000..95f7e48486 --- /dev/null +++ b/src/datadog_api_client/v2/model/control_notification_target_type.py @@ -0,0 +1,44 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ControlNotificationTargetType(ModelSimple): + """ + The type of notification destination. + + :param value: Must be one of ["email", "slack", "at_mention", "case"]. + :type value: str + """ + + allowed_values = { + "email", + "slack", + "at_mention", + "case", + } + EMAIL: ClassVar["ControlNotificationTargetType"] + SLACK: ClassVar["ControlNotificationTargetType"] + AT_MENTION: ClassVar["ControlNotificationTargetType"] + CASE: ClassVar["ControlNotificationTargetType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ControlNotificationTargetType.EMAIL = ControlNotificationTargetType("email") +ControlNotificationTargetType.SLACK = ControlNotificationTargetType("slack") +ControlNotificationTargetType.AT_MENTION = ControlNotificationTargetType("at_mention") +ControlNotificationTargetType.CASE = ControlNotificationTargetType("case") diff --git a/src/datadog_api_client/v2/model/governance_best_practice_definition.py b/src/datadog_api_client/v2/model/governance_best_practice_definition.py deleted file mode 100644 index a566219487..0000000000 --- a/src/datadog_api_client/v2/model/governance_best_practice_definition.py +++ /dev/null @@ -1,131 +0,0 @@ -# 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 List, Union - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - none_type, - unset, - UnsetType, -) - - -class GovernanceBestPracticeDefinition(ModelNormal): - @cached_property - def openapi_types(_): - return { - "category": (str,), - "deep_link": (str,), - "description": (str,), - "detection_type": (str, none_type), - "id": (str,), - "impact": (str,), - "impact_hint": (int,), - "permissions": ([str],), - "status": (str,), - "summary": (str,), - "title": (str,), - "trigger_condition": (str,), - "trigger_type": (str,), - } - - attribute_map = { - "category": "category", - "deep_link": "deep_link", - "description": "description", - "detection_type": "detection_type", - "id": "id", - "impact": "impact", - "impact_hint": "impact_hint", - "permissions": "permissions", - "status": "status", - "summary": "summary", - "title": "title", - "trigger_condition": "trigger_condition", - "trigger_type": "trigger_type", - } - - def __init__( - self_, - category: str, - deep_link: str, - description: str, - id: str, - impact: str, - impact_hint: int, - permissions: List[str], - status: str, - summary: str, - title: str, - trigger_condition: str, - trigger_type: str, - detection_type: Union[str, none_type, UnsetType] = unset, - **kwargs, - ): - """ - The best practice associated with an insight. Populated with the first active best practice - matched to the insight; ``null`` when no best practice is attached. - - :param category: The value driver the best practice is grouped under, such as ``access_governance`` , - ``security`` , ``compliance`` , or ``operational_hygiene``. - :type category: str - - :param deep_link: A relative link to the configuration page where the best practice can be acted upon. - :type deep_link: str - - :param description: The full rationale and guidance for the best practice. - :type description: str - - :param detection_type: An optional association to a control's detection type. ``null`` when not associated with a control. - :type detection_type: str, none_type, optional - - :param id: The unique identifier of the best practice. - :type id: str - - :param impact: The expected impact of following the best practice. - :type impact: str - - :param impact_hint: A priority hint for ordering best practices by expected impact. Lower values indicate - higher priority. - :type impact_hint: int - - :param permissions: The permissions required for the user to act on the best practice. - :type permissions: [str] - - :param status: Whether the best practice is currently ``active`` or ``deprecated``. - :type status: str - - :param summary: A one-line explanation of why this best practice matters. - :type summary: str - - :param title: A short, human-readable name for the best practice. - :type title: str - - :param trigger_condition: The condition that surfaces the best practice. For an ``insight`` trigger, the insight - slug; for a ``static`` trigger, a descriptive condition key. - :type trigger_condition: str - - :param trigger_type: How the best practice is surfaced. ``insight`` ties it to an insight; ``static`` surfaces it - unless its condition is met. - :type trigger_type: str - """ - if detection_type is not unset: - kwargs["detection_type"] = detection_type - super().__init__(kwargs) - - self_.category = category - self_.deep_link = deep_link - self_.description = description - self_.id = id - self_.impact = impact - self_.impact_hint = impact_hint - self_.permissions = permissions - self_.status = status - self_.summary = summary - self_.title = title - self_.trigger_condition = trigger_condition - self_.trigger_type = trigger_type diff --git a/src/datadog_api_client/v2/model/governance_config_attributes.py b/src/datadog_api_client/v2/model/governance_config_attributes.py new file mode 100644 index 0000000000..b44f73fe63 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_config_attributes.py @@ -0,0 +1,59 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class GovernanceConfigAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "assignment_notifications_enabled": (bool,), + "enabled": (bool,), + "usage_attribution_configured": (bool,), + "xorg_insights_enabled": (bool,), + } + + attribute_map = { + "assignment_notifications_enabled": "assignment_notifications_enabled", + "enabled": "enabled", + "usage_attribution_configured": "usage_attribution_configured", + "xorg_insights_enabled": "xorg_insights_enabled", + } + + def __init__( + self_, + assignment_notifications_enabled: bool, + enabled: bool, + usage_attribution_configured: bool, + xorg_insights_enabled: bool, + **kwargs, + ): + """ + The attributes of a Governance Console configuration. + + :param assignment_notifications_enabled: Whether notifications are sent to users when detections are assigned to them. + :type assignment_notifications_enabled: bool + + :param enabled: Whether the Governance Console is enabled for the organization. + :type enabled: bool + + :param usage_attribution_configured: Whether usage attribution is configured for the organization. + :type usage_attribution_configured: bool + + :param xorg_insights_enabled: Whether the organization has opted in to sharing governance data with a managing org + for cross-org insights. + :type xorg_insights_enabled: bool + """ + super().__init__(kwargs) + + self_.assignment_notifications_enabled = assignment_notifications_enabled + self_.enabled = enabled + self_.usage_attribution_configured = usage_attribution_configured + self_.xorg_insights_enabled = xorg_insights_enabled diff --git a/src/datadog_api_client/v2/model/governance_config_data.py b/src/datadog_api_client/v2/model/governance_config_data.py new file mode 100644 index 0000000000..92e40fb23a --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_config_data.py @@ -0,0 +1,60 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_config_attributes import GovernanceConfigAttributes + from datadog_api_client.v2.model.governance_console_config_resource_type import GovernanceConsoleConfigResourceType + + +class GovernanceConfigData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_config_attributes import GovernanceConfigAttributes + from datadog_api_client.v2.model.governance_console_config_resource_type import ( + GovernanceConsoleConfigResourceType, + ) + + return { + "attributes": (GovernanceConfigAttributes,), + "id": (str,), + "type": (GovernanceConsoleConfigResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: GovernanceConfigAttributes, id: str, type: GovernanceConsoleConfigResourceType, **kwargs + ): + """ + A Governance Console configuration resource. + + :param attributes: The attributes of a Governance Console configuration. + :type attributes: GovernanceConfigAttributes + + :param id: The unique identifier of the organization the Governance Console configuration applies + to. May be the nil UUID ( ``00000000-0000-0000-0000-000000000000`` ) when the configuration + is not tied to a specific organization record. + :type id: str + + :param type: Governance console config resource type. + :type type: GovernanceConsoleConfigResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_config_response.py b/src/datadog_api_client/v2/model/governance_config_response.py new file mode 100644 index 0000000000..36abb62f93 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_config_response.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_config_data import GovernanceConfigData + + +class GovernanceConfigResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_config_data import GovernanceConfigData + + return { + "data": (GovernanceConfigData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: GovernanceConfigData, **kwargs): + """ + The Governance Console configuration for an organization. + + :param data: A Governance Console configuration resource. + :type data: GovernanceConfigData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/governance_console_config_resource_type.py b/src/datadog_api_client/v2/model/governance_console_config_resource_type.py new file mode 100644 index 0000000000..80180cb5c2 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_console_config_resource_type.py @@ -0,0 +1,37 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceConsoleConfigResourceType(ModelSimple): + """ + Governance console config resource type. + + :param value: If omitted defaults to "governance_console_config". Must be one of ["governance_console_config"]. + :type value: str + """ + + allowed_values = { + "governance_console_config", + } + GOVERNANCE_CONSOLE_CONFIG: ClassVar["GovernanceConsoleConfigResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceConsoleConfigResourceType.GOVERNANCE_CONSOLE_CONFIG = GovernanceConsoleConfigResourceType( + "governance_console_config" +) diff --git a/src/datadog_api_client/v2/model/governance_control_attributes.py b/src/datadog_api_client/v2/model/governance_control_attributes.py index 09d6f6e622..9dc28bf97a 100644 --- a/src/datadog_api_client/v2/model/governance_control_attributes.py +++ b/src/datadog_api_client/v2/model/governance_control_attributes.py @@ -40,8 +40,6 @@ def openapi_types(_): "description": (str,), "detection_frequency": (str,), "detection_parameters": (GovernanceControlParametersMap,), - "detection_type": (str,), - "feature_flags": ([str],), "insights": ([str],), "last_detection_at": (datetime, none_type), "mitigated_detections_count": (int,), @@ -49,20 +47,12 @@ def openapi_types(_): "mitigation_type": (str,), "mitigations": ([GovernanceControlMitigationDefinition],), "name": (str,), - "next_steps": (str,), - "notification_frequency": (str,), - "notification_parameters": (GovernanceControlParametersMap,), - "notification_type": (str,), "priority": (str,), "product": (str,), - "release_status": (str,), "resource_type": (str,), "resource_type_display_name": (str,), "supported_detection_parameters": ([GovernanceControlParameterDefinition],), - "supported_notification_parameters": ([GovernanceControlParameterDefinition],), - "task": (str,), "type": (str,), - "usage_concern": (str,), } attribute_map = { @@ -73,8 +63,6 @@ def openapi_types(_): "description": "description", "detection_frequency": "detection_frequency", "detection_parameters": "detection_parameters", - "detection_type": "detection_type", - "feature_flags": "feature_flags", "insights": "insights", "last_detection_at": "last_detection_at", "mitigated_detections_count": "mitigated_detections_count", @@ -82,20 +70,12 @@ def openapi_types(_): "mitigation_type": "mitigation_type", "mitigations": "mitigations", "name": "name", - "next_steps": "next_steps", - "notification_frequency": "notification_frequency", - "notification_parameters": "notification_parameters", - "notification_type": "notification_type", "priority": "priority", "product": "product", - "release_status": "release_status", "resource_type": "resource_type", "resource_type_display_name": "resource_type_display_name", "supported_detection_parameters": "supported_detection_parameters", - "supported_notification_parameters": "supported_notification_parameters", - "task": "task", "type": "type", - "usage_concern": "usage_concern", } def __init__( @@ -107,8 +87,6 @@ def __init__( description: str, detection_frequency: str, detection_parameters: GovernanceControlParametersMap, - detection_type: str, - feature_flags: List[str], insights: List[str], last_detection_at: Union[datetime, none_type], mitigated_detections_count: int, @@ -116,20 +94,12 @@ def __init__( mitigation_type: str, mitigations: List[GovernanceControlMitigationDefinition], name: str, - next_steps: str, - notification_frequency: str, - notification_parameters: GovernanceControlParametersMap, - notification_type: str, priority: str, product: str, - release_status: str, resource_type: str, resource_type_display_name: str, supported_detection_parameters: List[GovernanceControlParameterDefinition], - supported_notification_parameters: List[GovernanceControlParameterDefinition], - task: str, type: str, - usage_concern: str, **kwargs, ): """ @@ -156,12 +126,6 @@ def __init__( :param detection_parameters: A free-form map of parameter names to their configured values. :type detection_parameters: GovernanceControlParametersMap - :param detection_type: The detection type that uniquely identifies the control. - :type detection_type: str - - :param feature_flags: The feature flags that gate the control. - :type feature_flags: [str] - :param insights: The insight slugs associated with the control. :type insights: [str] @@ -183,27 +147,12 @@ def __init__( :param name: Human-readable name of the control. :type name: str - :param next_steps: Guidance on the next steps to remediate detections for the control. - :type next_steps: str - - :param notification_frequency: The configured notification frequency for the control. Empty when not configured. - :type notification_frequency: str - - :param notification_parameters: A free-form map of parameter names to their configured values. - :type notification_parameters: GovernanceControlParametersMap - - :param notification_type: The configured notification type for the control. Empty when not configured. - :type notification_type: str - :param priority: The priority of the control, such as ``High``. :type priority: str :param product: The product the control belongs to. :type product: str - :param release_status: The release status of the control, such as ``prod`` or ``beta``. - :type release_status: str - :param resource_type: The type of resource the control evaluates. :type resource_type: str @@ -213,17 +162,8 @@ def __init__( :param supported_detection_parameters: An array of parameter definitions. :type supported_detection_parameters: [GovernanceControlParameterDefinition] - :param supported_notification_parameters: An array of parameter definitions. - :type supported_notification_parameters: [GovernanceControlParameterDefinition] - - :param task: A short description of the remediation task for the control. - :type task: str - :param type: The control type, such as ``Proactive`` or ``Detection``. :type type: str - - :param usage_concern: The usage concern the control addresses, such as ``Security`` or ``Cost Optimization``. - :type usage_concern: str """ super().__init__(kwargs) @@ -234,8 +174,6 @@ def __init__( self_.description = description self_.detection_frequency = detection_frequency self_.detection_parameters = detection_parameters - self_.detection_type = detection_type - self_.feature_flags = feature_flags self_.insights = insights self_.last_detection_at = last_detection_at self_.mitigated_detections_count = mitigated_detections_count @@ -243,17 +181,9 @@ def __init__( self_.mitigation_type = mitigation_type self_.mitigations = mitigations self_.name = name - self_.next_steps = next_steps - self_.notification_frequency = notification_frequency - self_.notification_parameters = notification_parameters - self_.notification_type = notification_type self_.priority = priority self_.product = product - self_.release_status = release_status self_.resource_type = resource_type self_.resource_type_display_name = resource_type_display_name self_.supported_detection_parameters = supported_detection_parameters - self_.supported_notification_parameters = supported_notification_parameters - self_.task = task self_.type = type - self_.usage_concern = usage_concern diff --git a/src/datadog_api_client/v2/model/governance_control_data.py b/src/datadog_api_client/v2/model/governance_control_data.py index 92fa274920..7c68313727 100644 --- a/src/datadog_api_client/v2/model/governance_control_data.py +++ b/src/datadog_api_client/v2/model/governance_control_data.py @@ -43,7 +43,7 @@ def __init__( :param attributes: The attributes of a governance control. :type attributes: GovernanceControlAttributes - :param id: The unique identifier of the control. + :param id: The detection type that uniquely identifies the control. :type id: str :param type: JSON:API resource type for a governance control. diff --git a/src/datadog_api_client/v2/model/governance_control_detection_assignment_source.py b/src/datadog_api_client/v2/model/governance_control_detection_assignment_source.py new file mode 100644 index 0000000000..e346e378aa --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_assignment_source.py @@ -0,0 +1,44 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceControlDetectionAssignmentSource(ModelSimple): + """ + How the detection's current assignment was determined. Possible values are `auto_resolved`, `manual`, `reassigned`, and `cleared`. + + :param value: Must be one of ["auto_resolved", "manual", "reassigned", "cleared"]. + :type value: str + """ + + allowed_values = { + "auto_resolved", + "manual", + "reassigned", + "cleared", + } + AUTO_RESOLVED: ClassVar["GovernanceControlDetectionAssignmentSource"] + MANUAL: ClassVar["GovernanceControlDetectionAssignmentSource"] + REASSIGNED: ClassVar["GovernanceControlDetectionAssignmentSource"] + CLEARED: ClassVar["GovernanceControlDetectionAssignmentSource"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceControlDetectionAssignmentSource.AUTO_RESOLVED = GovernanceControlDetectionAssignmentSource("auto_resolved") +GovernanceControlDetectionAssignmentSource.MANUAL = GovernanceControlDetectionAssignmentSource("manual") +GovernanceControlDetectionAssignmentSource.REASSIGNED = GovernanceControlDetectionAssignmentSource("reassigned") +GovernanceControlDetectionAssignmentSource.CLEARED = GovernanceControlDetectionAssignmentSource("cleared") diff --git a/src/datadog_api_client/v2/model/governance_control_detection_attributes.py b/src/datadog_api_client/v2/model/governance_control_detection_attributes.py new file mode 100644 index 0000000000..af3ceef07d --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_attributes.py @@ -0,0 +1,180 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_control_detection_assignment_source import ( + GovernanceControlDetectionAssignmentSource, + ) + from datadog_api_client.v2.model.governance_control_detection_state import GovernanceControlDetectionState + + +class GovernanceControlDetectionAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_control_detection_assignment_source import ( + GovernanceControlDetectionAssignmentSource, + ) + from datadog_api_client.v2.model.governance_control_detection_state import GovernanceControlDetectionState + + return { + "assigned_team": (str,), + "assigned_to": (str,), + "assignment_source": (GovernanceControlDetectionAssignmentSource,), + "control_id": (str,), + "created_at": (datetime,), + "detection_type": (str,), + "display_name": (str,), + "exception_at": (datetime,), + "exception_by": (str,), + "metadata": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ), + "mitigate_after": (datetime,), + "mitigated_at": (datetime,), + "priority": (int,), + "resource_id": (str,), + "resource_type": (str,), + "state": (GovernanceControlDetectionState,), + } + + attribute_map = { + "assigned_team": "assigned_team", + "assigned_to": "assigned_to", + "assignment_source": "assignment_source", + "control_id": "control_id", + "created_at": "created_at", + "detection_type": "detection_type", + "display_name": "display_name", + "exception_at": "exception_at", + "exception_by": "exception_by", + "metadata": "metadata", + "mitigate_after": "mitigate_after", + "mitigated_at": "mitigated_at", + "priority": "priority", + "resource_id": "resource_id", + "resource_type": "resource_type", + "state": "state", + } + + def __init__( + self_, + assignment_source: GovernanceControlDetectionAssignmentSource, + control_id: str, + created_at: datetime, + detection_type: str, + display_name: str, + priority: int, + resource_id: str, + resource_type: str, + state: GovernanceControlDetectionState, + assigned_team: Union[str, UnsetType] = unset, + assigned_to: Union[str, UnsetType] = unset, + exception_at: Union[datetime, UnsetType] = unset, + exception_by: Union[str, UnsetType] = unset, + metadata: Union[Any, UnsetType] = unset, + mitigate_after: Union[datetime, UnsetType] = unset, + mitigated_at: Union[datetime, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of a governance control detection. + + :param assigned_team: The identifier of the team the detection is assigned to, if any. + :type assigned_team: str, optional + + :param assigned_to: The identifier of the user the detection is assigned to, if any. + :type assigned_to: str, optional + + :param assignment_source: How the detection's current assignment was determined. Possible values are ``auto_resolved`` , ``manual`` , ``reassigned`` , and ``cleared``. + :type assignment_source: GovernanceControlDetectionAssignmentSource + + :param control_id: DEPRECATED: mirrors ``detection_type`` for backward compatibility; use ``detection_type`` + instead. **Deprecated**. + :type control_id: str + + :param created_at: The date and time when the detection was created. + :type created_at: datetime + + :param detection_type: The type of detection, which determines what condition was detected. + :type detection_type: str + + :param display_name: The human-readable name of the detected resource. + :type display_name: str + + :param exception_at: The date and time when the detection was marked as an exception, if applicable. + :type exception_at: datetime, optional + + :param exception_by: The identifier of the user who marked the detection as an exception, if applicable. + :type exception_by: str, optional + + :param metadata: Free-form metadata associated with the detection. + :type metadata: bool, date, datetime, dict, float, int, list, str, UUID, none_type, optional + + :param mitigate_after: The date and time after which the detection is scheduled to be mitigated, if applicable. + :type mitigate_after: datetime, optional + + :param mitigated_at: The date and time when the detection was mitigated, if applicable. + :type mitigated_at: datetime, optional + + :param priority: The priority of the detection, if set. + :type priority: int + + :param resource_id: The identifier of the resource the detection applies to. + :type resource_id: str + + :param resource_type: The type of resource the detection applies to, for example ``api_key`` or ``dashboard``. + :type resource_type: str + + :param state: The current state of the detection. Possible values are ``active`` , ``exception`` , ``mitigated`` , ``inactive`` , ``obsolete`` , ``resolved_externally`` , and ``mitigation_in_progress``. + :type state: GovernanceControlDetectionState + """ + if assigned_team is not unset: + kwargs["assigned_team"] = assigned_team + if assigned_to is not unset: + kwargs["assigned_to"] = assigned_to + if exception_at is not unset: + kwargs["exception_at"] = exception_at + if exception_by is not unset: + kwargs["exception_by"] = exception_by + if metadata is not unset: + kwargs["metadata"] = metadata + if mitigate_after is not unset: + kwargs["mitigate_after"] = mitigate_after + if mitigated_at is not unset: + kwargs["mitigated_at"] = mitigated_at + super().__init__(kwargs) + + self_.assignment_source = assignment_source + self_.control_id = control_id + self_.created_at = created_at + self_.detection_type = detection_type + self_.display_name = display_name + self_.priority = priority + self_.resource_id = resource_id + self_.resource_type = resource_type + self_.state = state diff --git a/src/datadog_api_client/v2/model/governance_control_detection_data.py b/src/datadog_api_client/v2/model/governance_control_detection_data.py new file mode 100644 index 0000000000..60245182be --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_data.py @@ -0,0 +1,66 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_control_detection_attributes import GovernanceControlDetectionAttributes + from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, + ) + + +class GovernanceControlDetectionData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_control_detection_attributes import ( + GovernanceControlDetectionAttributes, + ) + from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, + ) + + return { + "attributes": (GovernanceControlDetectionAttributes,), + "id": (str,), + "type": (GovernanceControlDetectionResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: GovernanceControlDetectionAttributes, + id: str, + type: GovernanceControlDetectionResourceType, + **kwargs, + ): + """ + A governance control detection resource. + + :param attributes: The attributes of a governance control detection. + :type attributes: GovernanceControlDetectionAttributes + + :param id: The unique identifier of the detection. + :type id: str + + :param type: Governance control detection resource type. + :type type: GovernanceControlDetectionResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_control_detection_resource_type.py b/src/datadog_api_client/v2/model/governance_control_detection_resource_type.py new file mode 100644 index 0000000000..f462a36683 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_resource_type.py @@ -0,0 +1,37 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceControlDetectionResourceType(ModelSimple): + """ + Governance control detection resource type. + + :param value: If omitted defaults to "governance_control_detection". Must be one of ["governance_control_detection"]. + :type value: str + """ + + allowed_values = { + "governance_control_detection", + } + GOVERNANCE_CONTROL_DETECTION: ClassVar["GovernanceControlDetectionResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceControlDetectionResourceType.GOVERNANCE_CONTROL_DETECTION = GovernanceControlDetectionResourceType( + "governance_control_detection" +) diff --git a/src/datadog_api_client/v2/model/governance_control_detection_response.py b/src/datadog_api_client/v2/model/governance_control_detection_response.py new file mode 100644 index 0000000000..6f057fc891 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_response.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_control_detection_data import GovernanceControlDetectionData + + +class GovernanceControlDetectionResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_control_detection_data import GovernanceControlDetectionData + + return { + "data": (GovernanceControlDetectionData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: GovernanceControlDetectionData, **kwargs): + """ + A single governance control detection. + + :param data: A governance control detection resource. + :type data: GovernanceControlDetectionData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/governance_control_detection_state.py b/src/datadog_api_client/v2/model/governance_control_detection_state.py new file mode 100644 index 0000000000..2c57e21ebc --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_state.py @@ -0,0 +1,53 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceControlDetectionState(ModelSimple): + """ + The current state of the detection. Possible values are `active`, `exception`, `mitigated`, `inactive`, `obsolete`, `resolved_externally`, and `mitigation_in_progress`. + + :param value: Must be one of ["active", "exception", "mitigated", "inactive", "obsolete", "resolved_externally", "mitigation_in_progress"]. + :type value: str + """ + + allowed_values = { + "active", + "exception", + "mitigated", + "inactive", + "obsolete", + "resolved_externally", + "mitigation_in_progress", + } + ACTIVE: ClassVar["GovernanceControlDetectionState"] + EXCEPTION: ClassVar["GovernanceControlDetectionState"] + MITIGATED: ClassVar["GovernanceControlDetectionState"] + INACTIVE: ClassVar["GovernanceControlDetectionState"] + OBSOLETE: ClassVar["GovernanceControlDetectionState"] + RESOLVED_EXTERNALLY: ClassVar["GovernanceControlDetectionState"] + MITIGATION_IN_PROGRESS: ClassVar["GovernanceControlDetectionState"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceControlDetectionState.ACTIVE = GovernanceControlDetectionState("active") +GovernanceControlDetectionState.EXCEPTION = GovernanceControlDetectionState("exception") +GovernanceControlDetectionState.MITIGATED = GovernanceControlDetectionState("mitigated") +GovernanceControlDetectionState.INACTIVE = GovernanceControlDetectionState("inactive") +GovernanceControlDetectionState.OBSOLETE = GovernanceControlDetectionState("obsolete") +GovernanceControlDetectionState.RESOLVED_EXTERNALLY = GovernanceControlDetectionState("resolved_externally") +GovernanceControlDetectionState.MITIGATION_IN_PROGRESS = GovernanceControlDetectionState("mitigation_in_progress") diff --git a/src/datadog_api_client/v2/model/governance_control_detection_update_attributes.py b/src/datadog_api_client/v2/model/governance_control_detection_update_attributes.py new file mode 100644 index 0000000000..e2a94c0fc7 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_update_attributes.py @@ -0,0 +1,75 @@ +# 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, + datetime, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_control_detection_update_state import ( + GovernanceControlDetectionUpdateState, + ) + + +class GovernanceControlDetectionUpdateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_control_detection_update_state import ( + GovernanceControlDetectionUpdateState, + ) + + return { + "assigned_team": (str,), + "assigned_to": (str,), + "mitigate_after": (datetime,), + "state": (GovernanceControlDetectionUpdateState,), + } + + attribute_map = { + "assigned_team": "assigned_team", + "assigned_to": "assigned_to", + "mitigate_after": "mitigate_after", + "state": "state", + } + + def __init__( + self_, + assigned_team: Union[str, UnsetType] = unset, + assigned_to: Union[str, UnsetType] = unset, + mitigate_after: Union[datetime, UnsetType] = unset, + state: Union[GovernanceControlDetectionUpdateState, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of a governance control detection that can be updated. Only the attributes present in the request are modified. + + :param assigned_team: The handle of the team the detection is assigned to. Set to an empty string to clear the assignment. + :type assigned_team: str, optional + + :param assigned_to: The UUID of the user the detection is assigned to. Set to an empty string to clear the assignment. + :type assigned_to: str, optional + + :param mitigate_after: The timestamp after which the detection becomes eligible for mitigation. Used to defer mitigation to a later time. + :type mitigate_after: datetime, optional + + :param state: The new state to set for the detection. Set to ``exception`` to acknowledge the detection and exclude it from active counts, or ``active`` to reopen it. + :type state: GovernanceControlDetectionUpdateState, optional + """ + if assigned_team is not unset: + kwargs["assigned_team"] = assigned_team + if assigned_to is not unset: + kwargs["assigned_to"] = assigned_to + if mitigate_after is not unset: + kwargs["mitigate_after"] = mitigate_after + if state is not unset: + kwargs["state"] = state + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/governance_control_detection_update_data.py b/src/datadog_api_client/v2/model/governance_control_detection_update_data.py new file mode 100644 index 0000000000..1ef61c05fa --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_update_data.py @@ -0,0 +1,64 @@ +# 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.governance_control_detection_update_attributes import ( + GovernanceControlDetectionUpdateAttributes, + ) + from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, + ) + + +class GovernanceControlDetectionUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_control_detection_update_attributes import ( + GovernanceControlDetectionUpdateAttributes, + ) + from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, + ) + + return { + "attributes": (GovernanceControlDetectionUpdateAttributes,), + "type": (GovernanceControlDetectionResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + type: GovernanceControlDetectionResourceType, + attributes: Union[GovernanceControlDetectionUpdateAttributes, UnsetType] = unset, + **kwargs, + ): + """ + The data of a governance control detection update request. + + :param attributes: The attributes of a governance control detection that can be updated. Only the attributes present in the request are modified. + :type attributes: GovernanceControlDetectionUpdateAttributes, optional + + :param type: Governance control detection resource type. + :type type: GovernanceControlDetectionResourceType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_control_detection_update_request.py b/src/datadog_api_client/v2/model/governance_control_detection_update_request.py new file mode 100644 index 0000000000..308b726b8b --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_update_request.py @@ -0,0 +1,44 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_control_detection_update_data import ( + GovernanceControlDetectionUpdateData, + ) + + +class GovernanceControlDetectionUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_control_detection_update_data import ( + GovernanceControlDetectionUpdateData, + ) + + return { + "data": (GovernanceControlDetectionUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: GovernanceControlDetectionUpdateData, **kwargs): + """ + A request to update a governance control detection. + + :param data: The data of a governance control detection update request. + :type data: GovernanceControlDetectionUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/governance_control_detection_update_state.py b/src/datadog_api_client/v2/model/governance_control_detection_update_state.py new file mode 100644 index 0000000000..78b04f907e --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detection_update_state.py @@ -0,0 +1,38 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceControlDetectionUpdateState(ModelSimple): + """ + The new state to set for the detection. Set to `exception` to acknowledge the detection and exclude it from active counts, or `active` to reopen it. + + :param value: Must be one of ["exception", "active"]. + :type value: str + """ + + allowed_values = { + "exception", + "active", + } + EXCEPTION: ClassVar["GovernanceControlDetectionUpdateState"] + ACTIVE: ClassVar["GovernanceControlDetectionUpdateState"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceControlDetectionUpdateState.EXCEPTION = GovernanceControlDetectionUpdateState("exception") +GovernanceControlDetectionUpdateState.ACTIVE = GovernanceControlDetectionUpdateState("active") diff --git a/src/datadog_api_client/v2/model/governance_control_detections_response.py b/src/datadog_api_client/v2/model/governance_control_detections_response.py new file mode 100644 index 0000000000..ba2ba9eb32 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_control_detections_response.py @@ -0,0 +1,40 @@ +# 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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_control_detection_data import GovernanceControlDetectionData + + +class GovernanceControlDetectionsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_control_detection_data import GovernanceControlDetectionData + + return { + "data": ([GovernanceControlDetectionData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[GovernanceControlDetectionData], **kwargs): + """ + A list of governance control detections. + + :param data: An array of governance control detection resources. + :type data: [GovernanceControlDetectionData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/governance_control_mitigation_definition.py b/src/datadog_api_client/v2/model/governance_control_mitigation_definition.py index 39fcd7f6ef..f5fbaf8660 100644 --- a/src/datadog_api_client/v2/model/governance_control_mitigation_definition.py +++ b/src/datadog_api_client/v2/model/governance_control_mitigation_definition.py @@ -3,13 +3,11 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import List, Union, TYPE_CHECKING +from typing import List, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) @@ -25,88 +23,59 @@ def openapi_types(_): ) return { - "action_verb": (str,), "description": (str,), "execution_modes": ([str],), - "feature_flags": ([str],), "id": (str,), - "manual_mitigation_warning": (str,), "permissions": ([str],), - "requires_ai": (bool,), "supported_parameters": ([GovernanceControlParameterDefinition],), "title": (str,), } attribute_map = { - "action_verb": "action_verb", "description": "description", "execution_modes": "execution_modes", - "feature_flags": "feature_flags", "id": "id", - "manual_mitigation_warning": "manual_mitigation_warning", "permissions": "permissions", - "requires_ai": "requires_ai", "supported_parameters": "supported_parameters", "title": "title", } def __init__( self_, - action_verb: str, description: str, - feature_flags: List[str], + execution_modes: List[str], id: str, - manual_mitigation_warning: str, permissions: List[str], - requires_ai: bool, supported_parameters: List[GovernanceControlParameterDefinition], title: str, - execution_modes: Union[List[str], UnsetType] = unset, **kwargs, ): """ The definition of a mitigation available for a control. - :param action_verb: The verb describing the mitigation action, such as ``revoke`` or ``delete``. - :type action_verb: str - :param description: A human-readable description of the mitigation. :type description: str :param execution_modes: The execution modes the mitigation supports, such as ``manual`` or ``automatic``. - :type execution_modes: [str], optional - - :param feature_flags: The feature flags that gate the mitigation. - :type feature_flags: [str] + :type execution_modes: [str] :param id: The unique identifier of the mitigation. :type id: str - :param manual_mitigation_warning: A warning shown to the user before applying the mitigation manually. - :type manual_mitigation_warning: str - :param permissions: The permissions required to apply the mitigation. :type permissions: [str] - :param requires_ai: Whether the mitigation requires AI to be enabled. - :type requires_ai: bool - :param supported_parameters: An array of parameter definitions. :type supported_parameters: [GovernanceControlParameterDefinition] :param title: A short, human-readable name for the mitigation. :type title: str """ - if execution_modes is not unset: - kwargs["execution_modes"] = execution_modes super().__init__(kwargs) - self_.action_verb = action_verb self_.description = description - self_.feature_flags = feature_flags + self_.execution_modes = execution_modes self_.id = id - self_.manual_mitigation_warning = manual_mitigation_warning self_.permissions = permissions - self_.requires_ai = requires_ai self_.supported_parameters = supported_parameters self_.title = title diff --git a/src/datadog_api_client/v2/model/governance_control_parameter_definition.py b/src/datadog_api_client/v2/model/governance_control_parameter_definition.py index f5d9419f56..e7dbd32d6a 100644 --- a/src/datadog_api_client/v2/model/governance_control_parameter_definition.py +++ b/src/datadog_api_client/v2/model/governance_control_parameter_definition.py @@ -39,7 +39,6 @@ def openapi_types(_): ), "description": (str,), "display_name": (str,), - "hidden": (bool,), "name": (str,), "required": (bool,), "supported_values": ([GovernanceControlSupportedValue],), @@ -50,7 +49,6 @@ def openapi_types(_): "default_value": "default_value", "description": "description", "display_name": "display_name", - "hidden": "hidden", "name": "name", "required": "required", "supported_values": "supported_values", @@ -62,7 +60,6 @@ def __init__( default_value: Any, description: str, display_name: str, - hidden: bool, name: str, required: bool, supported_values: List[GovernanceControlSupportedValue], @@ -81,9 +78,6 @@ def __init__( :param display_name: The human-readable name of the parameter. :type display_name: str - :param hidden: Whether the parameter is hidden from the UI. - :type hidden: bool - :param name: The machine-readable name of the parameter. :type name: str @@ -101,7 +95,6 @@ def __init__( self_.default_value = default_value self_.description = description self_.display_name = display_name - self_.hidden = hidden self_.name = name self_.required = required self_.supported_values = supported_values diff --git a/src/datadog_api_client/v2/model/governance_control_update_attributes.py b/src/datadog_api_client/v2/model/governance_control_update_attributes.py index 4634dbb6a6..8132ce405e 100644 --- a/src/datadog_api_client/v2/model/governance_control_update_attributes.py +++ b/src/datadog_api_client/v2/model/governance_control_update_attributes.py @@ -27,10 +27,6 @@ def openapi_types(_): "detection_parameters": (GovernanceControlParametersMap,), "mitigation_parameters": (GovernanceControlParametersMap,), "mitigation_type": (str,), - "name": (str,), - "notification_frequency": (str,), - "notification_parameters": (GovernanceControlParametersMap,), - "notification_type": (str,), } attribute_map = { @@ -38,10 +34,6 @@ def openapi_types(_): "detection_parameters": "detection_parameters", "mitigation_parameters": "mitigation_parameters", "mitigation_type": "mitigation_type", - "name": "name", - "notification_frequency": "notification_frequency", - "notification_parameters": "notification_parameters", - "notification_type": "notification_type", } def __init__( @@ -50,10 +42,6 @@ def __init__( detection_parameters: Union[GovernanceControlParametersMap, UnsetType] = unset, mitigation_parameters: Union[GovernanceControlParametersMap, UnsetType] = unset, mitigation_type: Union[str, UnsetType] = unset, - name: Union[str, UnsetType] = unset, - notification_frequency: Union[str, UnsetType] = unset, - notification_parameters: Union[GovernanceControlParametersMap, UnsetType] = unset, - notification_type: Union[str, UnsetType] = unset, **kwargs, ): """ @@ -70,18 +58,6 @@ def __init__( :param mitigation_type: The mitigation type to configure for the control. :type mitigation_type: str, optional - - :param name: A new human-readable name for the control. - :type name: str, optional - - :param notification_frequency: The notification frequency to configure for the control. - :type notification_frequency: str, optional - - :param notification_parameters: A free-form map of parameter names to their configured values. - :type notification_parameters: GovernanceControlParametersMap, optional - - :param notification_type: The notification type to configure for the control. - :type notification_type: str, optional """ if detection_frequency is not unset: kwargs["detection_frequency"] = detection_frequency @@ -91,12 +67,4 @@ def __init__( kwargs["mitigation_parameters"] = mitigation_parameters if mitigation_type is not unset: kwargs["mitigation_type"] = mitigation_type - if name is not unset: - kwargs["name"] = name - if notification_frequency is not unset: - kwargs["notification_frequency"] = notification_frequency - if notification_parameters is not unset: - kwargs["notification_parameters"] = notification_parameters - if notification_type is not unset: - kwargs["notification_type"] = notification_type super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/governance_control_update_data.py b/src/datadog_api_client/v2/model/governance_control_update_data.py index cb4377dd60..e8f35f7a97 100644 --- a/src/datadog_api_client/v2/model/governance_control_update_data.py +++ b/src/datadog_api_client/v2/model/governance_control_update_data.py @@ -26,13 +26,11 @@ def openapi_types(_): return { "attributes": (GovernanceControlUpdateAttributes,), - "id": (str,), "type": (GovernanceControlResourceType,), } attribute_map = { "attributes": "attributes", - "id": "id", "type": "type", } @@ -40,7 +38,6 @@ def __init__( self_, type: GovernanceControlResourceType, attributes: Union[GovernanceControlUpdateAttributes, UnsetType] = unset, - id: Union[str, UnsetType] = unset, **kwargs, ): """ @@ -49,16 +46,11 @@ def __init__( :param attributes: The attributes of a governance control that can be updated. Only the attributes present in the request are modified. :type attributes: GovernanceControlUpdateAttributes, optional - :param id: The unique identifier of the control. - :type id: str, optional - :param type: JSON:API resource type for a governance control. :type type: GovernanceControlResourceType """ if attributes is not unset: kwargs["attributes"] = attributes - if id is not unset: - kwargs["id"] = id super().__init__(kwargs) self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_insight_attributes.py b/src/datadog_api_client/v2/model/governance_insight_attributes.py index f591a89e3f..43dcbe0baf 100644 --- a/src/datadog_api_client/v2/model/governance_insight_attributes.py +++ b/src/datadog_api_client/v2/model/governance_insight_attributes.py @@ -8,7 +8,6 @@ from datadog_api_client.model_utils import ( ModelNormal, cached_property, - none_type, unset, UnsetType, ) @@ -16,7 +15,6 @@ if TYPE_CHECKING: from datadog_api_client.v2.model.governance_insight_audit_query import GovernanceInsightAuditQuery - from datadog_api_client.v2.model.governance_best_practice_definition import GovernanceBestPracticeDefinition from datadog_api_client.v2.model.governance_insight_event_query import GovernanceInsightEventQuery from datadog_api_client.v2.model.governance_insight_metric_query import GovernanceInsightMetricQuery from datadog_api_client.v2.model.governance_insight_percentage_query import GovernanceInsightPercentageQuery @@ -28,7 +26,6 @@ class GovernanceInsightAttributes(ModelNormal): @cached_property def openapi_types(_): from datadog_api_client.v2.model.governance_insight_audit_query import GovernanceInsightAuditQuery - from datadog_api_client.v2.model.governance_best_practice_definition import GovernanceBestPracticeDefinition from datadog_api_client.v2.model.governance_insight_event_query import GovernanceInsightEventQuery from datadog_api_client.v2.model.governance_insight_metric_query import GovernanceInsightMetricQuery from datadog_api_client.v2.model.governance_insight_percentage_query import GovernanceInsightPercentageQuery @@ -37,80 +34,57 @@ def openapi_types(_): return { "audit_query": (GovernanceInsightAuditQuery,), - "best_practice": (GovernanceBestPracticeDefinition,), - "deep_link": (str,), "description": (str,), "display_name": (str,), "event_query": (GovernanceInsightEventQuery,), "metric_query": (GovernanceInsightMetricQuery,), - "old_value": (float, none_type), "percentage_query": (GovernanceInsightPercentageQuery,), "product": (str,), "query_config": (GovernanceInsightQueryConfig,), - "sort_order": (int,), - "state": (str,), "sub_product": (str,), "time_range": (str,), "unit_name": (str,), "usage_query": (GovernanceInsightUsageQuery,), - "value": (float, none_type), } attribute_map = { "audit_query": "audit_query", - "best_practice": "best_practice", - "deep_link": "deep_link", "description": "description", "display_name": "display_name", "event_query": "event_query", "metric_query": "metric_query", - "old_value": "old_value", "percentage_query": "percentage_query", "product": "product", "query_config": "query_config", - "sort_order": "sort_order", - "state": "state", "sub_product": "sub_product", "time_range": "time_range", "unit_name": "unit_name", "usage_query": "usage_query", - "value": "value", } def __init__( self_, - audit_query: GovernanceInsightAuditQuery, - best_practice: GovernanceBestPracticeDefinition, - deep_link: str, description: str, display_name: str, - event_query: GovernanceInsightEventQuery, - metric_query: GovernanceInsightMetricQuery, - old_value: Union[float, none_type], - percentage_query: GovernanceInsightPercentageQuery, product: str, - state: str, sub_product: str, time_range: str, unit_name: str, - usage_query: GovernanceInsightUsageQuery, - value: Union[float, none_type], + audit_query: Union[GovernanceInsightAuditQuery, UnsetType] = unset, + event_query: Union[GovernanceInsightEventQuery, UnsetType] = unset, + metric_query: Union[GovernanceInsightMetricQuery, UnsetType] = unset, + percentage_query: Union[GovernanceInsightPercentageQuery, UnsetType] = unset, query_config: Union[GovernanceInsightQueryConfig, UnsetType] = unset, - sort_order: Union[int, UnsetType] = unset, + usage_query: Union[GovernanceInsightUsageQuery, UnsetType] = unset, **kwargs, ): """ - The attributes of a governance insight. + The attributes of a governance insight. Exactly one of ``metric_query`` , ``event_query`` , + ``usage_query`` , ``audit_query`` , or ``percentage_query`` is populated, depending on the data + source the insight is computed from; the rest are ``null``. :param audit_query: An audit log query used to compute an insight value. - :type audit_query: GovernanceInsightAuditQuery - - :param best_practice: The best practice associated with an insight. Populated with the first active best practice - matched to the insight; ``null`` when no best practice is attached. - :type best_practice: GovernanceBestPracticeDefinition - - :param deep_link: A relative link to the product surface where the insight can be acted upon. - :type deep_link: str + :type audit_query: GovernanceInsightAuditQuery, optional :param description: A human-readable description of what the insight measures. :type description: str @@ -119,31 +93,20 @@ def __init__( :type display_name: str :param event_query: An event query used to compute an insight value. - :type event_query: GovernanceInsightEventQuery + :type event_query: GovernanceInsightEventQuery, optional :param metric_query: A metric query used to compute an insight value. - :type metric_query: GovernanceInsightMetricQuery - - :param old_value: The value of the insight over the previous comparison window. ``null`` when values were - not requested or could not be computed. - :type old_value: float, none_type + :type metric_query: GovernanceInsightMetricQuery, optional :param percentage_query: A percentage query that computes an insight value as a ratio of two metric queries. - :type percentage_query: GovernanceInsightPercentageQuery + :type percentage_query: GovernanceInsightPercentageQuery, optional :param product: The product the insight belongs to. :type product: str - :param query_config: Query execution context that allows the frontend to execute insight queries directly. + :param query_config: Query execution context for running insight queries directly. :type query_config: GovernanceInsightQueryConfig, optional - :param sort_order: The relative order in which the insight should be displayed. - :type sort_order: int, optional - - :param state: The state of the insight. A ``critical`` insight receives extra UI treatment to draw - attention to it. - :type state: str - :param sub_product: The sub-product the insight belongs to, if any. :type sub_product: str @@ -154,30 +117,25 @@ def __init__( :type unit_name: str :param usage_query: A usage query used to compute an insight value. - :type usage_query: GovernanceInsightUsageQuery - - :param value: The current value of the insight. ``null`` when values were not requested or could not be computed. - :type value: float, none_type + :type usage_query: GovernanceInsightUsageQuery, optional """ + if audit_query is not unset: + kwargs["audit_query"] = audit_query + if event_query is not unset: + kwargs["event_query"] = event_query + if metric_query is not unset: + kwargs["metric_query"] = metric_query + if percentage_query is not unset: + kwargs["percentage_query"] = percentage_query if query_config is not unset: kwargs["query_config"] = query_config - if sort_order is not unset: - kwargs["sort_order"] = sort_order + if usage_query is not unset: + kwargs["usage_query"] = usage_query super().__init__(kwargs) - self_.audit_query = audit_query - self_.best_practice = best_practice - self_.deep_link = deep_link self_.description = description self_.display_name = display_name - self_.event_query = event_query - self_.metric_query = metric_query - self_.old_value = old_value - self_.percentage_query = percentage_query self_.product = product - self_.state = state self_.sub_product = sub_product self_.time_range = time_range self_.unit_name = unit_name - self_.usage_query = usage_query - self_.value = value diff --git a/src/datadog_api_client/v2/model/governance_insight_data.py b/src/datadog_api_client/v2/model/governance_insight_data.py index a22ed94887..9a08b1e283 100644 --- a/src/datadog_api_client/v2/model/governance_insight_data.py +++ b/src/datadog_api_client/v2/model/governance_insight_data.py @@ -40,7 +40,9 @@ def __init__( """ A governance insight resource. - :param attributes: The attributes of a governance insight. + :param attributes: The attributes of a governance insight. Exactly one of ``metric_query`` , ``event_query`` , + ``usage_query`` , ``audit_query`` , or ``percentage_query`` is populated, depending on the data + source the insight is computed from; the rest are ``null``. :type attributes: GovernanceInsightAttributes :param id: The unique identifier of the insight. diff --git a/src/datadog_api_client/v2/model/governance_insight_directionality.py b/src/datadog_api_client/v2/model/governance_insight_directionality.py new file mode 100644 index 0000000000..042fd319bb --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_directionality.py @@ -0,0 +1,41 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceInsightDirectionality(ModelSimple): + """ + Whether an increase in the insight's value is good, bad, or neutral. + + :param value: Must be one of ["neutral", "increase_better", "decrease_better"]. + :type value: str + """ + + allowed_values = { + "neutral", + "increase_better", + "decrease_better", + } + NEUTRAL: ClassVar["GovernanceInsightDirectionality"] + INCREASE_BETTER: ClassVar["GovernanceInsightDirectionality"] + DECREASE_BETTER: ClassVar["GovernanceInsightDirectionality"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceInsightDirectionality.NEUTRAL = GovernanceInsightDirectionality("neutral") +GovernanceInsightDirectionality.INCREASE_BETTER = GovernanceInsightDirectionality("increase_better") +GovernanceInsightDirectionality.DECREASE_BETTER = GovernanceInsightDirectionality("decrease_better") diff --git a/src/datadog_api_client/v2/model/governance_insight_query_config.py b/src/datadog_api_client/v2/model/governance_insight_query_config.py index fcb82af379..b4fb702167 100644 --- a/src/datadog_api_client/v2/model/governance_insight_query_config.py +++ b/src/datadog_api_client/v2/model/governance_insight_query_config.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -13,14 +13,20 @@ ) +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_insight_directionality import GovernanceInsightDirectionality + + class GovernanceInsightQueryConfig(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.governance_insight_directionality import GovernanceInsightDirectionality + return { "chart_type": (str,), "comparison_shift": (str,), "default_value": (int,), - "directionality": (str,), + "directionality": (GovernanceInsightDirectionality,), "effective_time_window_days": (int,), } @@ -38,24 +44,23 @@ def __init__( effective_time_window_days: int, chart_type: Union[str, UnsetType] = unset, default_value: Union[int, UnsetType] = unset, - directionality: Union[str, UnsetType] = unset, + directionality: Union[GovernanceInsightDirectionality, UnsetType] = unset, **kwargs, ): """ - Query execution context that allows the frontend to execute insight queries directly. + Query execution context for running insight queries directly. - :param chart_type: The chart type the frontend should use to render the insight. + :param chart_type: The chart type used to render the insight. :type chart_type: str, optional - :param comparison_shift: The window used for the previous value comparison, for example ``week`` or ``month``. + :param comparison_shift: The window used for the previous value comparison; for example, ``week`` or ``month``. :type comparison_shift: str :param default_value: The default value to display when no data is available. :type default_value: int, optional - :param directionality: Whether an increase in the value is good, bad, or neutral. One of ``neutral`` , - ``increase_better`` , or ``decrease_better``. - :type directionality: str, optional + :param directionality: Whether an increase in the insight's value is good, bad, or neutral. + :type directionality: GovernanceInsightDirectionality, optional :param effective_time_window_days: The number of days the insight value is computed over. :type effective_time_window_days: int diff --git a/src/datadog_api_client/v2/model/governance_limit_attributes.py b/src/datadog_api_client/v2/model/governance_limit_attributes.py new file mode 100644 index 0000000000..19aa1f296e --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_limit_attributes.py @@ -0,0 +1,109 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_limit_query import GovernanceLimitQuery + from datadog_api_client.v2.model.governance_limit_query_config import GovernanceLimitQueryConfig + + +class GovernanceLimitAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_limit_query import GovernanceLimitQuery + from datadog_api_client.v2.model.governance_limit_query_config import GovernanceLimitQueryConfig + + return { + "description": (str,), + "display_name": (str,), + "limit_type": (str,), + "product": (str,), + "query": (GovernanceLimitQuery,), + "query_config": (GovernanceLimitQueryConfig,), + "time_range": (str,), + "times_hit_limit": (float,), + "unit_name": (str,), + "usage_status": (str,), + } + + attribute_map = { + "description": "description", + "display_name": "display_name", + "limit_type": "limit_type", + "product": "product", + "query": "query", + "query_config": "query_config", + "time_range": "time_range", + "times_hit_limit": "times_hit_limit", + "unit_name": "unit_name", + "usage_status": "usage_status", + } + + def __init__( + self_, + description: str, + display_name: str, + limit_type: str, + product: str, + query: GovernanceLimitQuery, + query_config: GovernanceLimitQueryConfig, + time_range: str, + times_hit_limit: float, + unit_name: str, + usage_status: str, + **kwargs, + ): + """ + The attributes of a usage limit. + + :param description: A description of what the limit measures. + :type description: str + + :param display_name: The human-readable name of the limit. + :type display_name: str + + :param limit_type: The type of limit, such as a rate limit or a usage limit. + :type limit_type: str + + :param product: The Datadog product the limit belongs to. + :type product: str + + :param query: A metric query used to compute usage against a limit. + :type query: GovernanceLimitQuery + + :param query_config: The query execution context used to visualize a limit and its usage. + :type query_config: GovernanceLimitQueryConfig + + :param time_range: The time range over which usage against the limit is measured. + :type time_range: str + + :param times_hit_limit: The number of times usage has reached the limit within the measured time range. + :type times_hit_limit: float + + :param unit_name: The unit in which the limit and its usage are measured. + :type unit_name: str + + :param usage_status: The current usage status of the limit relative to its threshold. + :type usage_status: str + """ + super().__init__(kwargs) + + self_.description = description + self_.display_name = display_name + self_.limit_type = limit_type + self_.product = product + self_.query = query + self_.query_config = query_config + self_.time_range = time_range + self_.times_hit_limit = times_hit_limit + self_.unit_name = unit_name + self_.usage_status = usage_status diff --git a/src/datadog_api_client/v2/model/governance_limit_data.py b/src/datadog_api_client/v2/model/governance_limit_data.py new file mode 100644 index 0000000000..475db00f76 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_limit_data.py @@ -0,0 +1,54 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_limit_attributes import GovernanceLimitAttributes + from datadog_api_client.v2.model.governance_limit_resource_type import GovernanceLimitResourceType + + +class GovernanceLimitData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_limit_attributes import GovernanceLimitAttributes + from datadog_api_client.v2.model.governance_limit_resource_type import GovernanceLimitResourceType + + return { + "attributes": (GovernanceLimitAttributes,), + "id": (str,), + "type": (GovernanceLimitResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: GovernanceLimitAttributes, id: str, type: GovernanceLimitResourceType, **kwargs): + """ + A usage limit resource. + + :param attributes: The attributes of a usage limit. + :type attributes: GovernanceLimitAttributes + + :param id: The unique identifier of the limit. + :type id: str + + :param type: Limit resource type. + :type type: GovernanceLimitResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_limit_query.py b/src/datadog_api_client/v2/model/governance_limit_query.py new file mode 100644 index 0000000000..95b77e5cbc --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_limit_query.py @@ -0,0 +1,45 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class GovernanceLimitQuery(ModelNormal): + @cached_property + def openapi_types(_): + return { + "query": (str,), + "reducer": (str,), + "source": (str,), + } + + attribute_map = { + "query": "query", + "reducer": "reducer", + "source": "source", + } + + def __init__(self_, query: str, reducer: str, source: str, **kwargs): + """ + A metric query used to compute usage against a limit. + + :param query: The metric query expression used to compute the limit value. + :type query: str + + :param reducer: How the query results are aggregated into a single value (for example, sum, max, or avg). + :type reducer: str + + :param source: The data source used to evaluate the metric query, such as metrics or events. + :type source: str + """ + super().__init__(kwargs) + + self_.query = query + self_.reducer = reducer + self_.source = source diff --git a/src/datadog_api_client/v2/model/governance_limit_query_config.py b/src/datadog_api_client/v2/model/governance_limit_query_config.py new file mode 100644 index 0000000000..87c860ce1d --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_limit_query_config.py @@ -0,0 +1,72 @@ +# 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 GovernanceLimitQueryConfig(ModelNormal): + @cached_property + def openapi_types(_): + return { + "chart_type": (str,), + "comparison_shift": (str,), + "default_value": (int,), + "directionality": (str,), + "effective_time_window_days": (int,), + } + + attribute_map = { + "chart_type": "chart_type", + "comparison_shift": "comparison_shift", + "default_value": "default_value", + "directionality": "directionality", + "effective_time_window_days": "effective_time_window_days", + } + + def __init__( + self_, + chart_type: Union[str, UnsetType] = unset, + comparison_shift: Union[str, UnsetType] = unset, + default_value: Union[int, UnsetType] = unset, + directionality: Union[str, UnsetType] = unset, + effective_time_window_days: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + The query execution context used to visualize a limit and its usage. + + :param chart_type: The chart type used to visualize the limit and its usage. + :type chart_type: str, optional + + :param comparison_shift: The time shift applied to compare current usage against a prior period. + :type comparison_shift: str, optional + + :param default_value: The default value used for the limit when no explicit value is configured. + :type default_value: int, optional + + :param directionality: The direction in which usage approaches the limit, indicating whether higher or lower values are closer to the limit. + :type directionality: str, optional + + :param effective_time_window_days: The number of days of data the limit query evaluates over. + :type effective_time_window_days: int, optional + """ + if chart_type is not unset: + kwargs["chart_type"] = chart_type + if comparison_shift is not unset: + kwargs["comparison_shift"] = comparison_shift + if default_value is not unset: + kwargs["default_value"] = default_value + if directionality is not unset: + kwargs["directionality"] = directionality + if effective_time_window_days is not unset: + kwargs["effective_time_window_days"] = effective_time_window_days + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/governance_limit_resource_type.py b/src/datadog_api_client/v2/model/governance_limit_resource_type.py new file mode 100644 index 0000000000..ed2f4e5617 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_limit_resource_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceLimitResourceType(ModelSimple): + """ + Limit resource type. + + :param value: If omitted defaults to "limit". Must be one of ["limit"]. + :type value: str + """ + + allowed_values = { + "limit", + } + LIMIT: ClassVar["GovernanceLimitResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceLimitResourceType.LIMIT = GovernanceLimitResourceType("limit") diff --git a/src/datadog_api_client/v2/model/governance_limits_response.py b/src/datadog_api_client/v2/model/governance_limits_response.py new file mode 100644 index 0000000000..f6ee605cb8 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_limits_response.py @@ -0,0 +1,40 @@ +# 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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_limit_data import GovernanceLimitData + + +class GovernanceLimitsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_limit_data import GovernanceLimitData + + return { + "data": ([GovernanceLimitData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[GovernanceLimitData], **kwargs): + """ + A list of usage limits. + + :param data: An array of usage limit resources. + :type data: [GovernanceLimitData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/governance_mitigation_request.py b/src/datadog_api_client/v2/model/governance_mitigation_request.py new file mode 100644 index 0000000000..6c66ec5229 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_mitigation_request.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_mitigation_request_data import GovernanceMitigationRequestData + + +class GovernanceMitigationRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_mitigation_request_data import GovernanceMitigationRequestData + + return { + "data": (GovernanceMitigationRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: GovernanceMitigationRequestData, **kwargs): + """ + A request to mitigate a set of governance detections. + + :param data: The data of a governance mitigation request. + :type data: GovernanceMitigationRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/governance_mitigation_request_attributes.py b/src/datadog_api_client/v2/model/governance_mitigation_request_attributes.py new file mode 100644 index 0000000000..7c1a3aec03 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_mitigation_request_attributes.py @@ -0,0 +1,70 @@ +# 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 List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_control_parameters_map import GovernanceControlParametersMap + + +class GovernanceMitigationRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_control_parameters_map import GovernanceControlParametersMap + + return { + "detection_ids": ([str],), + "detection_type": (str,), + "mitigation_parameters": (GovernanceControlParametersMap,), + "mitigation_type": (str,), + } + + attribute_map = { + "detection_ids": "detection_ids", + "detection_type": "detection_type", + "mitigation_parameters": "mitigation_parameters", + "mitigation_type": "mitigation_type", + } + + def __init__( + self_, + detection_ids: Union[List[str], UnsetType] = unset, + detection_type: Union[str, UnsetType] = unset, + mitigation_parameters: Union[GovernanceControlParametersMap, UnsetType] = unset, + mitigation_type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of a governance mitigation request. + + :param detection_ids: The identifiers of the detections to mitigate in this request. + :type detection_ids: [str], optional + + :param detection_type: The detection type whose detections should be mitigated. + :type detection_type: str, optional + + :param mitigation_parameters: A free-form map of parameter names to their configured values. + :type mitigation_parameters: GovernanceControlParametersMap, optional + + :param mitigation_type: The mitigation to apply to the selected detections. Defaults to the control's configured mitigation when omitted. + :type mitigation_type: str, optional + """ + if detection_ids is not unset: + kwargs["detection_ids"] = detection_ids + if detection_type is not unset: + kwargs["detection_type"] = detection_type + if mitigation_parameters is not unset: + kwargs["mitigation_parameters"] = mitigation_parameters + if mitigation_type is not unset: + kwargs["mitigation_type"] = mitigation_type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/governance_mitigation_request_data.py b/src/datadog_api_client/v2/model/governance_mitigation_request_data.py new file mode 100644 index 0000000000..b1e16558af --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_mitigation_request_data.py @@ -0,0 +1,64 @@ +# 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.governance_mitigation_request_attributes import ( + GovernanceMitigationRequestAttributes, + ) + from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, + ) + + +class GovernanceMitigationRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_mitigation_request_attributes import ( + GovernanceMitigationRequestAttributes, + ) + from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, + ) + + return { + "attributes": (GovernanceMitigationRequestAttributes,), + "type": (GovernanceControlDetectionResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + type: GovernanceControlDetectionResourceType, + attributes: Union[GovernanceMitigationRequestAttributes, UnsetType] = unset, + **kwargs, + ): + """ + The data of a governance mitigation request. + + :param attributes: The attributes of a governance mitigation request. + :type attributes: GovernanceMitigationRequestAttributes, optional + + :param type: Governance control detection resource type. + :type type: GovernanceControlDetectionResourceType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_notification_settings_attributes.py b/src/datadog_api_client/v2/model/governance_notification_settings_attributes.py new file mode 100644 index 0000000000..d27eb4952b --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_notification_settings_attributes.py @@ -0,0 +1,33 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class GovernanceNotificationSettingsAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "assignment_notifications_enabled": (bool,), + } + + attribute_map = { + "assignment_notifications_enabled": "assignment_notifications_enabled", + } + + def __init__(self_, assignment_notifications_enabled: bool, **kwargs): + """ + The attributes of the organization-wide governance notification settings. + + :param assignment_notifications_enabled: Whether notifications are sent to users when detections are assigned to them. + :type assignment_notifications_enabled: bool + """ + super().__init__(kwargs) + + self_.assignment_notifications_enabled = assignment_notifications_enabled diff --git a/src/datadog_api_client/v2/model/governance_notification_settings_data.py b/src/datadog_api_client/v2/model/governance_notification_settings_data.py new file mode 100644 index 0000000000..8b784e3d04 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_notification_settings_data.py @@ -0,0 +1,68 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_notification_settings_attributes import ( + GovernanceNotificationSettingsAttributes, + ) + from datadog_api_client.v2.model.governance_notification_settings_resource_type import ( + GovernanceNotificationSettingsResourceType, + ) + + +class GovernanceNotificationSettingsData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_notification_settings_attributes import ( + GovernanceNotificationSettingsAttributes, + ) + from datadog_api_client.v2.model.governance_notification_settings_resource_type import ( + GovernanceNotificationSettingsResourceType, + ) + + return { + "attributes": (GovernanceNotificationSettingsAttributes,), + "id": (str,), + "type": (GovernanceNotificationSettingsResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: GovernanceNotificationSettingsAttributes, + id: str, + type: GovernanceNotificationSettingsResourceType, + **kwargs, + ): + """ + A governance notification settings resource. + + :param attributes: The attributes of the organization-wide governance notification settings. + :type attributes: GovernanceNotificationSettingsAttributes + + :param id: The unique identifier of the organization the notification settings apply to. + :type id: str + + :param type: Governance notification settings resource type. + :type type: GovernanceNotificationSettingsResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_notification_settings_resource_type.py b/src/datadog_api_client/v2/model/governance_notification_settings_resource_type.py new file mode 100644 index 0000000000..4d99292b42 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_notification_settings_resource_type.py @@ -0,0 +1,37 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceNotificationSettingsResourceType(ModelSimple): + """ + Governance notification settings resource type. + + :param value: If omitted defaults to "governance_notification_settings". Must be one of ["governance_notification_settings"]. + :type value: str + """ + + allowed_values = { + "governance_notification_settings", + } + GOVERNANCE_NOTIFICATION_SETTINGS: ClassVar["GovernanceNotificationSettingsResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceNotificationSettingsResourceType.GOVERNANCE_NOTIFICATION_SETTINGS = ( + GovernanceNotificationSettingsResourceType("governance_notification_settings") +) diff --git a/src/datadog_api_client/v2/model/governance_notification_settings_response.py b/src/datadog_api_client/v2/model/governance_notification_settings_response.py new file mode 100644 index 0000000000..47270f2b87 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_notification_settings_response.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_notification_settings_data import GovernanceNotificationSettingsData + + +class GovernanceNotificationSettingsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_notification_settings_data import GovernanceNotificationSettingsData + + return { + "data": (GovernanceNotificationSettingsData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: GovernanceNotificationSettingsData, **kwargs): + """ + The organization-wide governance notification settings. + + :param data: A governance notification settings resource. + :type data: GovernanceNotificationSettingsData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/governance_notification_settings_update_attributes.py b/src/datadog_api_client/v2/model/governance_notification_settings_update_attributes.py new file mode 100644 index 0000000000..ba9d259f36 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_notification_settings_update_attributes.py @@ -0,0 +1,36 @@ +# 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 GovernanceNotificationSettingsUpdateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "assignment_notifications_enabled": (bool,), + } + + attribute_map = { + "assignment_notifications_enabled": "assignment_notifications_enabled", + } + + def __init__(self_, assignment_notifications_enabled: Union[bool, UnsetType] = unset, **kwargs): + """ + The attributes of the governance notification settings that can be updated. Only the attributes present in the request are modified. + + :param assignment_notifications_enabled: Whether notifications are sent to users when detections are assigned to them. + :type assignment_notifications_enabled: bool, optional + """ + if assignment_notifications_enabled is not unset: + kwargs["assignment_notifications_enabled"] = assignment_notifications_enabled + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/governance_notification_settings_update_data.py b/src/datadog_api_client/v2/model/governance_notification_settings_update_data.py new file mode 100644 index 0000000000..bd31931259 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_notification_settings_update_data.py @@ -0,0 +1,64 @@ +# 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.governance_notification_settings_update_attributes import ( + GovernanceNotificationSettingsUpdateAttributes, + ) + from datadog_api_client.v2.model.governance_notification_settings_resource_type import ( + GovernanceNotificationSettingsResourceType, + ) + + +class GovernanceNotificationSettingsUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_notification_settings_update_attributes import ( + GovernanceNotificationSettingsUpdateAttributes, + ) + from datadog_api_client.v2.model.governance_notification_settings_resource_type import ( + GovernanceNotificationSettingsResourceType, + ) + + return { + "attributes": (GovernanceNotificationSettingsUpdateAttributes,), + "type": (GovernanceNotificationSettingsResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + type: GovernanceNotificationSettingsResourceType, + attributes: Union[GovernanceNotificationSettingsUpdateAttributes, UnsetType] = unset, + **kwargs, + ): + """ + The data of a governance notification settings update request. + + :param attributes: The attributes of the governance notification settings that can be updated. Only the attributes present in the request are modified. + :type attributes: GovernanceNotificationSettingsUpdateAttributes, optional + + :param type: Governance notification settings resource type. + :type type: GovernanceNotificationSettingsResourceType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_notification_settings_update_request.py b/src/datadog_api_client/v2/model/governance_notification_settings_update_request.py new file mode 100644 index 0000000000..a1dcc2739c --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_notification_settings_update_request.py @@ -0,0 +1,44 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_notification_settings_update_data import ( + GovernanceNotificationSettingsUpdateData, + ) + + +class GovernanceNotificationSettingsUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_notification_settings_update_data import ( + GovernanceNotificationSettingsUpdateData, + ) + + return { + "data": (GovernanceNotificationSettingsUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: GovernanceNotificationSettingsUpdateData, **kwargs): + """ + A request to update the organization-wide governance notification settings. + + :param data: The data of a governance notification settings update request. + :type data: GovernanceNotificationSettingsUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/governance_resource_limit_attributes.py b/src/datadog_api_client/v2/model/governance_resource_limit_attributes.py new file mode 100644 index 0000000000..82f8d753ad --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_resource_limit_attributes.py @@ -0,0 +1,130 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_limit_query import GovernanceLimitQuery + from datadog_api_client.v2.model.governance_limit_query_config import GovernanceLimitQueryConfig + + +class GovernanceResourceLimitAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_limit_query import GovernanceLimitQuery + from datadog_api_client.v2.model.governance_limit_query_config import GovernanceLimitQueryConfig + + return { + "current_limit": (float,), + "current_value": (float,), + "default_current_value": (float,), + "default_limit_value": (float,), + "description": (str,), + "display_name": (str,), + "limit_query": (GovernanceLimitQuery,), + "product": (str,), + "query": (GovernanceLimitQuery,), + "query_config": (GovernanceLimitQueryConfig,), + "time_range": (str,), + "unit_name": (str,), + "usage_status": (str,), + } + + attribute_map = { + "current_limit": "current_limit", + "current_value": "current_value", + "default_current_value": "default_current_value", + "default_limit_value": "default_limit_value", + "description": "description", + "display_name": "display_name", + "limit_query": "limit_query", + "product": "product", + "query": "query", + "query_config": "query_config", + "time_range": "time_range", + "unit_name": "unit_name", + "usage_status": "usage_status", + } + + def __init__( + self_, + current_limit: float, + current_value: float, + default_current_value: float, + default_limit_value: float, + description: str, + display_name: str, + limit_query: GovernanceLimitQuery, + product: str, + query: GovernanceLimitQuery, + query_config: GovernanceLimitQueryConfig, + time_range: str, + unit_name: str, + usage_status: str, + **kwargs, + ): + """ + The attributes of a governance resource limit. + + :param current_limit: The current limit configured for the resource. + :type current_limit: float + + :param current_value: The current value of the resource. + :type current_value: float + + :param default_current_value: The default current value used when the resource value cannot be computed from the query. + :type default_current_value: float + + :param default_limit_value: The default limit value used when the limit cannot be computed from the query. + :type default_limit_value: float + + :param description: A description of what the resource limit measures. + :type description: str + + :param display_name: The human-readable name of the resource limit. + :type display_name: str + + :param limit_query: A metric query used to compute usage against a limit. + :type limit_query: GovernanceLimitQuery + + :param product: The Datadog product the resource limit belongs to. + :type product: str + + :param query: A metric query used to compute usage against a limit. + :type query: GovernanceLimitQuery + + :param query_config: The query execution context used to visualize a limit and its usage. + :type query_config: GovernanceLimitQueryConfig + + :param time_range: The time range over which the resource value is measured. + :type time_range: str + + :param unit_name: The unit in which the resource value and limit are measured. + :type unit_name: str + + :param usage_status: The current usage status of the resource relative to its limit. + :type usage_status: str + """ + super().__init__(kwargs) + + self_.current_limit = current_limit + self_.current_value = current_value + self_.default_current_value = default_current_value + self_.default_limit_value = default_limit_value + self_.description = description + self_.display_name = display_name + self_.limit_query = limit_query + self_.product = product + self_.query = query + self_.query_config = query_config + self_.time_range = time_range + self_.unit_name = unit_name + self_.usage_status = usage_status diff --git a/src/datadog_api_client/v2/model/governance_resource_limit_data.py b/src/datadog_api_client/v2/model/governance_resource_limit_data.py new file mode 100644 index 0000000000..9d1f832ccc --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_resource_limit_data.py @@ -0,0 +1,62 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_resource_limit_attributes import GovernanceResourceLimitAttributes + from datadog_api_client.v2.model.governance_resource_limit_resource_type import GovernanceResourceLimitResourceType + + +class GovernanceResourceLimitData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_resource_limit_attributes import GovernanceResourceLimitAttributes + from datadog_api_client.v2.model.governance_resource_limit_resource_type import ( + GovernanceResourceLimitResourceType, + ) + + return { + "attributes": (GovernanceResourceLimitAttributes,), + "id": (str,), + "type": (GovernanceResourceLimitResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: GovernanceResourceLimitAttributes, + id: str, + type: GovernanceResourceLimitResourceType, + **kwargs, + ): + """ + A governance resource limit resource. + + :param attributes: The attributes of a governance resource limit. + :type attributes: GovernanceResourceLimitAttributes + + :param id: The unique identifier of the resource limit. + :type id: str + + :param type: Resource limit resource type. + :type type: GovernanceResourceLimitResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_resource_limit_resource_type.py b/src/datadog_api_client/v2/model/governance_resource_limit_resource_type.py new file mode 100644 index 0000000000..32baaeeb30 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_resource_limit_resource_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GovernanceResourceLimitResourceType(ModelSimple): + """ + Resource limit resource type. + + :param value: If omitted defaults to "resource-limit". Must be one of ["resource-limit"]. + :type value: str + """ + + allowed_values = { + "resource-limit", + } + RESOURCE_LIMIT: ClassVar["GovernanceResourceLimitResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceResourceLimitResourceType.RESOURCE_LIMIT = GovernanceResourceLimitResourceType("resource-limit") diff --git a/src/datadog_api_client/v2/model/governance_resource_limits_response.py b/src/datadog_api_client/v2/model/governance_resource_limits_response.py new file mode 100644 index 0000000000..72726d7ef6 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_resource_limits_response.py @@ -0,0 +1,40 @@ +# 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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.governance_resource_limit_data import GovernanceResourceLimitData + + +class GovernanceResourceLimitsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_resource_limit_data import GovernanceResourceLimitData + + return { + "data": ([GovernanceResourceLimitData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[GovernanceResourceLimitData], **kwargs): + """ + A list of governance resource limits. + + :param data: An array of governance resource limit resources. + :type data: [GovernanceResourceLimitData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 9a2c10edc0..e3669e44bf 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1514,6 +1514,22 @@ from datadog_api_client.v2.model.containers_response import ContainersResponse from datadog_api_client.v2.model.containers_response_links import ContainersResponseLinks from datadog_api_client.v2.model.content_encoding import ContentEncoding +from datadog_api_client.v2.model.control_notification_event_setting import ControlNotificationEventSetting +from datadog_api_client.v2.model.control_notification_settings_attributes import ControlNotificationSettingsAttributes +from datadog_api_client.v2.model.control_notification_settings_data import ControlNotificationSettingsData +from datadog_api_client.v2.model.control_notification_settings_resource_type import ( + ControlNotificationSettingsResourceType, +) +from datadog_api_client.v2.model.control_notification_settings_response import ControlNotificationSettingsResponse +from datadog_api_client.v2.model.control_notification_settings_update_attributes import ( + ControlNotificationSettingsUpdateAttributes, +) +from datadog_api_client.v2.model.control_notification_settings_update_data import ControlNotificationSettingsUpdateData +from datadog_api_client.v2.model.control_notification_settings_update_request import ( + ControlNotificationSettingsUpdateRequest, +) +from datadog_api_client.v2.model.control_notification_target import ControlNotificationTarget +from datadog_api_client.v2.model.control_notification_target_type import ControlNotificationTargetType from datadog_api_client.v2.model.convert_job_results_to_signals_attributes import ConvertJobResultsToSignalsAttributes from datadog_api_client.v2.model.convert_job_results_to_signals_data import ConvertJobResultsToSignalsData from datadog_api_client.v2.model.convert_job_results_to_signals_data_type import ConvertJobResultsToSignalsDataType @@ -3329,9 +3345,31 @@ from datadog_api_client.v2.model.google_docs_postmortem_settings import GoogleDocsPostmortemSettings from datadog_api_client.v2.model.google_meet_configuration_reference import GoogleMeetConfigurationReference from datadog_api_client.v2.model.google_meet_configuration_reference_data import GoogleMeetConfigurationReferenceData -from datadog_api_client.v2.model.governance_best_practice_definition import GovernanceBestPracticeDefinition +from datadog_api_client.v2.model.governance_config_attributes import GovernanceConfigAttributes +from datadog_api_client.v2.model.governance_config_data import GovernanceConfigData +from datadog_api_client.v2.model.governance_config_response import GovernanceConfigResponse +from datadog_api_client.v2.model.governance_console_config_resource_type import GovernanceConsoleConfigResourceType from datadog_api_client.v2.model.governance_control_attributes import GovernanceControlAttributes from datadog_api_client.v2.model.governance_control_data import GovernanceControlData +from datadog_api_client.v2.model.governance_control_detection_assignment_source import ( + GovernanceControlDetectionAssignmentSource, +) +from datadog_api_client.v2.model.governance_control_detection_attributes import GovernanceControlDetectionAttributes +from datadog_api_client.v2.model.governance_control_detection_data import GovernanceControlDetectionData +from datadog_api_client.v2.model.governance_control_detection_resource_type import ( + GovernanceControlDetectionResourceType, +) +from datadog_api_client.v2.model.governance_control_detection_response import GovernanceControlDetectionResponse +from datadog_api_client.v2.model.governance_control_detection_state import GovernanceControlDetectionState +from datadog_api_client.v2.model.governance_control_detection_update_attributes import ( + GovernanceControlDetectionUpdateAttributes, +) +from datadog_api_client.v2.model.governance_control_detection_update_data import GovernanceControlDetectionUpdateData +from datadog_api_client.v2.model.governance_control_detection_update_request import ( + GovernanceControlDetectionUpdateRequest, +) +from datadog_api_client.v2.model.governance_control_detection_update_state import GovernanceControlDetectionUpdateState +from datadog_api_client.v2.model.governance_control_detections_response import GovernanceControlDetectionsResponse from datadog_api_client.v2.model.governance_control_mitigation_definition import GovernanceControlMitigationDefinition from datadog_api_client.v2.model.governance_control_parameter_definition import GovernanceControlParameterDefinition from datadog_api_client.v2.model.governance_control_parameters_map import GovernanceControlParametersMap @@ -3346,6 +3384,7 @@ from datadog_api_client.v2.model.governance_insight_audit_compute import GovernanceInsightAuditCompute from datadog_api_client.v2.model.governance_insight_audit_query import GovernanceInsightAuditQuery from datadog_api_client.v2.model.governance_insight_data import GovernanceInsightData +from datadog_api_client.v2.model.governance_insight_directionality import GovernanceInsightDirectionality from datadog_api_client.v2.model.governance_insight_event_compute import GovernanceInsightEventCompute from datadog_api_client.v2.model.governance_insight_event_query import GovernanceInsightEventQuery from datadog_api_client.v2.model.governance_insight_metric_query import GovernanceInsightMetricQuery @@ -3354,6 +3393,36 @@ from datadog_api_client.v2.model.governance_insight_resource_type import GovernanceInsightResourceType from datadog_api_client.v2.model.governance_insight_usage_query import GovernanceInsightUsageQuery from datadog_api_client.v2.model.governance_insights_response import GovernanceInsightsResponse +from datadog_api_client.v2.model.governance_limit_attributes import GovernanceLimitAttributes +from datadog_api_client.v2.model.governance_limit_data import GovernanceLimitData +from datadog_api_client.v2.model.governance_limit_query import GovernanceLimitQuery +from datadog_api_client.v2.model.governance_limit_query_config import GovernanceLimitQueryConfig +from datadog_api_client.v2.model.governance_limit_resource_type import GovernanceLimitResourceType +from datadog_api_client.v2.model.governance_limits_response import GovernanceLimitsResponse +from datadog_api_client.v2.model.governance_mitigation_request import GovernanceMitigationRequest +from datadog_api_client.v2.model.governance_mitigation_request_attributes import GovernanceMitigationRequestAttributes +from datadog_api_client.v2.model.governance_mitigation_request_data import GovernanceMitigationRequestData +from datadog_api_client.v2.model.governance_notification_settings_attributes import ( + GovernanceNotificationSettingsAttributes, +) +from datadog_api_client.v2.model.governance_notification_settings_data import GovernanceNotificationSettingsData +from datadog_api_client.v2.model.governance_notification_settings_resource_type import ( + GovernanceNotificationSettingsResourceType, +) +from datadog_api_client.v2.model.governance_notification_settings_response import GovernanceNotificationSettingsResponse +from datadog_api_client.v2.model.governance_notification_settings_update_attributes import ( + GovernanceNotificationSettingsUpdateAttributes, +) +from datadog_api_client.v2.model.governance_notification_settings_update_data import ( + GovernanceNotificationSettingsUpdateData, +) +from datadog_api_client.v2.model.governance_notification_settings_update_request import ( + GovernanceNotificationSettingsUpdateRequest, +) +from datadog_api_client.v2.model.governance_resource_limit_attributes import GovernanceResourceLimitAttributes +from datadog_api_client.v2.model.governance_resource_limit_data import GovernanceResourceLimitData +from datadog_api_client.v2.model.governance_resource_limit_resource_type import GovernanceResourceLimitResourceType +from datadog_api_client.v2.model.governance_resource_limits_response import GovernanceResourceLimitsResponse from datadog_api_client.v2.model.grey_noise_api_key import GreyNoiseAPIKey from datadog_api_client.v2.model.grey_noise_api_key_type import GreyNoiseAPIKeyType from datadog_api_client.v2.model.grey_noise_api_key_update import GreyNoiseAPIKeyUpdate @@ -11515,6 +11584,16 @@ "ContainersResponse", "ContainersResponseLinks", "ContentEncoding", + "ControlNotificationEventSetting", + "ControlNotificationSettingsAttributes", + "ControlNotificationSettingsData", + "ControlNotificationSettingsResourceType", + "ControlNotificationSettingsResponse", + "ControlNotificationSettingsUpdateAttributes", + "ControlNotificationSettingsUpdateData", + "ControlNotificationSettingsUpdateRequest", + "ControlNotificationTarget", + "ControlNotificationTargetType", "ConvertJobResultsToSignalsAttributes", "ConvertJobResultsToSignalsData", "ConvertJobResultsToSignalsDataType", @@ -12878,9 +12957,23 @@ "GoogleDocsPostmortemSettings", "GoogleMeetConfigurationReference", "GoogleMeetConfigurationReferenceData", - "GovernanceBestPracticeDefinition", + "GovernanceConfigAttributes", + "GovernanceConfigData", + "GovernanceConfigResponse", + "GovernanceConsoleConfigResourceType", "GovernanceControlAttributes", "GovernanceControlData", + "GovernanceControlDetectionAssignmentSource", + "GovernanceControlDetectionAttributes", + "GovernanceControlDetectionData", + "GovernanceControlDetectionResourceType", + "GovernanceControlDetectionResponse", + "GovernanceControlDetectionState", + "GovernanceControlDetectionUpdateAttributes", + "GovernanceControlDetectionUpdateData", + "GovernanceControlDetectionUpdateRequest", + "GovernanceControlDetectionUpdateState", + "GovernanceControlDetectionsResponse", "GovernanceControlMitigationDefinition", "GovernanceControlParameterDefinition", "GovernanceControlParametersMap", @@ -12895,6 +12988,7 @@ "GovernanceInsightAuditCompute", "GovernanceInsightAuditQuery", "GovernanceInsightData", + "GovernanceInsightDirectionality", "GovernanceInsightEventCompute", "GovernanceInsightEventQuery", "GovernanceInsightMetricQuery", @@ -12903,6 +12997,26 @@ "GovernanceInsightResourceType", "GovernanceInsightUsageQuery", "GovernanceInsightsResponse", + "GovernanceLimitAttributes", + "GovernanceLimitData", + "GovernanceLimitQuery", + "GovernanceLimitQueryConfig", + "GovernanceLimitResourceType", + "GovernanceLimitsResponse", + "GovernanceMitigationRequest", + "GovernanceMitigationRequestAttributes", + "GovernanceMitigationRequestData", + "GovernanceNotificationSettingsAttributes", + "GovernanceNotificationSettingsData", + "GovernanceNotificationSettingsResourceType", + "GovernanceNotificationSettingsResponse", + "GovernanceNotificationSettingsUpdateAttributes", + "GovernanceNotificationSettingsUpdateData", + "GovernanceNotificationSettingsUpdateRequest", + "GovernanceResourceLimitAttributes", + "GovernanceResourceLimitData", + "GovernanceResourceLimitResourceType", + "GovernanceResourceLimitsResponse", "GreyNoiseAPIKey", "GreyNoiseAPIKeyType", "GreyNoiseAPIKeyUpdate", diff --git a/tests/v2/features/governance_console.feature b/tests/v2/features/governance_console.feature new file mode 100644 index 0000000000..07f6d64b51 --- /dev/null +++ b/tests/v2/features/governance_console.feature @@ -0,0 +1,287 @@ +@endpoint(governance-console) @endpoint(governance-console-v2) +Feature: Governance Console + The Governance Console finds issues that build up across a Datadog + organization over time, such as API keys nobody uses, users who no longer + need access, or custom metrics that are never queried, and tracks them + through to a fix. These endpoints allow you to: - Read insights: + measures of how your organization uses Datadog, each with the query behind + it. - Configure controls: the rules deciding how one kind of issue is + found and what is done about it. - Act on detections: the issues a control + found. Assign, defer, accept as an exception, or fix. - Manage settings: + organization-wide configuration, usage and resource limits, and + notifications. See the [Governance Console + page](https://docs.datadoghq.com/account_management/governance_console/) + for more information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "GovernanceConsole" API + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "Bad Request" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "Not Found" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "OK" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "Bad Request" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "Not Found" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "OK" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get control notification settings returns "Bad Request" response + Given operation "GetGovernanceControlNotificationSettings" enabled + And new "GetGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get control notification settings returns "OK" response + Given operation "GetGovernanceControlNotificationSettings" enabled + And new "GetGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get notification settings returns "Bad Request" response + Given operation "GetGovernanceNotificationSettings" enabled + And new "GetGovernanceNotificationSettings" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get notification settings returns "OK" response + Given operation "GetGovernanceNotificationSettings" enabled + And new "GetGovernanceNotificationSettings" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get the Governance Console configuration returns "Bad Request" response + Given operation "GetGovernanceConfig" enabled + And new "GetGovernanceConfig" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get the Governance Console configuration returns "OK" response + Given operation "GetGovernanceConfig" enabled + And new "GetGovernanceConfig" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List control detections returns "Bad Request" response + Given operation "ListGovernanceControlDetections" enabled + And new "ListGovernanceControlDetections" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List control detections returns "OK" response + Given operation "ListGovernanceControlDetections" enabled + And new "ListGovernanceControlDetections" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List controls returns "Bad Request" response + Given operation "ListGovernanceControls" enabled + And new "ListGovernanceControls" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List controls returns "OK" response + Given operation "ListGovernanceControls" enabled + And new "ListGovernanceControls" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List insights returns "Bad Request" response + Given operation "ListGovernanceInsights" enabled + And new "ListGovernanceInsights" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List insights returns "OK" response + Given operation "ListGovernanceInsights" enabled + And new "ListGovernanceInsights" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List resource limits returns "Bad Request" response + Given operation "ListGovernanceResourceLimits" enabled + And new "ListGovernanceResourceLimits" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List resource limits returns "OK" response + Given operation "ListGovernanceResourceLimits" enabled + And new "ListGovernanceResourceLimits" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List usage limits returns "Bad Request" response + Given operation "ListGovernanceLimits" enabled + And new "ListGovernanceLimits" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List usage limits returns "OK" response + Given operation "ListGovernanceLimits" enabled + And new "ListGovernanceLimits" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Mitigate detections returns "Accepted" response + Given operation "MitigateGovernanceDetections" enabled + And new "MitigateGovernanceDetections" request + And body with value {"data": {"attributes": {"detection_ids": ["3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d"], "detection_type": "unused_api_keys", "mitigation_type": "revoke_api_key"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Mitigate detections returns "Bad Request" response + Given operation "MitigateGovernanceDetections" enabled + And new "MitigateGovernanceDetections" request + And body with value {"data": {"attributes": {"detection_ids": ["3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d"], "detection_type": "unused_api_keys", "mitigation_type": "revoke_api_key"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "Bad Request" response + 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"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "Not Found" response + 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"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "OK" response + 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"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "Bad Request" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "Not Found" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "OK" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update control notification settings returns "Bad Request" response + Given operation "UpdateGovernanceControlNotificationSettings" enabled + And new "UpdateGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"event_settings": [{"enabled": true, "event_type": "new_detection", "targets": [{"handle": "#governance-alerts", "type": "slack"}]}]}, "type": "control_notification_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update control notification settings returns "OK" response + Given operation "UpdateGovernanceControlNotificationSettings" enabled + And new "UpdateGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"event_settings": [{"enabled": true, "event_type": "new_detection", "targets": [{"handle": "#governance-alerts", "type": "slack"}]}]}, "type": "control_notification_settings"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update notification settings returns "Bad Request" response + Given operation "UpdateGovernanceNotificationSettings" enabled + And new "UpdateGovernanceNotificationSettings" request + And body with value {"data": {"attributes": {"assignment_notifications_enabled": true}, "type": "governance_notification_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update notification settings returns "OK" response + Given operation "UpdateGovernanceNotificationSettings" enabled + And new "UpdateGovernanceNotificationSettings" request + And body with value {"data": {"attributes": {"assignment_notifications_enabled": true}, "type": "governance_notification_settings"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/governance_controls.feature b/tests/v2/features/governance_controls.feature deleted file mode 100644 index 1207f5cf50..0000000000 --- a/tests/v2/features/governance_controls.feature +++ /dev/null @@ -1,77 +0,0 @@ -@endpoint(governance-controls) @endpoint(governance-controls-v2) -Feature: Governance Controls - 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. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "GovernanceControls" API - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "Bad Request" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "Not Found" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "OK" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance controls returns "Bad Request" response - Given operation "ListGovernanceControls" enabled - And new "ListGovernanceControls" request - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance controls returns "OK" response - Given operation "ListGovernanceControls" enabled - And new "ListGovernanceControls" request - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "Bad Request" response - 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", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "Not Found" response - 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", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "OK" response - 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", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 200 OK diff --git a/tests/v2/features/governance_insights.feature b/tests/v2/features/governance_insights.feature deleted file mode 100644 index 0327e119c5..0000000000 --- a/tests/v2/features/governance_insights.feature +++ /dev/null @@ -1,24 +0,0 @@ -@endpoint(governance-insights) @endpoint(governance-insights-v2) -Feature: Governance Insights - Governance Insights surface key usage, configuration, and best-practice - signals for an organization within the Governance Console. Each insight - reports a current value (and, optionally, a previous value for comparison) - along with the query used to compute it, so that the Console can render - trends and highlight areas that need attention. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "GovernanceInsights" API - And operation "ListGovernanceInsights" enabled - And new "ListGovernanceInsights" request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance insights returns "Bad Request" response - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance insights returns "OK" response - When the request is sent - Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 133ab9ade4..d2c9763403 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2834,26 +2834,92 @@ "type": "safe" } }, + "GetGovernanceConfig": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, "ListGovernanceControls": { - "tag": "Governance Controls", + "tag": "Governance Console", "undo": { "type": "safe" } }, "GetGovernanceControl": { - "tag": "Governance Controls", + "tag": "Governance Console", "undo": { "type": "safe" } }, "UpdateGovernanceControl": { - "tag": "Governance Controls", + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "ListGovernanceControlDetections": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "GetGovernanceControlNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceControlNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "MitigateGovernanceDetections": { + "tag": "Governance Console", + "undo": { + "type": "unsafe" + } + }, + "GetGovernanceDetection": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceDetection": { + "tag": "Governance Console", "undo": { "type": "idempotent" } }, "ListGovernanceInsights": { - "tag": "Governance Insights", + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "ListGovernanceLimits": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "GetGovernanceNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "ListGovernanceResourceLimits": { + "tag": "Governance Console", "undo": { "type": "safe" }