diff --git a/.apigentools-info b/.apigentools-info index 6758969fc6..1095d6ee7f 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev11", - "regenerated": "2021-07-15 15:54:38.956828", - "spec_repo_commit": "18eae8f" + "regenerated": "2021-07-16 07:35:29.024585", + "spec_repo_commit": "3333df2" }, "v2": { "apigentools_version": "1.4.1.dev11", - "regenerated": "2021-07-15 15:55:05.776227", - "spec_repo_commit": "18eae8f" + "regenerated": "2021-07-16 07:35:56.451726", + "spec_repo_commit": "3333df2" } } } \ No newline at end of file diff --git a/docs/v1/DashboardBulkActionData.md b/docs/v1/DashboardBulkActionData.md new file mode 100644 index 0000000000..f6068c005e --- /dev/null +++ b/docs/v1/DashboardBulkActionData.md @@ -0,0 +1,13 @@ +# DashboardBulkActionData + +Dashboard bulk action request data. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Dashboard resource ID. | +**type** | [**DashboardResourceType**](DashboardResourceType.md) | | + +[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md) + + diff --git a/docs/v1/DashboardBulkActionDataList.md b/docs/v1/DashboardBulkActionDataList.md new file mode 100644 index 0000000000..2c4e1ae115 --- /dev/null +++ b/docs/v1/DashboardBulkActionDataList.md @@ -0,0 +1,12 @@ +# DashboardBulkActionDataList + +List of dashboard bulk action request data objects. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | [**[DashboardBulkActionData]**](DashboardBulkActionData.md) | List of dashboard bulk action request data objects. | + +[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md) + + diff --git a/docs/v1/DashboardBulkDeleteRequest.md b/docs/v1/DashboardBulkDeleteRequest.md new file mode 100644 index 0000000000..fe63b8c24e --- /dev/null +++ b/docs/v1/DashboardBulkDeleteRequest.md @@ -0,0 +1,12 @@ +# DashboardBulkDeleteRequest + +Dashboard bulk delete request body. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**DashboardBulkActionDataList**](DashboardBulkActionDataList.md) | | + +[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md) + + diff --git a/docs/v1/DashboardResourceType.md b/docs/v1/DashboardResourceType.md new file mode 100644 index 0000000000..78ecc035ae --- /dev/null +++ b/docs/v1/DashboardResourceType.md @@ -0,0 +1,12 @@ +# DashboardResourceType + +Dashboard resource type. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **str** | Dashboard resource type. | defaults to "dashboard", must be one of ["dashboard", ] + +[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md) + + diff --git a/docs/v1/DashboardRestoreRequest.md b/docs/v1/DashboardRestoreRequest.md new file mode 100644 index 0000000000..88c87efd30 --- /dev/null +++ b/docs/v1/DashboardRestoreRequest.md @@ -0,0 +1,12 @@ +# DashboardRestoreRequest + +Dashboard restore request body. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**DashboardBulkActionDataList**](DashboardBulkActionDataList.md) | | + +[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md) + + diff --git a/docs/v1/DashboardsApi.md b/docs/v1/DashboardsApi.md index afc496715e..ae4c0ed308 100644 --- a/docs/v1/DashboardsApi.md +++ b/docs/v1/DashboardsApi.md @@ -6,8 +6,10 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**create_dashboard**](DashboardsApi.md#create_dashboard) | **POST** /api/v1/dashboard | Create a new dashboard [**delete_dashboard**](DashboardsApi.md#delete_dashboard) | **DELETE** /api/v1/dashboard/{dashboard_id} | Delete a dashboard +[**delete_dashboards**](DashboardsApi.md#delete_dashboards) | **DELETE** /api/v1/dashboard | Delete dashboards [**get_dashboard**](DashboardsApi.md#get_dashboard) | **GET** /api/v1/dashboard/{dashboard_id} | Get a dashboard [**list_dashboards**](DashboardsApi.md#list_dashboards) | **GET** /api/v1/dashboard | Get all dashboards +[**restore_dashboards**](DashboardsApi.md#restore_dashboards) | **PATCH** /api/v1/dashboard | Restore deleted dashboards [**update_dashboard**](DashboardsApi.md#update_dashboard) | **PUT** /api/v1/dashboard/{dashboard_id} | Update a dashboard @@ -188,6 +190,77 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +# **delete_dashboards** +> delete_dashboards(body) + +Delete dashboards using the specified IDs. If there are any failures, no dashboards will be deleted (partial success is not allowed). + +### Example + +* Api Key Authentication (apiKeyAuth): +* Api Key Authentication (appKeyAuth): +```python +import os +from dateutil.parser import parse as dateutil_parser +from datadog_api_client.v1 import ApiClient, ApiException, Configuration +from datadog_api_client.v1.api import dashboards_api +from datadog_api_client.v1.models import * +from pprint import pprint +# See configuration.py for a list of all supported configuration parameters. +configuration = Configuration() + +# Enter a context with an instance of the API client +with ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = dashboards_api.DashboardsApi(api_client) + body = DashboardBulkDeleteRequest( + data=DashboardBulkActionDataList([ + DashboardBulkActionData( + id="123-abc-456", + type=DashboardResourceType("dashboard"), + ), + ]), + ) # DashboardBulkDeleteRequest | Delete dashboards request body. + + # example passing only required values which don't have defaults set + try: + # Delete dashboards + api_instance.delete_dashboards(body) + except ApiException as e: + print("Exception when calling DashboardsApi->delete_dashboards: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**DashboardBulkDeleteRequest**](DashboardBulkDeleteRequest.md)| Delete dashboards request body. | + +### Return type + +void (empty response body) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | No Content | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Dashboards Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + # **get_dashboard** > Dashboard get_dashboard(dashboard_id) @@ -319,6 +392,77 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +# **restore_dashboards** +> restore_dashboards(body) + +Restore dashboards using the specified IDs. If there are any failures, no dashboards will be restored (partial success is not allowed). + +### Example + +* Api Key Authentication (apiKeyAuth): +* Api Key Authentication (appKeyAuth): +```python +import os +from dateutil.parser import parse as dateutil_parser +from datadog_api_client.v1 import ApiClient, ApiException, Configuration +from datadog_api_client.v1.api import dashboards_api +from datadog_api_client.v1.models import * +from pprint import pprint +# See configuration.py for a list of all supported configuration parameters. +configuration = Configuration() + +# Enter a context with an instance of the API client +with ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = dashboards_api.DashboardsApi(api_client) + body = DashboardRestoreRequest( + data=DashboardBulkActionDataList([ + DashboardBulkActionData( + id="123-abc-456", + type=DashboardResourceType("dashboard"), + ), + ]), + ) # DashboardRestoreRequest | Restore dashboards request body. + + # example passing only required values which don't have defaults set + try: + # Restore deleted dashboards + api_instance.restore_dashboards(body) + except ApiException as e: + print("Exception when calling DashboardsApi->restore_dashboards: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**DashboardRestoreRequest**](DashboardRestoreRequest.md)| Restore dashboards request body. | + +### Return type + +void (empty response body) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | No Content | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Dashboards Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + # **update_dashboard** > Dashboard update_dashboard(dashboard_id, body) diff --git a/docs/v1/README.md b/docs/v1/README.md index 891ac42a59..0026384948 100644 --- a/docs/v1/README.md +++ b/docs/v1/README.md @@ -123,8 +123,10 @@ Class | Method | HTTP request | Description *DashboardListsApi* | [**update_dashboard_list**](DashboardListsApi.md#update_dashboard_list) | **PUT** /api/v1/dashboard/lists/manual/{list_id} | Update a dashboard list *DashboardsApi* | [**create_dashboard**](DashboardsApi.md#create_dashboard) | **POST** /api/v1/dashboard | Create a new dashboard *DashboardsApi* | [**delete_dashboard**](DashboardsApi.md#delete_dashboard) | **DELETE** /api/v1/dashboard/{dashboard_id} | Delete a dashboard +*DashboardsApi* | [**delete_dashboards**](DashboardsApi.md#delete_dashboards) | **DELETE** /api/v1/dashboard | Delete dashboards *DashboardsApi* | [**get_dashboard**](DashboardsApi.md#get_dashboard) | **GET** /api/v1/dashboard/{dashboard_id} | Get a dashboard *DashboardsApi* | [**list_dashboards**](DashboardsApi.md#list_dashboards) | **GET** /api/v1/dashboard | Get all dashboards +*DashboardsApi* | [**restore_dashboards**](DashboardsApi.md#restore_dashboards) | **PATCH** /api/v1/dashboard | Restore deleted dashboards *DashboardsApi* | [**update_dashboard**](DashboardsApi.md#update_dashboard) | **PUT** /api/v1/dashboard/{dashboard_id} | Update a dashboard *DowntimesApi* | [**cancel_downtime**](DowntimesApi.md#cancel_downtime) | **DELETE** /api/v1/downtime/{downtime_id} | Cancel a downtime *DowntimesApi* | [**cancel_downtimes_by_scope**](DowntimesApi.md#cancel_downtimes_by_scope) | **POST** /api/v1/downtime/cancel/by_scope | Cancel downtimes by scope @@ -337,12 +339,17 @@ Class | Method | HTTP request | Description - [ContentEncoding](ContentEncoding.md) - [Creator](Creator.md) - [Dashboard](Dashboard.md) + - [DashboardBulkActionData](DashboardBulkActionData.md) + - [DashboardBulkActionDataList](DashboardBulkActionDataList.md) + - [DashboardBulkDeleteRequest](DashboardBulkDeleteRequest.md) - [DashboardDeleteResponse](DashboardDeleteResponse.md) - [DashboardLayoutType](DashboardLayoutType.md) - [DashboardList](DashboardList.md) - [DashboardListDeleteResponse](DashboardListDeleteResponse.md) - [DashboardListListResponse](DashboardListListResponse.md) - [DashboardReflowType](DashboardReflowType.md) + - [DashboardResourceType](DashboardResourceType.md) + - [DashboardRestoreRequest](DashboardRestoreRequest.md) - [DashboardSummary](DashboardSummary.md) - [DashboardSummaryDefinition](DashboardSummaryDefinition.md) - [DashboardTemplateVariable](DashboardTemplateVariable.md) diff --git a/src/datadog_api_client/v1/api/dashboards_api.py b/src/datadog_api_client/v1/api/dashboards_api.py index c697dd1d1d..eac1ca9292 100644 --- a/src/datadog_api_client/v1/api/dashboards_api.py +++ b/src/datadog_api_client/v1/api/dashboards_api.py @@ -18,7 +18,9 @@ ) from datadog_api_client.v1.model.api_error_response import APIErrorResponse from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_bulk_delete_request import DashboardBulkDeleteRequest from datadog_api_client.v1.model.dashboard_delete_response import DashboardDeleteResponse +from datadog_api_client.v1.model.dashboard_restore_request import DashboardRestoreRequest from datadog_api_client.v1.model.dashboard_summary import DashboardSummary @@ -111,6 +113,42 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_dashboards_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v1/dashboard", + "operation_id": "delete_dashboards", + "http_method": "DELETE", + "servers": None, + }, + params_map={ + "all": [ + "body", + ], + "required": [ + "body", + ], + "nullable": [], + "enum": [], + "validation": [], + }, + root_map={ + "validations": {}, + "allowed_values": {}, + "openapi_types": { + "body": (DashboardBulkDeleteRequest,), + }, + "attribute_map": {}, + "location_map": { + "body": "body", + }, + "collection_format_map": {}, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._get_dashboard_endpoint = _Endpoint( settings={ "response_type": (Dashboard,), @@ -191,6 +229,42 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._restore_dashboards_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v1/dashboard", + "operation_id": "restore_dashboards", + "http_method": "PATCH", + "servers": None, + }, + params_map={ + "all": [ + "body", + ], + "required": [ + "body", + ], + "nullable": [], + "enum": [], + "validation": [], + }, + root_map={ + "validations": {}, + "allowed_values": {}, + "openapi_types": { + "body": (DashboardRestoreRequest,), + }, + "attribute_map": {}, + "location_map": { + "body": "body", + }, + "collection_format_map": {}, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_dashboard_endpoint = _Endpoint( settings={ "response_type": (Dashboard,), @@ -319,6 +393,49 @@ def delete_dashboard(self, dashboard_id, **kwargs): kwargs["dashboard_id"] = dashboard_id return self._delete_dashboard_endpoint.call_with_http_info(**kwargs) + def delete_dashboards(self, body, **kwargs): + """Delete dashboards # noqa: E501 + + Delete dashboards using the specified IDs. If there are any failures, no dashboards will be deleted (partial success is not allowed). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_dashboards(body, async_req=True) + >>> result = thread.get() + + Args: + body (DashboardBulkDeleteRequest): Delete dashboards request body. + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + None + If the method is called asynchronously, returns the request + thread. + """ + kwargs = self._delete_dashboards_endpoint.default_arguments(kwargs) + kwargs["body"] = body + return self._delete_dashboards_endpoint.call_with_http_info(**kwargs) + def get_dashboard(self, dashboard_id, **kwargs): """Get a dashboard # noqa: E501 @@ -403,6 +520,49 @@ def list_dashboards(self, **kwargs): kwargs = self._list_dashboards_endpoint.default_arguments(kwargs) return self._list_dashboards_endpoint.call_with_http_info(**kwargs) + def restore_dashboards(self, body, **kwargs): + """Restore deleted dashboards # noqa: E501 + + Restore dashboards using the specified IDs. If there are any failures, no dashboards will be restored (partial success is not allowed). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.restore_dashboards(body, async_req=True) + >>> result = thread.get() + + Args: + body (DashboardRestoreRequest): Restore dashboards request body. + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + None + If the method is called asynchronously, returns the request + thread. + """ + kwargs = self._restore_dashboards_endpoint.default_arguments(kwargs) + kwargs["body"] = body + return self._restore_dashboards_endpoint.call_with_http_info(**kwargs) + def update_dashboard(self, dashboard_id, body, **kwargs): """Update a dashboard # noqa: E501 diff --git a/src/datadog_api_client/v1/model/dashboard_bulk_action_data.py b/src/datadog_api_client/v1/model/dashboard_bulk_action_data.py new file mode 100644 index 0000000000..0d5982afb7 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_bulk_action_data.py @@ -0,0 +1,177 @@ +# 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. + + +import re # noqa: F401 +import sys # noqa: F401 + +from datadog_api_client.v1.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +def lazy_import(): + from datadog_api_client.v1.model.dashboard_resource_type import DashboardResourceType + + globals()["DashboardResourceType"] = DashboardResourceType + + +class DashboardBulkActionData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + "id": (str,), # noqa: E501 + "type": (DashboardResourceType,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "id": "id", # noqa: E501 + "type": "type", # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set( + [ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ] + ) + + @convert_js_args_to_python_args + def __init__(self, id, type, *args, **kwargs): # noqa: E501 + """DashboardBulkActionData - a model defined in OpenAPI + + Args: + id (str): Dashboard resource ID. + type (DashboardResourceType): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.id = id + self.type = type + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/src/datadog_api_client/v1/model/dashboard_bulk_action_data_list.py b/src/datadog_api_client/v1/model/dashboard_bulk_action_data_list.py new file mode 100644 index 0000000000..6f25ae7b6b --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_bulk_action_data_list.py @@ -0,0 +1,193 @@ +# 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. + + +import re # noqa: F401 +import sys # noqa: F401 + +from datadog_api_client.v1.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +def lazy_import(): + from datadog_api_client.v1.model.dashboard_bulk_action_data import DashboardBulkActionData + + globals()["DashboardBulkActionData"] = DashboardBulkActionData + + +class DashboardBulkActionDataList(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + "value": ([DashboardBulkActionData],), + } + + @cached_property + def discriminator(): + return None + + attribute_map = {} + + _composed_schemas = None + + required_properties = set( + [ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ] + ) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """DashboardBulkActionDataList - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] ([DashboardBulkActionData]): List of dashboard bulk action request data objects.. # noqa: E501 + + Keyword Args: + value ([DashboardBulkActionData]): List of dashboard bulk action request data objects.. # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + if not isinstance(value, list): + raise ApiTypeError( + "Invalid non-list arguments=%s passed to %s." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) diff --git a/src/datadog_api_client/v1/model/dashboard_bulk_delete_request.py b/src/datadog_api_client/v1/model/dashboard_bulk_delete_request.py new file mode 100644 index 0000000000..15a1c06666 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_bulk_delete_request.py @@ -0,0 +1,173 @@ +# 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. + + +import re # noqa: F401 +import sys # noqa: F401 + +from datadog_api_client.v1.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +def lazy_import(): + from datadog_api_client.v1.model.dashboard_bulk_action_data_list import DashboardBulkActionDataList + + globals()["DashboardBulkActionDataList"] = DashboardBulkActionDataList + + +class DashboardBulkDeleteRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + "data": (DashboardBulkActionDataList,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "data": "data", # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set( + [ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ] + ) + + @convert_js_args_to_python_args + def __init__(self, data, *args, **kwargs): # noqa: E501 + """DashboardBulkDeleteRequest - a model defined in OpenAPI + + Args: + data (DashboardBulkActionDataList): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.data = data + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/src/datadog_api_client/v1/model/dashboard_resource_type.py b/src/datadog_api_client/v1/model/dashboard_resource_type.py new file mode 100644 index 0000000000..7c0a0e23c4 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_resource_type.py @@ -0,0 +1,175 @@ +# 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. + + +import re # noqa: F401 +import sys # noqa: F401 + +from datadog_api_client.v1.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +class DashboardResourceType(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ("value",): { + "DASHBOARD": "dashboard", + }, + } + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "value": (str,), + } + + @cached_property + def discriminator(): + return None + + attribute_map = {} + + _composed_schemas = None + + required_properties = set( + [ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ] + ) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """DashboardResourceType - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): Dashboard resource type.. if omitted defaults to "dashboard", must be one of ["dashboard", ] # noqa: E501 + + Keyword Args: + value (str): Dashboard resource type.. if omitted defaults to "dashboard", must be one of ["dashboard", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + value = "dashboard" + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) diff --git a/src/datadog_api_client/v1/model/dashboard_restore_request.py b/src/datadog_api_client/v1/model/dashboard_restore_request.py new file mode 100644 index 0000000000..c17d0d6e46 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_restore_request.py @@ -0,0 +1,173 @@ +# 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. + + +import re # noqa: F401 +import sys # noqa: F401 + +from datadog_api_client.v1.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +def lazy_import(): + from datadog_api_client.v1.model.dashboard_bulk_action_data_list import DashboardBulkActionDataList + + globals()["DashboardBulkActionDataList"] = DashboardBulkActionDataList + + +class DashboardRestoreRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + "data": (DashboardBulkActionDataList,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "data": "data", # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set( + [ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ] + ) + + @convert_js_args_to_python_args + def __init__(self, data, *args, **kwargs): # noqa: E501 + """DashboardRestoreRequest - a model defined in OpenAPI + + Args: + data (DashboardBulkActionDataList): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.data = data + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 86073f799d..96ad477179 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -57,12 +57,17 @@ from datadog_api_client.v1.model.content_encoding import ContentEncoding from datadog_api_client.v1.model.creator import Creator from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_bulk_action_data import DashboardBulkActionData +from datadog_api_client.v1.model.dashboard_bulk_action_data_list import DashboardBulkActionDataList +from datadog_api_client.v1.model.dashboard_bulk_delete_request import DashboardBulkDeleteRequest from datadog_api_client.v1.model.dashboard_delete_response import DashboardDeleteResponse from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType from datadog_api_client.v1.model.dashboard_list import DashboardList from datadog_api_client.v1.model.dashboard_list_delete_response import DashboardListDeleteResponse from datadog_api_client.v1.model.dashboard_list_list_response import DashboardListListResponse from datadog_api_client.v1.model.dashboard_reflow_type import DashboardReflowType +from datadog_api_client.v1.model.dashboard_resource_type import DashboardResourceType +from datadog_api_client.v1.model.dashboard_restore_request import DashboardRestoreRequest from datadog_api_client.v1.model.dashboard_summary import DashboardSummary from datadog_api_client.v1.model.dashboard_summary_definition import DashboardSummaryDefinition from datadog_api_client.v1.model.dashboard_template_variable import DashboardTemplateVariable diff --git a/src/datadog_api_client/v1/openapi.yaml b/src/datadog_api_client/v1/openapi.yaml index 3ab2e79f23..751bd51c3b 100644 --- a/src/datadog_api_client/v1/openapi.yaml +++ b/src/datadog_api_client/v1/openapi.yaml @@ -955,6 +955,40 @@ components: - layout_type - widgets type: object + DashboardBulkActionData: + description: Dashboard bulk action request data. + example: + id: 123-abc-456 + type: dashboard + properties: + id: + $ref: '#/components/schemas/DashboardID' + type: + $ref: '#/components/schemas/DashboardResourceType' + required: + - type + - id + type: object + DashboardBulkActionDataList: + description: List of dashboard bulk action request data objects. + example: + - id: 123-abc-456 + type: dashboard + items: + $ref: '#/components/schemas/DashboardBulkActionData' + type: array + DashboardBulkDeleteRequest: + description: Dashboard bulk delete request body. + example: + data: + - id: 123-abc-456 + type: dashboard + properties: + data: + $ref: '#/components/schemas/DashboardBulkActionDataList' + required: + - data + type: object DashboardDeleteResponse: description: Response from the delete dashboard call. properties: @@ -962,6 +996,10 @@ components: description: ID of the deleted dashboard. type: string type: object + DashboardID: + description: Dashboard resource ID. + example: 123-abc-456 + type: string DashboardLayoutType: description: Layout type of the dashboard. enum: @@ -1044,6 +1082,27 @@ components: x-enum-varnames: - AUTO - FIXED + DashboardResourceType: + default: dashboard + description: Dashboard resource type. + enum: + - dashboard + example: dashboard + type: string + x-enum-varnames: + - DASHBOARD + DashboardRestoreRequest: + description: Dashboard restore request body. + example: + data: + - id: 123-abc-456 + type: dashboard + properties: + data: + $ref: '#/components/schemas/DashboardBulkActionDataList' + required: + - data + type: object DashboardSummary: description: Dashboard summary response. properties: @@ -14072,6 +14131,53 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v1/dashboard: + delete: + description: Delete dashboards using the specified IDs. If there are any failures, + no dashboards will be deleted (partial success is not allowed). + operationId: DeleteDashboards + requestBody: + content: + application/json: + examples: + json-request-body: + value: + data: + - id: 123-abc-456 + type: dashboard + - id: 789-def-101 + type: dashboard + schema: + $ref: '#/components/schemas/DashboardBulkDeleteRequest' + description: Delete dashboards request body. + required: true + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Dashboards Not Found + summary: Delete dashboards + tags: + - Dashboards + x-codegen-request-body-name: body + x-menu-order: 4 + x-undo: + type: idempotent get: description: 'Get all dashboards. @@ -14108,6 +14214,53 @@ paths: x-menu-order: 2 x-undo: type: safe + patch: + description: Restore dashboards using the specified IDs. If there are any failures, + no dashboards will be restored (partial success is not allowed). + operationId: RestoreDashboards + requestBody: + content: + application/json: + examples: + json-request-body: + value: + data: + - id: 123-abc-456 + type: dashboard + - id: 789-def-101 + type: dashboard + schema: + $ref: '#/components/schemas/DashboardRestoreRequest' + description: Restore dashboards request body. + required: true + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Dashboards Not Found + summary: Restore deleted dashboards + tags: + - Dashboards + x-codegen-request-body-name: body + x-menu-order: 5 + x-undo: + type: idempotent post: description: 'Create a dashboard using the specified options. When defining queries in your widgets, take note of which queries should have the `as_count()` @@ -14413,7 +14566,7 @@ paths: summary: Get a dashboard tags: - Dashboards - x-menu-order: 5 + x-menu-order: 7 x-undo: type: safe put: @@ -14462,7 +14615,7 @@ paths: tags: - Dashboards x-codegen-request-body-name: body - x-menu-order: 4 + x-menu-order: 6 x-undo: type: idempotent /api/v1/downtime: diff --git a/tests/v1/cassettes/test_scenarios/test_delete_dashboards_returns_no_content_response.frozen b/tests/v1/cassettes/test_scenarios/test_delete_dashboards_returns_no_content_response.frozen new file mode 100644 index 0000000000..dfeb3515cc --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_delete_dashboards_returns_no_content_response.frozen @@ -0,0 +1 @@ +2021-07-15T15:51:31.254Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_delete_dashboards_returns_no_content_response.yaml b/tests/v1/cassettes/test_scenarios/test_delete_dashboards_returns_no_content_response.yaml new file mode 100644 index 0000000000..51e16a75a2 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_delete_dashboards_returns_no_content_response.yaml @@ -0,0 +1,159 @@ +interactions: +- request: + body: '{"layout_type":"ordered","title":"Test-Delete_dashboards_returns_No_Content_response-1626364291 + with Profile Metrics Query","widgets":[{"definition":{"requests":[{"profile_metrics_query":{"compute":{"aggregation":"sum","facet":"@prof_core_cpu_cores"},"group_by":[{"facet":"service","limit":10,"sort":{"aggregation":"sum","facet":"@prof_core_cpu_cores","order":"desc"}}],"search":{"query":"runtime:jvm"}}}],"type":"timeseries"}}]}' + headers: + accept: + - application/json, */*;q=0.8 + connection: + - close + content-length: + - '429' + content-type: + - application/json + host: + - api.datadoghq.com + user-agent: + - datadog-api-client-typescript/1.0.0-beta.4+dev (node 14.17.3; os Linux; arch + x64) + x-datadog-parent-id: + - '2101234123578670468' + x-datadog-trace-id: + - '499179998183965666' + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + string: '{"notify_list":null,"description":null,"restricted_roles":[],"author_name":null,"template_variables":null,"is_read_only":false,"id":"npn-e8n-9h8","title":"Test-Delete_dashboards_returns_No_Content_response-1626364291 + with Profile Metrics Query","url":"/dashboard/npn-e8n-9h8/test-deletedashboardsreturnsnocontentresponse-1626364291-with-profile-metrics-qu","created_at":"2021-07-15T15:51:31.421021+00:00","modified_at":"2021-07-15T15:51:31.421021+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"profile_metrics_query":{"search":{"query":"runtime:jvm"},"group_by":[{"facet":"service","sort":{"facet":"@prof_core_cpu_cores","aggregation":"sum","order":"desc"},"limit":10}],"compute":{"facet":"@prof_core_cpu_cores","aggregation":"sum"}}}],"type":"timeseries"},"id":6112842896948102}],"layout_type":"ordered"}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '842' + content-security-policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + content-type: + - application/json + date: + - Thu, 15 Jul 2021 15:51:31 GMT + pragma: + - no-cache + strict-transport-security: + - max-age=15724800; + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-frame-options: + - SAMEORIGIN + status: + code: 200 + message: OK +- request: + body: '{"data":[{"id":"npn-e8n-9h8","type":"dashboard"}]}' + headers: + accept: + - application/json, */*;q=0.8 + connection: + - close + content-length: + - '50' + content-type: + - application/json + host: + - api.datadoghq.com + user-agent: + - datadog-api-client-typescript/1.0.0-beta.4+dev (node 14.17.3; os Linux; arch + x64) + x-datadog-parent-id: + - '5845383063144211042' + x-datadog-trace-id: + - '499179998183965666' + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + string: '' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '0' + content-security-policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + content-type: + - application/json + date: + - Thu, 15 Jul 2021 15:51:31 GMT + pragma: + - no-cache + strict-transport-security: + - max-age=15724800; + x-content-type-options: + - nosniff + x-frame-options: + - SAMEORIGIN + x-ratelimit-limit: + - '50' + x-ratelimit-period: + - '60' + x-ratelimit-remaining: + - '49' + x-ratelimit-reset: + - '29' + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - application/json, */*;q=0.8 + connection: + - close + host: + - api.datadoghq.com + user-agent: + - datadog-api-client-typescript/1.0.0-beta.4+dev (node 14.17.3; os Linux; arch + x64) + x-datadog-parent-id: + - '1994759177802865831' + x-datadog-trace-id: + - '499179998183965666' + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/npn-e8n-9h8 + response: + body: + string: '{"errors": ["Dashboard with ID npn-e8n-9h8 not found"]}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '55' + content-security-policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + content-type: + - application/json + date: + - Thu, 15 Jul 2021 15:51:31 GMT + pragma: + - no-cache + strict-transport-security: + - max-age=15724800; + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-frame-options: + - SAMEORIGIN + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 373fa08220..f1187370e7 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -59,6 +59,27 @@ Feature: Dashboards When the request is sent Then the response status is 200 OK + @generated @skip + Scenario: Delete dashboards returns "Bad Request" response + Given new "DeleteDashboards" request + And body with value {"data": [{"id": "123-abc-456", "type": "dashboard"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip + Scenario: Delete dashboards returns "Dashboards Not Found" response + Given new "DeleteDashboards" request + And body with value {"data": [{"id": "123-abc-456", "type": "dashboard"}]} + When the request is sent + Then the response status is 404 Dashboards Not Found + + Scenario: Delete dashboards returns "No Content" response + Given there is a valid "dashboard" in the system + And new "DeleteDashboards" request + And body with value {"data": [{"id": "{{ dashboard.id }}", "type": "dashboard"}]} + When the request is sent + Then the response status is 204 No Content + @generated @skip Scenario: Get a dashboard returns "Item Not Found" response Given new "GetDashboard" request @@ -80,6 +101,27 @@ Feature: Dashboards When the request is sent Then the response status is 200 OK + @generated @skip + Scenario: Restore deleted dashboards returns "Bad Request" response + Given new "RestoreDashboards" request + And body with value {"data": [{"id": "123-abc-456", "type": "dashboard"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip + Scenario: Restore deleted dashboards returns "Dashboards Not Found" response + Given new "RestoreDashboards" request + And body with value {"data": [{"id": "123-abc-456", "type": "dashboard"}]} + When the request is sent + Then the response status is 404 Dashboards Not Found + + @generated @skip + Scenario: Restore deleted dashboards returns "No Content" response + Given new "RestoreDashboards" request + And body with value {"data": [{"id": "123-abc-456", "type": "dashboard"}]} + When the request is sent + Then the response status is 204 No Content + @generated @skip Scenario: Update a dashboard returns "Bad Request" response Given new "UpdateDashboard" request diff --git a/tests/v1/features/undo.json b/tests/v1/features/undo.json index 38b7a2e326..ad91a26e41 100644 --- a/tests/v1/features/undo.json +++ b/tests/v1/features/undo.json @@ -97,12 +97,24 @@ "type": "safe" } }, + "DeleteDashboards": { + "tag": "Dashboards", + "undo": { + "type": "idempotent" + } + }, "ListDashboards": { "tag": "Dashboards", "undo": { "type": "safe" } }, + "RestoreDashboards": { + "tag": "Dashboards", + "undo": { + "type": "idempotent" + } + }, "CreateDashboard": { "tag": "Dashboards", "undo": {