com.azure.resourcemanager.webpubsub.implementation.WebPubSubReplicasClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-webpubsub Show documentation
Show all versions of azure-resourcemanager-webpubsub Show documentation
This package contains Microsoft Azure SDK for WebPubSub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure WebPubSub Service. Package tag package-2024-03-01.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.webpubsub.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.webpubsub.fluent.WebPubSubReplicasClient;
import com.azure.resourcemanager.webpubsub.fluent.models.ReplicaInner;
import com.azure.resourcemanager.webpubsub.models.ReplicaList;
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 WebPubSubReplicasClient.
*/
public final class WebPubSubReplicasClientImpl implements WebPubSubReplicasClient {
/**
* The proxy service used to perform REST calls.
*/
private final WebPubSubReplicasService service;
/**
* The service client containing this operation class.
*/
private final WebPubSubManagementClientImpl client;
/**
* Initializes an instance of WebPubSubReplicasClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
WebPubSubReplicasClientImpl(WebPubSubManagementClientImpl client) {
this.service
= RestProxy.create(WebPubSubReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for WebPubSubManagementClientWebPubSubReplicas to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "WebPubSubManagementC")
public interface WebPubSubReplicasService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@PathParam("replicaName") String replicaName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@PathParam("replicaName") String replicaName, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") ReplicaInner parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@PathParam("replicaName") String replicaName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> update(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@PathParam("replicaName") String replicaName, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") ReplicaInner parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/restart")
@ExpectedResponses({ 202, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> restart(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@PathParam("replicaName") String replicaName, @QueryParam("api-version") String apiVersion,
@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);
}
/**
* List all replicas belong to this resource.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the 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 the response body along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName, String resourceName) {
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 (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, this.client.getApiVersion(), 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()));
}
/**
* List all replicas belong to this resource.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the 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 the response body along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName, String resourceName,
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 (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, resourceName,
this.client.getApiVersion(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* List all replicas belong to this resource.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the 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 the paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String resourceName) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, resourceName),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* List all replicas belong to this resource.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the 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 the paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String resourceName, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, resourceName, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* List all replicas belong to this resource.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the 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 the paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String resourceName) {
return new PagedIterable<>(listAsync(resourceGroupName, resourceName));
}
/**
* List all replicas belong to this resource.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the 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 the paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String resourceName, Context context) {
return new PagedIterable<>(listAsync(resourceGroupName, resourceName, context));
}
/**
* Get the replica and its properties.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 replica and its properties along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String resourceName,
String replicaName) {
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 (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, replicaName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the replica and its properties.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 replica and its properties along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String resourceName,
String replicaName, 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 (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, resourceName,
replicaName, this.client.getApiVersion(), accept, context);
}
/**
* Get the replica and its properties.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 replica and its properties on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceGroupName, String resourceName, String replicaName) {
return getWithResponseAsync(resourceGroupName, resourceName, replicaName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Get the replica and its properties.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 replica and its properties along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String resourceName, String replicaName,
Context context) {
return getWithResponseAsync(resourceGroupName, resourceName, replicaName, context).block();
}
/**
* Get the replica and its properties.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 replica and its properties.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ReplicaInner get(String resourceGroupName, String resourceName, String replicaName) {
return getWithResponse(resourceGroupName, resourceName, replicaName, Context.NONE).getValue();
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String resourceName, String replicaName, ReplicaInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, replicaName, this.client.getApiVersion(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String resourceName, String replicaName, ReplicaInner parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
resourceName, replicaName, this.client.getApiVersion(), parameters, accept, context);
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ReplicaInner> beginCreateOrUpdateAsync(String resourceGroupName,
String resourceName, String replicaName, ReplicaInner parameters) {
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, resourceName, replicaName, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
ReplicaInner.class, ReplicaInner.class, this.client.getContext());
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ReplicaInner> beginCreateOrUpdateAsync(String resourceGroupName,
String resourceName, String replicaName, ReplicaInner parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, resourceName, replicaName, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
ReplicaInner.class, ReplicaInner.class, context);
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ReplicaInner> beginCreateOrUpdate(String resourceGroupName,
String resourceName, String replicaName, ReplicaInner parameters) {
return this.beginCreateOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters).getSyncPoller();
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ReplicaInner> beginCreateOrUpdate(String resourceGroupName,
String resourceName, String replicaName, ReplicaInner parameters, Context context) {
return this.beginCreateOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context)
.getSyncPoller();
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String resourceName, String replicaName,
ReplicaInner parameters) {
return beginCreateOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String resourceName, String replicaName,
ReplicaInner parameters, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ReplicaInner createOrUpdate(String resourceGroupName, String resourceName, String replicaName,
ReplicaInner parameters) {
return createOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters).block();
}
/**
* Create or update a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the create or update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ReplicaInner createOrUpdate(String resourceGroupName, String resourceName, String replicaName,
ReplicaInner parameters, Context context) {
return createOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context).block();
}
/**
* Operation to delete a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 resourceName,
String replicaName) {
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 (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, replicaName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Operation to delete a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 resourceName,
String replicaName, 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 (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
resourceName, replicaName, this.client.getApiVersion(), accept, context);
}
/**
* Operation to delete a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 resourceName, String replicaName) {
return deleteWithResponseAsync(resourceGroupName, resourceName, replicaName).flatMap(ignored -> Mono.empty());
}
/**
* Operation to delete a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deleteWithResponse(String resourceGroupName, String resourceName, String replicaName,
Context context) {
return deleteWithResponseAsync(resourceGroupName, resourceName, replicaName, context).block();
}
/**
* Operation to delete a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 resourceName, String replicaName) {
deleteWithResponse(resourceGroupName, resourceName, replicaName, Context.NONE);
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String resourceName,
String replicaName, ReplicaInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, replicaName, this.client.getApiVersion(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String resourceName,
String replicaName, ReplicaInner parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
resourceName, replicaName, this.client.getApiVersion(), parameters, accept, context);
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ReplicaInner> beginUpdateAsync(String resourceGroupName,
String resourceName, String replicaName, ReplicaInner parameters) {
Mono>> mono
= updateWithResponseAsync(resourceGroupName, resourceName, replicaName, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
ReplicaInner.class, ReplicaInner.class, this.client.getContext());
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ReplicaInner> beginUpdateAsync(String resourceGroupName,
String resourceName, String replicaName, ReplicaInner parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= updateWithResponseAsync(resourceGroupName, resourceName, replicaName, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
ReplicaInner.class, ReplicaInner.class, context);
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ReplicaInner> beginUpdate(String resourceGroupName, String resourceName,
String replicaName, ReplicaInner parameters) {
return this.beginUpdateAsync(resourceGroupName, resourceName, replicaName, parameters).getSyncPoller();
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ReplicaInner> beginUpdate(String resourceGroupName, String resourceName,
String replicaName, ReplicaInner parameters, Context context) {
return this.beginUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context).getSyncPoller();
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String resourceName, String replicaName,
ReplicaInner parameters) {
return beginUpdateAsync(resourceGroupName, resourceName, replicaName, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String resourceName, String replicaName,
ReplicaInner parameters, Context context) {
return beginUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ReplicaInner update(String resourceGroupName, String resourceName, String replicaName,
ReplicaInner parameters) {
return updateAsync(resourceGroupName, resourceName, replicaName, parameters).block();
}
/**
* Operation to update an exiting replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @param parameters Parameters for the update 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 class represent a replica resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ReplicaInner update(String resourceGroupName, String resourceName, String replicaName,
ReplicaInner parameters, Context context) {
return updateAsync(resourceGroupName, resourceName, replicaName, parameters, context).block();
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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>> restartWithResponseAsync(String resourceGroupName, String resourceName,
String replicaName) {
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 (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.restart(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, replicaName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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>> restartWithResponseAsync(String resourceGroupName, String resourceName,
String replicaName, 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 (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (replicaName == null) {
return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.restart(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
resourceName, replicaName, this.client.getApiVersion(), accept, context);
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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> beginRestartAsync(String resourceGroupName, String resourceName,
String replicaName) {
Mono>> mono = restartWithResponseAsync(resourceGroupName, resourceName, replicaName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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> beginRestartAsync(String resourceGroupName, String resourceName,
String replicaName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= restartWithResponseAsync(resourceGroupName, resourceName, replicaName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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> beginRestart(String resourceGroupName, String resourceName,
String replicaName) {
return this.beginRestartAsync(resourceGroupName, resourceName, replicaName).getSyncPoller();
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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> beginRestart(String resourceGroupName, String resourceName,
String replicaName, Context context) {
return this.beginRestartAsync(resourceGroupName, resourceName, replicaName, context).getSyncPoller();
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 restartAsync(String resourceGroupName, String resourceName, String replicaName) {
return beginRestartAsync(resourceGroupName, resourceName, replicaName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 restartAsync(String resourceGroupName, String resourceName, String replicaName,
Context context) {
return beginRestartAsync(resourceGroupName, resourceName, replicaName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 restart(String resourceGroupName, String resourceName, String replicaName) {
restartAsync(resourceGroupName, resourceName, replicaName).block();
}
/**
* Operation to restart a replica.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the resource.
* @param replicaName The name of the replica.
* @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 restart(String resourceGroupName, String resourceName, String replicaName, Context context) {
restartAsync(resourceGroupName, resourceName, replicaName, 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 response body 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 response body 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