"use strict";
/*
 * 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.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiManagementServiceImpl = 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 ApiManagementService operations. */
class ApiManagementServiceImpl {
    /**
     * Initialize a new instance of the class ApiManagementService class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * List all API Management services within a resource group.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param options The options parameters.
     */
    listByResourceGroup(resourceGroupName, options) {
        const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
        return {
            next() {
                return iter.next();
            },
            [Symbol.asyncIterator]() {
                return this;
            },
            byPage: (settings) => {
                if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
                    throw new Error("maxPageSize is not supported by this operation.");
                }
                return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
            },
        };
    }
    listByResourceGroupPagingPage(resourceGroupName, options, settings) {
        return tslib_1.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
            let result;
            let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
            if (!continuationToken) {
                result = yield tslib_1.__await(this._listByResourceGroup(resourceGroupName, options));
                let page = result.value || [];
                continuationToken = result.nextLink;
                (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
                yield yield tslib_1.__await(page);
            }
            while (continuationToken) {
                result = yield tslib_1.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
                continuationToken = result.nextLink;
                let page = result.value || [];
                (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
                yield yield tslib_1.__await(page);
            }
        });
    }
    listByResourceGroupPagingAll(resourceGroupName, options) {
        return tslib_1.__asyncGenerator(this, arguments, function* listByResourceGroupPagingAll_1() {
            var _a, e_1, _b, _c;
            try {
                for (var _d = true, _e = tslib_1.__asyncValues(this.listByResourceGroupPagingPage(resourceGroupName, options)), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a; _d = true) {
                    _c = _f.value;
                    _d = false;
                    const page = _c;
                    yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(page)));
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
                }
                finally { if (e_1) throw e_1.error; }
            }
        });
    }
    /**
     * Lists all API Management services within an Azure subscription.
     * @param options The options parameters.
     */
    list(options) {
        const iter = this.listPagingAll(options);
        return {
            next() {
                return iter.next();
            },
            [Symbol.asyncIterator]() {
                return this;
            },
            byPage: (settings) => {
                if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
                    throw new Error("maxPageSize is not supported by this operation.");
                }
                return this.listPagingPage(options, settings);
            },
        };
    }
    listPagingPage(options, settings) {
        return tslib_1.__asyncGenerator(this, arguments, function* listPagingPage_1() {
            let result;
            let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
            if (!continuationToken) {
                result = yield tslib_1.__await(this._list(options));
                let page = result.value || [];
                continuationToken = result.nextLink;
                (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
                yield yield tslib_1.__await(page);
            }
            while (continuationToken) {
                result = yield tslib_1.__await(this._listNext(continuationToken, options));
                continuationToken = result.nextLink;
                let page = result.value || [];
                (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
                yield yield tslib_1.__await(page);
            }
        });
    }
    listPagingAll(options) {
        return tslib_1.__asyncGenerator(this, arguments, function* listPagingAll_1() {
            var _a, e_2, _b, _c;
            try {
                for (var _d = true, _e = tslib_1.__asyncValues(this.listPagingPage(options)), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a; _d = true) {
                    _c = _f.value;
                    _d = false;
                    const page = _c;
                    yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(page)));
                }
            }
            catch (e_2_1) { e_2 = { error: e_2_1 }; }
            finally {
                try {
                    if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
                }
                finally { if (e_2) throw e_2.error; }
            }
        });
    }
    /**
     * Restores a backup of an API Management service created using the ApiManagementService_Backup
     * operation on the current service. This is a long running operation and could take several minutes to
     * complete.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param parameters Parameters supplied to the Restore API Management service from backup operation.
     * @param options The options parameters.
     */
    async beginRestore(resourceGroupName, serviceName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            var _a;
            let currentRawResponse = undefined;
            const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
            const callback = (rawResponse, flatResponse) => {
                currentRawResponse = rawResponse;
                providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
            };
            const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, 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, serviceName, parameters, options },
            spec: restoreOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
            intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
            resourceLocationConfig: "location",
        });
        await poller.poll();
        return poller;
    }
    /**
     * Restores a backup of an API Management service created using the ApiManagementService_Backup
     * operation on the current service. This is a long running operation and could take several minutes to
     * complete.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param parameters Parameters supplied to the Restore API Management service from backup operation.
     * @param options The options parameters.
     */
    async beginRestoreAndWait(resourceGroupName, serviceName, parameters, options) {
        const poller = await this.beginRestore(resourceGroupName, serviceName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Creates a backup of the API Management service to the given Azure Storage Account. This is long
     * running operation and could take several minutes to complete.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param parameters Parameters supplied to the ApiManagementService_Backup operation.
     * @param options The options parameters.
     */
    async beginBackup(resourceGroupName, serviceName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            var _a;
            let currentRawResponse = undefined;
            const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
            const callback = (rawResponse, flatResponse) => {
                currentRawResponse = rawResponse;
                providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
            };
            const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, 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, serviceName, parameters, options },
            spec: backupOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
            intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
            resourceLocationConfig: "location",
        });
        await poller.poll();
        return poller;
    }
    /**
     * Creates a backup of the API Management service to the given Azure Storage Account. This is long
     * running operation and could take several minutes to complete.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param parameters Parameters supplied to the ApiManagementService_Backup operation.
     * @param options The options parameters.
     */
    async beginBackupAndWait(resourceGroupName, serviceName, parameters, options) {
        const poller = await this.beginBackup(resourceGroupName, serviceName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Creates or updates an API Management service. This is long running operation and could take several
     * minutes to complete.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation.
     * @param options The options parameters.
     */
    async beginCreateOrUpdate(resourceGroupName, serviceName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            var _a;
            let currentRawResponse = undefined;
            const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
            const callback = (rawResponse, flatResponse) => {
                currentRawResponse = rawResponse;
                providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
            };
            const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, 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, serviceName, parameters, options },
            spec: createOrUpdateOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
            intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Creates or updates an API Management service. This is long running operation and could take several
     * minutes to complete.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation.
     * @param options The options parameters.
     */
    async beginCreateOrUpdateAndWait(resourceGroupName, serviceName, parameters, options) {
        const poller = await this.beginCreateOrUpdate(resourceGroupName, serviceName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Updates an existing API Management service.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation.
     * @param options The options parameters.
     */
    async beginUpdate(resourceGroupName, serviceName, parameters, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            var _a;
            let currentRawResponse = undefined;
            const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
            const callback = (rawResponse, flatResponse) => {
                currentRawResponse = rawResponse;
                providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
            };
            const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, 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, serviceName, parameters, options },
            spec: updateOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
            intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Updates an existing API Management service.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation.
     * @param options The options parameters.
     */
    async beginUpdateAndWait(resourceGroupName, serviceName, parameters, options) {
        const poller = await this.beginUpdate(resourceGroupName, serviceName, parameters, options);
        return poller.pollUntilDone();
    }
    /**
     * Gets an API Management service resource description.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param options The options parameters.
     */
    get(resourceGroupName, serviceName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serviceName, options }, getOperationSpec);
    }
    /**
     * Deletes an existing API Management service.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param options The options parameters.
     */
    async beginDelete(resourceGroupName, serviceName, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            var _a;
            let currentRawResponse = undefined;
            const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
            const callback = (rawResponse, flatResponse) => {
                currentRawResponse = rawResponse;
                providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
            };
            const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, 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, serviceName, options },
            spec: deleteOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
            intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
        });
        await poller.poll();
        return poller;
    }
    /**
     * Deletes an existing API Management service.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param options The options parameters.
     */
    async beginDeleteAndWait(resourceGroupName, serviceName, options) {
        const poller = await this.beginDelete(resourceGroupName, serviceName, options);
        return poller.pollUntilDone();
    }
    /**
     * Upgrades an API Management service to the Stv2 platform. For details refer to
     * https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation and
     * could take several minutes to complete.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param options The options parameters.
     */
    async beginMigrateToStv2(resourceGroupName, serviceName, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            var _a;
            let currentRawResponse = undefined;
            const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
            const callback = (rawResponse, flatResponse) => {
                currentRawResponse = rawResponse;
                providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
            };
            const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, 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, serviceName, options },
            spec: migrateToStv2OperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
            intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
            resourceLocationConfig: "location",
        });
        await poller.poll();
        return poller;
    }
    /**
     * Upgrades an API Management service to the Stv2 platform. For details refer to
     * https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation and
     * could take several minutes to complete.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param options The options parameters.
     */
    async beginMigrateToStv2AndWait(resourceGroupName, serviceName, options) {
        const poller = await this.beginMigrateToStv2(resourceGroupName, serviceName, options);
        return poller.pollUntilDone();
    }
    /**
     * List all API Management services within a resource group.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param options The options parameters.
     */
    _listByResourceGroup(resourceGroupName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, options }, listByResourceGroupOperationSpec);
    }
    /**
     * Lists all API Management services within an Azure subscription.
     * @param options The options parameters.
     */
    _list(options) {
        return this.client.sendOperationRequest({ options }, listOperationSpec);
    }
    /**
     * Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param options The options parameters.
     */
    getSsoToken(resourceGroupName, serviceName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serviceName, options }, getSsoTokenOperationSpec);
    }
    /**
     * Checks availability and correctness of a name for an API Management service.
     * @param parameters Parameters supplied to the CheckNameAvailability operation.
     * @param options The options parameters.
     */
    checkNameAvailability(parameters, options) {
        return this.client.sendOperationRequest({ parameters, options }, checkNameAvailabilityOperationSpec);
    }
    /**
     * Get the custom domain ownership identifier for an API Management service.
     * @param options The options parameters.
     */
    getDomainOwnershipIdentifier(options) {
        return this.client.sendOperationRequest({ options }, getDomainOwnershipIdentifierOperationSpec);
    }
    /**
     * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS
     * changes.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param options The options parameters.
     */
    async beginApplyNetworkConfigurationUpdates(resourceGroupName, serviceName, options) {
        const directSendOperation = async (args, spec) => {
            return this.client.sendOperationRequest(args, spec);
        };
        const sendOperationFn = async (args, spec) => {
            var _a;
            let currentRawResponse = undefined;
            const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
            const callback = (rawResponse, flatResponse) => {
                currentRawResponse = rawResponse;
                providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
            };
            const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, 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, serviceName, options },
            spec: applyNetworkConfigurationUpdatesOperationSpec,
        });
        const poller = await (0, core_lro_1.createHttpPoller)(lro, {
            restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
            intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
            resourceLocationConfig: "location",
        });
        await poller.poll();
        return poller;
    }
    /**
     * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS
     * changes.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param options The options parameters.
     */
    async beginApplyNetworkConfigurationUpdatesAndWait(resourceGroupName, serviceName, options) {
        const poller = await this.beginApplyNetworkConfigurationUpdates(resourceGroupName, serviceName, options);
        return poller.pollUntilDone();
    }
    /**
     * ListByResourceGroupNext
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method.
     * @param options The options parameters.
     */
    _listByResourceGroupNext(resourceGroupName, nextLink, options) {
        return this.client.sendOperationRequest({ resourceGroupName, nextLink, options }, listByResourceGroupNextOperationSpec);
    }
    /**
     * ListNext
     * @param nextLink The nextLink from the previous successful call to the List method.
     * @param options The options parameters.
     */
    _listNext(nextLink, options) {
        return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec);
    }
}
exports.ApiManagementServiceImpl = ApiManagementServiceImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const restoreOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore",
    httpMethod: "POST",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        201: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        202: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        204: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters37,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const backupOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup",
    httpMethod: "POST",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        201: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        202: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        204: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters37,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const createOrUpdateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}",
    httpMethod: "PUT",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        201: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        202: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        204: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters38,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const updateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}",
    httpMethod: "PATCH",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        201: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        202: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        204: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters39,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const getOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const deleteOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}",
    httpMethod: "DELETE",
    responses: {
        200: {},
        201: {},
        202: {},
        204: {},
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const migrateToStv2OperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2",
    httpMethod: "POST",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        201: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        202: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        204: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters40,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const listByResourceGroupOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceListResult,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const listOperationSpec = {
    path: "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceListResult,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.$host, Parameters.subscriptionId],
    headerParameters: [Parameters.accept],
    serializer,
};
const getSsoTokenOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken",
    httpMethod: "POST",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceGetSsoTokenResult,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const checkNameAvailabilityOperationSpec = {
    path: "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability",
    httpMethod: "POST",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceNameAvailabilityResult,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters41,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.$host, Parameters.subscriptionId],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const getDomainOwnershipIdentifierOperationSpec = {
    path: "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier",
    httpMethod: "POST",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceGetDomainOwnershipIdentifierResult,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.$host, Parameters.subscriptionId],
    headerParameters: [Parameters.accept],
    serializer,
};
const applyNetworkConfigurationUpdatesOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates",
    httpMethod: "POST",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        201: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        202: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        204: {
            bodyMapper: Mappers.ApiManagementServiceResource,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters42,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const listByResourceGroupNextOperationSpec = {
    path: "{nextLink}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceListResult,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.nextLink,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const listNextOperationSpec = {
    path: "{nextLink}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ApiManagementServiceListResult,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.nextLink,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
//# sourceMappingURL=apiManagementService.js.map