main.java.com.nutanix.pri.java.client.api.AlertEmailConfigurationApi Maven / Gradle / Ivy
package com.nutanix.pri.java.client.api;
import com.nutanix.pri.java.client.ApiClient;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.HashSet;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@javax.annotation.Generated(value = "com.nutanix.swagger.codegen.generators.JavaClientSDKGenerator", date = "2023-09-18T18:43:04.102Z[Etc/UTC]")@Component("com.nutanix.pri.java.client.api.AlertEmailConfigurationApi")
public class AlertEmailConfigurationApi {
private ApiClient apiClient;
private final Set headersToSkip;
public AlertEmailConfigurationApi() {
this(new ApiClient());
}
@Autowired
public AlertEmailConfigurationApi(ApiClient apiClient) {
this.apiClient = apiClient;
this.headersToSkip = new HashSet<>(Arrays.asList("authorization", "cookie", "ntnx-request-id", "host", "user-agent"));
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Get alert email configuration.
* 200 - Successfully retrieved alert email configuration.
*
4XX - Client error response
*
5XX - Server error response
* @param args Additional arguments
* @return com.nutanix.dp1.pri.prism.v4.serviceability.AlertEmailConfigurationApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.pri.prism.v4.serviceability.AlertEmailConfigurationApiResponse getAlertEmailConfiguration(HashMap ... args) throws RestClientException {
// Check for optional argument map
HashMap argMap = args.length > 0 ? args[0] : new HashMap();
Object postBody = null;
String path = UriComponentsBuilder.fromPath("/api/prism/v4.0.a2/serviceability/alerts/email-config").build().toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
argMap.forEach((key, value) -> {
if (!this.headersToSkip.contains(key.toLowerCase())) {
String stringValue = apiClient.parameterToString(value);
if (stringValue != null && !stringValue.trim().isEmpty()) {
headerParams.add(key, apiClient.parameterToString(value));
}
}
});
final String[] accepts = {
"application/json"
};
final List accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "basicAuthScheme" };
ParameterizedTypeReference returnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Update alert email configuration.
* 200 - Email configuration updated successfully.
*
4XX - Client error response
*
5XX - Server error response
* @param body Email configuration sent for the update.
* @param args Additional arguments
* @return com.nutanix.dp1.pri.prism.v4.serviceability.AlertEmailConfigurationApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.pri.prism.v4.serviceability.AlertEmailConfigurationApiResponse updateAlertEmailConfiguration(com.nutanix.dp1.pri.prism.v4.serviceability.AlertEmailConfiguration body, HashMap ... args) throws RestClientException {
// Check for optional argument map
HashMap argMap = args.length > 0 ? args[0] : new HashMap();
Object postBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling updateAlertEmailConfiguration");
}
String path = UriComponentsBuilder.fromPath("/api/prism/v4.0.a2/serviceability/alerts/email-config").build().toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
argMap.forEach((key, value) -> {
if (!this.headersToSkip.contains(key.toLowerCase())) {
String stringValue = apiClient.parameterToString(value);
if (stringValue != null && !stringValue.trim().isEmpty()) {
headerParams.add(key, apiClient.parameterToString(value));
}
}
});
final String[] accepts = {
"application/json"
};
final List accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "basicAuthScheme" };
ParameterizedTypeReference returnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}