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

com.datadog.api.client.v1.api.ServiceChecksApi Maven / Gradle / Ivy

package com.datadog.api.client.v1.api;

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.ApiResponse;
import com.datadog.api.client.Pair;
import com.datadog.api.client.v1.model.IntakePayloadAccepted;
import com.datadog.api.client.v1.model.ServiceCheck;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.core.GenericType;
import java.util.ArrayList;
import java.util.HashMap;
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 ServiceChecksApi {
  private ApiClient apiClient;

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

  public ServiceChecksApi(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;
  }

  /**
   * Submit a Service Check.
   *
   * 

See {@link #submitServiceCheckWithHttpInfo}. * * @param body Service Check request body. (required) * @return IntakePayloadAccepted * @throws ApiException if fails to make API call */ public IntakePayloadAccepted submitServiceCheck(List body) throws ApiException { return submitServiceCheckWithHttpInfo(body).getData(); } /** * Submit a Service Check. * *

See {@link #submitServiceCheckWithHttpInfoAsync}. * * @param body Service Check request body. (required) * @return CompletableFuture<IntakePayloadAccepted> */ public CompletableFuture submitServiceCheckAsync(List body) { return submitServiceCheckWithHttpInfoAsync(body) .thenApply( response -> { return response.getData(); }); } /** * Submit a list of Service Checks. * *

Notes: - A valid API key is required. - Service checks can be submitted up * to 10 minutes in the past. * * @param body Service Check request body. (required) * @return ApiResponse<IntakePayloadAccepted> * @throws ApiException if fails to make API call * @http.response.details *

* * * * * * * * *
Response details
Status Code Description Response Headers
202 Payload accepted -
400 Bad Request -
403 Authentication Error -
408 Request timeout -
413 Payload too large -
429 Too many requests -
*/ public ApiResponse submitServiceCheckWithHttpInfo(List 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 submitServiceCheck"); } // create path and map variables String localVarPath = "/api/v1/check_run"; Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( "v1.ServiceChecksApi.submitServiceCheck", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"text/json", "application/json"}, new String[] {"apiKeyAuth"}); return apiClient.invokeAPI( "POST", builder, localVarHeaderParams, new String[] {"application/json"}, localVarPostBody, new HashMap(), false, new GenericType() {}); } /** * Submit a Service Check. * *

See {@link #submitServiceCheckWithHttpInfo}. * * @param body Service Check request body. (required) * @return CompletableFuture<ApiResponse<IntakePayloadAccepted>> */ public CompletableFuture> submitServiceCheckWithHttpInfoAsync( List 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 submitServiceCheck")); return result; } // create path and map variables String localVarPath = "/api/v1/check_run"; Map localVarHeaderParams = new HashMap(); Invocation.Builder builder; try { builder = apiClient.createBuilder( "v1.ServiceChecksApi.submitServiceCheck", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"text/json", "application/json"}, new String[] {"apiKeyAuth"}); } 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() {}); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy