io.harness.cf.api.MetricsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ff-java-server-sdk Show documentation
Show all versions of ff-java-server-sdk Show documentation
Harness Feature Flag Java Server SDK
The newest version!
/*
* Harness feature flag service client apis
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package io.harness.cf.api;
import io.harness.cf.ApiCallback;
import io.harness.cf.ApiClient;
import io.harness.cf.ApiException;
import io.harness.cf.ApiResponse;
import io.harness.cf.Configuration;
import io.harness.cf.Pair;
import io.harness.cf.ProgressRequestBody;
import io.harness.cf.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import io.harness.cf.model.Error;
import io.harness.cf.model.Metrics;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MetricsApi {
private ApiClient localVarApiClient;
public MetricsApi() {
this(Configuration.getDefaultApiClient());
}
public MetricsApi(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public ApiClient getApiClient() {
return localVarApiClient;
}
public void setApiClient(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
/**
* Build call for postMetrics
* @param environmentUUID environment parameter in query. (required)
* @param cluster Unique identifier for the cluster for the account (optional)
* @param metrics (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code Description Response Headers
200 OK -
401 Unauthenticated -
403 Unauthorized -
500 Internal server error -
*/
public okhttp3.Call postMetricsCall(String environmentUUID, String cluster, Metrics metrics, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = metrics;
// create path and map variables
String localVarPath = "/metrics/{environmentUUID}"
.replaceAll("\\{" + "environmentUUID" + "\\}", localVarApiClient.escapeString(environmentUUID.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (cluster != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("cluster", cluster));
}
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
String[] localVarAuthNames = new String[] { "ApiKeyAuth", "BearerAuth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call postMetricsValidateBeforeCall(String environmentUUID, String cluster, Metrics metrics, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'environmentUUID' is set
if (environmentUUID == null) {
throw new ApiException("Missing the required parameter 'environmentUUID' when calling postMetrics(Async)");
}
okhttp3.Call localVarCall = postMetricsCall(environmentUUID, cluster, metrics, _callback);
return localVarCall;
}
/**
* Send metrics to the Analytics server.
* Send metrics to Analytics server
* @param environmentUUID environment parameter in query. (required)
* @param cluster Unique identifier for the cluster for the account (optional)
* @param metrics (optional)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code Description Response Headers
200 OK -
401 Unauthenticated -
403 Unauthorized -
500 Internal server error -
*/
public void postMetrics(String environmentUUID, String cluster, Metrics metrics) throws ApiException {
postMetricsWithHttpInfo(environmentUUID, cluster, metrics);
}
/**
* Send metrics to the Analytics server.
* Send metrics to Analytics server
* @param environmentUUID environment parameter in query. (required)
* @param cluster Unique identifier for the cluster for the account (optional)
* @param metrics (optional)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code Description Response Headers
200 OK -
401 Unauthenticated -
403 Unauthorized -
500 Internal server error -
*/
public ApiResponse postMetricsWithHttpInfo(String environmentUUID, String cluster, Metrics metrics) throws ApiException {
okhttp3.Call localVarCall = postMetricsValidateBeforeCall(environmentUUID, cluster, metrics, null);
return localVarApiClient.execute(localVarCall);
}
/**
* Send metrics to the Analytics server. (asynchronously)
* Send metrics to Analytics server
* @param environmentUUID environment parameter in query. (required)
* @param cluster Unique identifier for the cluster for the account (optional)
* @param metrics (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code Description Response Headers
200 OK -
401 Unauthenticated -
403 Unauthorized -
500 Internal server error -
*/
public okhttp3.Call postMetricsAsync(String environmentUUID, String cluster, Metrics metrics, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = postMetricsValidateBeforeCall(environmentUUID, cluster, metrics, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
}