com.azure.resourcemanager.sql.implementation.DatabasesClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-sql Show documentation
Show all versions of azure-resourcemanager-sql Show documentation
This package contains Microsoft Azure Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
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.sql.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.sql.fluent.DatabasesClient;
import com.azure.resourcemanager.sql.fluent.models.DatabaseInner;
import com.azure.resourcemanager.sql.fluent.models.ImportExportOperationResultInner;
import com.azure.resourcemanager.sql.models.DatabaseListResult;
import com.azure.resourcemanager.sql.models.DatabaseUpdate;
import com.azure.resourcemanager.sql.models.ExportDatabaseDefinition;
import com.azure.resourcemanager.sql.models.ImportExistingDatabaseDefinition;
import com.azure.resourcemanager.sql.models.ReplicaType;
import com.azure.resourcemanager.sql.models.ResourceMoveDefinition;
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 DatabasesClient.
*/
public final class DatabasesClientImpl implements DatabasesClient {
/**
* The proxy service used to perform REST calls.
*/
private final DatabasesService service;
/**
* The service client containing this operation class.
*/
private final SqlManagementClientImpl client;
/**
* Initializes an instance of DatabasesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
DatabasesClientImpl(SqlManagementClientImpl client) {
this.service
= RestProxy.create(DatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SqlManagementClientDatabases to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SqlManagementClientD")
public interface DatabasesService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByServer(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@QueryParam("$skipToken") String skipToken, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}")
@ExpectedResponses({ 200, 201, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion, @BodyParam("application/json") DatabaseInner parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion, Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> update(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion, @BodyParam("application/json") DatabaseUpdate parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> export(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") ExportDatabaseDefinition parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> failover(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @QueryParam("replicaType") ReplicaType replicaType,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> importMethod(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") ImportExistingDatabaseDefinition parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> rename(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") ResourceMoveDefinition parameters, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> pause(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @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.Sql/servers/{serverName}/databases/{databaseName}/resume")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> resume(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> upgradeDataWarehouse(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByElasticPool(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("elasticPoolName") String elasticPoolName, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/inaccessibleDatabases")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listInaccessibleByServer(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByServerNext(
@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> listByElasticPoolNext(
@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> listInaccessibleByServerNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Gets a list of databases.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param skipToken The skipToken parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName,
String skipToken) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName 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 accept = "application/json";
return FluxUtil
.withContext(context -> service.listByServer(this.client.getEndpoint(), resourceGroupName, serverName,
skipToken, this.client.getSubscriptionId(), 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()));
}
/**
* Gets a list of databases.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param skipToken The skipToken parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName,
String skipToken, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName 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 accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByServer(this.client.getEndpoint(), resourceGroupName, serverName, skipToken,
this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Gets a list of databases.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param skipToken The skipToken parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of databases as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByServerAsync(String resourceGroupName, String serverName, String skipToken) {
return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken),
nextLink -> listByServerNextSinglePageAsync(nextLink));
}
/**
* Gets a list of databases.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @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 list of databases as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByServerAsync(String resourceGroupName, String serverName) {
final String skipToken = null;
return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken),
nextLink -> listByServerNextSinglePageAsync(nextLink));
}
/**
* Gets a list of databases.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param skipToken The skipToken parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of databases as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByServerAsync(String resourceGroupName, String serverName, String skipToken,
Context context) {
return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken, context),
nextLink -> listByServerNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of databases.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @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 list of databases as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByServer(String resourceGroupName, String serverName) {
final String skipToken = null;
return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skipToken));
}
/**
* Gets a list of databases.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param skipToken The skipToken parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of databases as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByServer(String resourceGroupName, String serverName, String skipToken,
Context context) {
return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skipToken, context));
}
/**
* Gets a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 database along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String resourceGroupName, String serverName,
String databaseName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 database along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context);
}
/**
* Gets a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 database on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithResponseAsync(resourceGroupName, serverName, databaseName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 database along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String serverName, String databaseName,
Context context) {
return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block();
}
/**
* Gets a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 database.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) {
return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue();
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, DatabaseInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (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(), resourceGroupName, serverName,
databaseName, this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String serverName, String databaseName, DatabaseInner parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (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(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context);
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, DatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName,
String serverName, String databaseName, DatabaseInner parameters) {
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DatabaseInner.class, DatabaseInner.class, this.client.getContext());
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName,
String serverName, String databaseName, DatabaseInner parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DatabaseInner.class, DatabaseInner.class, context);
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DatabaseInner> beginCreateOrUpdate(String resourceGroupName,
String serverName, String databaseName, DatabaseInner parameters) {
return this.beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller();
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DatabaseInner> beginCreateOrUpdate(String resourceGroupName,
String serverName, String databaseName, DatabaseInner parameters, Context context) {
return this.beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context)
.getSyncPoller();
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName,
DatabaseInner parameters) {
return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName,
DatabaseInner parameters, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String databaseName,
DatabaseInner parameters) {
return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block();
}
/**
* Creates a new database or updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String databaseName,
DatabaseInner parameters, Context context) {
return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).block();
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName,
String databaseName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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."));
}
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, serverName,
databaseName, this.client.getSubscriptionId(), this.client.getApiVersion(), context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName,
String databaseName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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."));
}
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), context);
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName,
String databaseName) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, databaseName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName,
String databaseName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, serverName, databaseName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName,
String databaseName) {
return this.beginDeleteAsync(resourceGroupName, serverName, databaseName).getSyncPoller();
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName,
String databaseName, Context context) {
return this.beginDeleteAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller();
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName, String databaseName) {
return beginDeleteAsync(resourceGroupName, serverName, databaseName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName, String databaseName, Context context) {
return beginDeleteAsync(resourceGroupName, serverName, databaseName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName, String databaseName) {
deleteAsync(resourceGroupName, serverName, databaseName).block();
}
/**
* Deletes the database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @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 serverName, String databaseName, Context context) {
deleteAsync(resourceGroupName, serverName, databaseName, context).block();
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> updateWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, DatabaseUpdate parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (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(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, DatabaseUpdate parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (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(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context);
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, DatabaseInner> beginUpdateAsync(String resourceGroupName,
String serverName, String databaseName, DatabaseUpdate parameters) {
Mono>> mono
= updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DatabaseInner.class, DatabaseInner.class, this.client.getContext());
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DatabaseInner> beginUpdateAsync(String resourceGroupName,
String serverName, String databaseName, DatabaseUpdate parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DatabaseInner.class, DatabaseInner.class, context);
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DatabaseInner> beginUpdate(String resourceGroupName, String serverName,
String databaseName, DatabaseUpdate parameters) {
return this.beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller();
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DatabaseInner> beginUpdate(String resourceGroupName, String serverName,
String databaseName, DatabaseUpdate parameters, Context context) {
return this.beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller();
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateAsync(String resourceGroupName, String serverName, String databaseName,
DatabaseUpdate parameters) {
return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String serverName, String databaseName,
DatabaseUpdate parameters, Context context) {
return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner update(String resourceGroupName, String serverName, String databaseName,
DatabaseUpdate parameters) {
return updateAsync(resourceGroupName, serverName, databaseName, parameters).block();
}
/**
* Updates an existing database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The requested database resource state.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner update(String resourceGroupName, String serverName, String databaseName,
DatabaseUpdate parameters, Context context) {
return updateAsync(resourceGroupName, serverName, databaseName, parameters, context).block();
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> exportWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, ExportDatabaseDefinition parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (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.export(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> exportWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, ExportDatabaseDefinition parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (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.export(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context);
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, ImportExportOperationResultInner> beginExportAsync(
String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) {
Mono>> mono
= exportWithResponseAsync(resourceGroupName, serverName, databaseName, parameters);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ImportExportOperationResultInner.class,
ImportExportOperationResultInner.class, this.client.getContext());
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ImportExportOperationResultInner> beginExportAsync(
String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= exportWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ImportExportOperationResultInner.class,
ImportExportOperationResultInner.class, context);
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ImportExportOperationResultInner> beginExport(
String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) {
return this.beginExportAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller();
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ImportExportOperationResultInner> beginExport(
String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters,
Context context) {
return this.beginExportAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller();
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono exportAsync(String resourceGroupName, String serverName,
String databaseName, ExportDatabaseDefinition parameters) {
return beginExportAsync(resourceGroupName, serverName, databaseName, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono exportAsync(String resourceGroupName, String serverName,
String databaseName, ExportDatabaseDefinition parameters, Context context) {
return beginExportAsync(resourceGroupName, serverName, databaseName, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ImportExportOperationResultInner export(String resourceGroupName, String serverName, String databaseName,
ExportDatabaseDefinition parameters) {
return exportAsync(resourceGroupName, serverName, databaseName, parameters).block();
}
/**
* Exports a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database export request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ImportExportOperationResultInner export(String resourceGroupName, String serverName, String databaseName,
ExportDatabaseDefinition parameters, Context context) {
return exportAsync(resourceGroupName, serverName, databaseName, parameters, context).block();
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @param replicaType The type of replica to be failed over.
* @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>> failoverWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, ReplicaType replicaType) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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."));
}
return FluxUtil
.withContext(context -> service.failover(this.client.getEndpoint(), resourceGroupName, serverName,
databaseName, replicaType, this.client.getSubscriptionId(), this.client.getApiVersion(), context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @param replicaType The type of replica to be failed over.
* @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>> failoverWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, ReplicaType replicaType, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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."));
}
context = this.client.mergeContext(context);
return service.failover(this.client.getEndpoint(), resourceGroupName, serverName, databaseName, replicaType,
this.client.getSubscriptionId(), this.client.getApiVersion(), context);
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @param replicaType The type of replica to be failed over.
* @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> beginFailoverAsync(String resourceGroupName, String serverName,
String databaseName, ReplicaType replicaType) {
Mono>> mono
= failoverWithResponseAsync(resourceGroupName, serverName, databaseName, replicaType);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @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> beginFailoverAsync(String resourceGroupName, String serverName,
String databaseName) {
final ReplicaType replicaType = null;
Mono>> mono
= failoverWithResponseAsync(resourceGroupName, serverName, databaseName, replicaType);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @param replicaType The type of replica to be failed over.
* @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> beginFailoverAsync(String resourceGroupName, String serverName,
String databaseName, ReplicaType replicaType, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= failoverWithResponseAsync(resourceGroupName, serverName, databaseName, replicaType, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @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> beginFailover(String resourceGroupName, String serverName,
String databaseName) {
final ReplicaType replicaType = null;
return this.beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).getSyncPoller();
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @param replicaType The type of replica to be failed over.
* @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> beginFailover(String resourceGroupName, String serverName,
String databaseName, ReplicaType replicaType, Context context) {
return this.beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType, context)
.getSyncPoller();
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @param replicaType The type of replica to be failed over.
* @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 failoverAsync(String resourceGroupName, String serverName, String databaseName,
ReplicaType replicaType) {
return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @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 failoverAsync(String resourceGroupName, String serverName, String databaseName) {
final ReplicaType replicaType = null;
return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @param replicaType The type of replica to be failed over.
* @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 failoverAsync(String resourceGroupName, String serverName, String databaseName,
ReplicaType replicaType, Context context) {
return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @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 failover(String resourceGroupName, String serverName, String databaseName) {
final ReplicaType replicaType = null;
failoverAsync(resourceGroupName, serverName, databaseName, replicaType).block();
}
/**
* Failovers a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to failover.
* @param replicaType The type of replica to be failed over.
* @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 failover(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType,
Context context) {
failoverAsync(resourceGroupName, serverName, databaseName, replicaType, context).block();
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> importMethodWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, ImportExistingDatabaseDefinition parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (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.importMethod(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> importMethodWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, ImportExistingDatabaseDefinition parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (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.importMethod(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context);
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, ImportExportOperationResultInner>
beginImportMethodAsync(String resourceGroupName, String serverName, String databaseName,
ImportExistingDatabaseDefinition parameters) {
Mono>> mono
= importMethodWithResponseAsync(resourceGroupName, serverName, databaseName, parameters);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ImportExportOperationResultInner.class,
ImportExportOperationResultInner.class, this.client.getContext());
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ImportExportOperationResultInner>
beginImportMethodAsync(String resourceGroupName, String serverName, String databaseName,
ImportExistingDatabaseDefinition parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= importMethodWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ImportExportOperationResultInner.class,
ImportExportOperationResultInner.class, context);
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ImportExportOperationResultInner> beginImportMethod(
String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) {
return this.beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller();
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ImportExportOperationResultInner> beginImportMethod(
String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters,
Context context) {
return this.beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters, context)
.getSyncPoller();
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono importMethodAsync(String resourceGroupName, String serverName,
String databaseName, ImportExistingDatabaseDefinition parameters) {
return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono importMethodAsync(String resourceGroupName, String serverName,
String databaseName, ImportExistingDatabaseDefinition parameters, Context context) {
return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ImportExportOperationResultInner importMethod(String resourceGroupName, String serverName,
String databaseName, ImportExistingDatabaseDefinition parameters) {
return importMethodAsync(resourceGroupName, serverName, databaseName, parameters).block();
}
/**
* Imports a bacpac into a new database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param parameters The database import request parameters.
* @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 an ImportExport operation result resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ImportExportOperationResultInner importMethod(String resourceGroupName, String serverName,
String databaseName, ImportExistingDatabaseDefinition parameters, Context context) {
return importMethodAsync(resourceGroupName, serverName, databaseName, parameters, context).block();
}
/**
* Renames a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to rename.
* @param parameters The resource move definition for renaming this database.
* @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> renameWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, ResourceMoveDefinition parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
return FluxUtil
.withContext(context -> service.rename(this.client.getEndpoint(), resourceGroupName, serverName,
databaseName, this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Renames a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to rename.
* @param parameters The resource move definition for renaming this database.
* @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> renameWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, ResourceMoveDefinition parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
context = this.client.mergeContext(context);
return service.rename(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, context);
}
/**
* Renames a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to rename.
* @param parameters The resource move definition for renaming this database.
* @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 renameAsync(String resourceGroupName, String serverName, String databaseName,
ResourceMoveDefinition parameters) {
return renameWithResponseAsync(resourceGroupName, serverName, databaseName, parameters)
.flatMap(ignored -> Mono.empty());
}
/**
* Renames a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to rename.
* @param parameters The resource move definition for renaming this database.
* @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 renameWithResponse(String resourceGroupName, String serverName, String databaseName,
ResourceMoveDefinition parameters, Context context) {
return renameWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context).block();
}
/**
* Renames a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to rename.
* @param parameters The resource move definition for renaming this database.
* @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 rename(String resourceGroupName, String serverName, String databaseName,
ResourceMoveDefinition parameters) {
renameWithResponse(resourceGroupName, serverName, databaseName, parameters, Context.NONE);
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> pauseWithResponseAsync(String resourceGroupName, String serverName,
String databaseName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 accept = "application/json";
return FluxUtil
.withContext(context -> service.pause(this.client.getEndpoint(), resourceGroupName, serverName,
databaseName, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> pauseWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 accept = "application/json";
context = this.client.mergeContext(context);
return service.pause(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context);
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, DatabaseInner> beginPauseAsync(String resourceGroupName,
String serverName, String databaseName) {
Mono>> mono = pauseWithResponseAsync(resourceGroupName, serverName, databaseName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DatabaseInner.class, DatabaseInner.class, this.client.getContext());
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DatabaseInner> beginPauseAsync(String resourceGroupName,
String serverName, String databaseName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= pauseWithResponseAsync(resourceGroupName, serverName, databaseName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DatabaseInner.class, DatabaseInner.class, context);
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DatabaseInner> beginPause(String resourceGroupName, String serverName,
String databaseName) {
return this.beginPauseAsync(resourceGroupName, serverName, databaseName).getSyncPoller();
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DatabaseInner> beginPause(String resourceGroupName, String serverName,
String databaseName, Context context) {
return this.beginPauseAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller();
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono pauseAsync(String resourceGroupName, String serverName, String databaseName) {
return beginPauseAsync(resourceGroupName, serverName, databaseName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono pauseAsync(String resourceGroupName, String serverName, String databaseName,
Context context) {
return beginPauseAsync(resourceGroupName, serverName, databaseName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName) {
return pauseAsync(resourceGroupName, serverName, databaseName).block();
}
/**
* Pauses a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be paused.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName, Context context) {
return pauseAsync(resourceGroupName, serverName, databaseName, context).block();
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> resumeWithResponseAsync(String resourceGroupName, String serverName,
String databaseName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 accept = "application/json";
return FluxUtil
.withContext(context -> service.resume(this.client.getEndpoint(), resourceGroupName, serverName,
databaseName, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> resumeWithResponseAsync(String resourceGroupName, String serverName,
String databaseName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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 accept = "application/json";
context = this.client.mergeContext(context);
return service.resume(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context);
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, DatabaseInner> beginResumeAsync(String resourceGroupName,
String serverName, String databaseName) {
Mono>> mono = resumeWithResponseAsync(resourceGroupName, serverName, databaseName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DatabaseInner.class, DatabaseInner.class, this.client.getContext());
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DatabaseInner> beginResumeAsync(String resourceGroupName,
String serverName, String databaseName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= resumeWithResponseAsync(resourceGroupName, serverName, databaseName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DatabaseInner.class, DatabaseInner.class, context);
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DatabaseInner> beginResume(String resourceGroupName, String serverName,
String databaseName) {
return this.beginResumeAsync(resourceGroupName, serverName, databaseName).getSyncPoller();
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DatabaseInner> beginResume(String resourceGroupName, String serverName,
String databaseName, Context context) {
return this.beginResumeAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller();
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono resumeAsync(String resourceGroupName, String serverName, String databaseName) {
return beginResumeAsync(resourceGroupName, serverName, databaseName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono resumeAsync(String resourceGroupName, String serverName, String databaseName,
Context context) {
return beginResumeAsync(resourceGroupName, serverName, databaseName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName) {
return resumeAsync(resourceGroupName, serverName, databaseName).block();
}
/**
* Resumes a database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be resumed.
* @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 database resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName, Context context) {
return resumeAsync(resourceGroupName, serverName, databaseName, context).block();
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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>> upgradeDataWarehouseWithResponseAsync(String resourceGroupName,
String serverName, String databaseName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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."));
}
return FluxUtil
.withContext(context -> service.upgradeDataWarehouse(this.client.getEndpoint(), resourceGroupName,
serverName, databaseName, this.client.getSubscriptionId(), this.client.getApiVersion(), context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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>> upgradeDataWarehouseWithResponseAsync(String resourceGroupName,
String serverName, String databaseName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName 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."));
}
context = this.client.mergeContext(context);
return service.upgradeDataWarehouse(this.client.getEndpoint(), resourceGroupName, serverName, databaseName,
this.client.getSubscriptionId(), this.client.getApiVersion(), context);
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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> beginUpgradeDataWarehouseAsync(String resourceGroupName,
String serverName, String databaseName) {
Mono>> mono
= upgradeDataWarehouseWithResponseAsync(resourceGroupName, serverName, databaseName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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> beginUpgradeDataWarehouseAsync(String resourceGroupName,
String serverName, String databaseName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= upgradeDataWarehouseWithResponseAsync(resourceGroupName, serverName, databaseName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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> beginUpgradeDataWarehouse(String resourceGroupName, String serverName,
String databaseName) {
return this.beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).getSyncPoller();
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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> beginUpgradeDataWarehouse(String resourceGroupName, String serverName,
String databaseName, Context context) {
return this.beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context)
.getSyncPoller();
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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 upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) {
return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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 upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName,
Context context) {
return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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 upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) {
upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).block();
}
/**
* Upgrades a data warehouse.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database to be upgraded.
* @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 upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName,
Context context) {
upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context).block();
}
/**
* Gets a list of databases in an elastic pool.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param elasticPoolName The name of the elastic pool.
* @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 list of databases in an elastic pool along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByElasticPoolSinglePageAsync(String resourceGroupName,
String serverName, String elasticPoolName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (elasticPoolName == null) {
return Mono
.error(new IllegalArgumentException("Parameter elasticPoolName 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 accept = "application/json";
return FluxUtil
.withContext(context -> service.listByElasticPool(this.client.getEndpoint(), resourceGroupName, serverName,
elasticPoolName, this.client.getSubscriptionId(), 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()));
}
/**
* Gets a list of databases in an elastic pool.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param elasticPoolName The name of the elastic pool.
* @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 list of databases in an elastic pool along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByElasticPoolSinglePageAsync(String resourceGroupName,
String serverName, String elasticPoolName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (elasticPoolName == null) {
return Mono
.error(new IllegalArgumentException("Parameter elasticPoolName 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 accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByElasticPool(this.client.getEndpoint(), resourceGroupName, serverName, elasticPoolName,
this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Gets a list of databases in an elastic pool.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param elasticPoolName The name of the elastic pool.
* @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 list of databases in an elastic pool as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByElasticPoolAsync(String resourceGroupName, String serverName,
String elasticPoolName) {
return new PagedFlux<>(() -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName),
nextLink -> listByElasticPoolNextSinglePageAsync(nextLink));
}
/**
* Gets a list of databases in an elastic pool.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param elasticPoolName The name of the elastic pool.
* @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 list of databases in an elastic pool as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByElasticPoolAsync(String resourceGroupName, String serverName,
String elasticPoolName, Context context) {
return new PagedFlux<>(
() -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context),
nextLink -> listByElasticPoolNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of databases in an elastic pool.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param elasticPoolName The name of the elastic pool.
* @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 list of databases in an elastic pool as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByElasticPool(String resourceGroupName, String serverName,
String elasticPoolName) {
return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName));
}
/**
* Gets a list of databases in an elastic pool.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param elasticPoolName The name of the elastic pool.
* @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 list of databases in an elastic pool as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByElasticPool(String resourceGroupName, String serverName,
String elasticPoolName, Context context) {
return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, context));
}
/**
* Gets a list of inaccessible databases in a logical server.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @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 list of inaccessible databases in a logical server along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listInaccessibleByServerSinglePageAsync(String resourceGroupName,
String serverName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName 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 accept = "application/json";
return FluxUtil
.withContext(context -> service.listInaccessibleByServer(this.client.getEndpoint(), resourceGroupName,
serverName, this.client.getSubscriptionId(), 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()));
}
/**
* Gets a list of inaccessible databases in a logical server.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @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 list of inaccessible databases in a logical server along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listInaccessibleByServerSinglePageAsync(String resourceGroupName,
String serverName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName 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 accept = "application/json";
context = this.client.mergeContext(context);
return service
.listInaccessibleByServer(this.client.getEndpoint(), resourceGroupName, serverName,
this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Gets a list of inaccessible databases in a logical server.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @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 list of inaccessible databases in a logical server as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listInaccessibleByServerAsync(String resourceGroupName, String serverName) {
return new PagedFlux<>(() -> listInaccessibleByServerSinglePageAsync(resourceGroupName, serverName),
nextLink -> listInaccessibleByServerNextSinglePageAsync(nextLink));
}
/**
* Gets a list of inaccessible databases in a logical server.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @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 list of inaccessible databases in a logical server as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listInaccessibleByServerAsync(String resourceGroupName, String serverName,
Context context) {
return new PagedFlux<>(() -> listInaccessibleByServerSinglePageAsync(resourceGroupName, serverName, context),
nextLink -> listInaccessibleByServerNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of inaccessible databases in a logical server.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @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 list of inaccessible databases in a logical server as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName) {
return new PagedIterable<>(listInaccessibleByServerAsync(resourceGroupName, serverName));
}
/**
* Gets a list of inaccessible databases in a logical server.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @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 list of inaccessible databases in a logical server as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName,
Context context) {
return new PagedIterable<>(listInaccessibleByServerAsync(resourceGroupName, serverName, context));
}
/**
* 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 a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(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 a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(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 a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listInaccessibleByServerNextSinglePageAsync(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.listInaccessibleByServerNext(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 a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listInaccessibleByServerNextSinglePageAsync(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.listInaccessibleByServerNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy