From 3ecbec8ea3eb3ec4a28176b1f3a675af04a218b2 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 17 Jun 2026 20:29:19 +0000 Subject: [PATCH] Regenerate client from commit 5371379 of spec repo --- .generator/schemas/v2/openapi.yaml | 519 ++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 91 +++ .../ListGovernanceInsights.py | 14 + src/datadog_api_client/configuration.py | 1 + .../v2/api/governance_insights_api.py | 98 ++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../governance_best_practice_definition.py | 131 +++++ .../v2/model/governance_insight_attributes.py | 183 ++++++ .../model/governance_insight_audit_compute.py | 55 ++ .../model/governance_insight_audit_query.py | 58 ++ .../v2/model/governance_insight_data.py | 56 ++ .../model/governance_insight_event_compute.py | 39 ++ .../model/governance_insight_event_query.py | 61 ++ .../model/governance_insight_metric_query.py | 45 ++ .../governance_insight_percentage_query.py | 48 ++ .../model/governance_insight_query_config.py | 72 +++ .../model/governance_insight_resource_type.py | 35 ++ .../model/governance_insight_usage_query.py | 39 ++ .../v2/model/governance_insights_response.py | 40 ++ src/datadog_api_client/v2/models/__init__.py | 26 + tests/v2/features/governance_insights.feature | 24 + tests/v2/features/undo.json | 6 + 23 files changed, 1650 insertions(+) create mode 100644 examples/v2/governance-insights/ListGovernanceInsights.py create mode 100644 src/datadog_api_client/v2/api/governance_insights_api.py create mode 100644 src/datadog_api_client/v2/model/governance_best_practice_definition.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_attributes.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_audit_compute.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_audit_query.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_data.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_event_compute.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_event_query.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_metric_query.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_percentage_query.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_query_config.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_resource_type.py create mode 100644 src/datadog_api_client/v2/model/governance_insight_usage_query.py create mode 100644 src/datadog_api_client/v2/model/governance_insights_response.py create mode 100644 tests/v2/features/governance_insights.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ed5cb6857f..b17c8433bd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -41047,6 +41047,390 @@ 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. + properties: + category: + 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 + 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" + type: string + required: + - id + - title + - summary + - description + - category + - impact + - trigger_type + - trigger_condition + - deep_link + - permissions + - impact_hint + - status + type: object + GovernanceInsightAttributes: + description: The attributes of a governance insight. + 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" + type: string + display_name: + description: Human-readable name of the insight. + example: "Active Dashboards" + type: string + event_query: + $ref: "#/components/schemas/GovernanceInsightEventQuery" + nullable: true + 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 + product: + description: The product the insight belongs to. + example: "Usage" + type: string + 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" + type: string + time_range: + description: The time range the insight value is computed over, if applicable. + example: "month" + type: string + unit_name: + description: The unit that the insight's value is measured in. + example: "active dashboards" + type: string + 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. + properties: + aggregation: + description: The aggregation function to apply. + example: "cardinality" + type: string + interval: + description: The aggregation time window, in milliseconds. + example: 86400000 + format: int64 + type: integer + metric: + description: The metric or attribute to aggregate. + example: "@usr.id" + type: string + rollup: + description: An optional secondary aggregation applied to the audit query result. + example: "" + type: string + required: + - aggregation + - metric + - interval + type: object + GovernanceInsightAuditQuery: + description: An audit log query used to compute an insight value. + properties: + compute: + $ref: "#/components/schemas/GovernanceInsightAuditCompute" + indexes: + description: The audit log indexes the query runs against. + example: + - "main" + items: + description: An audit log index name. + type: string + type: array + query: + description: The audit log search query string. + example: "@evt.name:Dashboard" + type: string + source: + description: The data source the query runs against. + example: "audit" + type: string + required: + - source + - query + - indexes + - compute + type: object + GovernanceInsightData: + description: A governance insight resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceInsightAttributes" + id: + description: The unique identifier of the insight. + example: "498ee21f-8037-48b8-a961-a488692902f4" + type: string + type: + $ref: "#/components/schemas/GovernanceInsightResourceType" + required: + - id + - type + - attributes + type: object + GovernanceInsightEventCompute: + description: The aggregation applied to an event query. + properties: + aggregation: + description: The aggregation function to apply. + example: "count" + type: string + interval: + description: The aggregation time window, in milliseconds. + example: 86400000 + format: int64 + type: integer + required: + - aggregation + - interval + type: object + GovernanceInsightEventQuery: + description: An event query used to compute an insight value. + properties: + compute: + $ref: "#/components/schemas/GovernanceInsightEventCompute" + nullable: true + indexes: + description: The event indexes the query runs against. + example: + - "main" + items: + description: An event index name. + type: string + type: array + query: + description: The event search query string. + example: "source:cloudtrail" + type: string + required: + - query + - indexes + type: object + GovernanceInsightMetricQuery: + description: A metric query used to compute an insight value. + properties: + query: + description: The query string. + example: "avg:system.cpu.user{*}" + type: string + reducer: + description: How the query result series is reduced to a single value. + example: "avg" + type: string + source: + description: The data source the query runs against. + example: "metrics" + type: string + required: + - source + - query + - reducer + type: object + GovernanceInsightPercentageQuery: + description: A percentage query that computes an insight value as a ratio of two metric queries. + properties: + denominator_query: + $ref: "#/components/schemas/GovernanceInsightMetricQuery" + numerator_query: + $ref: "#/components/schemas/GovernanceInsightMetricQuery" + required: + - numerator_query + - denominator_query + type: object + GovernanceInsightQueryConfig: + description: Query execution context that allows the frontend to execute insight queries directly. + properties: + chart_type: + description: The chart type the frontend should use to render the insight. + example: "line" + type: string + comparison_shift: + description: The window used for the previous value comparison, for example `week` or `month`. + example: "month" + type: string + default_value: + description: The default value to display when no data is available. + example: 0 + 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 + effective_time_window_days: + description: The number of days the insight value is computed over. + example: 30 + format: int64 + type: integer + required: + - effective_time_window_days + - comparison_shift + type: object + GovernanceInsightResourceType: + description: JSON:API resource type for a governance insight. + enum: + - insight + example: "insight" + type: string + x-enum-varnames: + - INSIGHT + GovernanceInsightUsageQuery: + description: A usage query used to compute an insight value. + properties: + query: + description: The usage query string. + example: "logs_indexed_events" + type: string + reducer: + description: How the query result series is reduced to a single value. + example: "sum" + type: string + required: + - query + - reducer + type: object + GovernanceInsightsDataArray: + description: An array of governance insight resources. + items: + $ref: "#/components/schemas/GovernanceInsightData" + type: array + GovernanceInsightsResponse: + description: A list of governance insights. + properties: + data: + $ref: "#/components/schemas/GovernanceInsightsDataArray" + required: + - data + type: object GreyNoiseAPIKey: description: The definition of the `GreyNoiseAPIKey` object. properties: @@ -131857,6 +132241,135 @@ paths: operator: OR permissions: - user_access_read + /api/v2/governance/insights: + 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 + responses: + "200": + content: + application/json: + examples: + default: + 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: "" + time_range: "month" + unit_name: "active users" + usage_query: + value: 1291 + 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" + summary: List governance insights + tags: + - Governance Insights + 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/hamr: get: description: |- @@ -190013,6 +190526,12 @@ tags: description: For more information about the Datadog Google Chat integration, see the integration page. url: https://docs.datadoghq.com/integrations/google-hangouts-chat/ name: Google Chat Integration + - 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 - 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 45399d318a..60b434f7e3 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -403,6 +403,13 @@ datadog\_api\_client.v2.api.google\_chat\_integration\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.governance\_insights\_api module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.api.governance_insights_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.high\_availability\_multi\_region\_api module ------------------------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 4cc6139103..95baa66cec 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -16706,6 +16706,97 @@ datadog\_api\_client.v2.model.google\_meet\_configuration\_reference\_data modul :members: :show-inheritance: +datadog\_api\_client.v2.model.governance\_best\_practice\_definition module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_best_practice_definition + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_attributes module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insight_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_audit\_compute module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.governance_insight_audit_compute + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_audit\_query module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insight_audit_query + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_data module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insight_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_event\_compute module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.governance_insight_event_compute + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_event\_query module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insight_event_query + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_metric\_query module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insight_metric_query + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_percentage\_query module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insight_percentage_query + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_query\_config module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insight_query_config + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_resource\_type module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.governance_insight_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insight\_usage\_query module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insight_usage_query + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.governance\_insights\_response module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.governance_insights_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.grey\_noise\_api\_key module ---------------------------------------------------------- diff --git a/examples/v2/governance-insights/ListGovernanceInsights.py b/examples/v2/governance-insights/ListGovernanceInsights.py new file mode 100644 index 0000000000..e59895372a --- /dev/null +++ b/examples/v2/governance-insights/ListGovernanceInsights.py @@ -0,0 +1,14 @@ +""" +List governance insights returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.governance_insights_api import GovernanceInsightsApi + +configuration = Configuration() +configuration.unstable_operations["list_governance_insights"] = True +with ApiClient(configuration) as api_client: + api_instance = GovernanceInsightsApi(api_client) + response = api_instance.list_governance_insights() + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 50c8e49d60..65de7b7f8c 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -526,6 +526,7 @@ def __init__( "v2.upsert_and_publish_form_version": False, "v2.upsert_form_version": False, "v2.update_org_saml_configurations": False, + "v2.list_governance_insights": 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_insights_api.py b/src/datadog_api_client/v2/api/governance_insights_api.py new file mode 100644 index 0000000000..5b1d2db7ff --- /dev/null +++ b/src/datadog_api_client/v2/api/governance_insights_api.py @@ -0,0 +1,98 @@ +# 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 25241f4cfa..64095ed8e2 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -55,6 +55,7 @@ from datadog_api_client.v2.api.forms_api import FormsApi from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi from datadog_api_client.v2.api.google_chat_integration_api import GoogleChatIntegrationApi +from datadog_api_client.v2.api.governance_insights_api import GovernanceInsightsApi from datadog_api_client.v2.api.high_availability_multi_region_api import HighAvailabilityMultiRegionApi from datadog_api_client.v2.api.ip_allowlist_api import IPAllowlistApi from datadog_api_client.v2.api.incidents_api import IncidentsApi @@ -189,6 +190,7 @@ "FormsApi", "GCPIntegrationApi", "GoogleChatIntegrationApi", + "GovernanceInsightsApi", "HighAvailabilityMultiRegionApi", "IPAllowlistApi", "IncidentsApi", 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 new file mode 100644 index 0000000000..a566219487 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_best_practice_definition.py @@ -0,0 +1,131 @@ +# 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_insight_attributes.py b/src/datadog_api_client/v2/model/governance_insight_attributes.py new file mode 100644 index 0000000000..f591a89e3f --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_attributes.py @@ -0,0 +1,183 @@ +# 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, + none_type, + unset, + UnsetType, +) + + +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 + from datadog_api_client.v2.model.governance_insight_query_config import GovernanceInsightQueryConfig + from datadog_api_client.v2.model.governance_insight_usage_query import GovernanceInsightUsageQuery + + +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 + from datadog_api_client.v2.model.governance_insight_query_config import GovernanceInsightQueryConfig + from datadog_api_client.v2.model.governance_insight_usage_query import GovernanceInsightUsageQuery + + 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], + query_config: Union[GovernanceInsightQueryConfig, UnsetType] = unset, + sort_order: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of a governance insight. + + :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 + + :param description: A human-readable description of what the insight measures. + :type description: str + + :param display_name: Human-readable name of the insight. + :type display_name: str + + :param event_query: An event query used to compute an insight value. + :type event_query: GovernanceInsightEventQuery + + :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 + + :param percentage_query: A percentage query that computes an insight value as a ratio of two metric queries. + :type percentage_query: GovernanceInsightPercentageQuery + + :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. + :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 + + :param time_range: The time range the insight value is computed over, if applicable. + :type time_range: str + + :param unit_name: The unit that the insight's value is measured in. + :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 + """ + if query_config is not unset: + kwargs["query_config"] = query_config + if sort_order is not unset: + kwargs["sort_order"] = sort_order + 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_audit_compute.py b/src/datadog_api_client/v2/model/governance_insight_audit_compute.py new file mode 100644 index 0000000000..4a6ffce0b2 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_audit_compute.py @@ -0,0 +1,55 @@ +# 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 GovernanceInsightAuditCompute(ModelNormal): + @cached_property + def openapi_types(_): + return { + "aggregation": (str,), + "interval": (int,), + "metric": (str,), + "rollup": (str,), + } + + attribute_map = { + "aggregation": "aggregation", + "interval": "interval", + "metric": "metric", + "rollup": "rollup", + } + + def __init__(self_, aggregation: str, interval: int, metric: str, rollup: Union[str, UnsetType] = unset, **kwargs): + """ + The aggregation applied to an audit log query. + + :param aggregation: The aggregation function to apply. + :type aggregation: str + + :param interval: The aggregation time window, in milliseconds. + :type interval: int + + :param metric: The metric or attribute to aggregate. + :type metric: str + + :param rollup: An optional secondary aggregation applied to the audit query result. + :type rollup: str, optional + """ + if rollup is not unset: + kwargs["rollup"] = rollup + super().__init__(kwargs) + + self_.aggregation = aggregation + self_.interval = interval + self_.metric = metric diff --git a/src/datadog_api_client/v2/model/governance_insight_audit_query.py b/src/datadog_api_client/v2/model/governance_insight_audit_query.py new file mode 100644 index 0000000000..d4d63bbb02 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_audit_query.py @@ -0,0 +1,58 @@ +# 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_insight_audit_compute import GovernanceInsightAuditCompute + + +class GovernanceInsightAuditQuery(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_insight_audit_compute import GovernanceInsightAuditCompute + + return { + "compute": (GovernanceInsightAuditCompute,), + "indexes": ([str],), + "query": (str,), + "source": (str,), + } + + attribute_map = { + "compute": "compute", + "indexes": "indexes", + "query": "query", + "source": "source", + } + + def __init__(self_, compute: GovernanceInsightAuditCompute, indexes: List[str], query: str, source: str, **kwargs): + """ + An audit log query used to compute an insight value. + + :param compute: The aggregation applied to an audit log query. + :type compute: GovernanceInsightAuditCompute + + :param indexes: The audit log indexes the query runs against. + :type indexes: [str] + + :param query: The audit log search query string. + :type query: str + + :param source: The data source the query runs against. + :type source: str + """ + super().__init__(kwargs) + + self_.compute = compute + self_.indexes = indexes + self_.query = query + self_.source = source diff --git a/src/datadog_api_client/v2/model/governance_insight_data.py b/src/datadog_api_client/v2/model/governance_insight_data.py new file mode 100644 index 0000000000..a22ed94887 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_data.py @@ -0,0 +1,56 @@ +# 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_insight_attributes import GovernanceInsightAttributes + from datadog_api_client.v2.model.governance_insight_resource_type import GovernanceInsightResourceType + + +class GovernanceInsightData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_insight_attributes import GovernanceInsightAttributes + from datadog_api_client.v2.model.governance_insight_resource_type import GovernanceInsightResourceType + + return { + "attributes": (GovernanceInsightAttributes,), + "id": (str,), + "type": (GovernanceInsightResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: GovernanceInsightAttributes, id: str, type: GovernanceInsightResourceType, **kwargs + ): + """ + A governance insight resource. + + :param attributes: The attributes of a governance insight. + :type attributes: GovernanceInsightAttributes + + :param id: The unique identifier of the insight. + :type id: str + + :param type: JSON:API resource type for a governance insight. + :type type: GovernanceInsightResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/governance_insight_event_compute.py b/src/datadog_api_client/v2/model/governance_insight_event_compute.py new file mode 100644 index 0000000000..0b4fdea210 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_event_compute.py @@ -0,0 +1,39 @@ +# 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 GovernanceInsightEventCompute(ModelNormal): + @cached_property + def openapi_types(_): + return { + "aggregation": (str,), + "interval": (int,), + } + + attribute_map = { + "aggregation": "aggregation", + "interval": "interval", + } + + def __init__(self_, aggregation: str, interval: int, **kwargs): + """ + The aggregation applied to an event query. + + :param aggregation: The aggregation function to apply. + :type aggregation: str + + :param interval: The aggregation time window, in milliseconds. + :type interval: int + """ + super().__init__(kwargs) + + self_.aggregation = aggregation + self_.interval = interval diff --git a/src/datadog_api_client/v2/model/governance_insight_event_query.py b/src/datadog_api_client/v2/model/governance_insight_event_query.py new file mode 100644 index 0000000000..81ddeb3bcd --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_event_query.py @@ -0,0 +1,61 @@ +# 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_insight_event_compute import GovernanceInsightEventCompute + + +class GovernanceInsightEventQuery(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_insight_event_compute import GovernanceInsightEventCompute + + return { + "compute": (GovernanceInsightEventCompute,), + "indexes": ([str],), + "query": (str,), + } + + attribute_map = { + "compute": "compute", + "indexes": "indexes", + "query": "query", + } + + def __init__( + self_, + indexes: List[str], + query: str, + compute: Union[GovernanceInsightEventCompute, UnsetType] = unset, + **kwargs, + ): + """ + An event query used to compute an insight value. + + :param compute: The aggregation applied to an event query. + :type compute: GovernanceInsightEventCompute, optional + + :param indexes: The event indexes the query runs against. + :type indexes: [str] + + :param query: The event search query string. + :type query: str + """ + if compute is not unset: + kwargs["compute"] = compute + super().__init__(kwargs) + + self_.indexes = indexes + self_.query = query diff --git a/src/datadog_api_client/v2/model/governance_insight_metric_query.py b/src/datadog_api_client/v2/model/governance_insight_metric_query.py new file mode 100644 index 0000000000..15ae2d5267 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_metric_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 GovernanceInsightMetricQuery(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 an insight value. + + :param query: The query string. + :type query: str + + :param reducer: How the query result series is reduced to a single value. + :type reducer: str + + :param source: The data source the query runs against. + :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_insight_percentage_query.py b/src/datadog_api_client/v2/model/governance_insight_percentage_query.py new file mode 100644 index 0000000000..b481de86f5 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_percentage_query.py @@ -0,0 +1,48 @@ +# 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_insight_metric_query import GovernanceInsightMetricQuery + + +class GovernanceInsightPercentageQuery(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_insight_metric_query import GovernanceInsightMetricQuery + + return { + "denominator_query": (GovernanceInsightMetricQuery,), + "numerator_query": (GovernanceInsightMetricQuery,), + } + + attribute_map = { + "denominator_query": "denominator_query", + "numerator_query": "numerator_query", + } + + def __init__( + self_, denominator_query: GovernanceInsightMetricQuery, numerator_query: GovernanceInsightMetricQuery, **kwargs + ): + """ + A percentage query that computes an insight value as a ratio of two metric queries. + + :param denominator_query: A metric query used to compute an insight value. + :type denominator_query: GovernanceInsightMetricQuery + + :param numerator_query: A metric query used to compute an insight value. + :type numerator_query: GovernanceInsightMetricQuery + """ + super().__init__(kwargs) + + self_.denominator_query = denominator_query + self_.numerator_query = numerator_query 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 new file mode 100644 index 0000000000..fcb82af379 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_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 GovernanceInsightQueryConfig(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_, + comparison_shift: str, + effective_time_window_days: int, + chart_type: Union[str, UnsetType] = unset, + default_value: Union[int, UnsetType] = unset, + directionality: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Query execution context that allows the frontend to execute insight queries directly. + + :param chart_type: The chart type the frontend should use 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``. + :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 effective_time_window_days: The number of days the insight value is computed over. + :type effective_time_window_days: int + """ + if chart_type is not unset: + kwargs["chart_type"] = chart_type + if default_value is not unset: + kwargs["default_value"] = default_value + if directionality is not unset: + kwargs["directionality"] = directionality + super().__init__(kwargs) + + self_.comparison_shift = comparison_shift + self_.effective_time_window_days = effective_time_window_days diff --git a/src/datadog_api_client/v2/model/governance_insight_resource_type.py b/src/datadog_api_client/v2/model/governance_insight_resource_type.py new file mode 100644 index 0000000000..f65c2f1f7c --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_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 GovernanceInsightResourceType(ModelSimple): + """ + JSON:API resource type for a governance insight. + + :param value: If omitted defaults to "insight". Must be one of ["insight"]. + :type value: str + """ + + allowed_values = { + "insight", + } + INSIGHT: ClassVar["GovernanceInsightResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GovernanceInsightResourceType.INSIGHT = GovernanceInsightResourceType("insight") diff --git a/src/datadog_api_client/v2/model/governance_insight_usage_query.py b/src/datadog_api_client/v2/model/governance_insight_usage_query.py new file mode 100644 index 0000000000..3a47025ab3 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insight_usage_query.py @@ -0,0 +1,39 @@ +# 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 GovernanceInsightUsageQuery(ModelNormal): + @cached_property + def openapi_types(_): + return { + "query": (str,), + "reducer": (str,), + } + + attribute_map = { + "query": "query", + "reducer": "reducer", + } + + def __init__(self_, query: str, reducer: str, **kwargs): + """ + A usage query used to compute an insight value. + + :param query: The usage query string. + :type query: str + + :param reducer: How the query result series is reduced to a single value. + :type reducer: str + """ + super().__init__(kwargs) + + self_.query = query + self_.reducer = reducer diff --git a/src/datadog_api_client/v2/model/governance_insights_response.py b/src/datadog_api_client/v2/model/governance_insights_response.py new file mode 100644 index 0000000000..81bfb2f7a5 --- /dev/null +++ b/src/datadog_api_client/v2/model/governance_insights_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_insight_data import GovernanceInsightData + + +class GovernanceInsightsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.governance_insight_data import GovernanceInsightData + + return { + "data": ([GovernanceInsightData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[GovernanceInsightData], **kwargs): + """ + A list of governance insights. + + :param data: An array of governance insight resources. + :type data: [GovernanceInsightData] + """ + 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 f39bb0804a..0910910737 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3124,6 +3124,19 @@ ) 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_insight_attributes import GovernanceInsightAttributes +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_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 +from datadog_api_client.v2.model.governance_insight_percentage_query import GovernanceInsightPercentageQuery +from datadog_api_client.v2.model.governance_insight_query_config import GovernanceInsightQueryConfig +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.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 @@ -11656,6 +11669,19 @@ "GoogleChatUpdateOrganizationHandleRequestData", "GoogleMeetConfigurationReference", "GoogleMeetConfigurationReferenceData", + "GovernanceBestPracticeDefinition", + "GovernanceInsightAttributes", + "GovernanceInsightAuditCompute", + "GovernanceInsightAuditQuery", + "GovernanceInsightData", + "GovernanceInsightEventCompute", + "GovernanceInsightEventQuery", + "GovernanceInsightMetricQuery", + "GovernanceInsightPercentageQuery", + "GovernanceInsightQueryConfig", + "GovernanceInsightResourceType", + "GovernanceInsightUsageQuery", + "GovernanceInsightsResponse", "GreyNoiseAPIKey", "GreyNoiseAPIKeyType", "GreyNoiseAPIKeyUpdate", diff --git a/tests/v2/features/governance_insights.feature b/tests/v2/features/governance_insights.feature new file mode 100644 index 0000000000..0327e119c5 --- /dev/null +++ b/tests/v2/features/governance_insights.feature @@ -0,0 +1,24 @@ +@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 8729c7318e..049cc12522 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2762,6 +2762,12 @@ "type": "safe" } }, + "ListGovernanceInsights": { + "tag": "Governance Insights", + "undo": { + "type": "safe" + } + }, "GetHamrOrgConnection": { "tag": "High Availability MultiRegion", "undo": {