"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManagedDatabasesImpl = void 0;
const tslib_1 = require("tslib");
const pagingHelper_js_1 = require("../pagingHelper.js");
const coreClient = tslib_1.__importStar(require("@azure/core-client"));
const Mappers = tslib_1.__importStar(require("../models/mappers.js"));
const Parameters = tslib_1.__importStar(require("../models/parameters.js"));
const core_lro_1 = require("@azure/core-lro");
const lroImpl_js_1 = require("../lroImpl.js");
/// <reference lib="esnext.asynciterable" />
/** Class containing ManagedDatabases operations. */
class ManagedDatabasesImpl {
    client;
    /**
     * Initialize a new instance of the class ManagedDatabases class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * Gets a list of managed databases.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param managedInstanceName The name of the managed instance.
     * @param options The options parameters.
     */
    listByInstance(resourceGroupName, managedInstanceName, options) {
        const iter = this.listByInstancePagingAll(resourceGroupName, managedInstanceName, options);
        return {
            next() {
                return iter.next();
            },
            [Symbol.asyncIterator]() {
                return this;
            },
            byPage: (settings) => {
                if (settings?.maxPageSize) {
                    throw new Error("maxPageSize is not supported by this operation.");
                }
                return this.listByInstancePagingPage(resourceGroupName, managedInstanceName, options, settings);
            },
        };
    }
    async *listByInstancePagingPage(resourceGroupName, managedInstanceName, options, settings) {
        let result;
        let continuationToken = settings?.continuationToken;
        if (!continuationToken) {
            result = await this._listByInstance(resourceGroupName, managedInstanceName, options);
            let page = result.value || [];
            continuationToken = result.nextLink;
            (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
            yield page;
        }
        while (continuationToken) {
            result = await this._listByInstanceNext(resourceGroupName, managedInstanceName, continuationToken, options);
            continuationToken = result.nextLink;
            let page = result.value || [];
            (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
            yield page;
        }
    }
    async *listByInstancePagingAll(resourceGroupName, managedInstanceName, options) {
        for await (const page of this.listByInstancePagingPage(resourceGroupName, managedInstanceName, options)) {
            yield* page;
        }
    }
    /**
     * Gets a list of inaccessible managed databases in a 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 managedInstanceName The name of the managed instance.
     * @param options The options parameters.
     */
    listInaccessibleByInstance(resourceGroupName, managedInstanceName, options) {
        const iter = this.listInaccessibleByInstancePagingAll(resourceGroupName, managedInstanceName, options);
        return {
            next() {
                return iter.next();
            },
            [Symbol.asyncIterator]() {
                return this;
            },
            byPage: (settings) => {
                if (settings?.maxPageSize) {
                    throw new Error("maxPageSize is not supported by this operation.");
                }
                return this.listInaccessibleByInstancePagingPage(resourceGroupName, managedInstanceName, options, settings);
            },
        };
    }
    async *listInaccessibleByInstancePagingPage(resourceGroupName, managedInstanceName, options, settings) {
        let result;
        let continuationToken = settings?.continuationToken;
        if (!continuationToken) {
            result = await this._listInaccessibleByInstance(resourceGroupName, managedInstanceName, options);
            let page = result.value || [];
            continuationToken = result.nextLink;
            (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
            yield page;
        }
        while (continuationToken) {
            result = await this._listInaccessibleByInstanceNext(resourceGroupName, managedInstanceName, continuationToken, options);
            continuationToken = result.nextLink;
            let page = result.value || [];
            (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
            yield page;
        }
    }
    async *listInaccessibleByInstancePagingAll(resourceGroupName, managedInstanceName, options) {
        for await (const page of this.listInaccessibleByInstancePagingPage(resourceGroupName, managedInstanceName, options)) {
            yield* page;
        }
    }
    /**
     * Gets a list of managed databases.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param managedInstanceName The name of the managed instance.
     * @param options The options parameters.
     */
    _listByInstance(resourceGroupName, managedInstanceName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, managedInstanceName, options }, listByInstanceOperationSpec);
    }
    /**
     * Gets 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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param options The options parameters.
     */
    get(resourceGroupName, managedInstanceName, databaseName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, managedInstanceName, databaseName, options }, getOperationSpec);
    }
    /**
     * Creates a new database or updates an existing database.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters The requested database resource state.
     * @param options The options parameters.
     */
    async beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            let currentRawResponse = undefined;
            const providedCallback = args.options?.onResponse;
            const callback = (rawResponse, flatResponse) => {
                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 = (0, lroImpl_js_1.createLroSpec)({
            sendOperationFn,
            args: {
                resourceGroupName,
                managedInstanceName,
                databaseName,
                parameters,
                options,
            },
            spec: createOrUpdateOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options?.resumeFrom,
            intervalInMs: options?.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Creates a new database or updates an existing database.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters The requested database resource state.
     * @param options The options parameters.
     */
    async beginCreateOrUpdateAndWait(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const poller = await this.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Deletes 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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param options The options parameters.
     */
    async beginDelete(resourceGroupName, managedInstanceName, databaseName, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            let currentRawResponse = undefined;
            const providedCallback = args.options?.onResponse;
            const callback = (rawResponse, flatResponse) => {
                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 = (0, lroImpl_js_1.createLroSpec)({
            sendOperationFn,
            args: { resourceGroupName, managedInstanceName, databaseName, options },
            spec: deleteOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options?.resumeFrom,
            intervalInMs: options?.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Deletes 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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param options The options parameters.
     */
    async beginDeleteAndWait(resourceGroupName, managedInstanceName, databaseName, options) {
        const poller = await this.beginDelete(resourceGroupName, managedInstanceName, databaseName, options);
        return poller.pollUntilDone();
    }
    /**
     * Updates an existing database.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters The requested database resource state.
     * @param options The options parameters.
     */
    async beginUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            let currentRawResponse = undefined;
            const providedCallback = args.options?.onResponse;
            const callback = (rawResponse, flatResponse) => {
                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 = (0, lroImpl_js_1.createLroSpec)({
            sendOperationFn,
            args: {
                resourceGroupName,
                managedInstanceName,
                databaseName,
                parameters,
                options,
            },
            spec: updateOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options?.resumeFrom,
            intervalInMs: options?.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Updates an existing database.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters The requested database resource state.
     * @param options The options parameters.
     */
    async beginUpdateAndWait(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const poller = await this.beginUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Cancels a managed database move operation.
     * @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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters Parameters of the cancel managed database move operation.
     * @param options The options parameters.
     */
    async beginCancelMove(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            let currentRawResponse = undefined;
            const providedCallback = args.options?.onResponse;
            const callback = (rawResponse, flatResponse) => {
                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 = (0, lroImpl_js_1.createLroSpec)({
            sendOperationFn,
            args: {
                resourceGroupName,
                managedInstanceName,
                databaseName,
                parameters,
                options,
            },
            spec: cancelMoveOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options?.resumeFrom,
            intervalInMs: options?.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Cancels a managed database move operation.
     * @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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters Parameters of the cancel managed database move operation.
     * @param options The options parameters.
     */
    async beginCancelMoveAndWait(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const poller = await this.beginCancelMove(resourceGroupName, managedInstanceName, databaseName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Completes a managed database move operation.
     * @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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters Parameters of the complete managed database move operation.
     * @param options The options parameters.
     */
    async beginCompleteMove(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            let currentRawResponse = undefined;
            const providedCallback = args.options?.onResponse;
            const callback = (rawResponse, flatResponse) => {
                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 = (0, lroImpl_js_1.createLroSpec)({
            sendOperationFn,
            args: {
                resourceGroupName,
                managedInstanceName,
                databaseName,
                parameters,
                options,
            },
            spec: completeMoveOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options?.resumeFrom,
            intervalInMs: options?.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Completes a managed database move operation.
     * @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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters Parameters of the complete managed database move operation.
     * @param options The options parameters.
     */
    async beginCompleteMoveAndWait(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const poller = await this.beginCompleteMove(resourceGroupName, managedInstanceName, databaseName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Completes the restore operation on 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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters The definition for completing the restore of this managed database.
     * @param options The options parameters.
     */
    async beginCompleteRestore(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            let currentRawResponse = undefined;
            const providedCallback = args.options?.onResponse;
            const callback = (rawResponse, flatResponse) => {
                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 = (0, lroImpl_js_1.createLroSpec)({
            sendOperationFn,
            args: {
                resourceGroupName,
                managedInstanceName,
                databaseName,
                parameters,
                options,
            },
            spec: completeRestoreOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options?.resumeFrom,
            intervalInMs: options?.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Completes the restore operation on 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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters The definition for completing the restore of this managed database.
     * @param options The options parameters.
     */
    async beginCompleteRestoreAndWait(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const poller = await this.beginCompleteRestore(resourceGroupName, managedInstanceName, databaseName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Starts a managed database move operation.
     * @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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters Parameters of the start managed database move operation.
     * @param options The options parameters.
     */
    async beginStartMove(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            let currentRawResponse = undefined;
            const providedCallback = args.options?.onResponse;
            const callback = (rawResponse, flatResponse) => {
                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 = (0, lroImpl_js_1.createLroSpec)({
            sendOperationFn,
            args: {
                resourceGroupName,
                managedInstanceName,
                databaseName,
                parameters,
                options,
            },
            spec: startMoveOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options?.resumeFrom,
            intervalInMs: options?.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Starts a managed database move operation.
     * @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 managedInstanceName The name of the managed instance.
     * @param databaseName The name of the database.
     * @param parameters Parameters of the start managed database move operation.
     * @param options The options parameters.
     */
    async beginStartMoveAndWait(resourceGroupName, managedInstanceName, databaseName, parameters, options) {
        const poller = await this.beginStartMove(resourceGroupName, managedInstanceName, databaseName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Gets a list of inaccessible managed databases in a 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 managedInstanceName The name of the managed instance.
     * @param options The options parameters.
     */
    _listInaccessibleByInstance(resourceGroupName, managedInstanceName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, managedInstanceName, options }, listInaccessibleByInstanceOperationSpec);
    }
    /**
     * ListByInstanceNext
     * @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 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.
     */
    _listByInstanceNext(resourceGroupName, managedInstanceName, nextLink, options) {
        return this.client.sendOperationRequest({ resourceGroupName, managedInstanceName, nextLink, options }, listByInstanceNextOperationSpec);
    }
    /**
     * ListInaccessibleByInstanceNext
     * @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 managedInstanceName The name of the managed instance.
     * @param nextLink The nextLink from the previous successful call to the ListInaccessibleByInstance
     *                 method.
     * @param options The options parameters.
     */
    _listInaccessibleByInstanceNext(resourceGroupName, managedInstanceName, nextLink, options) {
        return this.client.sendOperationRequest({ resourceGroupName, managedInstanceName, nextLink, options }, listInaccessibleByInstanceNextOperationSpec);
    }
}
exports.ManagedDatabasesImpl = ManagedDatabasesImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByInstanceOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ManagedDatabaseListResult,
        },
        default: {},
    },
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const getOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        default: {},
    },
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.databaseName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const createOrUpdateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}",
    httpMethod: "PUT",
    responses: {
        200: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        201: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        202: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        204: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        default: {},
    },
    requestBody: Parameters.parameters80,
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.databaseName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const deleteOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}",
    httpMethod: "DELETE",
    responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.databaseName,
        Parameters.managedInstanceName,
    ],
    serializer,
};
const updateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}",
    httpMethod: "PATCH",
    responses: {
        200: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        201: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        202: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        204: {
            bodyMapper: Mappers.ManagedDatabase,
        },
        default: {},
    },
    requestBody: Parameters.parameters81,
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.databaseName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const cancelMoveOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/cancelMove",
    httpMethod: "POST",
    responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
    requestBody: Parameters.parameters82,
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.databaseName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.contentType],
    mediaType: "json",
    serializer,
};
const completeMoveOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/completeMove",
    httpMethod: "POST",
    responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
    requestBody: Parameters.parameters82,
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.databaseName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.contentType],
    mediaType: "json",
    serializer,
};
const completeRestoreOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/completeRestore",
    httpMethod: "POST",
    responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
    requestBody: Parameters.parameters83,
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.databaseName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.contentType],
    mediaType: "json",
    serializer,
};
const startMoveOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/startMove",
    httpMethod: "POST",
    responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
    requestBody: Parameters.parameters84,
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.databaseName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.contentType],
    mediaType: "json",
    serializer,
};
const listInaccessibleByInstanceOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/inaccessibleManagedDatabases",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ManagedDatabaseListResult,
        },
        default: {},
    },
    queryParameters: [Parameters.apiVersion2],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const listByInstanceNextOperationSpec = {
    path: "{nextLink}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ManagedDatabaseListResult,
        },
        default: {},
    },
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.nextLink,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const listInaccessibleByInstanceNextOperationSpec = {
    path: "{nextLink}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ManagedDatabaseListResult,
        },
        default: {},
    },
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.nextLink,
        Parameters.managedInstanceName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
//# sourceMappingURL=managedDatabases.js.map