|
| 1 | +package com.datadog.api.client.v2.api; |
| 2 | + |
| 3 | +import com.datadog.api.client.ApiClient; |
| 4 | +import com.datadog.api.client.ApiException; |
| 5 | +import com.datadog.api.client.ApiResponse; |
| 6 | +import com.datadog.api.client.Pair; |
| 7 | +import com.datadog.api.client.v2.model.ServiceList; |
| 8 | +import jakarta.ws.rs.client.Invocation; |
| 9 | +import jakarta.ws.rs.core.GenericType; |
| 10 | +import java.util.ArrayList; |
| 11 | +import java.util.HashMap; |
| 12 | +import java.util.Map; |
| 13 | +import java.util.concurrent.CompletableFuture; |
| 14 | + |
| 15 | +@jakarta.annotation.Generated( |
| 16 | + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") |
| 17 | +public class ApmApi { |
| 18 | + private ApiClient apiClient; |
| 19 | + |
| 20 | + public ApmApi() { |
| 21 | + this(ApiClient.getDefaultApiClient()); |
| 22 | + } |
| 23 | + |
| 24 | + public ApmApi(ApiClient apiClient) { |
| 25 | + this.apiClient = apiClient; |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * Get the API client. |
| 30 | + * |
| 31 | + * @return API client |
| 32 | + */ |
| 33 | + public ApiClient getApiClient() { |
| 34 | + return apiClient; |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Set the API client. |
| 39 | + * |
| 40 | + * @param apiClient an instance of API client |
| 41 | + */ |
| 42 | + public void setApiClient(ApiClient apiClient) { |
| 43 | + this.apiClient = apiClient; |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Get service list. |
| 48 | + * |
| 49 | + * <p>See {@link #getServiceListWithHttpInfo}. |
| 50 | + * |
| 51 | + * @return ServiceList |
| 52 | + * @throws ApiException if fails to make API call |
| 53 | + */ |
| 54 | + public ServiceList getServiceList() throws ApiException { |
| 55 | + return getServiceListWithHttpInfo().getData(); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Get service list. |
| 60 | + * |
| 61 | + * <p>See {@link #getServiceListWithHttpInfoAsync}. |
| 62 | + * |
| 63 | + * @return CompletableFuture<ServiceList> |
| 64 | + */ |
| 65 | + public CompletableFuture<ServiceList> getServiceListAsync() { |
| 66 | + return getServiceListWithHttpInfoAsync() |
| 67 | + .thenApply( |
| 68 | + response -> { |
| 69 | + return response.getData(); |
| 70 | + }); |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * @return ApiResponse<ServiceList> |
| 75 | + * @throws ApiException if fails to make API call |
| 76 | + * @http.response.details |
| 77 | + * <table border="1"> |
| 78 | + * <caption>Response details</caption> |
| 79 | + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> |
| 80 | + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> |
| 81 | + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> |
| 82 | + * </table> |
| 83 | + */ |
| 84 | + public ApiResponse<ServiceList> getServiceListWithHttpInfo() throws ApiException { |
| 85 | + Object localVarPostBody = null; |
| 86 | + // create path and map variables |
| 87 | + String localVarPath = "/api/v2/apm/services"; |
| 88 | + |
| 89 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 90 | + |
| 91 | + Invocation.Builder builder = |
| 92 | + apiClient.createBuilder( |
| 93 | + "v2.ApmApi.getServiceList", |
| 94 | + localVarPath, |
| 95 | + new ArrayList<Pair>(), |
| 96 | + localVarHeaderParams, |
| 97 | + new HashMap<String, String>(), |
| 98 | + new String[] {"application/json"}, |
| 99 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 100 | + return apiClient.invokeAPI( |
| 101 | + "GET", |
| 102 | + builder, |
| 103 | + localVarHeaderParams, |
| 104 | + new String[] {}, |
| 105 | + localVarPostBody, |
| 106 | + new HashMap<String, Object>(), |
| 107 | + false, |
| 108 | + new GenericType<ServiceList>() {}); |
| 109 | + } |
| 110 | + |
| 111 | + /** |
| 112 | + * Get service list. |
| 113 | + * |
| 114 | + * <p>See {@link #getServiceListWithHttpInfo}. |
| 115 | + * |
| 116 | + * @return CompletableFuture<ApiResponse<ServiceList>> |
| 117 | + */ |
| 118 | + public CompletableFuture<ApiResponse<ServiceList>> getServiceListWithHttpInfoAsync() { |
| 119 | + Object localVarPostBody = null; |
| 120 | + // create path and map variables |
| 121 | + String localVarPath = "/api/v2/apm/services"; |
| 122 | + |
| 123 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 124 | + |
| 125 | + Invocation.Builder builder; |
| 126 | + try { |
| 127 | + builder = |
| 128 | + apiClient.createBuilder( |
| 129 | + "v2.ApmApi.getServiceList", |
| 130 | + localVarPath, |
| 131 | + new ArrayList<Pair>(), |
| 132 | + localVarHeaderParams, |
| 133 | + new HashMap<String, String>(), |
| 134 | + new String[] {"application/json"}, |
| 135 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 136 | + } catch (ApiException ex) { |
| 137 | + CompletableFuture<ApiResponse<ServiceList>> result = new CompletableFuture<>(); |
| 138 | + result.completeExceptionally(ex); |
| 139 | + return result; |
| 140 | + } |
| 141 | + return apiClient.invokeAPIAsync( |
| 142 | + "GET", |
| 143 | + builder, |
| 144 | + localVarHeaderParams, |
| 145 | + new String[] {}, |
| 146 | + localVarPostBody, |
| 147 | + new HashMap<String, Object>(), |
| 148 | + false, |
| 149 | + new GenericType<ServiceList>() {}); |
| 150 | + } |
| 151 | +} |
0 commit comments