com.azure.resourcemanager.sql.implementation.LongTermRetentionManagedInstanceBackupsClientImpl 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.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.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.LongTermRetentionManagedInstanceBackupsClient;
import com.azure.resourcemanager.sql.fluent.models.ManagedInstanceLongTermRetentionBackupInner;
import com.azure.resourcemanager.sql.models.DatabaseState;
import com.azure.resourcemanager.sql.models.ManagedInstanceLongTermRetentionBackupListResult;
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
* LongTermRetentionManagedInstanceBackupsClient.
*/
public final class LongTermRetentionManagedInstanceBackupsClientImpl
implements LongTermRetentionManagedInstanceBackupsClient {
/**
* The proxy service used to perform REST calls.
*/
private final LongTermRetentionManagedInstanceBackupsService service;
/**
* The service client containing this operation class.
*/
private final SqlManagementClientImpl client;
/**
* Initializes an instance of LongTermRetentionManagedInstanceBackupsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
LongTermRetentionManagedInstanceBackupsClientImpl(SqlManagementClientImpl client) {
this.service = RestProxy.create(LongTermRetentionManagedInstanceBackupsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SqlManagementClientLongTermRetentionManagedInstanceBackups to be used
* by the proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SqlManagementClientL")
public interface LongTermRetentionManagedInstanceBackupsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByLocation(
@HostParam("$host") String endpoint, @PathParam("locationName") String locationName,
@QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase,
@QueryParam("databaseState") DatabaseState databaseState,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByDatabase(
@HostParam("$host") String endpoint, @PathParam("locationName") String locationName,
@PathParam("managedInstanceName") String managedInstanceName,
@PathParam("databaseName") String databaseName,
@QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase,
@QueryParam("databaseState") DatabaseState databaseState,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("locationName") String locationName,
@PathParam("managedInstanceName") String managedInstanceName,
@PathParam("databaseName") String databaseName, @PathParam("backupName") String backupName,
@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" })
@Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("locationName") String locationName,
@PathParam("managedInstanceName") String managedInstanceName,
@PathParam("databaseName") String databaseName, @PathParam("backupName") String backupName,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByInstance(
@HostParam("$host") String endpoint, @PathParam("locationName") String locationName,
@PathParam("managedInstanceName") String managedInstanceName,
@QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase,
@QueryParam("databaseState") DatabaseState databaseState,
@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/locations/{locationName}/longTermRetentionManagedInstanceBackups")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroupLocation(
@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName,
@PathParam("locationName") String locationName,
@QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase,
@QueryParam("databaseState") DatabaseState databaseState,
@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/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroupDatabase(
@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName,
@PathParam("locationName") String locationName,
@PathParam("managedInstanceName") String managedInstanceName,
@PathParam("databaseName") String databaseName,
@QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase,
@QueryParam("databaseState") DatabaseState databaseState,
@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/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> getByResourceGroup(
@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName,
@PathParam("locationName") String locationName,
@PathParam("managedInstanceName") String managedInstanceName,
@PathParam("databaseName") String databaseName, @PathParam("backupName") String backupName,
@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" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> deleteByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("locationName") String locationName,
@PathParam("managedInstanceName") String managedInstanceName,
@PathParam("databaseName") String databaseName, @PathParam("backupName") String backupName,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroupInstance(
@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName,
@PathParam("locationName") String locationName,
@PathParam("managedInstanceName") String managedInstanceName,
@QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase,
@QueryParam("databaseState") DatabaseState databaseState,
@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> listByLocationNext(
@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> listByDatabaseNext(
@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> listByInstanceNext(
@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> listByResourceGroupLocationNext(
@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> listByResourceGroupDatabaseNext(
@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> listByResourceGroupInstanceNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @param locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByLocationSinglePageAsync(String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName 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.listByLocation(this.client.getEndpoint(), locationName, onlyLatestPerDatabase,
databaseState, 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()));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @param locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByLocationSinglePageAsync(
String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName 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
.listByLocation(this.client.getEndpoint(), locationName, onlyLatestPerDatabase, databaseState,
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));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @param locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByLocationAsync(String locationName,
Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
return new PagedFlux<>(() -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState),
nextLink -> listByLocationNextSinglePageAsync(nextLink));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @param locationName The location 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 list of long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByLocationAsync(String locationName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedFlux<>(() -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState),
nextLink -> listByLocationNextSinglePageAsync(nextLink));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @param locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByLocationAsync(String locationName,
Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) {
return new PagedFlux<>(
() -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState, context),
nextLink -> listByLocationNextSinglePageAsync(nextLink, context));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @param locationName The location 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 list of long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByLocation(String locationName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @param locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByLocation(String locationName,
Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) {
return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, context));
}
/**
* Lists all long term retention backups for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByDatabaseSinglePageAsync(
String locationName, String managedInstanceName, String databaseName, Boolean onlyLatestPerDatabase,
DatabaseState databaseState) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName 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.listByDatabase(this.client.getEndpoint(), locationName, managedInstanceName,
databaseName, onlyLatestPerDatabase, databaseState, 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()));
}
/**
* Lists all long term retention backups for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByDatabaseSinglePageAsync(
String locationName, String managedInstanceName, String databaseName, Boolean onlyLatestPerDatabase,
DatabaseState databaseState, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName 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
.listByDatabase(this.client.getEndpoint(), locationName, managedInstanceName, databaseName,
onlyLatestPerDatabase, databaseState, 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));
}
/**
* Lists all long term retention backups for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByDatabaseAsync(String locationName,
String managedInstanceName, String databaseName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName,
onlyLatestPerDatabase, databaseState), nextLink -> listByDatabaseNextSinglePageAsync(nextLink));
}
/**
* Lists all long term retention backups for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed 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 list of long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByDatabaseAsync(String locationName,
String managedInstanceName, String databaseName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName,
onlyLatestPerDatabase, databaseState), nextLink -> listByDatabaseNextSinglePageAsync(nextLink));
}
/**
* Lists all long term retention backups for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByDatabaseAsync(String locationName,
String managedInstanceName, String databaseName, Boolean onlyLatestPerDatabase, DatabaseState databaseState,
Context context) {
return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName,
onlyLatestPerDatabase, databaseState, context),
nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context));
}
/**
* Lists all long term retention backups for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed 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 list of long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByDatabase(String locationName,
String managedInstanceName, String databaseName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedIterable<>(
listByDatabaseAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState));
}
/**
* Lists all long term retention backups for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByDatabase(String locationName,
String managedInstanceName, String databaseName, Boolean onlyLatestPerDatabase, DatabaseState databaseState,
Context context) {
return new PagedIterable<>(listByDatabaseAsync(locationName, managedInstanceName, databaseName,
onlyLatestPerDatabase, databaseState, context));
}
/**
* Gets a long term retention backup for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backup for a managed database along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String locationName,
String managedInstanceName, String databaseName, String backupName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
}
if (backupName == null) {
return Mono.error(new IllegalArgumentException("Parameter backupName 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(), locationName, managedInstanceName, databaseName,
backupName, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a long term retention backup for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 long term retention backup for a managed database along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String locationName,
String managedInstanceName, String databaseName, String backupName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
}
if (backupName == null) {
return Mono.error(new IllegalArgumentException("Parameter backupName 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(), locationName, managedInstanceName, databaseName, backupName,
this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context);
}
/**
* Gets a long term retention backup for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backup for a managed database on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String locationName, String managedInstanceName,
String databaseName, String backupName) {
return getWithResponseAsync(locationName, managedInstanceName, databaseName, backupName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets a long term retention backup for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 long term retention backup for a managed database along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String locationName,
String managedInstanceName, String databaseName, String backupName, Context context) {
return getWithResponseAsync(locationName, managedInstanceName, databaseName, backupName, context).block();
}
/**
* Gets a long term retention backup for a managed database.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backup for a managed database.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ManagedInstanceLongTermRetentionBackupInner get(String locationName, String managedInstanceName,
String databaseName, String backupName) {
return getWithResponse(locationName, managedInstanceName, databaseName, backupName, Context.NONE).getValue();
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 locationName, String managedInstanceName,
String databaseName, String backupName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
}
if (backupName == null) {
return Mono.error(new IllegalArgumentException("Parameter backupName 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(), locationName, managedInstanceName,
databaseName, backupName, this.client.getSubscriptionId(), this.client.getApiVersion(), context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 locationName, String managedInstanceName,
String databaseName, String backupName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
}
if (backupName == null) {
return Mono.error(new IllegalArgumentException("Parameter backupName 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(), locationName, managedInstanceName, databaseName, backupName,
this.client.getSubscriptionId(), this.client.getApiVersion(), context);
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 locationName, String managedInstanceName,
String databaseName, String backupName) {
Mono>> mono
= deleteWithResponseAsync(locationName, managedInstanceName, databaseName, backupName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 locationName, String managedInstanceName,
String databaseName, String backupName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(locationName, managedInstanceName, databaseName, backupName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 locationName, String managedInstanceName,
String databaseName, String backupName) {
return this.beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName).getSyncPoller();
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 locationName, String managedInstanceName,
String databaseName, String backupName, Context context) {
return this.beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName, context)
.getSyncPoller();
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 locationName, String managedInstanceName, String databaseName,
String backupName) {
return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 locationName, String managedInstanceName, String databaseName,
String backupName, Context context) {
return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @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 locationName, String managedInstanceName, String databaseName, String backupName) {
deleteAsync(locationName, managedInstanceName, databaseName, backupName).block();
}
/**
* Deletes a long term retention backup.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 locationName, String managedInstanceName, String databaseName, String backupName,
Context context) {
deleteAsync(locationName, managedInstanceName, databaseName, backupName, context).block();
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByInstanceSinglePageAsync(
String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName 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.listByInstance(this.client.getEndpoint(), locationName, managedInstanceName,
onlyLatestPerDatabase, databaseState, 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()));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByInstanceSinglePageAsync(
String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName 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
.listByInstance(this.client.getEndpoint(), locationName, managedInstanceName, onlyLatestPerDatabase,
databaseState, 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));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByInstanceAsync(String locationName,
String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
return new PagedFlux<>(() -> listByInstanceSinglePageAsync(locationName, managedInstanceName,
onlyLatestPerDatabase, databaseState), nextLink -> listByInstanceNextSinglePageAsync(nextLink));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByInstanceAsync(String locationName,
String managedInstanceName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedFlux<>(() -> listByInstanceSinglePageAsync(locationName, managedInstanceName,
onlyLatestPerDatabase, databaseState), nextLink -> listByInstanceNextSinglePageAsync(nextLink));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByInstanceAsync(String locationName,
String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) {
return new PagedFlux<>(() -> listByInstanceSinglePageAsync(locationName, managedInstanceName,
onlyLatestPerDatabase, databaseState, context),
nextLink -> listByInstanceNextSinglePageAsync(nextLink, context));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByInstance(String locationName,
String managedInstanceName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedIterable<>(
listByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByInstance(String locationName,
String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) {
return new PagedIterable<>(
listByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @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 locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupLocationSinglePageAsync(
String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName 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.listByResourceGroupLocation(this.client.getEndpoint(), resourceGroupName,
locationName, onlyLatestPerDatabase, databaseState, 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()));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @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 locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupLocationSinglePageAsync(
String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState,
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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName 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
.listByResourceGroupLocation(this.client.getEndpoint(), resourceGroupName, locationName,
onlyLatestPerDatabase, databaseState, 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));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @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 locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByResourceGroupLocationAsync(
String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
return new PagedFlux<>(() -> listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName,
onlyLatestPerDatabase, databaseState),
nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @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 locationName The location 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 list of long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux
listByResourceGroupLocationAsync(String resourceGroupName, String locationName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedFlux<>(() -> listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName,
onlyLatestPerDatabase, databaseState),
nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @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 locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupLocationAsync(
String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState,
Context context) {
return new PagedFlux<>(() -> listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName,
onlyLatestPerDatabase, databaseState, context),
nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink, context));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @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 locationName The location 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 list of long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable
listByResourceGroupLocation(String resourceGroupName, String locationName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedIterable<>(
listByResourceGroupLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState));
}
/**
* Lists the long term retention backups for managed databases in a given location.
*
* @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 locationName The location of the database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroupLocation(
String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState,
Context context) {
return new PagedIterable<>(listByResourceGroupLocationAsync(resourceGroupName, locationName,
onlyLatestPerDatabase, databaseState, context));
}
/**
* Lists all long term retention backups for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupDatabaseSinglePageAsync(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName,
Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName 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.listByResourceGroupDatabase(this.client.getEndpoint(), resourceGroupName,
locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState,
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()));
}
/**
* Lists all long term retention backups for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupDatabaseSinglePageAsync(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName,
Boolean onlyLatestPerDatabase, DatabaseState databaseState, 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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName 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
.listByResourceGroupDatabase(this.client.getEndpoint(), resourceGroupName, locationName,
managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState,
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));
}
/**
* Lists all long term retention backups for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByResourceGroupDatabaseAsync(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName,
Boolean onlyLatestPerDatabase, DatabaseState databaseState) {
return new PagedFlux<>(
() -> listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName,
databaseName, onlyLatestPerDatabase, databaseState),
nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink));
}
/**
* Lists all long term retention backups for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed 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 list of long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByResourceGroupDatabaseAsync(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedFlux<>(
() -> listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName,
databaseName, onlyLatestPerDatabase, databaseState),
nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink));
}
/**
* Lists all long term retention backups for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupDatabaseAsync(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName,
Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) {
return new PagedFlux<>(
() -> listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName,
databaseName, onlyLatestPerDatabase, databaseState, context),
nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink, context));
}
/**
* Lists all long term retention backups for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed 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 list of long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroupDatabase(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedIterable<>(listByResourceGroupDatabaseAsync(resourceGroupName, locationName,
managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState));
}
/**
* Lists all long term retention backups for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroupDatabase(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName,
Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) {
return new PagedIterable<>(listByResourceGroupDatabaseAsync(resourceGroupName, locationName,
managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, context));
}
/**
* Gets a long term retention backup for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backup for a managed database along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getByResourceGroupWithResponseAsync(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName,
String backupName) {
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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
}
if (backupName == null) {
return Mono.error(new IllegalArgumentException("Parameter backupName 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.getByResourceGroup(this.client.getEndpoint(), resourceGroupName,
locationName, managedInstanceName, databaseName, backupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a long term retention backup for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 long term retention backup for a managed database along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName,
String backupName, 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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
}
if (backupName == null) {
return Mono.error(new IllegalArgumentException("Parameter backupName 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.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, locationName,
managedInstanceName, databaseName, backupName, this.client.getSubscriptionId(), this.client.getApiVersion(),
accept, context);
}
/**
* Gets a long term retention backup for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backup for a managed database on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getByResourceGroupAsync(String resourceGroupName,
String locationName, String managedInstanceName, String databaseName, String backupName) {
return getByResourceGroupWithResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName,
backupName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets a long term retention backup for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 long term retention backup for a managed database along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getByResourceGroupWithResponse(
String resourceGroupName, String locationName, String managedInstanceName, String databaseName,
String backupName, Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName,
backupName, context).block();
}
/**
* Gets a long term retention backup for a managed 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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backup for a managed database.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ManagedInstanceLongTermRetentionBackupInner getByResourceGroup(String resourceGroupName, String locationName,
String managedInstanceName, String databaseName, String backupName) {
return getByResourceGroupWithResponse(resourceGroupName, locationName, managedInstanceName, databaseName,
backupName, Context.NONE).getValue();
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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>> deleteByResourceGroupWithResponseAsync(String resourceGroupName,
String locationName, String managedInstanceName, String databaseName, String backupName) {
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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
}
if (backupName == null) {
return Mono.error(new IllegalArgumentException("Parameter backupName 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.deleteByResourceGroup(this.client.getEndpoint(), resourceGroupName,
locationName, managedInstanceName, databaseName, backupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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>> deleteByResourceGroupWithResponseAsync(String resourceGroupName,
String locationName, String managedInstanceName, String databaseName, String backupName, 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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));
}
if (databaseName == null) {
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
}
if (backupName == null) {
return Mono.error(new IllegalArgumentException("Parameter backupName 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.deleteByResourceGroup(this.client.getEndpoint(), resourceGroupName, locationName,
managedInstanceName, databaseName, backupName, this.client.getSubscriptionId(), this.client.getApiVersion(),
context);
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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> beginDeleteByResourceGroupAsync(String resourceGroupName,
String locationName, String managedInstanceName, String databaseName, String backupName) {
Mono>> mono = deleteByResourceGroupWithResponseAsync(resourceGroupName, locationName,
managedInstanceName, databaseName, backupName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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> beginDeleteByResourceGroupAsync(String resourceGroupName,
String locationName, String managedInstanceName, String databaseName, String backupName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = deleteByResourceGroupWithResponseAsync(resourceGroupName, locationName,
managedInstanceName, databaseName, backupName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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> beginDeleteByResourceGroup(String resourceGroupName, String locationName,
String managedInstanceName, String databaseName, String backupName) {
return this
.beginDeleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName,
backupName)
.getSyncPoller();
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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> beginDeleteByResourceGroup(String resourceGroupName, String locationName,
String managedInstanceName, String databaseName, String backupName, Context context) {
return this
.beginDeleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName,
backupName, context)
.getSyncPoller();
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 deleteByResourceGroupAsync(String resourceGroupName, String locationName,
String managedInstanceName, String databaseName, String backupName) {
return beginDeleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName,
backupName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 deleteByResourceGroupAsync(String resourceGroupName, String locationName,
String managedInstanceName, String databaseName, String backupName, Context context) {
return beginDeleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName,
backupName, context).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @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 deleteByResourceGroup(String resourceGroupName, String locationName, String managedInstanceName,
String databaseName, String backupName) {
deleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName)
.block();
}
/**
* Deletes a long term retention backup.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param backupName The backup name.
* @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 deleteByResourceGroup(String resourceGroupName, String locationName, String managedInstanceName,
String databaseName, String backupName, Context context) {
deleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName,
context).block();
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupInstanceSinglePageAsync(
String resourceGroupName, String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase,
DatabaseState databaseState) {
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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName 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.listByResourceGroupInstance(this.client.getEndpoint(), resourceGroupName,
locationName, managedInstanceName, onlyLatestPerDatabase, databaseState,
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()));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupInstanceSinglePageAsync(
String resourceGroupName, String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase,
DatabaseState databaseState, 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 (locationName == null) {
return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null."));
}
if (managedInstanceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter managedInstanceName 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
.listByResourceGroupInstance(this.client.getEndpoint(), resourceGroupName, locationName,
managedInstanceName, onlyLatestPerDatabase, databaseState, 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));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByResourceGroupInstanceAsync(
String resourceGroupName, String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase,
DatabaseState databaseState) {
return new PagedFlux<>(
() -> listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName,
onlyLatestPerDatabase, databaseState),
nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux
listByResourceGroupInstanceAsync(String resourceGroupName, String locationName, String managedInstanceName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedFlux<>(
() -> listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName,
onlyLatestPerDatabase, databaseState),
nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupInstanceAsync(
String resourceGroupName, String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase,
DatabaseState databaseState, Context context) {
return new PagedFlux<>(
() -> listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName,
onlyLatestPerDatabase, databaseState, context),
nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink, context));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable
listByResourceGroupInstance(String resourceGroupName, String locationName, String managedInstanceName) {
final Boolean onlyLatestPerDatabase = null;
final DatabaseState databaseState = null;
return new PagedIterable<>(listByResourceGroupInstanceAsync(resourceGroupName, locationName,
managedInstanceName, onlyLatestPerDatabase, databaseState));
}
/**
* Lists the long term retention backups for a given managed instance.
*
* @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 locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database.
* @param databaseState Whether to query against just live databases, just deleted databases, or all databases.
* @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 long term retention backups for managed database(s) as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroupInstance(
String resourceGroupName, String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase,
DatabaseState databaseState, Context context) {
return new PagedIterable<>(listByResourceGroupInstanceAsync(resourceGroupName, locationName,
managedInstanceName, onlyLatestPerDatabase, databaseState, 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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByLocationNextSinglePageAsync(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.listByLocationNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByLocationNextSinglePageAsync(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.listByLocationNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByDatabaseNextSinglePageAsync(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.listByDatabaseNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByDatabaseNextSinglePageAsync(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.listByDatabaseNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByInstanceNextSinglePageAsync(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.listByInstanceNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByInstanceNextSinglePageAsync(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.listByInstanceNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByResourceGroupLocationNextSinglePageAsync(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.listByResourceGroupLocationNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByResourceGroupLocationNextSinglePageAsync(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.listByResourceGroupLocationNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByResourceGroupDatabaseNextSinglePageAsync(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.listByResourceGroupDatabaseNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByResourceGroupDatabaseNextSinglePageAsync(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.listByResourceGroupDatabaseNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByResourceGroupInstanceNextSinglePageAsync(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.listByResourceGroupInstanceNext(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 long term retention backups for managed database(s) along with {@link PagedResponse} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByResourceGroupInstanceNextSinglePageAsync(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.listByResourceGroupInstanceNext(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