Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark v1 downtime endpoints as deprecated #1818

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-12-27 15:09:17.062005",
"spec_repo_commit": "61dc4c3e"
"regenerated": "2023-12-28 18:22:57.275767",
"spec_repo_commit": "42c21a14"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-12-27 15:09:17.081944",
"spec_repo_commit": "61dc4c3e"
"regenerated": "2023-12-28 18:22:57.289365",
"spec_repo_commit": "42c21a14"
}
}
}
30 changes: 23 additions & 7 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22984,7 +22984,9 @@ paths:
x-codegen-request-body-name: body
/api/v1/downtime:
get:
description: Get all scheduled downtimes.
deprecated: true
description: Get all scheduled downtimes. **Note:** This endpoint has been deprecated.
Please use v2 endpoints.
operationId: ListDowntimes
parameters:
- description: Only return downtimes that are active when the request is made.
Expand Down Expand Up @@ -23025,7 +23027,9 @@ paths:
tags:
- Downtimes
post:
description: Schedule a downtime.
deprecated: true
description: Schedule a downtime. **Note:** This endpoint has been deprecated.
Please use v2 endpoints.
operationId: CreateDowntime
requestBody:
content:
Expand Down Expand Up @@ -23066,7 +23070,11 @@ paths:
x-codegen-request-body-name: body
/api/v1/downtime/cancel/by_scope:
post:
description: Delete all downtimes that match the scope of `X`.
deprecated: true
description: Delete all downtimes that match the scope of `X`. **Note:** This
only interacts with Downtimes created using v1 endpoints. This endpoint has
been deprecated and will not be replaced. Please use v2 endpoints to find
and cancel downtimes.
operationId: CancelDowntimesByScope
requestBody:
content:
Expand Down Expand Up @@ -23113,7 +23121,9 @@ paths:
x-codegen-request-body-name: body
/api/v1/downtime/{downtime_id}:
delete:
description: Cancel a downtime.
deprecated: true
description: Cancel a downtime. **Note:** This endpoint has been deprecated.
Please use v2 endpoints.
operationId: CancelDowntime
parameters:
- description: ID of the downtime to cancel.
Expand Down Expand Up @@ -23150,7 +23160,9 @@ paths:
tags:
- Downtimes
get:
description: Get downtime detail by `downtime_id`.
deprecated: true
description: Get downtime detail by `downtime_id`. **Note:** This endpoint has
been deprecated. Please use v2 endpoints.
operationId: GetDowntime
parameters:
- description: ID of the downtime to fetch.
Expand Down Expand Up @@ -23191,7 +23203,9 @@ paths:
tags:
- Downtimes
put:
description: Update a single downtime by `downtime_id`.
deprecated: true
description: Update a single downtime by `downtime_id`. **Note:** This endpoint
has been deprecated. Please use v2 endpoints.
operationId: UpdateDowntime
parameters:
- description: ID of the downtime to update.
Expand Down Expand Up @@ -27176,7 +27190,9 @@ paths:
x-codegen-request-body-name: body
/api/v1/monitor/{monitor_id}/downtimes:
get:
description: Get all active downtimes for the specified monitor.
deprecated: true
description: Get all active v1 downtimes for the specified monitor. **Note:**
This endpoint has been deprecated. Please use v2 endpoints.
operationId: ListMonitorDowntimes
parameters:
- description: The id of the monitor
Expand Down
36 changes: 22 additions & 14 deletions src/datadog_api_client/v1/api/downtimes_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import annotations

from typing import Any, Dict, List, Union
import warnings

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
Expand Down Expand Up @@ -195,9 +196,9 @@ def cancel_downtime(
self,
downtime_id: int,
) -> None:
"""Cancel a downtime.
"""Cancel a downtime. **Deprecated**.

Cancel a downtime.
Cancel a downtime. **Note:** This endpoint has been deprecated. Please use v2 endpoints.

