"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.QuotaByPeriodKeysImpl = 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 QuotaByPeriodKeys operations. */
class QuotaByPeriodKeysImpl {
    /**
     * Initialize a new instance of the class QuotaByPeriodKeys class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * Gets the value of the quota counter associated with the counter-key in the policy for the specific
     * period in service instance.
     * @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 quotaPeriodKey Quota period key identifier.
     * @param options The options parameters.
     */
    get(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, options) {
        return this.client.sendOperationRequest({
            resourceGroupName,
            serviceName,
            quotaCounterKey,
            quotaPeriodKey,
            options,
        }, getOperationSpec);
    }
    /**
     * Updates an existing quota counter value in the specified service instance.
     * @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 quotaPeriodKey Quota period key identifier.
     * @param parameters The value of the Quota counter to be applied on the specified period.
     * @param options The options parameters.
     */
    update(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters, options) {
        return this.client.sendOperationRequest({
            resourceGroupName,
            serviceName,
            quotaCounterKey,
            quotaPeriodKey,
            parameters,
            options,
        }, updateOperationSpec);
    }
}
exports.QuotaByPeriodKeysImpl = QuotaByPeriodKeysImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.QuotaCounterContract,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
        Parameters.quotaCounterKey,
        Parameters.quotaPeriodKey,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const updateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}",
    httpMethod: "PATCH",
    responses: {
        200: {
            bodyMapper: Mappers.QuotaCounterContract,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.parameters77,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [
        Parameters.$host,
        Parameters.resourceGroupName,
        Parameters.subscriptionId,
        Parameters.serviceName,
        Parameters.quotaCounterKey,
        Parameters.quotaPeriodKey,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
//# sourceMappingURL=quotaByPeriodKeys.js.map