Elimina todos los tiempos de inactividad que coincidan con el contexto de X. Nota: Esta acción sólo interactúa con los tiempos de inactividad creados con endpoints v1. Este endpoint ha quedado obsoleto y no será reemplazado. Utiliza endpoints v2 para buscar y anular tiempos de inactividad.
This endpoint requires the monitors_downtime permission.
OAuth apps require the monitors_downtime authorization scope to access this endpoint.
Solicitud
Body Data (required)
Contexto para la anulación de tiempos de inactividad.
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
// Cancel downtimes by scope returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){// there is a valid "downtime" in the systemDowntimeScope0:=os.Getenv("DOWNTIME_SCOPE_0")body:=datadogV1.CancelDowntimesByScopeRequest{Scope:DowntimeScope0,}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.CancelDowntimesByScope(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.CancelDowntimesByScope`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.CancelDowntimesByScope`:\n%s\n",responseContent)}
// Cancel downtimes by scope returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.model.CancelDowntimesByScopeRequest;importcom.datadog.api.client.v1.model.CanceledDowntimesIds;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);// there is a valid "downtime" in the systemStringDOWNTIME_SCOPE_0=System.getenv("DOWNTIME_SCOPE_0");CancelDowntimesByScopeRequestbody=newCancelDowntimesByScopeRequest().scope(DOWNTIME_SCOPE_0);try{CanceledDowntimesIdsresult=apiInstance.cancelDowntimesByScope(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#cancelDowntimesByScope");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
fromdatadogimportinitialize,apioptions={'api_key':'<DATADOG_API_KEY>','app_key':'<DATADOG_APPLICATION_KEY>'}initialize(**options)# Cancel all downtimes with scopeapi.Downtime.cancel_downtime_by_scope('env:testing')
"""
Cancel downtimes by scope returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApifromdatadog_api_client.v1.model.cancel_downtimes_by_scope_requestimportCancelDowntimesByScopeRequest# there is a valid "downtime" in the systemDOWNTIME_SCOPE_0=environ["DOWNTIME_SCOPE_0"]body=CancelDowntimesByScopeRequest(scope=DOWNTIME_SCOPE_0,)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.cancel_downtimes_by_scope(body=body)print(response)
require'dogapi'api_key='<DATADOG_API_KEY>'app_key='<DATADOG_APPLICATION_KEY>'dog=Dogapi::Client.new(api_key,app_key)# Cancel all downtimes with the given scopedog.cancel_downtime_by_scope('env:testing')
# Cancel downtimes by scope returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.new# there is a valid "downtime" in the systemDOWNTIME_SCOPE_0=ENV["DOWNTIME_SCOPE_0"]body=DatadogAPIClient::V1::CancelDowntimesByScopeRequest.new({scope:DOWNTIME_SCOPE_0,})papi_instance.cancel_downtimes_by_scope(body)
// Cancel downtimes by scope returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV1::model::CancelDowntimesByScopeRequest;#[tokio::main]asyncfnmain(){// there is a valid "downtime" in the system
letdowntime_scope_0=std::env::var("DOWNTIME_SCOPE_0").unwrap();letbody=CancelDowntimesByScopeRequest::new(downtime_scope_0.clone());letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.cancel_downtimes_by_scope(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Cancel downtimes by scope returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);// there is a valid "downtime" in the system
constDOWNTIME_SCOPE_0=process.env.DOWNTIME_SCOPE_0asstring;constparams: v1.DowntimesApiCancelDowntimesByScopeRequest={body:{scope: DOWNTIME_SCOPE_0,},};apiInstance.cancelDowntimesByScope(params).then((data: v1.CanceledDowntimesIds)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));