diff --git a/.apigentools-info b/.apigentools-info index e85023ac27..23ba14a73e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-02-28 21:36:44.614979", - "spec_repo_commit": "f478a381" + "regenerated": "2024-02-29 14:49:25.092326", + "spec_repo_commit": "bb5305bc" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-02-28 21:36:44.629759", - "spec_repo_commit": "f478a381" + "regenerated": "2024-02-29 14:49:25.138459", + "spec_repo_commit": "bb5305bc" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d1b6f0e8e7..9a70faf6ba 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -11082,6 +11082,136 @@ components: $ref: '#/components/schemas/MetricAllTags' readOnly: true type: object + MetricAssetAttributes: + description: Assets where only included attribute is its title + properties: + title: + description: Title of the asset. + type: string + type: object + MetricAssetDashboardRelationship: + description: An object of type `dashboard` that can be referenced in the `included` + data. + properties: + id: + $ref: '#/components/schemas/MetricDashboardID' + type: + $ref: '#/components/schemas/MetricDashboardType' + type: object + MetricAssetDashboardRelationships: + description: An object containing the list of dashboards that can be referenced + in the `included` data. + properties: + data: + description: A list of dashboards that can be referenced in the `included` + data. + items: + $ref: '#/components/schemas/MetricAssetDashboardRelationship' + type: array + type: object + MetricAssetMonitorRelationship: + description: An object of type `monitor` that can be referenced in the `included` + data. + properties: + id: + $ref: '#/components/schemas/MetricMonitorID' + type: + $ref: '#/components/schemas/MetricMonitorType' + type: object + MetricAssetMonitorRelationships: + description: A object containing the list of monitors that can be referenced + in the `included` data. + properties: + data: + description: A list of monitors that can be referenced in the `included` + data. + items: + $ref: '#/components/schemas/MetricAssetMonitorRelationship' + type: array + type: object + MetricAssetNotebookRelationship: + description: An object of type `notebook` that can be referenced in the `included` + data. + properties: + id: + $ref: '#/components/schemas/MetricNotebookID' + type: + $ref: '#/components/schemas/MetricNotebookType' + type: object + MetricAssetNotebookRelationships: + description: An object containing the list of notebooks that can be referenced + in the `included` data. + properties: + data: + description: A list of notebooks that can be referenced in the `included` + data. + items: + $ref: '#/components/schemas/MetricAssetNotebookRelationship' + type: array + type: object + MetricAssetResponseData: + description: Metric assets response data. + properties: + id: + $ref: '#/components/schemas/MetricName' + relationships: + $ref: '#/components/schemas/MetricAssetResponseRelationships' + type: + $ref: '#/components/schemas/MetricType' + required: + - id + - type + type: object + MetricAssetResponseIncluded: + description: List of included assets with full set of attributes. + oneOf: + - $ref: '#/components/schemas/MetricDashboardAsset' + - $ref: '#/components/schemas/MetricMonitorAsset' + - $ref: '#/components/schemas/MetricNotebookAsset' + - $ref: '#/components/schemas/MetricSLOAsset' + MetricAssetResponseRelationships: + description: Relationships to assets related to the metric. + properties: + dashboards: + $ref: '#/components/schemas/MetricAssetDashboardRelationships' + monitors: + $ref: '#/components/schemas/MetricAssetMonitorRelationships' + notebooks: + $ref: '#/components/schemas/MetricAssetNotebookRelationships' + slos: + $ref: '#/components/schemas/MetricAssetSLORelationships' + type: object + MetricAssetSLORelationship: + description: An object of type `slos` that can be referenced in the `included` + data. + properties: + id: + $ref: '#/components/schemas/MetricSLOID' + type: + $ref: '#/components/schemas/MetricSLOType' + type: object + MetricAssetSLORelationships: + description: An object containing a list of SLOs that can be referenced in the + `included` data. + properties: + data: + description: A list of SLOs that can be referenced in the `included` data. + items: + $ref: '#/components/schemas/MetricAssetSLORelationship' + type: array + type: object + MetricAssetsResponse: + description: Response object that includes related dashboards, monitors, notebooks, + and SLOs. + properties: + data: + $ref: '#/components/schemas/MetricAssetResponseData' + included: + description: Array of objects related to the metric assets. + items: + $ref: '#/components/schemas/MetricAssetResponseIncluded' + type: array + type: object MetricBulkConfigureTagsType: default: metric_bulk_configure_tags description: The metric bulk configure tags resource. @@ -11323,6 +11453,44 @@ components: - MAX - MIN - SUM + MetricDashboardAsset: + description: A dashboard object with title and popularity. + properties: + attributes: + $ref: '#/components/schemas/MetricDashboardAttributes' + id: + $ref: '#/components/schemas/MetricDashboardID' + type: + $ref: '#/components/schemas/MetricDashboardType' + required: + - id + - type + type: object + MetricDashboardAttributes: + description: Attributes related to the dashboard, including title and popularity. + properties: + popularity: + description: Value from 0 to 5 that ranks popularity of the dashboard. + format: double + maximum: 5 + minimum: 0 + type: number + title: + description: Title of the asset. + type: string + type: object + MetricDashboardID: + description: The related dashboard's ID. + example: xxx-yyy-zzz + type: string + MetricDashboardType: + description: Dashboard resource type. + enum: + - dashboards + example: dashboards + type: string + x-enum-varnames: + - DASHBOARDS MetricDistinctVolume: description: Object for a single metric's distinct volume. properties: @@ -11463,10 +11631,60 @@ components: origin: $ref: '#/components/schemas/MetricOrigin' type: object + MetricMonitorAsset: + description: A monitor object with title. + properties: + attributes: + $ref: '#/components/schemas/MetricAssetAttributes' + id: + $ref: '#/components/schemas/MetricMonitorID' + type: + $ref: '#/components/schemas/MetricMonitorType' + required: + - id + - type + type: object + MetricMonitorID: + description: The related monitor's ID. + example: '1775073' + type: string + MetricMonitorType: + description: Monitor resource type. + enum: + - monitors + example: monitors + type: string + x-enum-varnames: + - MONITORS MetricName: description: The metric name for this resource. example: test.metric.latency type: string + MetricNotebookAsset: + description: A notebook object with title. + properties: + attributes: + $ref: '#/components/schemas/MetricAssetAttributes' + id: + $ref: '#/components/schemas/MetricNotebookID' + type: + $ref: '#/components/schemas/MetricNotebookType' + required: + - id + - type + type: object + MetricNotebookID: + description: The related notebook's ID. + example: '12345' + type: string + MetricNotebookType: + description: Notebook resource type. + enum: + - notebooks + example: notebooks + type: string + x-enum-varnames: + - NOTEBOOKS MetricOrigin: description: Metric origin information. properties: @@ -11540,6 +11758,31 @@ components: description: The type of the resource. type: string type: object + MetricSLOAsset: + description: A SLO object with title. + properties: + attributes: + $ref: '#/components/schemas/MetricAssetAttributes' + id: + $ref: '#/components/schemas/MetricSLOID' + type: + $ref: '#/components/schemas/MetricSLOType' + required: + - id + - type + type: object + MetricSLOID: + description: The SLO ID. + example: 9ffef113b389520db54391d67d652dfb + type: string + MetricSLOType: + description: SLO resource type. + enum: + - slos + example: slos + type: string + x-enum-varnames: + - SLOS MetricSeries: description: 'A metric to submit to Datadog. @@ -28087,6 +28330,51 @@ paths: summary: List tags by metric name tags: - Metrics + /api/v2/metrics/{metric_name}/assets: + get: + description: Returns dashboards, monitors, notebooks, and SLOs that a metric + is stored in, if any. Updated every 24 hours. + operationId: ListMetricAssets + parameters: + - $ref: '#/components/parameters/MetricName' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MetricAssetsResponse' + description: Success + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Related Assets to a Metric + tags: + - Metrics /api/v2/metrics/{metric_name}/estimate: get: description: Returns the estimated cardinality for a metric with a given tag, @@ -28180,19 +28468,6 @@ paths: summary: Tag Configuration Cardinality Estimator tags: - Metrics - x-dd-ownership: - notification_configuration: - manual_escalation_policy: '[Points Aggregation] Primary' - prod_high_urgency: '@pagerduty-Points-Aggregation @slack-points-aggr-ops' - prod_low_urgency: '@slack-points-aggr-ops' - slack_support_channel: '#points-aggregation' - staging_high_urgency: '@slack-points-aggr-stg-ops' - staging_low_urgency: '@slack-points-aggr-stg-ops' - team: points-aggregation - team_escalation: '[Points Aggregation] Primary' - x-permission: - operator: OPEN - permissions: [] /api/v2/metrics/{metric_name}/tags: delete: description: 'Deletes a metric''s tag configuration. Can only be used with application diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 2b83a4a3fc..ec22867196 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -4810,6 +4810,97 @@ metric\_all\_tags\_response :members: :show-inheritance: +metric\_asset\_attributes +------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_attributes + :members: + :show-inheritance: + +metric\_asset\_dashboard\_relationship +-------------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_dashboard_relationship + :members: + :show-inheritance: + +metric\_asset\_dashboard\_relationships +--------------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_dashboard_relationships + :members: + :show-inheritance: + +metric\_asset\_monitor\_relationship +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.metric_asset_monitor_relationship + :members: + :show-inheritance: + +metric\_asset\_monitor\_relationships +------------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_monitor_relationships + :members: + :show-inheritance: + +metric\_asset\_notebook\_relationship +------------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_notebook_relationship + :members: + :show-inheritance: + +metric\_asset\_notebook\_relationships +-------------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_notebook_relationships + :members: + :show-inheritance: + +metric\_asset\_response\_data +----------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_response_data + :members: + :show-inheritance: + +metric\_asset\_response\_included +--------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_response_included + :members: + :show-inheritance: + +metric\_asset\_response\_relationships +-------------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_response_relationships + :members: + :show-inheritance: + +metric\_asset\_slo\_relationship +-------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_slo_relationship + :members: + :show-inheritance: + +metric\_asset\_slo\_relationships +--------------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_asset_slo_relationships + :members: + :show-inheritance: + +metric\_assets\_response +------------------------ + +.. automodule:: datadog_api_client.v2.model.metric_assets_response + :members: + :show-inheritance: + metric\_bulk\_configure\_tags\_type ----------------------------------- @@ -4929,6 +5020,27 @@ metric\_custom\_time\_aggregation :members: :show-inheritance: +metric\_dashboard\_asset +------------------------ + +.. automodule:: datadog_api_client.v2.model.metric_dashboard_asset + :members: + :show-inheritance: + +metric\_dashboard\_attributes +----------------------------- + +.. automodule:: datadog_api_client.v2.model.metric_dashboard_attributes + :members: + :show-inheritance: + +metric\_dashboard\_type +----------------------- + +.. automodule:: datadog_api_client.v2.model.metric_dashboard_type + :members: + :show-inheritance: + metric\_distinct\_volume ------------------------ @@ -5020,6 +5132,34 @@ metric\_metadata :members: :show-inheritance: +metric\_monitor\_asset +---------------------- + +.. automodule:: datadog_api_client.v2.model.metric_monitor_asset + :members: + :show-inheritance: + +metric\_monitor\_type +--------------------- + +.. automodule:: datadog_api_client.v2.model.metric_monitor_type + :members: + :show-inheritance: + +metric\_notebook\_asset +----------------------- + +.. automodule:: datadog_api_client.v2.model.metric_notebook_asset + :members: + :show-inheritance: + +metric\_notebook\_type +---------------------- + +.. automodule:: datadog_api_client.v2.model.metric_notebook_type + :members: + :show-inheritance: + metric\_origin -------------- @@ -5055,6 +5195,20 @@ metric\_series :members: :show-inheritance: +metric\_slo\_asset +------------------ + +.. automodule:: datadog_api_client.v2.model.metric_slo_asset + :members: + :show-inheritance: + +metric\_slo\_type +----------------- + +.. automodule:: datadog_api_client.v2.model.metric_slo_type + :members: + :show-inheritance: + metric\_suggested\_aggregations ------------------------------- diff --git a/examples/v2/metrics/ListMetricAssets.py b/examples/v2/metrics/ListMetricAssets.py new file mode 100644 index 0000000000..33a298ba51 --- /dev/null +++ b/examples/v2/metrics/ListMetricAssets.py @@ -0,0 +1,15 @@ +""" +Related Assets to a Metric returns "Success" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.metrics_api import MetricsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = MetricsApi(api_client) + response = api_instance.list_metric_assets( + metric_name="system.cpu.user", + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/metrics_api.py b/src/datadog_api_client/v2/api/metrics_api.py index cde85a01b2..e5159f7db6 100644 --- a/src/datadog_api_client/v2/api/metrics_api.py +++ b/src/datadog_api_client/v2/api/metrics_api.py @@ -22,6 +22,7 @@ MetricSuggestedTagsAndAggregationsResponse, ) from datadog_api_client.v2.model.metric_all_tags_response import MetricAllTagsResponse +from datadog_api_client.v2.model.metric_assets_response import MetricAssetsResponse from datadog_api_client.v2.model.metric_estimate_response import MetricEstimateResponse from datadog_api_client.v2.model.metric_tag_configuration_response import MetricTagConfigurationResponse from datadog_api_client.v2.model.metric_tag_configuration_update_request import MetricTagConfigurationUpdateRequest @@ -235,6 +236,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_metric_assets_endpoint = _Endpoint( + settings={ + "response_type": (MetricAssetsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/metrics/{metric_name}/assets", + "operation_id": "list_metric_assets", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "metric_name": { + "required": True, + "openapi_types": (str,), + "attribute": "metric_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_tag_configuration_by_name_endpoint = _Endpoint( settings={ "response_type": (MetricTagConfigurationResponse,), @@ -604,6 +628,23 @@ def list_active_metric_configurations( return self._list_active_metric_configurations_endpoint.call_with_http_info(**kwargs) + def list_metric_assets( + self, + metric_name: str, + ) -> MetricAssetsResponse: + """Related Assets to a Metric. + + Returns dashboards, monitors, notebooks, and SLOs that a metric is stored in, if any. Updated every 24 hours. + + :param metric_name: The name of the metric. + :type metric_name: str + :rtype: MetricAssetsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["metric_name"] = metric_name + + return self._list_metric_assets_endpoint.call_with_http_info(**kwargs) + def list_tag_configuration_by_name( self, metric_name: str, diff --git a/src/datadog_api_client/v2/model/metric_asset_attributes.py b/src/datadog_api_client/v2/model/metric_asset_attributes.py new file mode 100644 index 0000000000..2becf69d5b --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_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 MetricAssetAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "title": (str,), + } + + attribute_map = { + "title": "title", + } + + def __init__(self_, title: Union[str, UnsetType] = unset, **kwargs): + """ + Assets where only included attribute is its title + + :param title: Title of the asset. + :type title: str, optional + """ + if title is not unset: + kwargs["title"] = title + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_dashboard_relationship.py b/src/datadog_api_client/v2/model/metric_asset_dashboard_relationship.py new file mode 100644 index 0000000000..a830d7e7bc --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_dashboard_relationship.py @@ -0,0 +1,51 @@ +# 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.metric_dashboard_type import MetricDashboardType + + +class MetricAssetDashboardRelationship(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_dashboard_type import MetricDashboardType + + return { + "id": (str,), + "type": (MetricDashboardType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__( + self_, id: Union[str, UnsetType] = unset, type: Union[MetricDashboardType, UnsetType] = unset, **kwargs + ): + """ + An object of type ``dashboard`` that can be referenced in the ``included`` data. + + :param id: The related dashboard's ID. + :type id: str, optional + + :param type: Dashboard resource type. + :type type: MetricDashboardType, optional + """ + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_dashboard_relationships.py b/src/datadog_api_client/v2/model/metric_asset_dashboard_relationships.py new file mode 100644 index 0000000000..6c76f905d7 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_dashboard_relationships.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.metric_asset_dashboard_relationship import MetricAssetDashboardRelationship + + +class MetricAssetDashboardRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_dashboard_relationship import MetricAssetDashboardRelationship + + return { + "data": ([MetricAssetDashboardRelationship],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[MetricAssetDashboardRelationship], UnsetType] = unset, **kwargs): + """ + An object containing the list of dashboards that can be referenced in the ``included`` data. + + :param data: A list of dashboards that can be referenced in the ``included`` data. + :type data: [MetricAssetDashboardRelationship], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_monitor_relationship.py b/src/datadog_api_client/v2/model/metric_asset_monitor_relationship.py new file mode 100644 index 0000000000..ef1ddf44d3 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_monitor_relationship.py @@ -0,0 +1,49 @@ +# 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.metric_monitor_type import MetricMonitorType + + +class MetricAssetMonitorRelationship(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_monitor_type import MetricMonitorType + + return { + "id": (str,), + "type": (MetricMonitorType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: Union[str, UnsetType] = unset, type: Union[MetricMonitorType, UnsetType] = unset, **kwargs): + """ + An object of type ``monitor`` that can be referenced in the ``included`` data. + + :param id: The related monitor's ID. + :type id: str, optional + + :param type: Monitor resource type. + :type type: MetricMonitorType, optional + """ + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_monitor_relationships.py b/src/datadog_api_client/v2/model/metric_asset_monitor_relationships.py new file mode 100644 index 0000000000..19470ab32a --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_monitor_relationships.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.metric_asset_monitor_relationship import MetricAssetMonitorRelationship + + +class MetricAssetMonitorRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_monitor_relationship import MetricAssetMonitorRelationship + + return { + "data": ([MetricAssetMonitorRelationship],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[MetricAssetMonitorRelationship], UnsetType] = unset, **kwargs): + """ + A object containing the list of monitors that can be referenced in the ``included`` data. + + :param data: A list of monitors that can be referenced in the ``included`` data. + :type data: [MetricAssetMonitorRelationship], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_notebook_relationship.py b/src/datadog_api_client/v2/model/metric_asset_notebook_relationship.py new file mode 100644 index 0000000000..02286da71d --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_notebook_relationship.py @@ -0,0 +1,51 @@ +# 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.metric_notebook_type import MetricNotebookType + + +class MetricAssetNotebookRelationship(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_notebook_type import MetricNotebookType + + return { + "id": (str,), + "type": (MetricNotebookType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__( + self_, id: Union[str, UnsetType] = unset, type: Union[MetricNotebookType, UnsetType] = unset, **kwargs + ): + """ + An object of type ``notebook`` that can be referenced in the ``included`` data. + + :param id: The related notebook's ID. + :type id: str, optional + + :param type: Notebook resource type. + :type type: MetricNotebookType, optional + """ + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_notebook_relationships.py b/src/datadog_api_client/v2/model/metric_asset_notebook_relationships.py new file mode 100644 index 0000000000..180d352443 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_notebook_relationships.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.metric_asset_notebook_relationship import MetricAssetNotebookRelationship + + +class MetricAssetNotebookRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_notebook_relationship import MetricAssetNotebookRelationship + + return { + "data": ([MetricAssetNotebookRelationship],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[MetricAssetNotebookRelationship], UnsetType] = unset, **kwargs): + """ + An object containing the list of notebooks that can be referenced in the ``included`` data. + + :param data: A list of notebooks that can be referenced in the ``included`` data. + :type data: [MetricAssetNotebookRelationship], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_response_data.py b/src/datadog_api_client/v2/model/metric_asset_response_data.py new file mode 100644 index 0000000000..1477e834b6 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_response_data.py @@ -0,0 +1,63 @@ +# 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.metric_asset_response_relationships import MetricAssetResponseRelationships + from datadog_api_client.v2.model.metric_type import MetricType + + +class MetricAssetResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_response_relationships import MetricAssetResponseRelationships + from datadog_api_client.v2.model.metric_type import MetricType + + return { + "id": (str,), + "relationships": (MetricAssetResponseRelationships,), + "type": (MetricType,), + } + + attribute_map = { + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + id: str, + type: MetricType, + relationships: Union[MetricAssetResponseRelationships, UnsetType] = unset, + **kwargs, + ): + """ + Metric assets response data. + + :param id: The metric name for this resource. + :type id: str + + :param relationships: Relationships to assets related to the metric. + :type relationships: MetricAssetResponseRelationships, optional + + :param type: The metric resource type. + :type type: MetricType + """ + if relationships is not unset: + kwargs["relationships"] = relationships + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/metric_asset_response_included.py b/src/datadog_api_client/v2/model/metric_asset_response_included.py new file mode 100644 index 0000000000..fff329bf39 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_response_included.py @@ -0,0 +1,50 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class MetricAssetResponseIncluded(ModelComposed): + def __init__(self, **kwargs): + """ + List of included assets with full set of attributes. + + :param attributes: Attributes related to the dashboard, including title and popularity. + :type attributes: MetricDashboardAttributes, optional + + :param id: The related dashboard's ID. + :type id: str + + :param type: Dashboard resource type. + :type type: MetricDashboardType + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.metric_dashboard_asset import MetricDashboardAsset + from datadog_api_client.v2.model.metric_monitor_asset import MetricMonitorAsset + from datadog_api_client.v2.model.metric_notebook_asset import MetricNotebookAsset + from datadog_api_client.v2.model.metric_slo_asset import MetricSLOAsset + + return { + "oneOf": [ + MetricDashboardAsset, + MetricMonitorAsset, + MetricNotebookAsset, + MetricSLOAsset, + ], + } diff --git a/src/datadog_api_client/v2/model/metric_asset_response_relationships.py b/src/datadog_api_client/v2/model/metric_asset_response_relationships.py new file mode 100644 index 0000000000..2bd24936ac --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_response_relationships.py @@ -0,0 +1,76 @@ +# 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.metric_asset_dashboard_relationships import MetricAssetDashboardRelationships + from datadog_api_client.v2.model.metric_asset_monitor_relationships import MetricAssetMonitorRelationships + from datadog_api_client.v2.model.metric_asset_notebook_relationships import MetricAssetNotebookRelationships + from datadog_api_client.v2.model.metric_asset_slo_relationships import MetricAssetSLORelationships + + +class MetricAssetResponseRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_dashboard_relationships import MetricAssetDashboardRelationships + from datadog_api_client.v2.model.metric_asset_monitor_relationships import MetricAssetMonitorRelationships + from datadog_api_client.v2.model.metric_asset_notebook_relationships import MetricAssetNotebookRelationships + from datadog_api_client.v2.model.metric_asset_slo_relationships import MetricAssetSLORelationships + + return { + "dashboards": (MetricAssetDashboardRelationships,), + "monitors": (MetricAssetMonitorRelationships,), + "notebooks": (MetricAssetNotebookRelationships,), + "slos": (MetricAssetSLORelationships,), + } + + attribute_map = { + "dashboards": "dashboards", + "monitors": "monitors", + "notebooks": "notebooks", + "slos": "slos", + } + + def __init__( + self_, + dashboards: Union[MetricAssetDashboardRelationships, UnsetType] = unset, + monitors: Union[MetricAssetMonitorRelationships, UnsetType] = unset, + notebooks: Union[MetricAssetNotebookRelationships, UnsetType] = unset, + slos: Union[MetricAssetSLORelationships, UnsetType] = unset, + **kwargs, + ): + """ + Relationships to assets related to the metric. + + :param dashboards: An object containing the list of dashboards that can be referenced in the ``included`` data. + :type dashboards: MetricAssetDashboardRelationships, optional + + :param monitors: A object containing the list of monitors that can be referenced in the ``included`` data. + :type monitors: MetricAssetMonitorRelationships, optional + + :param notebooks: An object containing the list of notebooks that can be referenced in the ``included`` data. + :type notebooks: MetricAssetNotebookRelationships, optional + + :param slos: An object containing a list of SLOs that can be referenced in the ``included`` data. + :type slos: MetricAssetSLORelationships, optional + """ + if dashboards is not unset: + kwargs["dashboards"] = dashboards + if monitors is not unset: + kwargs["monitors"] = monitors + if notebooks is not unset: + kwargs["notebooks"] = notebooks + if slos is not unset: + kwargs["slos"] = slos + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_slo_relationship.py b/src/datadog_api_client/v2/model/metric_asset_slo_relationship.py new file mode 100644 index 0000000000..d7072ca3f2 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_slo_relationship.py @@ -0,0 +1,49 @@ +# 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.metric_slo_type import MetricSLOType + + +class MetricAssetSLORelationship(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_slo_type import MetricSLOType + + return { + "id": (str,), + "type": (MetricSLOType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: Union[str, UnsetType] = unset, type: Union[MetricSLOType, UnsetType] = unset, **kwargs): + """ + An object of type ``slos`` that can be referenced in the ``included`` data. + + :param id: The SLO ID. + :type id: str, optional + + :param type: SLO resource type. + :type type: MetricSLOType, optional + """ + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_asset_slo_relationships.py b/src/datadog_api_client/v2/model/metric_asset_slo_relationships.py new file mode 100644 index 0000000000..7e5042ba52 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_asset_slo_relationships.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.metric_asset_slo_relationship import MetricAssetSLORelationship + + +class MetricAssetSLORelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_slo_relationship import MetricAssetSLORelationship + + return { + "data": ([MetricAssetSLORelationship],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[MetricAssetSLORelationship], UnsetType] = unset, **kwargs): + """ + An object containing a list of SLOs that can be referenced in the ``included`` data. + + :param data: A list of SLOs that can be referenced in the ``included`` data. + :type data: [MetricAssetSLORelationship], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_assets_response.py b/src/datadog_api_client/v2/model/metric_assets_response.py new file mode 100644 index 0000000000..531fef1bdc --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_assets_response.py @@ -0,0 +1,71 @@ +# 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.metric_asset_response_data import MetricAssetResponseData + from datadog_api_client.v2.model.metric_asset_response_included import MetricAssetResponseIncluded + from datadog_api_client.v2.model.metric_dashboard_asset import MetricDashboardAsset + from datadog_api_client.v2.model.metric_monitor_asset import MetricMonitorAsset + from datadog_api_client.v2.model.metric_notebook_asset import MetricNotebookAsset + from datadog_api_client.v2.model.metric_slo_asset import MetricSLOAsset + + +class MetricAssetsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_response_data import MetricAssetResponseData + from datadog_api_client.v2.model.metric_asset_response_included import MetricAssetResponseIncluded + + return { + "data": (MetricAssetResponseData,), + "included": ([MetricAssetResponseIncluded],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__( + self_, + data: Union[MetricAssetResponseData, UnsetType] = unset, + included: Union[ + List[ + Union[ + MetricAssetResponseIncluded, + MetricDashboardAsset, + MetricMonitorAsset, + MetricNotebookAsset, + MetricSLOAsset, + ] + ], + UnsetType, + ] = unset, + **kwargs, + ): + """ + Response object that includes related dashboards, monitors, notebooks, and SLOs. + + :param data: Metric assets response data. + :type data: MetricAssetResponseData, optional + + :param included: Array of objects related to the metric assets. + :type included: [MetricAssetResponseIncluded], optional + """ + if data is not unset: + kwargs["data"] = data + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_dashboard_asset.py b/src/datadog_api_client/v2/model/metric_dashboard_asset.py new file mode 100644 index 0000000000..7bd74692fd --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_dashboard_asset.py @@ -0,0 +1,63 @@ +# 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.metric_dashboard_attributes import MetricDashboardAttributes + from datadog_api_client.v2.model.metric_dashboard_type import MetricDashboardType + + +class MetricDashboardAsset(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_dashboard_attributes import MetricDashboardAttributes + from datadog_api_client.v2.model.metric_dashboard_type import MetricDashboardType + + return { + "attributes": (MetricDashboardAttributes,), + "id": (str,), + "type": (MetricDashboardType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + id: str, + type: MetricDashboardType, + attributes: Union[MetricDashboardAttributes, UnsetType] = unset, + **kwargs, + ): + """ + A dashboard object with title and popularity. + + :param attributes: Attributes related to the dashboard, including title and popularity. + :type attributes: MetricDashboardAttributes, optional + + :param id: The related dashboard's ID. + :type id: str + + :param type: Dashboard resource type. + :type type: MetricDashboardType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/metric_dashboard_attributes.py b/src/datadog_api_client/v2/model/metric_dashboard_attributes.py new file mode 100644 index 0000000000..bacc9c08ad --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_dashboard_attributes.py @@ -0,0 +1,50 @@ +# 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 MetricDashboardAttributes(ModelNormal): + validations = { + "popularity": { + "inclusive_maximum": 5, + "inclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + return { + "popularity": (float,), + "title": (str,), + } + + attribute_map = { + "popularity": "popularity", + "title": "title", + } + + def __init__(self_, popularity: Union[float, UnsetType] = unset, title: Union[str, UnsetType] = unset, **kwargs): + """ + Attributes related to the dashboard, including title and popularity. + + :param popularity: Value from 0 to 5 that ranks popularity of the dashboard. + :type popularity: float, optional + + :param title: Title of the asset. + :type title: str, optional + """ + if popularity is not unset: + kwargs["popularity"] = popularity + if title is not unset: + kwargs["title"] = title + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/metric_dashboard_type.py b/src/datadog_api_client/v2/model/metric_dashboard_type.py new file mode 100644 index 0000000000..49a3fbd9a6 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_dashboard_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 MetricDashboardType(ModelSimple): + """ + Dashboard resource type. + + :param value: If omitted defaults to "dashboards". Must be one of ["dashboards"]. + :type value: str + """ + + allowed_values = { + "dashboards", + } + DASHBOARDS: ClassVar["MetricDashboardType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +MetricDashboardType.DASHBOARDS = MetricDashboardType("dashboards") diff --git a/src/datadog_api_client/v2/model/metric_monitor_asset.py b/src/datadog_api_client/v2/model/metric_monitor_asset.py new file mode 100644 index 0000000000..2b4418c5e1 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_monitor_asset.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 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.metric_asset_attributes import MetricAssetAttributes + from datadog_api_client.v2.model.metric_monitor_type import MetricMonitorType + + +class MetricMonitorAsset(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_attributes import MetricAssetAttributes + from datadog_api_client.v2.model.metric_monitor_type import MetricMonitorType + + return { + "attributes": (MetricAssetAttributes,), + "id": (str,), + "type": (MetricMonitorType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, id: str, type: MetricMonitorType, attributes: Union[MetricAssetAttributes, UnsetType] = unset, **kwargs + ): + """ + A monitor object with title. + + :param attributes: Assets where only included attribute is its title + :type attributes: MetricAssetAttributes, optional + + :param id: The related monitor's ID. + :type id: str + + :param type: Monitor resource type. + :type type: MetricMonitorType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/metric_monitor_type.py b/src/datadog_api_client/v2/model/metric_monitor_type.py new file mode 100644 index 0000000000..be720fc358 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_monitor_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 MetricMonitorType(ModelSimple): + """ + Monitor resource type. + + :param value: If omitted defaults to "monitors". Must be one of ["monitors"]. + :type value: str + """ + + allowed_values = { + "monitors", + } + MONITORS: ClassVar["MetricMonitorType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +MetricMonitorType.MONITORS = MetricMonitorType("monitors") diff --git a/src/datadog_api_client/v2/model/metric_notebook_asset.py b/src/datadog_api_client/v2/model/metric_notebook_asset.py new file mode 100644 index 0000000000..644784d05d --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_notebook_asset.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 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.metric_asset_attributes import MetricAssetAttributes + from datadog_api_client.v2.model.metric_notebook_type import MetricNotebookType + + +class MetricNotebookAsset(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_attributes import MetricAssetAttributes + from datadog_api_client.v2.model.metric_notebook_type import MetricNotebookType + + return { + "attributes": (MetricAssetAttributes,), + "id": (str,), + "type": (MetricNotebookType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, id: str, type: MetricNotebookType, attributes: Union[MetricAssetAttributes, UnsetType] = unset, **kwargs + ): + """ + A notebook object with title. + + :param attributes: Assets where only included attribute is its title + :type attributes: MetricAssetAttributes, optional + + :param id: The related notebook's ID. + :type id: str + + :param type: Notebook resource type. + :type type: MetricNotebookType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/metric_notebook_type.py b/src/datadog_api_client/v2/model/metric_notebook_type.py new file mode 100644 index 0000000000..1af5d9e6c3 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_notebook_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 MetricNotebookType(ModelSimple): + """ + Notebook resource type. + + :param value: If omitted defaults to "notebooks". Must be one of ["notebooks"]. + :type value: str + """ + + allowed_values = { + "notebooks", + } + NOTEBOOKS: ClassVar["MetricNotebookType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +MetricNotebookType.NOTEBOOKS = MetricNotebookType("notebooks") diff --git a/src/datadog_api_client/v2/model/metric_slo_asset.py b/src/datadog_api_client/v2/model/metric_slo_asset.py new file mode 100644 index 0000000000..19d6ab2589 --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_slo_asset.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 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.metric_asset_attributes import MetricAssetAttributes + from datadog_api_client.v2.model.metric_slo_type import MetricSLOType + + +class MetricSLOAsset(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.metric_asset_attributes import MetricAssetAttributes + from datadog_api_client.v2.model.metric_slo_type import MetricSLOType + + return { + "attributes": (MetricAssetAttributes,), + "id": (str,), + "type": (MetricSLOType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, id: str, type: MetricSLOType, attributes: Union[MetricAssetAttributes, UnsetType] = unset, **kwargs + ): + """ + A SLO object with title. + + :param attributes: Assets where only included attribute is its title + :type attributes: MetricAssetAttributes, optional + + :param id: The SLO ID. + :type id: str + + :param type: SLO resource type. + :type type: MetricSLOType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/metric_slo_type.py b/src/datadog_api_client/v2/model/metric_slo_type.py new file mode 100644 index 0000000000..5c184f6d1b --- /dev/null +++ b/src/datadog_api_client/v2/model/metric_slo_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 MetricSLOType(ModelSimple): + """ + SLO resource type. + + :param value: If omitted defaults to "slos". Must be one of ["slos"]. + :type value: str + """ + + allowed_values = { + "slos", + } + SLOS: ClassVar["MetricSLOType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +MetricSLOType.SLOS = MetricSLOType("slos") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index d7408692ea..dd155848f8 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -779,6 +779,19 @@ from datadog_api_client.v2.model.metric_all_tags import MetricAllTags from datadog_api_client.v2.model.metric_all_tags_attributes import MetricAllTagsAttributes from datadog_api_client.v2.model.metric_all_tags_response import MetricAllTagsResponse +from datadog_api_client.v2.model.metric_asset_attributes import MetricAssetAttributes +from datadog_api_client.v2.model.metric_asset_dashboard_relationship import MetricAssetDashboardRelationship +from datadog_api_client.v2.model.metric_asset_dashboard_relationships import MetricAssetDashboardRelationships +from datadog_api_client.v2.model.metric_asset_monitor_relationship import MetricAssetMonitorRelationship +from datadog_api_client.v2.model.metric_asset_monitor_relationships import MetricAssetMonitorRelationships +from datadog_api_client.v2.model.metric_asset_notebook_relationship import MetricAssetNotebookRelationship +from datadog_api_client.v2.model.metric_asset_notebook_relationships import MetricAssetNotebookRelationships +from datadog_api_client.v2.model.metric_asset_response_data import MetricAssetResponseData +from datadog_api_client.v2.model.metric_asset_response_included import MetricAssetResponseIncluded +from datadog_api_client.v2.model.metric_asset_response_relationships import MetricAssetResponseRelationships +from datadog_api_client.v2.model.metric_asset_slo_relationship import MetricAssetSLORelationship +from datadog_api_client.v2.model.metric_asset_slo_relationships import MetricAssetSLORelationships +from datadog_api_client.v2.model.metric_assets_response import MetricAssetsResponse from datadog_api_client.v2.model.metric_bulk_configure_tags_type import MetricBulkConfigureTagsType from datadog_api_client.v2.model.metric_bulk_tag_config_create import MetricBulkTagConfigCreate from datadog_api_client.v2.model.metric_bulk_tag_config_create_attributes import MetricBulkTagConfigCreateAttributes @@ -796,6 +809,9 @@ from datadog_api_client.v2.model.metric_custom_aggregations import MetricCustomAggregations from datadog_api_client.v2.model.metric_custom_space_aggregation import MetricCustomSpaceAggregation from datadog_api_client.v2.model.metric_custom_time_aggregation import MetricCustomTimeAggregation +from datadog_api_client.v2.model.metric_dashboard_asset import MetricDashboardAsset +from datadog_api_client.v2.model.metric_dashboard_attributes import MetricDashboardAttributes +from datadog_api_client.v2.model.metric_dashboard_type import MetricDashboardType from datadog_api_client.v2.model.metric_distinct_volume import MetricDistinctVolume from datadog_api_client.v2.model.metric_distinct_volume_attributes import MetricDistinctVolumeAttributes from datadog_api_client.v2.model.metric_distinct_volume_type import MetricDistinctVolumeType @@ -809,10 +825,16 @@ from datadog_api_client.v2.model.metric_ingested_indexed_volume_type import MetricIngestedIndexedVolumeType from datadog_api_client.v2.model.metric_intake_type import MetricIntakeType from datadog_api_client.v2.model.metric_metadata import MetricMetadata +from datadog_api_client.v2.model.metric_monitor_asset import MetricMonitorAsset +from datadog_api_client.v2.model.metric_monitor_type import MetricMonitorType +from datadog_api_client.v2.model.metric_notebook_asset import MetricNotebookAsset +from datadog_api_client.v2.model.metric_notebook_type import MetricNotebookType from datadog_api_client.v2.model.metric_origin import MetricOrigin from datadog_api_client.v2.model.metric_payload import MetricPayload from datadog_api_client.v2.model.metric_point import MetricPoint from datadog_api_client.v2.model.metric_resource import MetricResource +from datadog_api_client.v2.model.metric_slo_asset import MetricSLOAsset +from datadog_api_client.v2.model.metric_slo_type import MetricSLOType from datadog_api_client.v2.model.metric_series import MetricSeries from datadog_api_client.v2.model.metric_suggested_aggregations import MetricSuggestedAggregations from datadog_api_client.v2.model.metric_suggested_tags_and_aggregations import MetricSuggestedTagsAndAggregations @@ -2343,6 +2365,19 @@ "MetricAllTags", "MetricAllTagsAttributes", "MetricAllTagsResponse", + "MetricAssetAttributes", + "MetricAssetDashboardRelationship", + "MetricAssetDashboardRelationships", + "MetricAssetMonitorRelationship", + "MetricAssetMonitorRelationships", + "MetricAssetNotebookRelationship", + "MetricAssetNotebookRelationships", + "MetricAssetResponseData", + "MetricAssetResponseIncluded", + "MetricAssetResponseRelationships", + "MetricAssetSLORelationship", + "MetricAssetSLORelationships", + "MetricAssetsResponse", "MetricBulkConfigureTagsType", "MetricBulkTagConfigCreate", "MetricBulkTagConfigCreateAttributes", @@ -2360,6 +2395,9 @@ "MetricCustomAggregations", "MetricCustomSpaceAggregation", "MetricCustomTimeAggregation", + "MetricDashboardAsset", + "MetricDashboardAttributes", + "MetricDashboardType", "MetricDistinctVolume", "MetricDistinctVolumeAttributes", "MetricDistinctVolumeType", @@ -2373,10 +2411,16 @@ "MetricIngestedIndexedVolumeType", "MetricIntakeType", "MetricMetadata", + "MetricMonitorAsset", + "MetricMonitorType", + "MetricNotebookAsset", + "MetricNotebookType", "MetricOrigin", "MetricPayload", "MetricPoint", "MetricResource", + "MetricSLOAsset", + "MetricSLOType", "MetricSeries", "MetricSuggestedAggregations", "MetricSuggestedTagsAndAggregations", diff --git a/tests/v2/cassettes/test_scenarios/test_related_assets_to_a_metric_returns_success_response.frozen b/tests/v2/cassettes/test_scenarios/test_related_assets_to_a_metric_returns_success_response.frozen new file mode 100644 index 0000000000..a7312811c4 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_related_assets_to_a_metric_returns_success_response.frozen @@ -0,0 +1 @@ +2024-02-28T15:57:55.633Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_related_assets_to_a_metric_returns_success_response.yaml b/tests/v2/cassettes/test_scenarios/test_related_assets_to_a_metric_returns_success_response.yaml new file mode 100644 index 0000000000..96fdb69614 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_related_assets_to_a_metric_returns_success_response.yaml @@ -0,0 +1,32 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/metrics/system.cpu.user/assets + response: + body: + string: '{"data":{"id":"system.cpu.user","type":"metrics","relationships":{"dashboards":{"data":[{"id":"d5e-dpd-umy","type":"dashboards"},{"id":"884-jxj-d7f","type":"dashboards"},{"id":"kqz-yw2-egk","type":"dashboards"},{"id":"43b-kw6-vqr","type":"dashboards"},{"id":"3bd-yi5-t9f","type":"dashboards"},{"id":"zfd-a24-thy","type":"dashboards"},{"id":"5qr-399-8wz","type":"dashboards"},{"id":"zst-bcm-gq6","type":"dashboards"},{"id":"ytd-nd3-bxu","type":"dashboards"},{"id":"7dp-46c-6tr","type":"dashboards"},{"id":"ug4-a8z-jva","type":"dashboards"},{"id":"89p-5x9-mfp","type":"dashboards"},{"id":"unw-hwk-68w","type":"dashboards"},{"id":"2m8-ht3-7kf","type":"dashboards"},{"id":"eq3-r74-a85","type":"dashboards"},{"id":"8yn-6s7-pue","type":"dashboards"},{"id":"b6n-8j5-2iz","type":"dashboards"},{"id":"4j8-nbn-4gi","type":"dashboards"},{"id":"tpx-f7m-z57","type":"dashboards"},{"id":"xfe-kap-e5y","type":"dashboards"},{"id":"5tp-tr6-93q","type":"dashboards"},{"id":"6md-r2g-kxc","type":"dashboards"},{"id":"neh-3bi-sgi","type":"dashboards"},{"id":"63v-49e-a7d","type":"dashboards"},{"id":"8w6-777-dbc","type":"dashboards"},{"id":"bgp-uee-rt3","type":"dashboards"},{"id":"p8w-deq-k6x","type":"dashboards"},{"id":"f4a-76m-nbn","type":"dashboards"},{"id":"9km-gj8-2rj","type":"dashboards"},{"id":"deh-2pa-jv8","type":"dashboards"}]},"monitors":{"data":[]},"notebooks":{"data":[{"id":"4758632","type":"notebooks"}]},"slos":{"data":[]}}},"included":[{"id":"d5e-dpd-umy","type":"dashboards","attributes":{"popularity":0,"title":"Cloud + Foundry - Infrastructure Overview"}},{"id":"884-jxj-d7f","type":"dashboards","attributes":{"popularity":0,"title":"Cloud + Foundry - Infrastructure Overview"}},{"id":"kqz-yw2-egk","type":"dashboards","attributes":{"popularity":0,"title":"PCF + Nozzle Testing (cloned)"}},{"id":"43b-kw6-vqr","type":"dashboards","attributes":{"popularity":0,"title":"Cloud + Foundry - Overview (cloned)"}},{"id":"3bd-yi5-t9f","type":"dashboards","attributes":{"popularity":0,"title":"Cloud + Foundry - Overview (cloned)"}},{"id":"zfd-a24-thy","type":"dashboards","attributes":{"popularity":0,"title":"PCF + Cloud Controller"}},{"id":"5qr-399-8wz","type":"dashboards","attributes":{"popularity":0,"title":"Example-Create_a_new_dashboard_with_formulas_and_functions_scatterplot_widget_1708538631"}},{"id":"zst-bcm-gq6","type":"dashboards","attributes":{"popularity":0,"title":"Ordered + Layout Dashboard"}},{"id":"ytd-nd3-bxu","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"7dp-46c-6tr","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"ug4-a8z-jva","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"89p-5x9-mfp","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"unw-hwk-68w","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"2m8-ht3-7kf","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"eq3-r74-a85","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"8yn-6s7-pue","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"b6n-8j5-2iz","type":"dashboards","attributes":{"popularity":0,"title":"Cloud + Foundry - Overview (cloned) (cloned)"}},{"id":"4j8-nbn-4gi","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"tpx-f7m-z57","type":"dashboards","attributes":{"popularity":0,"title":"{{ + unique }}"}},{"id":"xfe-kap-e5y","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"5tp-tr6-93q","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"6md-r2g-kxc","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"neh-3bi-sgi","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"63v-49e-a7d","type":"dashboards","attributes":{"popularity":0,"title":"sarah + test"}},{"id":"8w6-777-dbc","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"bgp-uee-rt3","type":"dashboards","attributes":{"popularity":0,"title":""}},{"id":"p8w-deq-k6x","type":"dashboards","attributes":{"popularity":0,"title":"CRP-176"}},{"id":"f4a-76m-nbn","type":"dashboards","attributes":{"popularity":0,"title":"Hippolyte''s + Screenboard Fri, Apr 16, 10:20:54 am"}},{"id":"9km-gj8-2rj","type":"dashboards","attributes":{"popularity":0,"title":"Hippolyte''s + Screenboard Fri, Apr 16, 10:20:54 am"}},{"id":"deh-2pa-jv8","type":"dashboards","attributes":{"popularity":0,"title":"Hippolyte''s + Timeboard Wed, Mar 3, 10:57:28 am"}},{"id":"4758632","type":"notebooks","attributes":{"title":"PCF + Container Usage Attribution"}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/metrics.feature b/tests/v2/features/metrics.feature index 751f90ef43..671d2173ad 100644 --- a/tests/v2/features/metrics.feature +++ b/tests/v2/features/metrics.feature @@ -279,6 +279,24 @@ Feature: Metrics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/metrics-experience + Scenario: Related Assets to a Metric returns "API error response." response + Given a valid "appKeyAuth" key in the system + And new "ListMetricAssets" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/metrics-experience + Scenario: Related Assets to a Metric returns "Success" response + Given a valid "appKeyAuth" key in the system + And new "ListMetricAssets" request + And request contains "metric_name" parameter with value "system.cpu.user" + When the request is sent + Then the response status is 200 Success + And the response "data.type" is equal to "metrics" + And the response "data.id" is equal to "system.cpu.user" + @team:Datadog/timeseries-query Scenario: Scalar cross product query returns "Bad Request" response Given a valid "appKeyAuth" key in the system diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index f58d4d3534..387676557a 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1162,6 +1162,12 @@ "type": "safe" } }, + "ListMetricAssets": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, "EstimateMetricsOutputSeries": { "tag": "Metrics", "undo": {