"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.QuotaByCounterKeysImpl = 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"));
/** Class containing QuotaByCounterKeys operations. */
class QuotaByCounterKeysImpl {
    /**
     * Initialize a new instance of the class QuotaByCounterKeys class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * Lists a collection of current quota counter periods associated with the counter-key configured in
     * the policy on the specified service instance. The api does not support paging yet.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in
     *                        counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in
     *                        the policy, then it’s accessible by "boo" counter key. But if it’s defined as
     *                        counter-key="@("b"+"a")" then it will be accessible by "ba" key
     * @param options The options parameters.
     */
    listByService(resourceGroupName, serviceName, quotaCounterKey, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serviceName, quotaCounterKey, options }, listByServiceOperationSpec);
    }
    /**
     * Updates all the quota counter values specified with the existing quota counter key to a value in the
     * specified service instance. This should be used for reset of the quota counter values.
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param serviceName The name of the API Management service.
     * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in
     *                        counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in
     *                        the policy, then it’s accessible by "boo" counter key. But if it’s defined as
     *                        counter-key="@("b"+"a")" then it will be accessible by "ba" key
     * @param parameters The value of the quota counter to be applied to all quota counter periods.
     * @param options The options parameters.
     */
    update(resourceGroupName, serviceName, quotaCounterKey, parameters, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serviceName, quotaCounterKey, parameters, options }, updateOperationSpec);
    }
}
exports.QuotaByCounterKeysImpl = QuotaByCounterKeysImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByServiceOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.QuotaCounterCollection,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
        Parameters.quotaCounterKey,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const updateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}",
    httpMethod: "PATCH",
    responses: {
        200: {
            bodyMapper: Mappers.QuotaCounterCollection,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters77,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
        Parameters.quotaCounterKey,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
//# sourceMappingURL=quotaByCounterKeys.js.map