"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ElasticPoolDatabaseActivitiesImpl = void 0;
const tslib_1 = require("tslib");
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"));
/// <reference lib="esnext.asynciterable" />
/** Class containing ElasticPoolDatabaseActivities operations. */
class ElasticPoolDatabaseActivitiesImpl {
    client;
    /**
     * Initialize a new instance of the class ElasticPoolDatabaseActivities class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * Returns activity on databases inside of an elastic pool.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param serverName The name of the server.
     * @param elasticPoolName The name of the elastic pool.
     * @param options The options parameters.
     */
    listByElasticPool(resourceGroupName, serverName, elasticPoolName, options) {
        const iter = this.listByElasticPoolPagingAll(resourceGroupName, serverName, elasticPoolName, 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.listByElasticPoolPagingPage(resourceGroupName, serverName, elasticPoolName, options, settings);
            },
        };
    }
    async *listByElasticPoolPagingPage(resourceGroupName, serverName, elasticPoolName, options, _settings) {
        let result;
        result = await this._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options);
        yield result.value || [];
    }
    async *listByElasticPoolPagingAll(resourceGroupName, serverName, elasticPoolName, options) {
        for await (const page of this.listByElasticPoolPagingPage(resourceGroupName, serverName, elasticPoolName, options)) {
            yield* page;
        }
    }
    /**
     * Returns activity on databases inside of an elastic pool.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param serverName The name of the server.
     * @param elasticPoolName The name of the elastic pool.
     * @param options The options parameters.
     */
    _listByElasticPool(resourceGroupName, serverName, elasticPoolName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serverName, elasticPoolName, options }, listByElasticPoolOperationSpec);
    }
}
exports.ElasticPoolDatabaseActivitiesImpl = ElasticPoolDatabaseActivitiesImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByElasticPoolOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ElasticPoolDatabaseActivityListResult,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.elasticPoolName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
//# sourceMappingURL=elasticPoolDatabaseActivities.js.map