SnapshotsClientImpl.java
// 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.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
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.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.compute.fluent.SnapshotsClient;
import com.azure.resourcemanager.compute.fluent.models.AccessUriInner;
import com.azure.resourcemanager.compute.fluent.models.SnapshotInner;
import com.azure.resourcemanager.compute.models.GrantAccessData;
import com.azure.resourcemanager.compute.models.SnapshotList;
import com.azure.resourcemanager.compute.models.SnapshotUpdate;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsGet;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsListing;
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 SnapshotsClient. */
public final class SnapshotsClientImpl
implements InnerSupportsGet<SnapshotInner>,
InnerSupportsListing<SnapshotInner>,
InnerSupportsDelete<Void>,
SnapshotsClient {
private final ClientLogger logger = new ClientLogger(SnapshotsClientImpl.class);
/** The proxy service used to perform REST calls. */
private final SnapshotsService service;
/** The service client containing this operation class. */
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of SnapshotsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
SnapshotsClientImpl(ComputeManagementClientImpl client) {
this.service =
RestProxy.create(SnapshotsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientSnapshots to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
private interface SnapshotsService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"
+ "/{snapshotName}")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("snapshotName") String snapshotName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") SnapshotInner snapshot,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"
+ "/{snapshotName}")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> update(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("snapshotName") String snapshotName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") SnapshotUpdate snapshot,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"
+ "/{snapshotName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<SnapshotInner>> getByResourceGroup(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("snapshotName") String snapshotName,
@QueryParam("api-version") String apiVersion,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"
+ "/{snapshotName}")
@ExpectedResponses({200, 202, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> delete(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("snapshotName") String snapshotName,
@QueryParam("api-version") String apiVersion,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<SnapshotList>> listByResourceGroup(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<SnapshotList>> list(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"
+ "/{snapshotName}/beginGetAccess")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> grantAccess(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("snapshotName") String snapshotName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") GrantAccessData grantAccessData,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"
+ "/{snapshotName}/endGetAccess")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> revokeAccess(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("snapshotName") String snapshotName,
@QueryParam("api-version") String apiVersion,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<SnapshotList>> listByResourceGroupNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<SnapshotList>> listNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName, String snapshotName, SnapshotInner snapshot) {
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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
if (snapshot == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshot is required and cannot be null."));
} else {
snapshot.validate();
}
final String apiVersion = "2019-11-01";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
snapshot,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName, String snapshotName, SnapshotInner snapshot, 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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
if (snapshot == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshot is required and cannot be null."));
} else {
snapshot.validate();
}
final String apiVersion = "2019-11-01";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
snapshot,
context);
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<SnapshotInner>, SnapshotInner> beginCreateOrUpdateAsync(
String resourceGroupName, String snapshotName, SnapshotInner snapshot) {
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(resourceGroupName, snapshotName, snapshot);
return this
.client
.<SnapshotInner, SnapshotInner>getLroResult(
mono, this.client.getHttpPipeline(), SnapshotInner.class, SnapshotInner.class, Context.NONE);
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<SnapshotInner>, SnapshotInner> beginCreateOrUpdateAsync(
String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(resourceGroupName, snapshotName, snapshot, context);
return this
.client
.<SnapshotInner, SnapshotInner>getLroResult(
mono, this.client.getHttpPipeline(), SnapshotInner.class, SnapshotInner.class, context);
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<SnapshotInner>, SnapshotInner> beginCreateOrUpdate(
String resourceGroupName, String snapshotName, SnapshotInner snapshot) {
return beginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot).getSyncPoller();
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<SnapshotInner>, SnapshotInner> beginCreateOrUpdate(
String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot, context).getSyncPoller();
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SnapshotInner> createOrUpdateAsync(
String resourceGroupName, String snapshotName, SnapshotInner snapshot) {
return beginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<SnapshotInner> createOrUpdateAsync(
String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SnapshotInner createOrUpdate(String resourceGroupName, String snapshotName, SnapshotInner snapshot) {
return createOrUpdateAsync(resourceGroupName, snapshotName, snapshot).block();
}
/**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SnapshotInner createOrUpdate(
String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) {
return createOrUpdateAsync(resourceGroupName, snapshotName, snapshot, context).block();
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
if (snapshot == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshot is required and cannot be null."));
} else {
snapshot.validate();
}
final String apiVersion = "2019-11-01";
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
snapshot,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, 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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
if (snapshot == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshot is required and cannot be null."));
} else {
snapshot.validate();
}
final String apiVersion = "2019-11-01";
context = this.client.mergeContext(context);
return service
.update(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
snapshot,
context);
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<SnapshotInner>, SnapshotInner> beginUpdateAsync(
String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
Mono<Response<Flux<ByteBuffer>>> mono = updateWithResponseAsync(resourceGroupName, snapshotName, snapshot);
return this
.client
.<SnapshotInner, SnapshotInner>getLroResult(
mono, this.client.getHttpPipeline(), SnapshotInner.class, SnapshotInner.class, Context.NONE);
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<SnapshotInner>, SnapshotInner> beginUpdateAsync(
String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
updateWithResponseAsync(resourceGroupName, snapshotName, snapshot, context);
return this
.client
.<SnapshotInner, SnapshotInner>getLroResult(
mono, this.client.getHttpPipeline(), SnapshotInner.class, SnapshotInner.class, context);
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<SnapshotInner>, SnapshotInner> beginUpdate(
String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
return beginUpdateAsync(resourceGroupName, snapshotName, snapshot).getSyncPoller();
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<SnapshotInner>, SnapshotInner> beginUpdate(
String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) {
return beginUpdateAsync(resourceGroupName, snapshotName, snapshot, context).getSyncPoller();
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SnapshotInner> updateAsync(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
return beginUpdateAsync(resourceGroupName, snapshotName, snapshot)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<SnapshotInner> updateAsync(
String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) {
return beginUpdateAsync(resourceGroupName, snapshotName, snapshot, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SnapshotInner update(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
return updateAsync(resourceGroupName, snapshotName, snapshot).block();
}
/**
* Updates (patches) a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param snapshot Snapshot update resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return snapshot resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SnapshotInner update(
String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) {
return updateAsync(resourceGroupName, snapshotName, snapshot, context).block();
}
/**
* Gets information about a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about a snapshot.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SnapshotInner>> getByResourceGroupWithResponseAsync(
String resourceGroupName, String snapshotName) {
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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
final String apiVersion = "2019-11-01";
return FluxUtil
.withContext(
context ->
service
.getByResourceGroup(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets information about a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about a snapshot.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<SnapshotInner>> getByResourceGroupWithResponseAsync(
String resourceGroupName, String snapshotName, 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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
final String apiVersion = "2019-11-01";
context = this.client.mergeContext(context);
return service
.getByResourceGroup(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
context);
}
/**
* Gets information about a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about a snapshot.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SnapshotInner> getByResourceGroupAsync(String resourceGroupName, String snapshotName) {
return getByResourceGroupWithResponseAsync(resourceGroupName, snapshotName)
.flatMap(
(Response<SnapshotInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets information about a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about a snapshot.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SnapshotInner getByResourceGroup(String resourceGroupName, String snapshotName) {
return getByResourceGroupAsync(resourceGroupName, snapshotName).block();
}
/**
* Gets information about a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about a snapshot.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<SnapshotInner> getByResourceGroupWithResponse(
String resourceGroupName, String snapshotName, Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, snapshotName, context).block();
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String snapshotName) {
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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
final String apiVersion = "2019-11-01";
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String snapshotName, 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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
final String apiVersion = "2019-11-01";
context = this.client.mergeContext(context);
return service
.delete(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
context);
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(String resourceGroupName, String snapshotName) {
Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, snapshotName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String snapshotName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, snapshotName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String snapshotName) {
return beginDeleteAsync(resourceGroupName, snapshotName).getSyncPoller();
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String snapshotName, Context context) {
return beginDeleteAsync(resourceGroupName, snapshotName, context).getSyncPoller();
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(String resourceGroupName, String snapshotName) {
return beginDeleteAsync(resourceGroupName, snapshotName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deleteAsync(String resourceGroupName, String snapshotName, Context context) {
return beginDeleteAsync(resourceGroupName, snapshotName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException 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 snapshotName) {
deleteAsync(resourceGroupName, snapshotName).block();
}
/**
* Deletes a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException 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 snapshotName, Context context) {
deleteAsync(resourceGroupName, snapshotName, context).block();
}
/**
* Lists snapshots under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<SnapshotInner>> listByResourceGroupSinglePageAsync(String resourceGroupName) {
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."));
}
final String apiVersion = "2019-11-01";
return FluxUtil
.withContext(
context ->
service
.listByResourceGroup(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
context))
.<PagedResponse<SnapshotInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists snapshots under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<SnapshotInner>> listByResourceGroupSinglePageAsync(
String resourceGroupName, 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."));
}
final String apiVersion = "2019-11-01";
context = this.client.mergeContext(context);
return service
.listByResourceGroup(
this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, apiVersion, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Lists snapshots under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<SnapshotInner> listByResourceGroupAsync(String resourceGroupName) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
}
/**
* Lists snapshots under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<SnapshotInner> listByResourceGroupAsync(String resourceGroupName, Context context) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName, context),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
}
/**
* Lists snapshots under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<SnapshotInner> listByResourceGroup(String resourceGroupName) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName));
}
/**
* Lists snapshots under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<SnapshotInner> listByResourceGroup(String resourceGroupName, Context context) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
}
/**
* Lists snapshots under a subscription.
*
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<SnapshotInner>> listSinglePageAsync() {
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."));
}
final String apiVersion = "2019-11-01";
return FluxUtil
.withContext(
context ->
service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, context))
.<PagedResponse<SnapshotInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists snapshots under a subscription.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<SnapshotInner>> listSinglePageAsync(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."));
}
final String apiVersion = "2019-11-01";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Lists snapshots under a subscription.
*
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<SnapshotInner> listAsync() {
return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Lists snapshots under a subscription.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<SnapshotInner> listAsync(Context context) {
return new PagedFlux<>(
() -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Lists snapshots under a subscription.
*
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<SnapshotInner> list() {
return new PagedIterable<>(listAsync());
}
/**
* Lists snapshots under a subscription.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<SnapshotInner> list(Context context) {
return new PagedIterable<>(listAsync(context));
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> grantAccessWithResponseAsync(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) {
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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
if (grantAccessData == null) {
return Mono
.error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null."));
} else {
grantAccessData.validate();
}
final String apiVersion = "2019-11-01";
return FluxUtil
.withContext(
context ->
service
.grantAccess(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
grantAccessData,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> grantAccessWithResponseAsync(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, 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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
if (grantAccessData == null) {
return Mono
.error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null."));
} else {
grantAccessData.validate();
}
final String apiVersion = "2019-11-01";
context = this.client.mergeContext(context);
return service
.grantAccess(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
grantAccessData,
context);
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<AccessUriInner>, AccessUriInner> beginGrantAccessAsync(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) {
Mono<Response<Flux<ByteBuffer>>> mono =
grantAccessWithResponseAsync(resourceGroupName, snapshotName, grantAccessData);
return this
.client
.<AccessUriInner, AccessUriInner>getLroResult(
mono, this.client.getHttpPipeline(), AccessUriInner.class, AccessUriInner.class, Context.NONE);
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<AccessUriInner>, AccessUriInner> beginGrantAccessAsync(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
grantAccessWithResponseAsync(resourceGroupName, snapshotName, grantAccessData, context);
return this
.client
.<AccessUriInner, AccessUriInner>getLroResult(
mono, this.client.getHttpPipeline(), AccessUriInner.class, AccessUriInner.class, context);
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<AccessUriInner>, AccessUriInner> beginGrantAccess(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) {
return beginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData).getSyncPoller();
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<AccessUriInner>, AccessUriInner> beginGrantAccess(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) {
return beginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData, context).getSyncPoller();
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<AccessUriInner> grantAccessAsync(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) {
return beginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<AccessUriInner> grantAccessAsync(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) {
return beginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AccessUriInner grantAccess(String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) {
return grantAccessAsync(resourceGroupName, snapshotName, grantAccessData).block();
}
/**
* Grants access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param grantAccessData Data used for requesting a SAS.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AccessUriInner grantAccess(
String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) {
return grantAccessAsync(resourceGroupName, snapshotName, grantAccessData, context).block();
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> revokeAccessWithResponseAsync(
String resourceGroupName, String snapshotName) {
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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
final String apiVersion = "2019-11-01";
return FluxUtil
.withContext(
context ->
service
.revokeAccess(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> revokeAccessWithResponseAsync(
String resourceGroupName, String snapshotName, 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 (snapshotName == null) {
return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
}
final String apiVersion = "2019-11-01";
context = this.client.mergeContext(context);
return service
.revokeAccess(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
snapshotName,
apiVersion,
context);
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginRevokeAccessAsync(String resourceGroupName, String snapshotName) {
Mono<Response<Flux<ByteBuffer>>> mono = revokeAccessWithResponseAsync(resourceGroupName, snapshotName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginRevokeAccessAsync(
String resourceGroupName, String snapshotName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = revokeAccessWithResponseAsync(resourceGroupName, snapshotName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginRevokeAccess(String resourceGroupName, String snapshotName) {
return beginRevokeAccessAsync(resourceGroupName, snapshotName).getSyncPoller();
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginRevokeAccess(
String resourceGroupName, String snapshotName, Context context) {
return beginRevokeAccessAsync(resourceGroupName, snapshotName, context).getSyncPoller();
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> revokeAccessAsync(String resourceGroupName, String snapshotName) {
return beginRevokeAccessAsync(resourceGroupName, snapshotName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> revokeAccessAsync(String resourceGroupName, String snapshotName, Context context) {
return beginRevokeAccessAsync(resourceGroupName, snapshotName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException 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 revokeAccess(String resourceGroupName, String snapshotName) {
revokeAccessAsync(resourceGroupName, snapshotName).block();
}
/**
* Revokes access to a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException 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 revokeAccess(String resourceGroupName, String snapshotName, Context context) {
revokeAccessAsync(resourceGroupName, snapshotName, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<SnapshotInner>> listByResourceGroupNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.listByResourceGroupNext(nextLink, context))
.<PagedResponse<SnapshotInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<SnapshotInner>> listByResourceGroupNextSinglePageAsync(
String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service
.listByResourceGroupNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<SnapshotInner>> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.listNext(nextLink, context))
.<PagedResponse<SnapshotInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Snapshots operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<SnapshotInner>> listNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service
.listNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
}