![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.compute.implementation.SnapshotsClientImpl 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.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.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, InnerSupportsListing,
InnerSupportsDelete, SnapshotsClient {
/**
* 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")
public interface SnapshotsService {
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> 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,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> 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,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> getByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("snapshotName") String snapshotName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, 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>> 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({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> 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, @HeaderParam("Accept") String accept,
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>> 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({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroupNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, 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 object supplied in the body of the Put disk 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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, snapshotName, apiVersion, snapshot, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 object supplied in the body of the Put disk operation.
* @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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
snapshotName, apiVersion, snapshot, accept, 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 object supplied in the body of the Put disk 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 {@link PollerFlux} for polling of snapshot resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, SnapshotInner> beginCreateOrUpdateAsync(String resourceGroupName,
String snapshotName, SnapshotInner snapshot) {
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, snapshotName, snapshot);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
SnapshotInner.class, SnapshotInner.class, 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 object supplied in the body of the Put disk operation.
* @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 {@link PollerFlux} for polling of snapshot resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, SnapshotInner> beginCreateOrUpdateAsync(String resourceGroupName,
String snapshotName, SnapshotInner snapshot, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, snapshotName, snapshot, context);
return this.client.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 object supplied in the body of the Put disk 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 {@link SyncPoller} for polling of snapshot resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, SnapshotInner> beginCreateOrUpdate(String resourceGroupName,
String snapshotName, SnapshotInner snapshot) {
return this.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 object supplied in the body of the Put disk operation.
* @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 {@link SyncPoller} for polling of snapshot resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, SnapshotInner> beginCreateOrUpdate(String resourceGroupName,
String snapshotName, SnapshotInner snapshot, Context context) {
return this.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 object supplied in the body of the Put disk 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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 object supplied in the body of the Put disk operation.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 object supplied in the body of the Put disk 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) {
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 object supplied in the body of the Put disk operation.
* @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 object supplied in the body of the Patch snapshot 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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, snapshotName, apiVersion, snapshot, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 object supplied in the body of the Patch snapshot operation.
* @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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
snapshotName, apiVersion, snapshot, accept, 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 object supplied in the body of the Patch snapshot 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 {@link PollerFlux} for polling of snapshot resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, SnapshotInner> beginUpdateAsync(String resourceGroupName,
String snapshotName, SnapshotUpdate snapshot) {
Mono>> mono = updateWithResponseAsync(resourceGroupName, snapshotName, snapshot);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
SnapshotInner.class, SnapshotInner.class, 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 object supplied in the body of the Patch snapshot operation.
* @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 {@link PollerFlux} for polling of snapshot resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, SnapshotInner> beginUpdateAsync(String resourceGroupName,
String snapshotName, SnapshotUpdate snapshot, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= updateWithResponseAsync(resourceGroupName, snapshotName, snapshot, context);
return this.client.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 object supplied in the body of the Patch snapshot 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 {@link SyncPoller} for polling of snapshot resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, SnapshotInner> beginUpdate(String resourceGroupName,
String snapshotName, SnapshotUpdate snapshot) {
return this.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 object supplied in the body of the Patch snapshot operation.
* @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 {@link SyncPoller} for polling of snapshot resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, SnapshotInner> beginUpdate(String resourceGroupName,
String snapshotName, SnapshotUpdate snapshot, Context context) {
return this.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 object supplied in the body of the Patch snapshot 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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 object supplied in the body of the Patch snapshot operation.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 object supplied in the body of the Patch snapshot 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) {
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 object supplied in the body of the Patch snapshot operation.
* @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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> 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 = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.getByResourceGroup(this.client.getEndpoint(),
this.client.getSubscriptionId(), resourceGroupName, snapshotName, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> 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 = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
snapshotName, apiVersion, accept, 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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getByResourceGroupAsync(String resourceGroupName, String snapshotName) {
return getByResourceGroupWithResponseAsync(resourceGroupName, snapshotName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* 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 along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getByResourceGroupWithResponse(String resourceGroupName, String snapshotName,
Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, snapshotName, 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 SnapshotInner getByResourceGroup(String resourceGroupName, String snapshotName) {
return getByResourceGroupWithResponse(resourceGroupName, snapshotName, Context.NONE).getValue();
}
/**
* 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-02";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, snapshotName, apiVersion, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-02";
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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String snapshotName) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, snapshotName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String snapshotName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = deleteWithResponseAsync(resourceGroupName, snapshotName, context);
return this.client.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String snapshotName) {
return this.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String snapshotName,
Context context) {
return this.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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> 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 = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listByResourceGroup(this.client.getEndpoint(),
this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> 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 = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
apiVersion, accept, 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 as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux 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 as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux 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 as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable 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 as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable 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 along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> 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 = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion,
accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> 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 = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, 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 as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux 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 as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux 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 as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable 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 as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable 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 Access data object supplied in the body of the get snapshot access 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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.grantAccess(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, snapshotName, apiVersion, grantAccessData, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 Access data object supplied in the body of the get snapshot access operation.
* @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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.grantAccess(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
snapshotName, apiVersion, grantAccessData, accept, 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 Access data object supplied in the body of the get snapshot access 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 {@link PollerFlux} for polling of a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, AccessUriInner> beginGrantAccessAsync(String resourceGroupName,
String snapshotName, GrantAccessData grantAccessData) {
Mono>> mono
= grantAccessWithResponseAsync(resourceGroupName, snapshotName, grantAccessData);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
AccessUriInner.class, AccessUriInner.class, 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 Access data object supplied in the body of the get snapshot access operation.
* @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 {@link PollerFlux} for polling of a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, AccessUriInner> beginGrantAccessAsync(String resourceGroupName,
String snapshotName, GrantAccessData grantAccessData, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= grantAccessWithResponseAsync(resourceGroupName, snapshotName, grantAccessData, context);
return this.client.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 Access data object supplied in the body of the get snapshot access 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 {@link SyncPoller} for polling of a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, AccessUriInner> beginGrantAccess(String resourceGroupName,
String snapshotName, GrantAccessData grantAccessData) {
return this.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 Access data object supplied in the body of the get snapshot access operation.
* @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 {@link SyncPoller} for polling of a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, AccessUriInner> beginGrantAccess(String resourceGroupName,
String snapshotName, GrantAccessData grantAccessData, Context context) {
return this.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 Access data object supplied in the body of the get snapshot access 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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 Access data object supplied in the body of the get snapshot access operation.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 Access data object supplied in the body of the get snapshot access 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) {
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 Access data object supplied in the body of the get snapshot access operation.
* @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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-02";
return FluxUtil
.withContext(context -> service.revokeAccess(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, snapshotName, apiVersion, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-02";
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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRevokeAccessAsync(String resourceGroupName, String snapshotName) {
Mono>> mono = revokeAccessWithResponseAsync(resourceGroupName, snapshotName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginRevokeAccessAsync(String resourceGroupName, String snapshotName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = revokeAccessWithResponseAsync(resourceGroupName, snapshotName, context);
return this.client.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String snapshotName) {
return this.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String snapshotName,
Context context) {
return this.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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 URL to get the next list of items.
* @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 along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @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 along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupNextSinglePageAsync(String nextLink,
Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, 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 URL to get the next list of items.
* @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 along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @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 along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy