"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudfrontRequestRateMetric = void 0;
const aws_cdk_lib_1 = require("aws-cdk-lib");
const _1 = require(".");
class CloudfrontRequestRateMetric extends aws_cdk_lib_1.aws_cloudwatch.MathExpression {
    constructor(props) {
        var _a, _b;
        const requests = new _1.CloudfrontRequestsMetric(props);
        const idx = (_a = props.metricIdx) !== null && _a !== void 0 ? _a : 0;
        super({
            label: (_b = props.label) !== null && _b !== void 0 ? _b : 'Requests/s',
            color: props.color,
            period: props.period,
            expression: `requests_${idx}/PERIOD(requests_${idx})`,
            usingMetrics: { [`requests_${idx}`]: requests },
        });
    }
}
exports.CloudfrontRequestRateMetric = CloudfrontRequestRateMetric;
