com.nutanix.net.java.client.api.RoutingPolicyApi Maven / Gradle / Ivy
package com.nutanix.net.java.client.api;
import com.nutanix.net.java.client.ApiClient;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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-02-01T08:24:43.584Z[Etc/UTC]")@Component("com.nutanix.net.java.client.api.RoutingPolicyApi")
public class RoutingPolicyApi {
private ApiClient apiClient;
public RoutingPolicyApi() {
this(new ApiClient());
}
@Autowired
public RoutingPolicyApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create a routing policy.
* 202 - Task Id corresponding to the create Routing Policy request.
*
4XX - Client error response
*
5XX - Server error response
* @param body Schema to configure a routing policy.
* @param args Additional arguments
* @return com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse createRoutingPolicy(com.nutanix.dp1.net.networking.v4.config.RoutingPolicy 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 createRoutingPolicy");
}
String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/routing-policies").build().toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
if (!CollectionUtils.isEmpty(argMap)) {
if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH)));
}
if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH)));
}
}
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.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Delete the routing policy corresponding to the extId.
* 202 - Task Id corresponding to the delete routing policy request.
*
4XX - Client error response
*
5XX - Server error response
* @param extId ExtId of the Routing Policy.
* @param args Additional arguments
* @return com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse deleteRoutingPolicy(String extId, HashMap ... args) throws RestClientException {
// Check for optional argument map
HashMap argMap = args.length > 0 ? args[0] : new HashMap();
Object postBody = null;
// verify the required parameter 'extId' is set
if (extId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling deleteRoutingPolicy");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("extId", extId);
String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/routing-policies/{extId}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
if (!CollectionUtils.isEmpty(argMap)) {
if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH)));
}
if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH)));
}
}
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.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Get a single routing policy corresponding to the extId.
* 200 - Routing policy queried.
*
4XX - Client error response
*
5XX - Server error response
* @param extId ExtId of the Routing Policy.
* @param args Additional arguments
* @return com.nutanix.dp1.net.networking.v4.config.RoutingPolicyApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.net.networking.v4.config.RoutingPolicyApiResponse getRoutingPolicy(String extId, HashMap ... args) throws RestClientException {
// Check for optional argument map
HashMap argMap = args.length > 0 ? args[0] : new HashMap();
Object postBody = null;
// verify the required parameter 'extId' is set
if (extId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling getRoutingPolicy");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("extId", extId);
String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/routing-policies/{extId}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
if (!CollectionUtils.isEmpty(argMap)) {
if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH)));
}
if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH)));
}
}
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);
}
/**
* Get a list of routing policies.
* 200 - List of routing policies queried.
*
4XX - Client error response
*
5XX - Server error response
* @param $page A URL query parameter that specifies the page number of the result set. Must be a positive integer between 0 and the maximum number of pages that are available for that resource. Any number out of this range will lead to no results being returned.
* @param $limit A URL query parameter that specifies the total number of records returned in the result set. Must be a positive integer between 0 and 100. Any number out of this range will lead to a validation error. If the limit is not provided a default value of 50 records will be returned in the result set.
* @param $filter A URL query parameter that allows clients to filter a collection of resources. The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Expression specified with the $filter must conform to the OData V4.01 URL conventions.
* The filter can be applied on the following fields:
*
* - name
* - policies
* - priority
* - vpcExtId
*
* @param $orderby A URL query parameter that allows clients to specify the sort criteria for the returned list of objects. Resources can be sorted in ascending order using asc or descending order using desc. If asc or desc are not specified the resources will be sorted in ascending order by default. For example, 'orderby=templateName desc' would get all templates sorted by templateName in desc order.
* The orderby can be applied to the following fields:
*
* - name
* - priority
*
* @param args Additional arguments
* @return com.nutanix.dp1.net.networking.v4.config.RoutingPolicyListApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.net.networking.v4.config.RoutingPolicyListApiResponse listRoutingPolicies(Integer $page, Integer $limit, String $filter, String $orderby, 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/networking/v4.0.a1/config/routing-policies").build().toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "$page", $page));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "$limit", $limit));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "$filter", $filter));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "$orderby", $orderby));
if (!CollectionUtils.isEmpty(argMap)) {
if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH)));
}
if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH)));
}
}
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 the Routing Policy corresponding to the extId.
* 202 - Task Id corresponding to the update routing policy request.
*
4XX - Client error response
*
5XX - Server error response
* @param body Schema to configure a routing policy.
* @param extId ExtId of the Routing Policy.
* @param args Additional arguments
* @return com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse putRoutingPolicy(com.nutanix.dp1.net.networking.v4.config.RoutingPolicy body, String extId, 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 putRoutingPolicy");
}
// verify the required parameter 'extId' is set
if (extId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling putRoutingPolicy");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("extId", extId);
String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/routing-policies/{extId}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
if (!CollectionUtils.isEmpty(argMap)) {
if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH)));
}
if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) {
headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH)));
}
}
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);
}
}