4
4
from __future__ import annotations
5
5
6
6
from typing import Any , Dict , List , Union
7
+ import warnings
7
8
8
9
from datadog_api_client .api_client import ApiClient , Endpoint as _Endpoint
9
10
from datadog_api_client .configuration import Configuration
@@ -195,9 +196,9 @@ def cancel_downtime(
195
196
self ,
196
197
downtime_id : int ,
197
198
) -> None :
198
- """Cancel a downtime.
199
+ """Cancel a downtime. **Deprecated**.
199
200
200
- Cancel a downtime.
201
+ Cancel a downtime. **Note:** This endpoint has been deprecated. Please use v2 endpoints.
201
202
202
203
:param downtime_id: ID of the downtime to cancel.
203
204
:type downtime_id: int
@@ -206,15 +207,16 @@ def cancel_downtime(
206
207
kwargs : Dict [str , Any ] = {}
207
208
kwargs ["downtime_id" ] = downtime_id
208
209
210
+ warnings .warn ("cancel_downtime is deprecated" , DeprecationWarning , stacklevel = 2 )
209
211
return self ._cancel_downtime_endpoint .call_with_http_info (** kwargs )
210
212
211
213
def cancel_downtimes_by_scope (
212
214
self ,
213
215
body : CancelDowntimesByScopeRequest ,
214
216
) -> CanceledDowntimesIds :
215
- """Cancel downtimes by scope.
217
+ """Cancel downtimes by scope. **Deprecated**.
216
218
217
- Delete all downtimes that match the scope of ``X``.
219
+ 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.
218
220
219
221
:param body: Scope to cancel downtimes for.
220
222
:type body: CancelDowntimesByScopeRequest
@@ -223,15 +225,16 @@ def cancel_downtimes_by_scope(
223
225
kwargs : Dict [str , Any ] = {}
224
226
kwargs ["body" ] = body
225
227
228
+ warnings .warn ("cancel_downtimes_by_scope is deprecated" , DeprecationWarning , stacklevel = 2 )
226
229
return self ._cancel_downtimes_by_scope_endpoint .call_with_http_info (** kwargs )
227
230
228
231
def create_downtime (
229
232
self ,
230
233
body : Downtime ,
231
234
) -> Downtime :
232
- """Schedule a downtime.
235
+ """Schedule a downtime. **Deprecated**.
233
236
234
- Schedule a downtime.
237
+ Schedule a downtime. **Note:** This endpoint has been deprecated. Please use v2 endpoints.
235
238
236
239
:param body: Schedule a downtime request body.
237
240
:type body: Downtime
@@ -240,15 +243,16 @@ def create_downtime(
240
243
kwargs : Dict [str , Any ] = {}
241
244
kwargs ["body" ] = body
242
245
246
+ warnings .warn ("create_downtime is deprecated" , DeprecationWarning , stacklevel = 2 )
243
247
return self ._create_downtime_endpoint .call_with_http_info (** kwargs )
244
248
245
249
def get_downtime (
246
250
self ,
247
251
downtime_id : int ,
248
252
) -> Downtime :
249
- """Get a downtime.
253
+ """Get a downtime. **Deprecated**.
250
254
251
- Get downtime detail by ``downtime_id``.
255
+ Get downtime detail by ``downtime_id``. **Note:** This endpoint has been deprecated. Please use v2 endpoints.
252
256
253
257
:param downtime_id: ID of the downtime to fetch.
254
258
:type downtime_id: int
@@ -257,6 +261,7 @@ def get_downtime(
257
261
kwargs : Dict [str , Any ] = {}
258
262
kwargs ["downtime_id" ] = downtime_id
259
263
264
+ warnings .warn ("get_downtime is deprecated" , DeprecationWarning , stacklevel = 2 )
260
265
return self ._get_downtime_endpoint .call_with_http_info (** kwargs )
261
266
262
267
def list_downtimes (
@@ -265,9 +270,9 @@ def list_downtimes(
265
270
current_only : Union [bool , UnsetType ] = unset ,
266
271
with_creator : Union [bool , UnsetType ] = unset ,
267
272
) -> List [Downtime ]:
268
- """Get all downtimes.
273
+ """Get all downtimes. **Deprecated**.
269
274
270
- Get all scheduled downtimes.
275
+ Get all scheduled downtimes. **Note:** This endpoint has been deprecated. Please use v2 endpoints.
271
276
272
277
:param current_only: Only return downtimes that are active when the request is made.
273
278
:type current_only: bool, optional
@@ -282,15 +287,16 @@ def list_downtimes(
282
287
if with_creator is not unset :
283
288
kwargs ["with_creator" ] = with_creator
284
289
290
+ warnings .warn ("list_downtimes is deprecated" , DeprecationWarning , stacklevel = 2 )
285
291
return self ._list_downtimes_endpoint .call_with_http_info (** kwargs )
286
292
287
293
def list_monitor_downtimes (
288
294
self ,
289
295
monitor_id : int ,
290
296
) -> List [Downtime ]:
291
- """Get active downtimes for a monitor.
297
+ """Get active downtimes for a monitor. **Deprecated**.
292
298
293
- Get all active downtimes for the specified monitor.
299
+ Get all active v1 downtimes for the specified monitor. **Note:** This endpoint has been deprecated. Please use v2 endpoints .
294
300
295
301
:param monitor_id: The id of the monitor
296
302
:type monitor_id: int
@@ -299,16 +305,17 @@ def list_monitor_downtimes(
299
305
kwargs : Dict [str , Any ] = {}
300
306
kwargs ["monitor_id" ] = monitor_id
301
307
308
+ warnings .warn ("list_monitor_downtimes is deprecated" , DeprecationWarning , stacklevel = 2 )
302
309
return self ._list_monitor_downtimes_endpoint .call_with_http_info (** kwargs )
303
310
304
311
def update_downtime (
305
312
self ,
306
313
downtime_id : int ,
307
314
body : Downtime ,
308
315
) -> Downtime :
309
- """Update a downtime.
316
+ """Update a downtime. **Deprecated**.
310
317
311
- Update a single downtime by ``downtime_id``.
318
+ Update a single downtime by ``downtime_id``. **Note:** This endpoint has been deprecated. Please use v2 endpoints.
312
319
313
320
:param downtime_id: ID of the downtime to update.
314
321
:type downtime_id: int
@@ -321,4 +328,5 @@ def update_downtime(
321
328
322
329
kwargs ["body" ] = body
323
330
331
+ warnings .warn ("update_downtime is deprecated" , DeprecationWarning , stacklevel = 2 )
324
332
return self ._update_downtime_endpoint .call_with_http_info (** kwargs )
0 commit comments