:param downtime_id: ID of the downtime to cancel.
:type downtime_id: int
Expand All @@ -206,15 +207,16 @@ def cancel_downtime(
kwargs: Dict[str, Any] = {}
kwargs["downtime_id"] = downtime_id

warnings.warn("cancel_downtime is deprecated", DeprecationWarning, stacklevel=2)
return self._cancel_downtime_endpoint.call_with_http_info(**kwargs)

def cancel_downtimes_by_scope(
self,
body: CancelDowntimesByScopeRequest,
) -> CanceledDowntimesIds:
"""Cancel downtimes by scope.
"""Cancel downtimes by scope. **Deprecated**.

Delete all downtimes that match the scope of ``X``.
Delete all downtimes that match the scope of ``X``. **Note:** This only interacts with Downtimes created using v1 endpoints. This endpoint has been deprecated and will not be replaced. Please use v2 endpoints to find and cancel downtimes.

:param body: Scope to cancel downtimes for.
:type body: CancelDowntimesByScopeRequest
Expand All @@ -223,15 +225,16 @@ def cancel_downtimes_by_scope(
kwargs: Dict[str, Any] = {}
kwargs["body"] = body

warnings.warn("cancel_downtimes_by_scope is deprecated", DeprecationWarning, stacklevel=2)
return self._cancel_downtimes_by_scope_endpoint.call_with_http_info(**kwargs)

def create_downtime(
self,
body: Downtime,
) -> Downtime:
"""Schedule a downtime.
"""Schedule a downtime. **Deprecated**.

Schedule a downtime.
Schedule a downtime. **Note:** This endpoint has been deprecated. Please use v2 endpoints.

:param body: Schedule a downtime request body.
:type body: Downtime
Expand All @@ -240,15 +243,16 @@ def create_downtime(
kwargs: Dict[str, Any] = {}
kwargs["body"] = body

warnings.warn("create_downtime is deprecated", DeprecationWarning, stacklevel=2)
return self._create_downtime_endpoint.call_with_http_info(**kwargs)

def get_downtime(
self,
downtime_id: int,
) -> Downtime:
"""Get a downtime.
"""Get a downtime. **Deprecated**.

Get downtime detail by ``downtime_id``.
Get downtime detail by ``downtime_id``. **Note:** This endpoint has been deprecated. Please use v2 endpoints.

:param downtime_id: ID of the downtime to fetch.
:type downtime_id: int
Expand All @@ -257,6 +261,7 @@ def get_downtime(
kwargs: Dict[str, Any] = {}
kwargs["downtime_id"] = downtime_id

warnings.warn("get_downtime is deprecated", DeprecationWarning, stacklevel=2)
return self._get_downtime_endpoint.call_with_http_info(**kwargs)

def list_downtimes(
Expand All @@ -265,9 +270,9 @@ def list_downtimes(
current_only: Union[bool, UnsetType] = unset,
with_creator: Union[bool, UnsetType] = unset,
) -> List[Downtime]:
"""Get all downtimes.
"""Get all downtimes. **Deprecated**.

Get all scheduled downtimes.
Get all scheduled downtimes. **Note:** This endpoint has been deprecated. Please use v2 endpoints.

:param current_only: Only return downtimes that are active when the request is made.
:type current_only: bool, optional
Expand All @@ -282,15 +287,16 @@ def list_downtimes(
if with_creator is not unset:
kwargs["with_creator"] = with_creator

warnings.warn("list_downtimes is deprecated", DeprecationWarning, stacklevel=2)
return self._list_downtimes_endpoint.call_with_http_info(**kwargs)

def list_monitor_downtimes(
self,
monitor_id: int,
) -> List[Downtime]:
"""Get active downtimes for a monitor.
"""Get active downtimes for a monitor. **Deprecated**.

Get all active downtimes for the specified monitor.
Get all active v1 downtimes for the specified monitor. **Note:** This endpoint has been deprecated. Please use v2 endpoints.

:param monitor_id: The id of the monitor
:type monitor_id: int
Expand All @@ -299,16 +305,17 @@ def list_monitor_downtimes(
kwargs: Dict[str, Any] = {}
kwargs["monitor_id"] = monitor_id

warnings.warn("list_monitor_downtimes is deprecated", DeprecationWarning, stacklevel=2)
return self._list_monitor_downtimes_endpoint.call_with_http_info(**kwargs)

def update_downtime(
self,
downtime_id: int,
body: Downtime,
) -> Downtime:
"""Update a downtime.
"""Update a downtime. **Deprecated**.

Update a single downtime by ``downtime_id``.
Update a single downtime by ``downtime_id``. **Note:** This endpoint has been deprecated. Please use v2 endpoints.

:param downtime_id: ID of the downtime to update.
:type downtime_id: int
Expand All @@ -321,4 +328,5 @@ def update_downtime(

kwargs["body"] = body

warnings.warn("update_downtime is deprecated", DeprecationWarning, stacklevel=2)
return self._update_downtime_endpoint.call_with_http_info(**kwargs)
Loading