com.nutanix.dat.java.client.api.RecoveryPointsApi Maven / Gradle / Ivy
Show all versions of dataprotection-java-client Show documentation
package com.nutanix.dat.java.client.api;
import com.nutanix.dat.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.core.io.InputStreamResource;
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.*;
@lombok.extern.slf4j.Slf4j
@javax.annotation.Generated(value = "com.nutanix.swagger.codegen.generators.JavaClientSDKGenerator", date = "2024-05-07T04:20:38.805Z[Etc/UTC]")@Component("com.nutanix.dat.java.client.api.RecoveryPointsApi")
public class RecoveryPointsApi {
private ApiClient apiClient;
private final Set headersToSkip;
public RecoveryPointsApi() {
this(new ApiClient());
}
@Autowired
public RecoveryPointsApi(ApiClient apiClient) {
this.apiClient = apiClient;
this.headersToSkip = new HashSet<>(Arrays.asList("authorization", "cookie", "host", "user-agent"));
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create a new recovery point.<br> #### Task Completion Details <br> External identifier of the created recovery point can be found in the task completion details under the key `recoveryPointExtId`.
* 202 - Task Id to monitor the progress of recovery point create.
*
4XX - Client error response
*
5XX - Server error response
* @param body Details of the request body to create a recovery point.
* @param args Additional arguments
* @return com.nutanix.dp1.dat.dataprotection.v4.config.CreateRecoveryPointApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.dat.dataprotection.v4.config.CreateRecoveryPointApiResponse createRecoveryPoint(com.nutanix.dp1.dat.dataprotection.v4.config.RecoveryPoint body, Map ... args) throws RestClientException {
// Check for optional argument map
Map 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 createRecoveryPoint");
}
String path = UriComponentsBuilder.fromPath("/api/dataprotection/v4.0.b1/config/recovery-points").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.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Delete the recovery point identified by {extId}.
* 202 - Task Id to monitor the progress of a recovery point delete operation.
*
4XX - Client error response
*
5XX - Server error response
* @param extId The external identifier that can be used to retrieve the recovery point using its URL.
* @param args Additional arguments
* @return com.nutanix.dp1.dat.dataprotection.v4.config.DeleteRecoveryPointApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.dat.dataprotection.v4.config.DeleteRecoveryPointApiResponse deleteRecoveryPointById(String extId, Map ... args) throws RestClientException {
// Check for optional argument map
Map 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 deleteRecoveryPointById");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("extId", extId);
String path = UriComponentsBuilder.fromPath("/api/dataprotection/v4.0.b1/config/recovery-points/{extId}").buildAndExpand(uriVariables).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.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Query the recovery point identified by {extId}.
* 200 - Details of the recovery point queried.
*
4XX - Client error response
*
5XX - Server error response
* @param extId The external identifier that can be used to retrieve the recovery point using its URL.
* @param args Additional arguments
* @return com.nutanix.dp1.dat.dataprotection.v4.config.GetRecoveryPointApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.dat.dataprotection.v4.config.GetRecoveryPointApiResponse getRecoveryPointById(String extId, Map ... args) throws RestClientException {
// Check for optional argument map
Map 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 getRecoveryPointById");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("extId", extId);
String path = UriComponentsBuilder.fromPath("/api/dataprotection/v4.0.b1/config/recovery-points/{extId}").buildAndExpand(uriVariables).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);
}
/**
* List of recovery point.
* 200 - List of recovery point(s).
*
4XX - Client error response
*
5XX - Server error response
* @param $page A URL query parameter that specifies the page number of the result set. It 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 might lead to no results.
* @param $limit A URL query parameter that specifies the total number of records returned in the result set. Must be a positive integer between 1 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](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html) URL conventions.
* For example, filter '$filter=name eq 'karbon-ntnx-1.0' would filter the result on cluster name 'karbon-ntnx1.0', filter '$filter=startswith(name, 'C')' would filter on cluster name starting with 'C'.
* The filter can be applied to the following fields:
*
* - creationTime
* - extId
* - name
* - ownerExtId
* - recoveryPointType
* - vmRecoveryPoints
* - volumeGroupRecoveryPoints
*
* @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 descending order.
* The orderby can be applied to the following fields:
*
* - creationTime
* - expirationTime
* - name
* - ownerExtId
*
* @param $select A URL query parameter that allows clients to request a specific set of properties for each entity or complex type. Expression specified with the $select must conform to the [OData V4.01](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html) URL conventions. If a $select expression consists of a single select item that is an asterisk (i.e., *), then all properties on the matching resource will be returned.
- creationTime
- expirationTime
- extId
- name
- recoveryPointType
* @param args Additional arguments
* @return com.nutanix.dp1.dat.dataprotection.v4.config.ListRecoveryPointsApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.dat.dataprotection.v4.config.ListRecoveryPointsApiResponse listRecoveryPoints(Integer $page, Integer $limit, String $filter, String $orderby, String $select, Map ... args) throws RestClientException {
// Check for optional argument map
Map argMap = args.length > 0 ? args[0] : new HashMap();
Object postBody = null;
String path = UriComponentsBuilder.fromPath("/api/dataprotection/v4.0.b1/config/recovery-points").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));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "$select", $select));
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);
}
/**
* Replicate the recovery point identified by {extId}.<br> #### Task Completion Details <br> External identifier of the replicated recovery point can be found in the task completion details under the key `recoveryPointExtId`.
* 202 - Task Id to monitor the progress of recovery point replication.
*
4XX - Client error response
*
5XX - Server error response
* @param extId The external identifier that can be used to retrieve the recovery point using its URL.
* @param body External identifier of the cluster and the Prism Central where the recovery point is to be replicated. The recovery point identified by `extId` is replicated from the current Prism Central to the remote Prism Central with the external identifier `pcExtId` . This replication allows the data-protection service to decide on which cluster to perform the automatic replication. However, the user also has the option to choose the cluster identified by `clusterExtId` to which the recovery point identified by `extId` should be replicated. Cross-AZ replication can be performed only by users having legacy roles (e.g. `admin`).
* @param args Additional arguments
* @return com.nutanix.dp1.dat.dataprotection.v4.config.RecoveryPointReplicateApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.dat.dataprotection.v4.config.RecoveryPointReplicateApiResponse replicateRecoveryPoint(String extId, com.nutanix.dp1.dat.dataprotection.v4.config.RecoveryPointReplicationSpec body, Map ... args) throws RestClientException {
// Check for optional argument map
Map argMap = args.length > 0 ? args[0] : new HashMap();
Object postBody = body;
// verify the required parameter 'extId' is set
if (extId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling replicateRecoveryPoint");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling replicateRecoveryPoint");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("extId", extId);
String path = UriComponentsBuilder.fromPath("/api/dataprotection/v4.0.b1/config/recovery-points/{extId}/$actions/replicate").buildAndExpand(uriVariables).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.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Restore a recovery point identified by {extId}.<br> #### Task Completion Details <br> A comma separated list of the created VM and volume group external identifiers can be found in the task completion details under the keys `vmExtIds` and `volumeGroupExtIds` respectively.
* 202 - Task Id to monitor the progress of a recovery point restore.
*
4XX - Client error response
*
5XX - Server error response
* @param extId The external identifier that can be used to retrieve the recovery point using its URL.
* @param body Specification for the restore action on the top-level recovery point. For a recovery point that contains multiple VM or volume group recovery points, users can selectively trigger restore for any specific set of VM or volume group recovery point(s). In case no particular selection is made, all VM and volume group recovery points that are a part of the top-level recovery point will be restored.
* @param args Additional arguments
* @return com.nutanix.dp1.dat.dataprotection.v4.config.RecoveryPointRestoreApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.dat.dataprotection.v4.config.RecoveryPointRestoreApiResponse restoreRecoveryPoint(String extId, com.nutanix.dp1.dat.dataprotection.v4.config.RecoveryPointRestorationSpec body, Map ... args) throws RestClientException {
// Check for optional argument map
Map argMap = args.length > 0 ? args[0] : new HashMap();
Object postBody = body;
// verify the required parameter 'extId' is set
if (extId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling restoreRecoveryPoint");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("extId", extId);
String path = UriComponentsBuilder.fromPath("/api/dataprotection/v4.0.b1/config/recovery-points/{extId}/$actions/restore").buildAndExpand(uriVariables).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.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Set the expiration time for the recovery point identified by {extId}.
* 202 - Task Id to monitor the progress of the recovery point expiration time update.
*
4XX - Client error response
*
5XX - Server error response
* @param extId The external identifier that can be used to retrieve the recovery point using its URL.
* @param body Request body details to set the expiration time for the recovery point.
* @param args Additional arguments
* @return com.nutanix.dp1.dat.dataprotection.v4.config.UpdateRecoveryPointExpirationTimeApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public com.nutanix.dp1.dat.dataprotection.v4.config.UpdateRecoveryPointExpirationTimeApiResponse setRecoveryPointExpirationTime(String extId, com.nutanix.dp1.dat.dataprotection.v4.config.ExpirationTimeSpec body, Map ... args) throws RestClientException {
// Check for optional argument map
Map argMap = args.length > 0 ? args[0] : new HashMap();
Object postBody = body;
// verify the required parameter 'extId' is set
if (extId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling setRecoveryPointExpirationTime");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling setRecoveryPointExpirationTime");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("extId", extId);
String path = UriComponentsBuilder.fromPath("/api/dataprotection/v4.0.b1/config/recovery-points/{extId}/$actions/set-expiration-time").buildAndExpand(uriVariables).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.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}