All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datadog.api.client.v2.api.DowntimesApi Maven / Gradle / Ivy

There is a newer version: 2.24.0
Show newest version
package com.datadog.api.client.v2.api;

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.ApiResponse;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.Pair;
import com.datadog.api.client.v2.model.DowntimeCreateRequest;
import com.datadog.api.client.v2.model.DowntimeResponse;
import com.datadog.api.client.v2.model.DowntimeResponseData;
import com.datadog.api.client.v2.model.DowntimeUpdateRequest;
import com.datadog.api.client.v2.model.ListDowntimesResponse;
import com.datadog.api.client.v2.model.MonitorDowntimeMatchResponse;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.core.GenericType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

@jakarta.annotation.Generated(
    value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class DowntimesApi {
  private ApiClient apiClient;

  public DowntimesApi() {
    this(ApiClient.getDefaultApiClient());
  }

  public DowntimesApi(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * Get the API client.
   *
   * @return API client
   */
  public ApiClient getApiClient() {
    return apiClient;
  }

  /**
   * Set the API client.
   *
   * @param apiClient an instance of API client
   */
  public void setApiClient(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * Cancel a downtime.
   *
   * 

See {@link #cancelDowntimeWithHttpInfo}. * * @param downtimeId ID of the downtime to cancel. (required) * @throws ApiException if fails to make API call */ public void cancelDowntime(String downtimeId) throws ApiException { cancelDowntimeWithHttpInfo(downtimeId); } /** * Cancel a downtime. * *

See {@link #cancelDowntimeWithHttpInfoAsync}. * * @param downtimeId ID of the downtime to cancel. (required) * @return CompletableFuture */ public CompletableFuture cancelDowntimeAsync(String downtimeId) { return cancelDowntimeWithHttpInfoAsync(downtimeId) .thenApply( response -> { return response.getData(); }); } /** * Cancel a downtime. * * @param downtimeId ID of the downtime to cancel. (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details *

* * * * * * *
Response details
Status Code Description Response Headers
204 OK -
403 Forbidden -
404 Downtime not found -
429 Too many requests -
*/ public ApiResponse cancelDowntimeWithHttpInfo(String downtimeId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'downtimeId' is set if (downtimeId == null) { throw new ApiException( 400, "Missing the required parameter 'downtimeId' when calling cancelDowntime"); } // create path and map variables String localVarPath = "/api/v2/downtime/{downtime_id}" .replaceAll( "\\{" + "downtime_id" + "\\}", apiClient.escapeString(downtimeId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( "v2.DowntimesApi.cancelDowntime", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"*/*"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( "DELETE", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, null); } /** * Cancel a downtime. * *

See {@link #cancelDowntimeWithHttpInfo}. * * @param downtimeId ID of the downtime to cancel. (required) * @return CompletableFuture<ApiResponse<Void>> */ public CompletableFuture> cancelDowntimeWithHttpInfoAsync(String downtimeId) { Object localVarPostBody = null; // verify the required parameter 'downtimeId' is set if (downtimeId == null) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'downtimeId' when calling cancelDowntime")); return result; } // create path and map variables String localVarPath = "/api/v2/downtime/{downtime_id}" .replaceAll( "\\{" + "downtime_id" + "\\}", apiClient.escapeString(downtimeId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.DowntimesApi.cancelDowntime", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"*/*"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } return apiClient.invokeAPIAsync( "DELETE", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, null); } /** * Schedule a downtime. * *

See {@link #createDowntimeWithHttpInfo}. * * @param body Schedule a downtime request body. (required) * @return DowntimeResponse * @throws ApiException if fails to make API call */ public DowntimeResponse createDowntime(DowntimeCreateRequest body) throws ApiException { return createDowntimeWithHttpInfo(body).getData(); } /** * Schedule a downtime. * *

See {@link #createDowntimeWithHttpInfoAsync}. * * @param body Schedule a downtime request body. (required) * @return CompletableFuture<DowntimeResponse> */ public CompletableFuture createDowntimeAsync(DowntimeCreateRequest body) { return createDowntimeWithHttpInfoAsync(body) .thenApply( response -> { return response.getData(); }); } /** * Schedule a downtime. * * @param body Schedule a downtime request body. (required) * @return ApiResponse<DowntimeResponse> * @throws ApiException if fails to make API call * @http.response.details *

* * * * * * *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
*/ public ApiResponse createDowntimeWithHttpInfo(DowntimeCreateRequest body) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set if (body == null) { throw new ApiException( 400, "Missing the required parameter 'body' when calling createDowntime"); } // create path and map variables String localVarPath = "/api/v2/downtime"; Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( "v2.DowntimesApi.createDowntime", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( "POST", builder, localVarHeaderParams, new String[] {"application/json"}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** * Schedule a downtime. * *

See {@link #createDowntimeWithHttpInfo}. * * @param body Schedule a downtime request body. (required) * @return CompletableFuture<ApiResponse<DowntimeResponse>> */ public CompletableFuture> createDowntimeWithHttpInfoAsync( DowntimeCreateRequest body) { Object localVarPostBody = body; // verify the required parameter 'body' is set if (body == null) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'body' when calling createDowntime")); return result; } // create path and map variables String localVarPath = "/api/v2/downtime"; Map localVarHeaderParams = new HashMap(); Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.DowntimesApi.createDowntime", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } return apiClient.invokeAPIAsync( "POST", builder, localVarHeaderParams, new String[] {"application/json"}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** Manage optional parameters to getDowntime. */ public static class GetDowntimeOptionalParameters { private String include; /** * Set include. * * @param include Comma-separated list of resource paths for related resources to include in the * response. Supported resource paths are created_by and monitor. * (optional) * @return GetDowntimeOptionalParameters */ public GetDowntimeOptionalParameters include(String include) { this.include = include; return this; } } /** * Get a downtime. * *

See {@link #getDowntimeWithHttpInfo}. * * @param downtimeId ID of the downtime to fetch. (required) * @return DowntimeResponse * @throws ApiException if fails to make API call */ public DowntimeResponse getDowntime(String downtimeId) throws ApiException { return getDowntimeWithHttpInfo(downtimeId, new GetDowntimeOptionalParameters()).getData(); } /** * Get a downtime. * *

See {@link #getDowntimeWithHttpInfoAsync}. * * @param downtimeId ID of the downtime to fetch. (required) * @return CompletableFuture<DowntimeResponse> */ public CompletableFuture getDowntimeAsync(String downtimeId) { return getDowntimeWithHttpInfoAsync(downtimeId, new GetDowntimeOptionalParameters()) .thenApply( response -> { return response.getData(); }); } /** * Get a downtime. * *

See {@link #getDowntimeWithHttpInfo}. * * @param downtimeId ID of the downtime to fetch. (required) * @param parameters Optional parameters for the request. * @return DowntimeResponse * @throws ApiException if fails to make API call */ public DowntimeResponse getDowntime(String downtimeId, GetDowntimeOptionalParameters parameters) throws ApiException { return getDowntimeWithHttpInfo(downtimeId, parameters).getData(); } /** * Get a downtime. * *

See {@link #getDowntimeWithHttpInfoAsync}. * * @param downtimeId ID of the downtime to fetch. (required) * @param parameters Optional parameters for the request. * @return CompletableFuture<DowntimeResponse> */ public CompletableFuture getDowntimeAsync( String downtimeId, GetDowntimeOptionalParameters parameters) { return getDowntimeWithHttpInfoAsync(downtimeId, parameters) .thenApply( response -> { return response.getData(); }); } /** * Get downtime detail by downtime_id. * * @param downtimeId ID of the downtime to fetch. (required) * @param parameters Optional parameters for the request. * @return ApiResponse<DowntimeResponse> * @throws ApiException if fails to make API call * @http.response.details *

* * * * * * * *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
*/ public ApiResponse getDowntimeWithHttpInfo( String downtimeId, GetDowntimeOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'downtimeId' is set if (downtimeId == null) { throw new ApiException( 400, "Missing the required parameter 'downtimeId' when calling getDowntime"); } String include = parameters.include; // create path and map variables String localVarPath = "/api/v2/downtime/{downtime_id}" .replaceAll( "\\{" + "downtime_id" + "\\}", apiClient.escapeString(downtimeId.toString())); List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); Invocation.Builder builder = apiClient.createBuilder( "v2.DowntimesApi.getDowntime", localVarPath, localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( "GET", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** * Get a downtime. * *

See {@link #getDowntimeWithHttpInfo}. * * @param downtimeId ID of the downtime to fetch. (required) * @param parameters Optional parameters for the request. * @return CompletableFuture<ApiResponse<DowntimeResponse>> */ public CompletableFuture> getDowntimeWithHttpInfoAsync( String downtimeId, GetDowntimeOptionalParameters parameters) { Object localVarPostBody = null; // verify the required parameter 'downtimeId' is set if (downtimeId == null) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'downtimeId' when calling getDowntime")); return result; } String include = parameters.include; // create path and map variables String localVarPath = "/api/v2/downtime/{downtime_id}" .replaceAll( "\\{" + "downtime_id" + "\\}", apiClient.escapeString(downtimeId.toString())); List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.DowntimesApi.getDowntime", localVarPath, localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } return apiClient.invokeAPIAsync( "GET", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** Manage optional parameters to listDowntimes. */ public static class ListDowntimesOptionalParameters { private Boolean currentOnly; private String include; private Long pageOffset; private Long pageLimit; /** * Set currentOnly. * * @param currentOnly Only return downtimes that are active when the request is made. (optional) * @return ListDowntimesOptionalParameters */ public ListDowntimesOptionalParameters currentOnly(Boolean currentOnly) { this.currentOnly = currentOnly; return this; } /** * Set include. * * @param include Comma-separated list of resource paths for related resources to include in the * response. Supported resource paths are created_by and monitor. * (optional) * @return ListDowntimesOptionalParameters */ public ListDowntimesOptionalParameters include(String include) { this.include = include; return this; } /** * Set pageOffset. * * @param pageOffset Specific offset to use as the beginning of the returned page. (optional, * default to 0) * @return ListDowntimesOptionalParameters */ public ListDowntimesOptionalParameters pageOffset(Long pageOffset) { this.pageOffset = pageOffset; return this; } /** * Set pageLimit. * * @param pageLimit Maximum number of downtimes in the response. (optional, default to 30) * @return ListDowntimesOptionalParameters */ public ListDowntimesOptionalParameters pageLimit(Long pageLimit) { this.pageLimit = pageLimit; return this; } } /** * Get all downtimes. * *

See {@link #listDowntimesWithHttpInfo}. * * @return ListDowntimesResponse * @throws ApiException if fails to make API call */ public ListDowntimesResponse listDowntimes() throws ApiException { return listDowntimesWithHttpInfo(new ListDowntimesOptionalParameters()).getData(); } /** * Get all downtimes. * *

See {@link #listDowntimesWithHttpInfoAsync}. * * @return CompletableFuture<ListDowntimesResponse> */ public CompletableFuture listDowntimesAsync() { return listDowntimesWithHttpInfoAsync(new ListDowntimesOptionalParameters()) .thenApply( response -> { return response.getData(); }); } /** * Get all downtimes. * *

See {@link #listDowntimesWithHttpInfo}. * * @param parameters Optional parameters for the request. * @return ListDowntimesResponse * @throws ApiException if fails to make API call */ public ListDowntimesResponse listDowntimes(ListDowntimesOptionalParameters parameters) throws ApiException { return listDowntimesWithHttpInfo(parameters).getData(); } /** * Get all downtimes. * *

See {@link #listDowntimesWithHttpInfoAsync}. * * @param parameters Optional parameters for the request. * @return CompletableFuture<ListDowntimesResponse> */ public CompletableFuture listDowntimesAsync( ListDowntimesOptionalParameters parameters) { return listDowntimesWithHttpInfoAsync(parameters) .thenApply( response -> { return response.getData(); }); } /** * Get all downtimes. * *

See {@link #listDowntimesWithHttpInfo}. * * @return PaginationIterable<DowntimeResponseData> */ public PaginationIterable listDowntimesWithPagination() { ListDowntimesOptionalParameters parameters = new ListDowntimesOptionalParameters(); return listDowntimesWithPagination(parameters); } /** * Get all downtimes. * *

See {@link #listDowntimesWithHttpInfo}. * * @return ListDowntimesResponse */ public PaginationIterable listDowntimesWithPagination( ListDowntimesOptionalParameters parameters) { String resultsPath = "getData"; String valueGetterPath = ""; String valueSetterPath = "pageOffset"; Boolean valueSetterParamOptional = true; Long limit; if (parameters.pageLimit == null) { limit = 30l; parameters.pageLimit(limit); } else { limit = parameters.pageLimit; } LinkedHashMap args = new LinkedHashMap(); args.put("optionalParams", parameters); PaginationIterable iterator = new PaginationIterable( this, "listDowntimes", resultsPath, valueGetterPath, valueSetterPath, valueSetterParamOptional, true, limit, args); return iterator; } /** * Get all scheduled downtimes. * * @param parameters Optional parameters for the request. * @return ApiResponse<ListDowntimesResponse> * @throws ApiException if fails to make API call * @http.response.details *

* * * * * *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
429 Too many requests -
*/ public ApiResponse listDowntimesWithHttpInfo( ListDowntimesOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; Boolean currentOnly = parameters.currentOnly; String include = parameters.include; Long pageOffset = parameters.pageOffset; Long pageLimit = parameters.pageLimit; // create path and map variables String localVarPath = "/api/v2/downtime"; List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "current_only", currentOnly)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); Invocation.Builder builder = apiClient.createBuilder( "v2.DowntimesApi.listDowntimes", localVarPath, localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( "GET", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** * Get all downtimes. * *

See {@link #listDowntimesWithHttpInfo}. * * @param parameters Optional parameters for the request. * @return CompletableFuture<ApiResponse<ListDowntimesResponse>> */ public CompletableFuture> listDowntimesWithHttpInfoAsync( ListDowntimesOptionalParameters parameters) { Object localVarPostBody = null; Boolean currentOnly = parameters.currentOnly; String include = parameters.include; Long pageOffset = parameters.pageOffset; Long pageLimit = parameters.pageLimit; // create path and map variables String localVarPath = "/api/v2/downtime"; List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "current_only", currentOnly)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.DowntimesApi.listDowntimes", localVarPath, localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } return apiClient.invokeAPIAsync( "GET", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** * Get active downtimes for a monitor. * *

See {@link #listMonitorDowntimesWithHttpInfo}. * * @param monitorId The id of the monitor. (required) * @return MonitorDowntimeMatchResponse * @throws ApiException if fails to make API call */ public MonitorDowntimeMatchResponse listMonitorDowntimes(Long monitorId) throws ApiException { return listMonitorDowntimesWithHttpInfo(monitorId).getData(); } /** * Get active downtimes for a monitor. * *

See {@link #listMonitorDowntimesWithHttpInfoAsync}. * * @param monitorId The id of the monitor. (required) * @return CompletableFuture<MonitorDowntimeMatchResponse> */ public CompletableFuture listMonitorDowntimesAsync(Long monitorId) { return listMonitorDowntimesWithHttpInfoAsync(monitorId) .thenApply( response -> { return response.getData(); }); } /** * Get all active downtimes for the specified monitor. * * @param monitorId The id of the monitor. (required) * @return ApiResponse<MonitorDowntimeMatchResponse> * @throws ApiException if fails to make API call * @http.response.details *

* * * * * *
Response details
Status Code Description Response Headers
200 OK -
404 Monitor Not Found error -
429 Too many requests -
*/ public ApiResponse listMonitorDowntimesWithHttpInfo(Long monitorId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'monitorId' is set if (monitorId == null) { throw new ApiException( 400, "Missing the required parameter 'monitorId' when calling listMonitorDowntimes"); } // create path and map variables String localVarPath = "/api/v2/monitor/{monitor_id}/downtime_matches" .replaceAll("\\{" + "monitor_id" + "\\}", apiClient.escapeString(monitorId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( "v2.DowntimesApi.listMonitorDowntimes", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( "GET", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** * Get active downtimes for a monitor. * *

See {@link #listMonitorDowntimesWithHttpInfo}. * * @param monitorId The id of the monitor. (required) * @return CompletableFuture<ApiResponse<MonitorDowntimeMatchResponse>> */ public CompletableFuture> listMonitorDowntimesWithHttpInfoAsync(Long monitorId) { Object localVarPostBody = null; // verify the required parameter 'monitorId' is set if (monitorId == null) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'monitorId' when calling listMonitorDowntimes")); return result; } // create path and map variables String localVarPath = "/api/v2/monitor/{monitor_id}/downtime_matches" .replaceAll("\\{" + "monitor_id" + "\\}", apiClient.escapeString(monitorId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.DowntimesApi.listMonitorDowntimes", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } return apiClient.invokeAPIAsync( "GET", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** * Update a downtime. * *

See {@link #updateDowntimeWithHttpInfo}. * * @param downtimeId ID of the downtime to update. (required) * @param body Update a downtime request body. (required) * @return DowntimeResponse * @throws ApiException if fails to make API call */ public DowntimeResponse updateDowntime(String downtimeId, DowntimeUpdateRequest body) throws ApiException { return updateDowntimeWithHttpInfo(downtimeId, body).getData(); } /** * Update a downtime. * *

See {@link #updateDowntimeWithHttpInfoAsync}. * * @param downtimeId ID of the downtime to update. (required) * @param body Update a downtime request body. (required) * @return CompletableFuture<DowntimeResponse> */ public CompletableFuture updateDowntimeAsync( String downtimeId, DowntimeUpdateRequest body) { return updateDowntimeWithHttpInfoAsync(downtimeId, body) .thenApply( response -> { return response.getData(); }); } /** * Update a downtime by downtime_id. * * @param downtimeId ID of the downtime to update. (required) * @param body Update a downtime request body. (required) * @return ApiResponse<DowntimeResponse> * @throws ApiException if fails to make API call * @http.response.details *

* * * * * * * *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Downtime not found -
429 Too many requests -
*/ public ApiResponse updateDowntimeWithHttpInfo( String downtimeId, DowntimeUpdateRequest body) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'downtimeId' is set if (downtimeId == null) { throw new ApiException( 400, "Missing the required parameter 'downtimeId' when calling updateDowntime"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( 400, "Missing the required parameter 'body' when calling updateDowntime"); } // create path and map variables String localVarPath = "/api/v2/downtime/{downtime_id}" .replaceAll( "\\{" + "downtime_id" + "\\}", apiClient.escapeString(downtimeId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( "v2.DowntimesApi.updateDowntime", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( "PATCH", builder, localVarHeaderParams, new String[] {"application/json"}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** * Update a downtime. * *

See {@link #updateDowntimeWithHttpInfo}. * * @param downtimeId ID of the downtime to update. (required) * @param body Update a downtime request body. (required) * @return CompletableFuture<ApiResponse<DowntimeResponse>> */ public CompletableFuture> updateDowntimeWithHttpInfoAsync( String downtimeId, DowntimeUpdateRequest body) { Object localVarPostBody = body; // verify the required parameter 'downtimeId' is set if (downtimeId == null) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'downtimeId' when calling updateDowntime")); return result; } // verify the required parameter 'body' is set if (body == null) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'body' when calling updateDowntime")); return result; } // create path and map variables String localVarPath = "/api/v2/downtime/{downtime_id}" .replaceAll( "\\{" + "downtime_id" + "\\}", apiClient.escapeString(downtimeId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.DowntimesApi.updateDowntime", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } return apiClient.invokeAPIAsync( "PATCH", builder, localVarHeaderParams, new String[] {"application/json"}, localVarPostBody, new HashMap(), false, new GenericType() {}); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy