/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { LongTermRetentionManagedInstanceBackups } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SqlManagementClient } from "../sqlManagementClient";
import {
SimplePollerLike,
OperationState,
createHttpPoller
} from "@azure/core-lro";
import { createLroSpec } from "../lroImpl";
import {
ManagedInstanceLongTermRetentionBackup,
LongTermRetentionManagedInstanceBackupsListByDatabaseNextOptionalParams,
LongTermRetentionManagedInstanceBackupsListByDatabaseOptionalParams,
LongTermRetentionManagedInstanceBackupsListByDatabaseResponse,
LongTermRetentionManagedInstanceBackupsListByInstanceNextOptionalParams,
LongTermRetentionManagedInstanceBackupsListByInstanceOptionalParams,
LongTermRetentionManagedInstanceBackupsListByInstanceResponse,
LongTermRetentionManagedInstanceBackupsListByLocationNextOptionalParams,
LongTermRetentionManagedInstanceBackupsListByLocationOptionalParams,
LongTermRetentionManagedInstanceBackupsListByLocationResponse,
LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseNextOptionalParams,
LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseOptionalParams,
LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseResponse,
LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceNextOptionalParams,
LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceOptionalParams,
LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceResponse,
LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationNextOptionalParams,
LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationOptionalParams,
LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationResponse,
LongTermRetentionManagedInstanceBackupsGetOptionalParams,
LongTermRetentionManagedInstanceBackupsGetResponse,
LongTermRetentionManagedInstanceBackupsDeleteOptionalParams,
LongTermRetentionManagedInstanceBackupsGetByResourceGroupOptionalParams,
LongTermRetentionManagedInstanceBackupsGetByResourceGroupResponse,
LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupOptionalParams,
LongTermRetentionManagedInstanceBackupsListByDatabaseNextResponse,
LongTermRetentionManagedInstanceBackupsListByInstanceNextResponse,
LongTermRetentionManagedInstanceBackupsListByLocationNextResponse,
LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseNextResponse,
LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceNextResponse,
LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationNextResponse
} from "../models";
///
/** Class containing LongTermRetentionManagedInstanceBackups operations. */
export class LongTermRetentionManagedInstanceBackupsImpl
implements LongTermRetentionManagedInstanceBackups {
private readonly client: SqlManagementClient;
/**
* Initialize a new instance of the class LongTermRetentionManagedInstanceBackups class.
* @param client Reference to the service client
*/
constructor(client: SqlManagementClient) {
this.client = client;
}
/**
* 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 options The options parameters.
*/
public listByDatabase(
locationName: string,
managedInstanceName: string,
databaseName: string,
options?: LongTermRetentionManagedInstanceBackupsListByDatabaseOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listByDatabasePagingAll(
locationName,
managedInstanceName,
databaseName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByDatabasePagingPage(
locationName,
managedInstanceName,
databaseName,
options,
settings
);
}
};
}
private async *listByDatabasePagingPage(
locationName: string,
managedInstanceName: string,
databaseName: string,
options?: LongTermRetentionManagedInstanceBackupsListByDatabaseOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: LongTermRetentionManagedInstanceBackupsListByDatabaseResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByDatabase(
locationName,
managedInstanceName,
databaseName,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByDatabaseNext(
locationName,
managedInstanceName,
databaseName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByDatabasePagingAll(
locationName: string,
managedInstanceName: string,
databaseName: string,
options?: LongTermRetentionManagedInstanceBackupsListByDatabaseOptionalParams
): AsyncIterableIterator {
for await (const page of this.listByDatabasePagingPage(
locationName,
managedInstanceName,
databaseName,
options
)) {
yield* page;
}
}
/**
* 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 options The options parameters.
*/
public listByInstance(
locationName: string,
managedInstanceName: string,
options?: LongTermRetentionManagedInstanceBackupsListByInstanceOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listByInstancePagingAll(
locationName,
managedInstanceName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByInstancePagingPage(
locationName,
managedInstanceName,
options,
settings
);
}
};
}
private async *listByInstancePagingPage(
locationName: string,
managedInstanceName: string,
options?: LongTermRetentionManagedInstanceBackupsListByInstanceOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: LongTermRetentionManagedInstanceBackupsListByInstanceResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByInstance(
locationName,
managedInstanceName,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByInstanceNext(
locationName,
managedInstanceName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByInstancePagingAll(
locationName: string,
managedInstanceName: string,
options?: LongTermRetentionManagedInstanceBackupsListByInstanceOptionalParams
): AsyncIterableIterator {
for await (const page of this.listByInstancePagingPage(
locationName,
managedInstanceName,
options
)) {
yield* page;
}
}
/**
* Lists the long term retention backups for managed databases in a given location.
* @param locationName The location of the database.
* @param options The options parameters.
*/
public listByLocation(
locationName: string,
options?: LongTermRetentionManagedInstanceBackupsListByLocationOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listByLocationPagingAll(locationName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByLocationPagingPage(locationName, options, settings);
}
};
}
private async *listByLocationPagingPage(
locationName: string,
options?: LongTermRetentionManagedInstanceBackupsListByLocationOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: LongTermRetentionManagedInstanceBackupsListByLocationResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByLocation(locationName, options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByLocationNext(
locationName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByLocationPagingAll(
locationName: string,
options?: LongTermRetentionManagedInstanceBackupsListByLocationOptionalParams
): AsyncIterableIterator {
for await (const page of this.listByLocationPagingPage(
locationName,
options
)) {
yield* page;
}
}
/**
* 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 options The options parameters.
*/
public listByResourceGroupDatabase(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
databaseName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listByResourceGroupDatabasePagingAll(
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByResourceGroupDatabasePagingPage(
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
options,
settings
);
}
};
}
private async *listByResourceGroupDatabasePagingPage(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
databaseName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByResourceGroupDatabase(
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByResourceGroupDatabaseNext(
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByResourceGroupDatabasePagingAll(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
databaseName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseOptionalParams
): AsyncIterableIterator {
for await (const page of this.listByResourceGroupDatabasePagingPage(
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
options
)) {
yield* page;
}
}
/**
* 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 options The options parameters.
*/
public listByResourceGroupInstance(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listByResourceGroupInstancePagingAll(
resourceGroupName,
locationName,
managedInstanceName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByResourceGroupInstancePagingPage(
resourceGroupName,
locationName,
managedInstanceName,
options,
settings
);
}
};
}
private async *listByResourceGroupInstancePagingPage(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByResourceGroupInstance(
resourceGroupName,
locationName,
managedInstanceName,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByResourceGroupInstanceNext(
resourceGroupName,
locationName,
managedInstanceName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByResourceGroupInstancePagingAll(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceOptionalParams
): AsyncIterableIterator {
for await (const page of this.listByResourceGroupInstancePagingPage(
resourceGroupName,
locationName,
managedInstanceName,
options
)) {
yield* page;
}
}
/**
* 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 options The options parameters.
*/
public listByResourceGroupLocation(
resourceGroupName: string,
locationName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listByResourceGroupLocationPagingAll(
resourceGroupName,
locationName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByResourceGroupLocationPagingPage(
resourceGroupName,
locationName,
options,
settings
);
}
};
}
private async *listByResourceGroupLocationPagingPage(
resourceGroupName: string,
locationName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByResourceGroupLocation(
resourceGroupName,
locationName,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByResourceGroupLocationNext(
resourceGroupName,
locationName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByResourceGroupLocationPagingAll(
resourceGroupName: string,
locationName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationOptionalParams
): AsyncIterableIterator {
for await (const page of this.listByResourceGroupLocationPagingPage(
resourceGroupName,
locationName,
options
)) {
yield* page;
}
}
/**
* 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 options The options parameters.
*/
get(
locationName: string,
managedInstanceName: string,
databaseName: string,
backupName: string,
options?: LongTermRetentionManagedInstanceBackupsGetOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ locationName, managedInstanceName, databaseName, backupName, options },
getOperationSpec
);
}
/**
* 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 options The options parameters.
*/
async beginDelete(
locationName: string,
managedInstanceName: string,
databaseName: string,
backupName: string,
options?: LongTermRetentionManagedInstanceBackupsDeleteOptionalParams
): Promise, void>> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: {
locationName,
managedInstanceName,
databaseName,
backupName,
options
},
spec: deleteOperationSpec
});
const poller = await createHttpPoller>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await poller.poll();
return poller;
}
/**
* 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 options The options parameters.
*/
async beginDeleteAndWait(
locationName: string,
managedInstanceName: string,
databaseName: string,
backupName: string,
options?: LongTermRetentionManagedInstanceBackupsDeleteOptionalParams
): Promise {
const poller = await this.beginDelete(
locationName,
managedInstanceName,
databaseName,
backupName,
options
);
return poller.pollUntilDone();
}
/**
* 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 options The options parameters.
*/
private _listByDatabase(
locationName: string,
managedInstanceName: string,
databaseName: string,
options?: LongTermRetentionManagedInstanceBackupsListByDatabaseOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ locationName, managedInstanceName, databaseName, options },
listByDatabaseOperationSpec
);
}
/**
* 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 options The options parameters.
*/
private _listByInstance(
locationName: string,
managedInstanceName: string,
options?: LongTermRetentionManagedInstanceBackupsListByInstanceOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ locationName, managedInstanceName, options },
listByInstanceOperationSpec
);
}
/**
* Lists the long term retention backups for managed databases in a given location.
* @param locationName The location of the database.
* @param options The options parameters.
*/
private _listByLocation(
locationName: string,
options?: LongTermRetentionManagedInstanceBackupsListByLocationOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ locationName, options },
listByLocationOperationSpec
);
}
/**
* 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 options The options parameters.
*/
getByResourceGroup(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
databaseName: string,
backupName: string,
options?: LongTermRetentionManagedInstanceBackupsGetByResourceGroupOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsGetByResourceGroupResponse
> {
return this.client.sendOperationRequest(
{
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
backupName,
options
},
getByResourceGroupOperationSpec
);
}
/**
* 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 options The options parameters.
*/
async beginDeleteByResourceGroup(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
databaseName: string,
backupName: string,
options?: LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupOptionalParams
): Promise, void>> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
backupName,
options
},
spec: deleteByResourceGroupOperationSpec
});
const poller = await createHttpPoller>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await poller.poll();
return poller;
}
/**
* 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 options The options parameters.
*/
async beginDeleteByResourceGroupAndWait(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
databaseName: string,
backupName: string,
options?: LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupOptionalParams
): Promise {
const poller = await this.beginDeleteByResourceGroup(
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
backupName,
options
);
return poller.pollUntilDone();
}
/**
* 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 options The options parameters.
*/
private _listByResourceGroupDatabase(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
databaseName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseResponse
> {
return this.client.sendOperationRequest(
{
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
options
},
listByResourceGroupDatabaseOperationSpec
);
}
/**
* 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 options The options parameters.
*/
private _listByResourceGroupInstance(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceResponse
> {
return this.client.sendOperationRequest(
{ resourceGroupName, locationName, managedInstanceName, options },
listByResourceGroupInstanceOperationSpec
);
}
/**
* 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 options The options parameters.
*/
private _listByResourceGroupLocation(
resourceGroupName: string,
locationName: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationResponse
> {
return this.client.sendOperationRequest(
{ resourceGroupName, locationName, options },
listByResourceGroupLocationOperationSpec
);
}
/**
* ListByDatabaseNext
* @param locationName The location of the database.
* @param managedInstanceName The name of the managed instance.
* @param databaseName The name of the managed database.
* @param nextLink The nextLink from the previous successful call to the ListByDatabase method.
* @param options The options parameters.
*/
private _listByDatabaseNext(
locationName: string,
managedInstanceName: string,
databaseName: string,
nextLink: string,
options?: LongTermRetentionManagedInstanceBackupsListByDatabaseNextOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByDatabaseNextResponse
> {
return this.client.sendOperationRequest(
{ locationName, managedInstanceName, databaseName, nextLink, options },
listByDatabaseNextOperationSpec
);
}
/**
* ListByInstanceNext
* @param locationName The location of the database
* @param managedInstanceName The name of the managed instance.
* @param nextLink The nextLink from the previous successful call to the ListByInstance method.
* @param options The options parameters.
*/
private _listByInstanceNext(
locationName: string,
managedInstanceName: string,
nextLink: string,
options?: LongTermRetentionManagedInstanceBackupsListByInstanceNextOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByInstanceNextResponse
> {
return this.client.sendOperationRequest(
{ locationName, managedInstanceName, nextLink, options },
listByInstanceNextOperationSpec
);
}
/**
* ListByLocationNext
* @param locationName The location of the database.
* @param nextLink The nextLink from the previous successful call to the ListByLocation method.
* @param options The options parameters.
*/
private _listByLocationNext(
locationName: string,
nextLink: string,
options?: LongTermRetentionManagedInstanceBackupsListByLocationNextOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByLocationNextResponse
> {
return this.client.sendOperationRequest(
{ locationName, nextLink, options },
listByLocationNextOperationSpec
);
}
/**
* ListByResourceGroupDatabaseNext
* @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 nextLink The nextLink from the previous successful call to the ListByResourceGroupDatabase
* method.
* @param options The options parameters.
*/
private _listByResourceGroupDatabaseNext(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
databaseName: string,
nextLink: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseNextOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseNextResponse
> {
return this.client.sendOperationRequest(
{
resourceGroupName,
locationName,
managedInstanceName,
databaseName,
nextLink,
options
},
listByResourceGroupDatabaseNextOperationSpec
);
}
/**
* ListByResourceGroupInstanceNext
* @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 nextLink The nextLink from the previous successful call to the ListByResourceGroupInstance
* method.
* @param options The options parameters.
*/
private _listByResourceGroupInstanceNext(
resourceGroupName: string,
locationName: string,
managedInstanceName: string,
nextLink: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceNextOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceNextResponse
> {
return this.client.sendOperationRequest(
{
resourceGroupName,
locationName,
managedInstanceName,
nextLink,
options
},
listByResourceGroupInstanceNextOperationSpec
);
}
/**
* ListByResourceGroupLocationNext
* @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 nextLink The nextLink from the previous successful call to the ListByResourceGroupLocation
* method.
* @param options The options parameters.
*/
private _listByResourceGroupLocationNext(
resourceGroupName: string,
locationName: string,
nextLink: string,
options?: LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationNextOptionalParams
): Promise<
LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationNextResponse
> {
return this.client.sendOperationRequest(
{ resourceGroupName, locationName, nextLink, options },
listByResourceGroupLocationNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackup
},
default: {}
},
queryParameters: [Parameters.apiVersion6],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.databaseName,
Parameters.locationName,
Parameters.managedInstanceName,
Parameters.backupName
],
headerParameters: [Parameters.accept],
serializer
};
const deleteOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}",
httpMethod: "DELETE",
responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
queryParameters: [Parameters.apiVersion6],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.databaseName,
Parameters.locationName,
Parameters.managedInstanceName,
Parameters.backupName
],
serializer
};
const listByDatabaseOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
queryParameters: [
Parameters.apiVersion6,
Parameters.onlyLatestPerDatabase,
Parameters.databaseState
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.databaseName,
Parameters.locationName,
Parameters.managedInstanceName
],
headerParameters: [Parameters.accept],
serializer
};
const listByInstanceOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
queryParameters: [
Parameters.apiVersion6,
Parameters.onlyLatestPerDatabase,
Parameters.databaseState
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.locationName,
Parameters.managedInstanceName
],
headerParameters: [Parameters.accept],
serializer
};
const listByLocationOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
queryParameters: [
Parameters.apiVersion6,
Parameters.onlyLatestPerDatabase,
Parameters.databaseState
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.locationName
],
headerParameters: [Parameters.accept],
serializer
};
const getByResourceGroupOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackup
},
default: {}
},
queryParameters: [Parameters.apiVersion6],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.databaseName,
Parameters.locationName,
Parameters.managedInstanceName,
Parameters.backupName
],
headerParameters: [Parameters.accept],
serializer
};
const deleteByResourceGroupOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}",
httpMethod: "DELETE",
responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
queryParameters: [Parameters.apiVersion6],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.databaseName,
Parameters.locationName,
Parameters.managedInstanceName,
Parameters.backupName
],
serializer
};
const listByResourceGroupDatabaseOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
queryParameters: [
Parameters.apiVersion6,
Parameters.onlyLatestPerDatabase,
Parameters.databaseState
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.databaseName,
Parameters.locationName,
Parameters.managedInstanceName
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupInstanceOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
queryParameters: [
Parameters.apiVersion6,
Parameters.onlyLatestPerDatabase,
Parameters.databaseState
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.locationName,
Parameters.managedInstanceName
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupLocationOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
queryParameters: [
Parameters.apiVersion6,
Parameters.onlyLatestPerDatabase,
Parameters.databaseState
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.locationName
],
headerParameters: [Parameters.accept],
serializer
};
const listByDatabaseNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.databaseName,
Parameters.nextLink,
Parameters.locationName,
Parameters.managedInstanceName
],
headerParameters: [Parameters.accept],
serializer
};
const listByInstanceNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink,
Parameters.locationName,
Parameters.managedInstanceName
],
headerParameters: [Parameters.accept],
serializer
};
const listByLocationNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink,
Parameters.locationName
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupDatabaseNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.databaseName,
Parameters.nextLink,
Parameters.locationName,
Parameters.managedInstanceName
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupInstanceNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink,
Parameters.locationName,
Parameters.managedInstanceName
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupLocationNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ManagedInstanceLongTermRetentionBackupListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink,
Parameters.locationName
],
headerParameters: [Parameters.accept],
serializer
};