@Generated(value="com.nutanix.swagger.codegen.generators.JavaClientSDKGenerator", date="2023-09-18T22:40:06.153Z[Etc/UTC]") @Component(value="com.nutanix.mic.java.client.ApiClient") public class ApiClient extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ApiClient.CollectionFormat |
Constructor and Description |
---|
ApiClient() |
ApiClient(org.springframework.web.client.RestTemplate restTemplate) |
Modifier and Type | Method and Description |
---|---|
ApiClient |
addDefaultHeader(String name,
String value)
Add a default header.
|
String |
formatDate(Date date)
Format the given Date object into string.
|
Authentication |
getAuthentication(String authName)
Get authentication for the given name.
|
Map<String,Authentication> |
getAuthentications()
Get authentications (key: authentication name, value: authentication).
|
long |
getConnectTimeout()
Get the current connection timeout
|
DateFormat |
getDateFormat()
Get the date format used to parse/format date parameters.
|
static String |
getEtag(Object object)
Get ETag from an object if exists.
|
String |
getHost()
Get the current hostname or base URL
|
int |
getMaxRetryAttempts()
Get the number of max retry attempts
|
int |
getPort()
Get the current port for base URL
|
long |
getReadTimeout()
Get the current response read timeout
|
org.springframework.util.MultiValueMap<String,String> |
getResponseHeaders()
Gets the response headers of the previous request
|
int |
getRetryInterval()
Get the delay between each retry attempt
|
String |
getScheme()
Get the current URL scheme for making a connection to the cluster
|
org.springframework.http.HttpStatus |
getStatusCode()
Gets the status code of the previous request
|
<T> T |
invokeAPI(String path,
org.springframework.http.HttpMethod method,
org.springframework.util.MultiValueMap<String,String> queryParams,
Object body,
org.springframework.http.HttpHeaders headerParams,
org.springframework.util.MultiValueMap<String,Object> formParams,
List<org.springframework.http.MediaType> accept,
org.springframework.http.MediaType contentType,
String[] authNames,
org.springframework.core.ParameterizedTypeReference<T> returnType)
Invoke API by sending HTTP request with the given options.
|
boolean |
isDebugging()
Check that whether debugging is enabled for this API client.
|
boolean |
isJsonMime(org.springframework.http.MediaType mediaType)
Check if the given MIME is a JSON MIME.
|
boolean |
isJsonMime(String mediaType) |
org.springframework.util.MultiValueMap<String,String> |
parameterToMultiValueMap(ApiClient.CollectionFormat collectionFormat,
String name,
Object value)
Converts a parameter to a
MultiValueMap for use in REST requests |
String |
parameterToString(Object param)
Format the given parameter object into string.
|
Date |
parseDate(String str)
Parse the given string into Date object.
|
List<org.springframework.http.MediaType> |
selectHeaderAccept(String[] accepts)
Select the Accept header's value from the given accepts array:
if JSON exists in the given array, use it;
otherwise use all of them (joining into a string)
|
org.springframework.http.MediaType |
selectHeaderContentType(String[] contentTypes)
Select the Content-Type header's value from the given array:
if JSON exists in the given array, use it;
otherwise use the first one of the array.
|
ApiClient |
setConnectTimeout(long connectTimeout)
Set the connection timeout
|
ApiClient |
setDateFormat(DateFormat dateFormat)
Set the date format used to parse/format date parameters.
|
void |
setDebugging(boolean debugging)
Enable or disable debugging
|
ApiClient |
setHost(String host)
Set the hostname for base URL
|
ApiClient |
setMaxRetryAttempts(int maxRetryAttempts)
Set the number of max retry attempts
|
void |
setPassword(String password)
Helper method to set password for the first HTTP basic authentication.
|
ApiClient |
setPort(int port)
Set the port for base URL, which should exclude the semicolon (Default port: 9440)
|
ApiClient |
setReadTimeout(long readTimeout)
Set the response read timeout
|
ApiClient |
setRetryInterval(int retryInterval)
Set the delay between each retry attempt
|
ApiClient |
setScheme(String scheme)
Set a URI scheme for connecting to the cluster (HTTP or HTTPS using SSL/TLS)
|
void |
setUsername(String username)
Helper method to set username for the first HTTP basic authentication.
|
ApiClient |
setVerifySsl(boolean verifySsl)
Enable/Disable SSL Verification
|
public ApiClient()
@Autowired public ApiClient(org.springframework.web.client.RestTemplate restTemplate)
public ApiClient setVerifySsl(boolean verifySsl) throws KeyStoreException, NoSuchAlgorithmException
verifySsl
- flagKeyStoreException
- if key is not found.NoSuchAlgorithmException
- if requested cryptographic algorithm is not found.public String getScheme()
public ApiClient setScheme(String scheme)
scheme
- URL schemepublic String getHost()
public ApiClient setHost(String host)
host
- the hostnamepublic long getReadTimeout()
public ApiClient setReadTimeout(long readTimeout)
readTimeout
- the response read timeoutpublic long getConnectTimeout()
public ApiClient setConnectTimeout(long connectTimeout)
connectTimeout
- the connection timeoutpublic int getPort()
public ApiClient setPort(int port)
port
- the portpublic int getMaxRetryAttempts()
public ApiClient setMaxRetryAttempts(int maxRetryAttempts)
maxRetryAttempts
- number of max retry attemptspublic int getRetryInterval()
public ApiClient setRetryInterval(int retryInterval)
retryInterval
- delay between each retry attempt in millisecondspublic org.springframework.http.HttpStatus getStatusCode()
public org.springframework.util.MultiValueMap<String,String> getResponseHeaders()
public Map<String,Authentication> getAuthentications()
public Authentication getAuthentication(String authName)
authName
- The authentication namepublic void setUsername(String username)
username
- the usernamepublic void setPassword(String password)
password
- the passwordpublic ApiClient addDefaultHeader(String name, String value)
name
- The header's namevalue
- The header's valuepublic void setDebugging(boolean debugging)
debugging
- debug value true or falsepublic boolean isDebugging()
public DateFormat getDateFormat()
public ApiClient setDateFormat(DateFormat dateFormat)
dateFormat
- Date formatpublic Date parseDate(String str)
str
- date to parsepublic String formatDate(Date date)
date
- date to formatpublic String parameterToString(Object param)
param
- the object to convertpublic org.springframework.util.MultiValueMap<String,String> parameterToMultiValueMap(ApiClient.CollectionFormat collectionFormat, String name, Object value)
MultiValueMap
for use in REST requestscollectionFormat
- The format to convert toname
- The name of the parametervalue
- The parameter's valuepublic boolean isJsonMime(String mediaType)
public boolean isJsonMime(org.springframework.http.MediaType mediaType)
mediaType
- the input MediaTypepublic List<org.springframework.http.MediaType> selectHeaderAccept(String[] accepts)
accepts
- The accepts array to select frompublic org.springframework.http.MediaType selectHeaderContentType(String[] contentTypes)
contentTypes
- The Content-Type array to select frompublic <T> T invokeAPI(String path, org.springframework.http.HttpMethod method, org.springframework.util.MultiValueMap<String,String> queryParams, Object body, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<String,Object> formParams, List<org.springframework.http.MediaType> accept, org.springframework.http.MediaType contentType, String[] authNames, org.springframework.core.ParameterizedTypeReference<T> returnType) throws org.springframework.web.client.RestClientException
T
- the return type to usepath
- The sub-path of the HTTP URLmethod
- The request methodqueryParams
- The query parametersbody
- The request body objectheaderParams
- The header parametersformParams
- The form parametersaccept
- The request's Accept headercontentType
- The request's Content-Type headerauthNames
- The authentications to applyreturnType
- The return type into which to deserialize the responseorg.springframework.web.client.RestClientException
public static String getEtag(Object object)
object
- Object from which ETag needs to be retrievedCopyright © 2023. All rights reserved.