"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.149Z","fingerprint":"QRxvW2HvaSiSsVsSeU8FFEDPdap9v81yt2LLFnepiqI="}
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 ``RuleResourceProps``
     *
     * @param properties the TypeScript properties of a ``RuleResourceProps``
     *
     * @returns the result of the validation.
     */
    function RuleResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('description', cdk.validateString)(properties.description));
        errors.collect(cdk.propertyValidator('eventPattern', cdk.validateObject)(properties.eventPattern));
        errors.collect(cdk.propertyValidator('ruleName', cdk.validateString)(properties.ruleName));
        errors.collect(cdk.propertyValidator('roleArn', cdk.validateString)(properties.roleArn));
        errors.collect(cdk.propertyValidator('scheduleExpression', cdk.validateString)(properties.scheduleExpression));
        errors.collect(cdk.propertyValidator('state', cdk.validateString)(properties.state));
        errors.collect(cdk.propertyValidator('targets', cdk.listValidator(RuleResource_TargetPropertyValidator))(properties.targets));
        return errors.wrap('supplied properties not correct for "RuleResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Events::Rule`` resource
     *
     * @param properties the TypeScript properties of a ``RuleResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Events::Rule`` resource.
     */
    function ruleResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RuleResourcePropsValidator(properties).assertSuccess();
        return {
            Description: cdk.stringToCloudFormation(properties.description),
            EventPattern: cdk.objectToCloudFormation(properties.eventPattern),
            Name: cdk.stringToCloudFormation(properties.ruleName),
            RoleArn: cdk.stringToCloudFormation(properties.roleArn),
            ScheduleExpression: cdk.stringToCloudFormation(properties.scheduleExpression),
            State: cdk.stringToCloudFormation(properties.state),
            Targets: cdk.listMapper(ruleResourceTargetPropertyToCloudFormation)(properties.targets),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html
     */
    class RuleResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::Events::Rule``.
         *
         * @param parent     the ``cdk.Construct`` this ``RuleResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``RuleResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: RuleResource.resourceTypeName, properties });
            this.ruleArn = new RuleArn(this.getAtt('Arn'));
        }
        renderProperties() {
            return ruleResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    RuleResource.resourceTypeName = "AWS::Events::Rule";
    cloudformation.RuleResource = RuleResource;
    /**
     * Determine whether the given properties match those of a ``EcsParametersProperty``
     *
     * @param properties the TypeScript properties of a ``EcsParametersProperty``
     *
     * @returns the result of the validation.
     */
    function RuleResource_EcsParametersPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('taskCount', cdk.validateNumber)(properties.taskCount));
        errors.collect(cdk.propertyValidator('taskDefinitionArn', cdk.requiredValidator)(properties.taskDefinitionArn));
        errors.collect(cdk.propertyValidator('taskDefinitionArn', cdk.validateString)(properties.taskDefinitionArn));
        return errors.wrap('supplied properties not correct for "EcsParametersProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Events::Rule.EcsParameters`` resource
     *
     * @param properties the TypeScript properties of a ``EcsParametersProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Events::Rule.EcsParameters`` resource.
     */
    function ruleResourceEcsParametersPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RuleResource_EcsParametersPropertyValidator(properties).assertSuccess();
        return {
            TaskCount: cdk.numberToCloudFormation(properties.taskCount),
            TaskDefinitionArn: cdk.stringToCloudFormation(properties.taskDefinitionArn),
        };
    }
    /**
     * Determine whether the given properties match those of a ``InputTransformerProperty``
     *
     * @param properties the TypeScript properties of a ``InputTransformerProperty``
     *
     * @returns the result of the validation.
     */
    function RuleResource_InputTransformerPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('inputPathsMap', cdk.hashValidator(cdk.validateString))(properties.inputPathsMap));
        errors.collect(cdk.propertyValidator('inputTemplate', cdk.requiredValidator)(properties.inputTemplate));
        errors.collect(cdk.propertyValidator('inputTemplate', cdk.validateString)(properties.inputTemplate));
        return errors.wrap('supplied properties not correct for "InputTransformerProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Events::Rule.InputTransformer`` resource
     *
     * @param properties the TypeScript properties of a ``InputTransformerProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Events::Rule.InputTransformer`` resource.
     */
    function ruleResourceInputTransformerPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RuleResource_InputTransformerPropertyValidator(properties).assertSuccess();
        return {
            InputPathsMap: cdk.hashMapper(cdk.stringToCloudFormation)(properties.inputPathsMap),
            InputTemplate: cdk.stringToCloudFormation(properties.inputTemplate),
        };
    }
    /**
     * Determine whether the given properties match those of a ``KinesisParametersProperty``
     *
     * @param properties the TypeScript properties of a ``KinesisParametersProperty``
     *
     * @returns the result of the validation.
     */
    function RuleResource_KinesisParametersPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('partitionKeyPath', cdk.requiredValidator)(properties.partitionKeyPath));
        errors.collect(cdk.propertyValidator('partitionKeyPath', cdk.validateString)(properties.partitionKeyPath));
        return errors.wrap('supplied properties not correct for "KinesisParametersProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Events::Rule.KinesisParameters`` resource
     *
     * @param properties the TypeScript properties of a ``KinesisParametersProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Events::Rule.KinesisParameters`` resource.
     */
    function ruleResourceKinesisParametersPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RuleResource_KinesisParametersPropertyValidator(properties).assertSuccess();
        return {
            PartitionKeyPath: cdk.stringToCloudFormation(properties.partitionKeyPath),
        };
    }
    /**
     * Determine whether the given properties match those of a ``RunCommandParametersProperty``
     *
     * @param properties the TypeScript properties of a ``RunCommandParametersProperty``
     *
     * @returns the result of the validation.
     */
    function RuleResource_RunCommandParametersPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('runCommandTargets', cdk.requiredValidator)(properties.runCommandTargets));
        errors.collect(cdk.propertyValidator('runCommandTargets', cdk.listValidator(RuleResource_RunCommandTargetPropertyValidator))(properties.runCommandTargets));
        return errors.wrap('supplied properties not correct for "RunCommandParametersProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Events::Rule.RunCommandParameters`` resource
     *
     * @param properties the TypeScript properties of a ``RunCommandParametersProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Events::Rule.RunCommandParameters`` resource.
     */
    function ruleResourceRunCommandParametersPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RuleResource_RunCommandParametersPropertyValidator(properties).assertSuccess();
        return {
            RunCommandTargets: cdk.listMapper(ruleResourceRunCommandTargetPropertyToCloudFormation)(properties.runCommandTargets),
        };
    }
    /**
     * Determine whether the given properties match those of a ``RunCommandTargetProperty``
     *
     * @param properties the TypeScript properties of a ``RunCommandTargetProperty``
     *
     * @returns the result of the validation.
     */
    function RuleResource_RunCommandTargetPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('key', cdk.requiredValidator)(properties.key));
        errors.collect(cdk.propertyValidator('key', cdk.validateString)(properties.key));
        errors.collect(cdk.propertyValidator('values', cdk.requiredValidator)(properties.values));
        errors.collect(cdk.propertyValidator('values', cdk.listValidator(cdk.validateString))(properties.values));
        return errors.wrap('supplied properties not correct for "RunCommandTargetProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Events::Rule.RunCommandTarget`` resource
     *
     * @param properties the TypeScript properties of a ``RunCommandTargetProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Events::Rule.RunCommandTarget`` resource.
     */
    function ruleResourceRunCommandTargetPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RuleResource_RunCommandTargetPropertyValidator(properties).assertSuccess();
        return {
            Key: cdk.stringToCloudFormation(properties.key),
            Values: cdk.listMapper(cdk.stringToCloudFormation)(properties.values),
        };
    }
    /**
     * Determine whether the given properties match those of a ``TargetProperty``
     *
     * @param properties the TypeScript properties of a ``TargetProperty``
     *
     * @returns the result of the validation.
     */
    function RuleResource_TargetPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('arn', cdk.requiredValidator)(properties.arn));
        errors.collect(cdk.propertyValidator('arn', cdk.validateString)(properties.arn));
        errors.collect(cdk.propertyValidator('ecsParameters', RuleResource_EcsParametersPropertyValidator)(properties.ecsParameters));
        errors.collect(cdk.propertyValidator('id', cdk.requiredValidator)(properties.id));
        errors.collect(cdk.propertyValidator('id', cdk.validateString)(properties.id));
        errors.collect(cdk.propertyValidator('input', cdk.validateString)(properties.input));
        errors.collect(cdk.propertyValidator('inputPath', cdk.validateString)(properties.inputPath));
        errors.collect(cdk.propertyValidator('inputTransformer', RuleResource_InputTransformerPropertyValidator)(properties.inputTransformer));
        errors.collect(cdk.propertyValidator('kinesisParameters', RuleResource_KinesisParametersPropertyValidator)(properties.kinesisParameters));
        errors.collect(cdk.propertyValidator('roleArn', cdk.validateString)(properties.roleArn));
        errors.collect(cdk.propertyValidator('runCommandParameters', RuleResource_RunCommandParametersPropertyValidator)(properties.runCommandParameters));
        return errors.wrap('supplied properties not correct for "TargetProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Events::Rule.Target`` resource
     *
     * @param properties the TypeScript properties of a ``TargetProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Events::Rule.Target`` resource.
     */
    function ruleResourceTargetPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RuleResource_TargetPropertyValidator(properties).assertSuccess();
        return {
            Arn: cdk.stringToCloudFormation(properties.arn),
            EcsParameters: ruleResourceEcsParametersPropertyToCloudFormation(properties.ecsParameters),
            Id: cdk.stringToCloudFormation(properties.id),
            Input: cdk.stringToCloudFormation(properties.input),
            InputPath: cdk.stringToCloudFormation(properties.inputPath),
            InputTransformer: ruleResourceInputTransformerPropertyToCloudFormation(properties.inputTransformer),
            KinesisParameters: ruleResourceKinesisParametersPropertyToCloudFormation(properties.kinesisParameters),
            RoleArn: cdk.stringToCloudFormation(properties.roleArn),
            RunCommandParameters: ruleResourceRunCommandParametersPropertyToCloudFormation(properties.runCommandParameters),
        };
    }
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
class RuleArn extends cdk.Arn {
}
exports.RuleArn = RuleArn;
//# sourceMappingURL=data:application/json;base64, 