com.azure.resourcemanager.compute.implementation.RestorePointsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.compute.fluent.RestorePointsClient;
import com.azure.resourcemanager.compute.fluent.models.RestorePointInner;
import com.azure.resourcemanager.compute.models.ApiErrorException;
import com.azure.resourcemanager.compute.models.RestorePointExpandOptions;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in RestorePointsClient.
*/
public final class RestorePointsClientImpl implements RestorePointsClient {
/**
* The proxy service used to perform REST calls.
*/
private final RestorePointsService service;
/**
* The service client containing this operation class.
*/
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of RestorePointsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
RestorePointsClientImpl(ComputeManagementClientImpl client) {
this.service
= RestProxy.create(RestorePointsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientRestorePoints to be used by the proxy service
* to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
public interface RestorePointsService {
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}")
@ExpectedResponses({ 201 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> create(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("restorePointCollectionName") String restorePointCollectionName,
@PathParam("restorePointName") String restorePointName, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") RestorePointInner parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("restorePointCollectionName") String restorePointCollectionName,
@PathParam("restorePointName") String restorePointName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("restorePointCollectionName") String restorePointCollectionName,
@PathParam("restorePointName") String restorePointName,
@QueryParam("$expand") RestorePointExpandOptions expand, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> createWithResponseAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName, RestorePointInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (restorePointCollectionName == null) {
return Mono.error(
new IllegalArgumentException("Parameter restorePointCollectionName is required and cannot be null."));
}
if (restorePointName == null) {
return Mono
.error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
restorePointCollectionName, restorePointName, apiVersion, parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createWithResponseAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName, RestorePointInner parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (restorePointCollectionName == null) {
return Mono.error(
new IllegalArgumentException("Parameter restorePointCollectionName is required and cannot be null."));
}
if (restorePointName == null) {
return Mono
.error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
restorePointCollectionName, restorePointName, apiVersion, parameters, accept, context);
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of restore Point details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, RestorePointInner> beginCreateAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName, RestorePointInner parameters) {
Mono>> mono
= createWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
RestorePointInner.class, RestorePointInner.class, this.client.getContext());
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of restore Point details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, RestorePointInner> beginCreateAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName, RestorePointInner parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = createWithResponseAsync(resourceGroupName, restorePointCollectionName,
restorePointName, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
RestorePointInner.class, RestorePointInner.class, context);
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of restore Point details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, RestorePointInner> beginCreate(String resourceGroupName,
String restorePointCollectionName, String restorePointName, RestorePointInner parameters) {
return this.beginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters)
.getSyncPoller();
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of restore Point details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, RestorePointInner> beginCreate(String resourceGroupName,
String restorePointCollectionName, String restorePointName, RestorePointInner parameters, Context context) {
return this
.beginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, context)
.getSyncPoller();
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createAsync(String resourceGroupName, String restorePointCollectionName,
String restorePointName, RestorePointInner parameters) {
return beginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createAsync(String resourceGroupName, String restorePointCollectionName,
String restorePointName, RestorePointInner parameters, Context context) {
return beginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RestorePointInner create(String resourceGroupName, String restorePointCollectionName,
String restorePointName, RestorePointInner parameters) {
return createAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters).block();
}
/**
* The operation to create the restore point. Updating properties of an existing restore point is not allowed.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param parameters Parameters supplied to the Create restore point operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RestorePointInner create(String resourceGroupName, String restorePointCollectionName,
String restorePointName, RestorePointInner parameters, Context context) {
return createAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, context)
.block();
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> deleteWithResponseAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (restorePointCollectionName == null) {
return Mono.error(
new IllegalArgumentException("Parameter restorePointCollectionName is required and cannot be null."));
}
if (restorePointName == null) {
return Mono
.error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, restorePointCollectionName, restorePointName, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (restorePointCollectionName == null) {
return Mono.error(
new IllegalArgumentException("Parameter restorePointCollectionName is required and cannot be null."));
}
if (restorePointName == null) {
return Mono
.error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
restorePointCollectionName, restorePointName, apiVersion, accept, context);
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName) {
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String restorePointCollectionName,
String restorePointName) {
return this.beginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName).getSyncPoller();
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String restorePointCollectionName,
String restorePointName, Context context) {
return this.beginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName, context)
.getSyncPoller();
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(String resourceGroupName, String restorePointCollectionName,
String restorePointName) {
return beginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String restorePointCollectionName, String restorePointName,
Context context) {
return beginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String restorePointCollectionName, String restorePointName) {
deleteAsync(resourceGroupName, restorePointCollectionName, restorePointName).block();
}
/**
* The operation to delete the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the Restore Point Collection.
* @param restorePointName The name of the restore point.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String restorePointCollectionName, String restorePointName,
Context context) {
deleteAsync(resourceGroupName, restorePointCollectionName, restorePointName, context).block();
}
/**
* The operation to get the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the
* run-time state of a restore point.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName, RestorePointExpandOptions expand) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (restorePointCollectionName == null) {
return Mono.error(
new IllegalArgumentException("Parameter restorePointCollectionName is required and cannot be null."));
}
if (restorePointName == null) {
return Mono
.error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, restorePointCollectionName, restorePointName, expand, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* The operation to get the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the
* run-time state of a restore point.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String restorePointCollectionName, String restorePointName, RestorePointExpandOptions expand, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (restorePointCollectionName == null) {
return Mono.error(
new IllegalArgumentException("Parameter restorePointCollectionName is required and cannot be null."));
}
if (restorePointName == null) {
return Mono
.error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
restorePointCollectionName, restorePointName, expand, apiVersion, accept, context);
}
/**
* The operation to get the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String restorePointCollectionName,
String restorePointName) {
final RestorePointExpandOptions expand = null;
return getWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, expand)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* The operation to get the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the
* run-time state of a restore point.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String restorePointCollectionName,
String restorePointName, RestorePointExpandOptions expand, Context context) {
return getWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, expand, context)
.block();
}
/**
* The operation to get the restore point.
*
* @param resourceGroupName The name of the resource group.
* @param restorePointCollectionName The name of the restore point collection.
* @param restorePointName The name of the restore point.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return restore Point details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RestorePointInner get(String resourceGroupName, String restorePointCollectionName, String restorePointName) {
final RestorePointExpandOptions expand = null;
return getWithResponse(resourceGroupName, restorePointCollectionName, restorePointName, expand, Context.NONE)
.getValue();
}
}