"use strict";
// Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Generated from the AWS CloudFormation Resource Specification
// See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html
// @cfn2ts:meta@ {"generated":"2018-08-15T13:37:31.272Z","fingerprint":"m53GradQCCoAIJCVreo7nyg5rmXVuMBxPwRCzk/8qI4="}
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable:max-line-length | This is generated code - line lengths are difficult to control
const cdk = require("@aws-cdk/cdk");
var cloudformation;
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``AlarmResourceProps``
     *
     * @param properties the TypeScript properties of a ``AlarmResourceProps``
     *
     * @returns the result of the validation.
     */
    function AlarmResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('actionsEnabled', cdk.validateBoolean)(properties.actionsEnabled));
        errors.collect(cdk.propertyValidator('alarmActions', cdk.listValidator(cdk.validateString))(properties.alarmActions));
        errors.collect(cdk.propertyValidator('alarmDescription', cdk.validateString)(properties.alarmDescription));
        errors.collect(cdk.propertyValidator('alarmName', cdk.validateString)(properties.alarmName));
        errors.collect(cdk.propertyValidator('comparisonOperator', cdk.requiredValidator)(properties.comparisonOperator));
        errors.collect(cdk.propertyValidator('comparisonOperator', cdk.validateString)(properties.comparisonOperator));
        errors.collect(cdk.propertyValidator('dimensions', cdk.listValidator(AlarmResource_DimensionPropertyValidator))(properties.dimensions));
        errors.collect(cdk.propertyValidator('evaluateLowSampleCountPercentile', cdk.validateString)(properties.evaluateLowSampleCountPercentile));
        errors.collect(cdk.propertyValidator('evaluationPeriods', cdk.requiredValidator)(properties.evaluationPeriods));
        errors.collect(cdk.propertyValidator('evaluationPeriods', cdk.validateNumber)(properties.evaluationPeriods));
        errors.collect(cdk.propertyValidator('extendedStatistic', cdk.validateString)(properties.extendedStatistic));
        errors.collect(cdk.propertyValidator('insufficientDataActions', cdk.listValidator(cdk.validateString))(properties.insufficientDataActions));
        errors.collect(cdk.propertyValidator('metricName', cdk.requiredValidator)(properties.metricName));
        errors.collect(cdk.propertyValidator('metricName', cdk.validateString)(properties.metricName));
        errors.collect(cdk.propertyValidator('namespace', cdk.requiredValidator)(properties.namespace));
        errors.collect(cdk.propertyValidator('namespace', cdk.validateString)(properties.namespace));
        errors.collect(cdk.propertyValidator('okActions', cdk.listValidator(cdk.validateString))(properties.okActions));
        errors.collect(cdk.propertyValidator('period', cdk.requiredValidator)(properties.period));
        errors.collect(cdk.propertyValidator('period', cdk.validateNumber)(properties.period));
        errors.collect(cdk.propertyValidator('statistic', cdk.validateString)(properties.statistic));
        errors.collect(cdk.propertyValidator('threshold', cdk.requiredValidator)(properties.threshold));
        errors.collect(cdk.propertyValidator('threshold', cdk.validateNumber)(properties.threshold));
        errors.collect(cdk.propertyValidator('treatMissingData', cdk.validateString)(properties.treatMissingData));
        errors.collect(cdk.propertyValidator('unit', cdk.validateString)(properties.unit));
        return errors.wrap('supplied properties not correct for "AlarmResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CloudWatch::Alarm`` resource
     *
     * @param properties the TypeScript properties of a ``AlarmResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CloudWatch::Alarm`` resource.
     */
    function alarmResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        AlarmResourcePropsValidator(properties).assertSuccess();
        return {
            ComparisonOperator: cdk.stringToCloudFormation(properties.comparisonOperator),
            EvaluationPeriods: cdk.numberToCloudFormation(properties.evaluationPeriods),
            MetricName: cdk.stringToCloudFormation(properties.metricName),
            Namespace: cdk.stringToCloudFormation(properties.namespace),
            Period: cdk.numberToCloudFormation(properties.period),
            Threshold: cdk.numberToCloudFormation(properties.threshold),
            ActionsEnabled: cdk.booleanToCloudFormation(properties.actionsEnabled),
            AlarmActions: cdk.listMapper(cdk.stringToCloudFormation)(properties.alarmActions),
            AlarmDescription: cdk.stringToCloudFormation(properties.alarmDescription),
            AlarmName: cdk.stringToCloudFormation(properties.alarmName),
            Dimensions: cdk.listMapper(alarmResourceDimensionPropertyToCloudFormation)(properties.dimensions),
            EvaluateLowSampleCountPercentile: cdk.stringToCloudFormation(properties.evaluateLowSampleCountPercentile),
            ExtendedStatistic: cdk.stringToCloudFormation(properties.extendedStatistic),
            InsufficientDataActions: cdk.listMapper(cdk.stringToCloudFormation)(properties.insufficientDataActions),
            OKActions: cdk.listMapper(cdk.stringToCloudFormation)(properties.okActions),
            Statistic: cdk.stringToCloudFormation(properties.statistic),
            TreatMissingData: cdk.stringToCloudFormation(properties.treatMissingData),
            Unit: cdk.stringToCloudFormation(properties.unit),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html
     */
    class AlarmResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::CloudWatch::Alarm``.
         *
         * @param parent     the ``cdk.Construct`` this ``AlarmResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``AlarmResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: AlarmResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'comparisonOperator', this);
            cdk.requireProperty(properties, 'evaluationPeriods', this);
            cdk.requireProperty(properties, 'metricName', this);
            cdk.requireProperty(properties, 'namespace', this);
            cdk.requireProperty(properties, 'period', this);
            cdk.requireProperty(properties, 'threshold', this);
            this.alarmArn = new AlarmArn(this.getAtt('Arn'));
        }
        renderProperties() {
            return alarmResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    AlarmResource.resourceTypeName = "AWS::CloudWatch::Alarm";
    cloudformation.AlarmResource = AlarmResource;
    /**
     * Determine whether the given properties match those of a ``DimensionProperty``
     *
     * @param properties the TypeScript properties of a ``DimensionProperty``
     *
     * @returns the result of the validation.
     */
    function AlarmResource_DimensionPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name));
        errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
        errors.collect(cdk.propertyValidator('value', cdk.requiredValidator)(properties.value));
        errors.collect(cdk.propertyValidator('value', cdk.validateString)(properties.value));
        return errors.wrap('supplied properties not correct for "DimensionProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CloudWatch::Alarm.Dimension`` resource
     *
     * @param properties the TypeScript properties of a ``DimensionProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CloudWatch::Alarm.Dimension`` resource.
     */
    function alarmResourceDimensionPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        AlarmResource_DimensionPropertyValidator(properties).assertSuccess();
        return {
            Name: cdk.stringToCloudFormation(properties.name),
            Value: cdk.stringToCloudFormation(properties.value),
        };
    }
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
class AlarmArn extends cdk.Arn {
}
exports.AlarmArn = AlarmArn;
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``DashboardResourceProps``
     *
     * @param properties the TypeScript properties of a ``DashboardResourceProps``
     *
     * @returns the result of the validation.
     */
    function DashboardResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('dashboardBody', cdk.requiredValidator)(properties.dashboardBody));
        errors.collect(cdk.propertyValidator('dashboardBody', cdk.validateString)(properties.dashboardBody));
        errors.collect(cdk.propertyValidator('dashboardName', cdk.validateString)(properties.dashboardName));
        return errors.wrap('supplied properties not correct for "DashboardResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CloudWatch::Dashboard`` resource
     *
     * @param properties the TypeScript properties of a ``DashboardResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CloudWatch::Dashboard`` resource.
     */
    function dashboardResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        DashboardResourcePropsValidator(properties).assertSuccess();
        return {
            DashboardBody: cdk.stringToCloudFormation(properties.dashboardBody),
            DashboardName: cdk.stringToCloudFormation(properties.dashboardName),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-dashboard.html
     */
    class DashboardResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::CloudWatch::Dashboard``.
         *
         * @param parent     the ``cdk.Construct`` this ``DashboardResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``DashboardResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: DashboardResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'dashboardBody', this);
        }
        renderProperties() {
            return dashboardResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    DashboardResource.resourceTypeName = "AWS::CloudWatch::Dashboard";
    cloudformation.DashboardResource = DashboardResource;
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
//# sourceMappingURL=data:application/json;base64, 