"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:58.438Z","fingerprint":"wFv7REtzpATdnBt3g2rAqPA5mbNu3hxV0qks9EjScQQ="}
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 ``AliasResourceProps``
     *
     * @param properties the TypeScript properties of a ``AliasResourceProps``
     *
     * @returns the result of the validation.
     */
    function AliasResourcePropsValidator(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('functionName', cdk.requiredValidator)(properties.functionName));
        errors.collect(cdk.propertyValidator('functionName', cdk.validateString)(properties.functionName));
        errors.collect(cdk.propertyValidator('functionVersion', cdk.requiredValidator)(properties.functionVersion));
        errors.collect(cdk.propertyValidator('functionVersion', cdk.validateString)(properties.functionVersion));
        errors.collect(cdk.propertyValidator('aliasName', cdk.requiredValidator)(properties.aliasName));
        errors.collect(cdk.propertyValidator('aliasName', cdk.validateString)(properties.aliasName));
        errors.collect(cdk.propertyValidator('routingConfig', AliasResource_AliasRoutingConfigurationPropertyValidator)(properties.routingConfig));
        return errors.wrap('supplied properties not correct for "AliasResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Alias`` resource
     *
     * @param properties the TypeScript properties of a ``AliasResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Alias`` resource.
     */
    function aliasResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        AliasResourcePropsValidator(properties).assertSuccess();
        return {
            FunctionName: cdk.stringToCloudFormation(properties.functionName),
            FunctionVersion: cdk.stringToCloudFormation(properties.functionVersion),
            Name: cdk.stringToCloudFormation(properties.aliasName),
            Description: cdk.stringToCloudFormation(properties.description),
            RoutingConfig: aliasResourceAliasRoutingConfigurationPropertyToCloudFormation(properties.routingConfig),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html
     */
    class AliasResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::Lambda::Alias``.
         *
         * @param parent     the ``cdk.Construct`` this ``AliasResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``AliasResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: AliasResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'functionName', this);
            cdk.requireProperty(properties, 'functionVersion', this);
            cdk.requireProperty(properties, 'aliasName', this);
        }
        renderProperties() {
            return aliasResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    AliasResource.resourceTypeName = "AWS::Lambda::Alias";
    cloudformation.AliasResource = AliasResource;
    /**
     * Determine whether the given properties match those of a ``AliasRoutingConfigurationProperty``
     *
     * @param properties the TypeScript properties of a ``AliasRoutingConfigurationProperty``
     *
     * @returns the result of the validation.
     */
    function AliasResource_AliasRoutingConfigurationPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('additionalVersionWeights', cdk.requiredValidator)(properties.additionalVersionWeights));
        errors.collect(cdk.propertyValidator('additionalVersionWeights', cdk.listValidator(AliasResource_VersionWeightPropertyValidator))(properties.additionalVersionWeights));
        return errors.wrap('supplied properties not correct for "AliasRoutingConfigurationProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Alias.AliasRoutingConfiguration`` resource
     *
     * @param properties the TypeScript properties of a ``AliasRoutingConfigurationProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Alias.AliasRoutingConfiguration`` resource.
     */
    function aliasResourceAliasRoutingConfigurationPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        AliasResource_AliasRoutingConfigurationPropertyValidator(properties).assertSuccess();
        return {
            AdditionalVersionWeights: cdk.listMapper(aliasResourceVersionWeightPropertyToCloudFormation)(properties.additionalVersionWeights),
        };
    }
    /**
     * Determine whether the given properties match those of a ``VersionWeightProperty``
     *
     * @param properties the TypeScript properties of a ``VersionWeightProperty``
     *
     * @returns the result of the validation.
     */
    function AliasResource_VersionWeightPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('functionVersion', cdk.requiredValidator)(properties.functionVersion));
        errors.collect(cdk.propertyValidator('functionVersion', cdk.validateString)(properties.functionVersion));
        errors.collect(cdk.propertyValidator('functionWeight', cdk.requiredValidator)(properties.functionWeight));
        errors.collect(cdk.propertyValidator('functionWeight', cdk.validateNumber)(properties.functionWeight));
        return errors.wrap('supplied properties not correct for "VersionWeightProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Alias.VersionWeight`` resource
     *
     * @param properties the TypeScript properties of a ``VersionWeightProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Alias.VersionWeight`` resource.
     */
    function aliasResourceVersionWeightPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        AliasResource_VersionWeightPropertyValidator(properties).assertSuccess();
        return {
            FunctionVersion: cdk.stringToCloudFormation(properties.functionVersion),
            FunctionWeight: cdk.numberToCloudFormation(properties.functionWeight),
        };
    }
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``EventSourceMappingResourceProps``
     *
     * @param properties the TypeScript properties of a ``EventSourceMappingResourceProps``
     *
     * @returns the result of the validation.
     */
    function EventSourceMappingResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('batchSize', cdk.validateNumber)(properties.batchSize));
        errors.collect(cdk.propertyValidator('enabled', cdk.validateBoolean)(properties.enabled));
        errors.collect(cdk.propertyValidator('eventSourceArn', cdk.requiredValidator)(properties.eventSourceArn));
        errors.collect(cdk.propertyValidator('eventSourceArn', cdk.validateString)(properties.eventSourceArn));
        errors.collect(cdk.propertyValidator('functionName', cdk.requiredValidator)(properties.functionName));
        errors.collect(cdk.propertyValidator('functionName', cdk.validateString)(properties.functionName));
        errors.collect(cdk.propertyValidator('startingPosition', cdk.validateString)(properties.startingPosition));
        return errors.wrap('supplied properties not correct for "EventSourceMappingResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::EventSourceMapping`` resource
     *
     * @param properties the TypeScript properties of a ``EventSourceMappingResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::EventSourceMapping`` resource.
     */
    function eventSourceMappingResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        EventSourceMappingResourcePropsValidator(properties).assertSuccess();
        return {
            EventSourceArn: cdk.stringToCloudFormation(properties.eventSourceArn),
            FunctionName: cdk.stringToCloudFormation(properties.functionName),
            BatchSize: cdk.numberToCloudFormation(properties.batchSize),
            Enabled: cdk.booleanToCloudFormation(properties.enabled),
            StartingPosition: cdk.stringToCloudFormation(properties.startingPosition),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html
     */
    class EventSourceMappingResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::Lambda::EventSourceMapping``.
         *
         * @param parent     the ``cdk.Construct`` this ``EventSourceMappingResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``EventSourceMappingResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: EventSourceMappingResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'eventSourceArn', this);
            cdk.requireProperty(properties, 'functionName', this);
        }
        renderProperties() {
            return eventSourceMappingResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    EventSourceMappingResource.resourceTypeName = "AWS::Lambda::EventSourceMapping";
    cloudformation.EventSourceMappingResource = EventSourceMappingResource;
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``FunctionResourceProps``
     *
     * @param properties the TypeScript properties of a ``FunctionResourceProps``
     *
     * @returns the result of the validation.
     */
    function FunctionResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('code', cdk.requiredValidator)(properties.code));
        errors.collect(cdk.propertyValidator('code', FunctionResource_CodePropertyValidator)(properties.code));
        errors.collect(cdk.propertyValidator('deadLetterConfig', FunctionResource_DeadLetterConfigPropertyValidator)(properties.deadLetterConfig));
        errors.collect(cdk.propertyValidator('description', cdk.validateString)(properties.description));
        errors.collect(cdk.propertyValidator('environment', FunctionResource_EnvironmentPropertyValidator)(properties.environment));
        errors.collect(cdk.propertyValidator('functionName', cdk.validateString)(properties.functionName));
        errors.collect(cdk.propertyValidator('handler', cdk.requiredValidator)(properties.handler));
        errors.collect(cdk.propertyValidator('handler', cdk.validateString)(properties.handler));
        errors.collect(cdk.propertyValidator('kmsKeyArn', cdk.validateString)(properties.kmsKeyArn));
        errors.collect(cdk.propertyValidator('memorySize', cdk.validateNumber)(properties.memorySize));
        errors.collect(cdk.propertyValidator('reservedConcurrentExecutions', cdk.validateNumber)(properties.reservedConcurrentExecutions));
        errors.collect(cdk.propertyValidator('role', cdk.requiredValidator)(properties.role));
        errors.collect(cdk.propertyValidator('role', cdk.validateString)(properties.role));
        errors.collect(cdk.propertyValidator('runtime', cdk.requiredValidator)(properties.runtime));
        errors.collect(cdk.propertyValidator('runtime', cdk.validateString)(properties.runtime));
        errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateTag))(properties.tags));
        errors.collect(cdk.propertyValidator('timeout', cdk.validateNumber)(properties.timeout));
        errors.collect(cdk.propertyValidator('tracingConfig', FunctionResource_TracingConfigPropertyValidator)(properties.tracingConfig));
        errors.collect(cdk.propertyValidator('vpcConfig', FunctionResource_VpcConfigPropertyValidator)(properties.vpcConfig));
        return errors.wrap('supplied properties not correct for "FunctionResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Function`` resource
     *
     * @param properties the TypeScript properties of a ``FunctionResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Function`` resource.
     */
    function functionResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        FunctionResourcePropsValidator(properties).assertSuccess();
        return {
            Code: functionResourceCodePropertyToCloudFormation(properties.code),
            Handler: cdk.stringToCloudFormation(properties.handler),
            Role: cdk.stringToCloudFormation(properties.role),
            Runtime: cdk.stringToCloudFormation(properties.runtime),
            DeadLetterConfig: functionResourceDeadLetterConfigPropertyToCloudFormation(properties.deadLetterConfig),
            Description: cdk.stringToCloudFormation(properties.description),
            Environment: functionResourceEnvironmentPropertyToCloudFormation(properties.environment),
            FunctionName: cdk.stringToCloudFormation(properties.functionName),
            KmsKeyArn: cdk.stringToCloudFormation(properties.kmsKeyArn),
            MemorySize: cdk.numberToCloudFormation(properties.memorySize),
            ReservedConcurrentExecutions: cdk.numberToCloudFormation(properties.reservedConcurrentExecutions),
            Tags: cdk.listMapper(cdk.tagToCloudFormation)(properties.tags),
            Timeout: cdk.numberToCloudFormation(properties.timeout),
            TracingConfig: functionResourceTracingConfigPropertyToCloudFormation(properties.tracingConfig),
            VpcConfig: functionResourceVpcConfigPropertyToCloudFormation(properties.vpcConfig),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
     */
    class FunctionResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::Lambda::Function``.
         *
         * @param parent     the ``cdk.Construct`` this ``FunctionResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``FunctionResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: FunctionResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'code', this);
            cdk.requireProperty(properties, 'handler', this);
            cdk.requireProperty(properties, 'role', this);
            cdk.requireProperty(properties, 'runtime', this);
            this.functionArn = new FunctionArn(this.getAtt('Arn'));
        }
        renderProperties() {
            return functionResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    FunctionResource.resourceTypeName = "AWS::Lambda::Function";
    cloudformation.FunctionResource = FunctionResource;
    /**
     * Determine whether the given properties match those of a ``CodeProperty``
     *
     * @param properties the TypeScript properties of a ``CodeProperty``
     *
     * @returns the result of the validation.
     */
    function FunctionResource_CodePropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('s3Bucket', cdk.validateString)(properties.s3Bucket));
        errors.collect(cdk.propertyValidator('s3Key', cdk.validateString)(properties.s3Key));
        errors.collect(cdk.propertyValidator('s3ObjectVersion', cdk.validateString)(properties.s3ObjectVersion));
        errors.collect(cdk.propertyValidator('zipFile', cdk.validateString)(properties.zipFile));
        return errors.wrap('supplied properties not correct for "CodeProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Function.Code`` resource
     *
     * @param properties the TypeScript properties of a ``CodeProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Function.Code`` resource.
     */
    function functionResourceCodePropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        FunctionResource_CodePropertyValidator(properties).assertSuccess();
        return {
            S3Bucket: cdk.stringToCloudFormation(properties.s3Bucket),
            S3Key: cdk.stringToCloudFormation(properties.s3Key),
            S3ObjectVersion: cdk.stringToCloudFormation(properties.s3ObjectVersion),
            ZipFile: cdk.stringToCloudFormation(properties.zipFile),
        };
    }
    /**
     * Determine whether the given properties match those of a ``DeadLetterConfigProperty``
     *
     * @param properties the TypeScript properties of a ``DeadLetterConfigProperty``
     *
     * @returns the result of the validation.
     */
    function FunctionResource_DeadLetterConfigPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('targetArn', cdk.validateString)(properties.targetArn));
        return errors.wrap('supplied properties not correct for "DeadLetterConfigProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Function.DeadLetterConfig`` resource
     *
     * @param properties the TypeScript properties of a ``DeadLetterConfigProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Function.DeadLetterConfig`` resource.
     */
    function functionResourceDeadLetterConfigPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        FunctionResource_DeadLetterConfigPropertyValidator(properties).assertSuccess();
        return {
            TargetArn: cdk.stringToCloudFormation(properties.targetArn),
        };
    }
    /**
     * Determine whether the given properties match those of a ``EnvironmentProperty``
     *
     * @param properties the TypeScript properties of a ``EnvironmentProperty``
     *
     * @returns the result of the validation.
     */
    function FunctionResource_EnvironmentPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('variables', cdk.hashValidator(cdk.validateString))(properties.variables));
        return errors.wrap('supplied properties not correct for "EnvironmentProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Function.Environment`` resource
     *
     * @param properties the TypeScript properties of a ``EnvironmentProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Function.Environment`` resource.
     */
    function functionResourceEnvironmentPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        FunctionResource_EnvironmentPropertyValidator(properties).assertSuccess();
        return {
            Variables: cdk.hashMapper(cdk.stringToCloudFormation)(properties.variables),
        };
    }
    /**
     * Determine whether the given properties match those of a ``TracingConfigProperty``
     *
     * @param properties the TypeScript properties of a ``TracingConfigProperty``
     *
     * @returns the result of the validation.
     */
    function FunctionResource_TracingConfigPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('mode', cdk.validateString)(properties.mode));
        return errors.wrap('supplied properties not correct for "TracingConfigProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Function.TracingConfig`` resource
     *
     * @param properties the TypeScript properties of a ``TracingConfigProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Function.TracingConfig`` resource.
     */
    function functionResourceTracingConfigPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        FunctionResource_TracingConfigPropertyValidator(properties).assertSuccess();
        return {
            Mode: cdk.stringToCloudFormation(properties.mode),
        };
    }
    /**
     * Determine whether the given properties match those of a ``VpcConfigProperty``
     *
     * @param properties the TypeScript properties of a ``VpcConfigProperty``
     *
     * @returns the result of the validation.
     */
    function FunctionResource_VpcConfigPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('securityGroupIds', cdk.requiredValidator)(properties.securityGroupIds));
        errors.collect(cdk.propertyValidator('securityGroupIds', cdk.listValidator(cdk.validateString))(properties.securityGroupIds));
        errors.collect(cdk.propertyValidator('subnetIds', cdk.requiredValidator)(properties.subnetIds));
        errors.collect(cdk.propertyValidator('subnetIds', cdk.listValidator(cdk.validateString))(properties.subnetIds));
        return errors.wrap('supplied properties not correct for "VpcConfigProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Function.VpcConfig`` resource
     *
     * @param properties the TypeScript properties of a ``VpcConfigProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Function.VpcConfig`` resource.
     */
    function functionResourceVpcConfigPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        FunctionResource_VpcConfigPropertyValidator(properties).assertSuccess();
        return {
            SecurityGroupIds: cdk.listMapper(cdk.stringToCloudFormation)(properties.securityGroupIds),
            SubnetIds: cdk.listMapper(cdk.stringToCloudFormation)(properties.subnetIds),
        };
    }
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
class FunctionArn extends cdk.Arn {
}
exports.FunctionArn = FunctionArn;
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``PermissionResourceProps``
     *
     * @param properties the TypeScript properties of a ``PermissionResourceProps``
     *
     * @returns the result of the validation.
     */
    function PermissionResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('action', cdk.requiredValidator)(properties.action));
        errors.collect(cdk.propertyValidator('action', cdk.validateString)(properties.action));
        errors.collect(cdk.propertyValidator('eventSourceToken', cdk.validateString)(properties.eventSourceToken));
        errors.collect(cdk.propertyValidator('functionName', cdk.requiredValidator)(properties.functionName));
        errors.collect(cdk.propertyValidator('functionName', cdk.validateString)(properties.functionName));
        errors.collect(cdk.propertyValidator('principal', cdk.requiredValidator)(properties.principal));
        errors.collect(cdk.propertyValidator('principal', cdk.validateString)(properties.principal));
        errors.collect(cdk.propertyValidator('sourceAccount', cdk.validateString)(properties.sourceAccount));
        errors.collect(cdk.propertyValidator('sourceArn', cdk.validateString)(properties.sourceArn));
        return errors.wrap('supplied properties not correct for "PermissionResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Permission`` resource
     *
     * @param properties the TypeScript properties of a ``PermissionResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Permission`` resource.
     */
    function permissionResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        PermissionResourcePropsValidator(properties).assertSuccess();
        return {
            Action: cdk.stringToCloudFormation(properties.action),
            FunctionName: cdk.stringToCloudFormation(properties.functionName),
            Principal: cdk.stringToCloudFormation(properties.principal),
            EventSourceToken: cdk.stringToCloudFormation(properties.eventSourceToken),
            SourceAccount: cdk.stringToCloudFormation(properties.sourceAccount),
            SourceArn: cdk.stringToCloudFormation(properties.sourceArn),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html
     */
    class PermissionResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::Lambda::Permission``.
         *
         * @param parent     the ``cdk.Construct`` this ``PermissionResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``PermissionResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: PermissionResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'action', this);
            cdk.requireProperty(properties, 'functionName', this);
            cdk.requireProperty(properties, 'principal', this);
        }
        renderProperties() {
            return permissionResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    PermissionResource.resourceTypeName = "AWS::Lambda::Permission";
    cloudformation.PermissionResource = PermissionResource;
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``VersionResourceProps``
     *
     * @param properties the TypeScript properties of a ``VersionResourceProps``
     *
     * @returns the result of the validation.
     */
    function VersionResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('codeSha256', cdk.validateString)(properties.codeSha256));
        errors.collect(cdk.propertyValidator('description', cdk.validateString)(properties.description));
        errors.collect(cdk.propertyValidator('functionName', cdk.requiredValidator)(properties.functionName));
        errors.collect(cdk.propertyValidator('functionName', cdk.validateString)(properties.functionName));
        return errors.wrap('supplied properties not correct for "VersionResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::Lambda::Version`` resource
     *
     * @param properties the TypeScript properties of a ``VersionResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::Lambda::Version`` resource.
     */
    function versionResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        VersionResourcePropsValidator(properties).assertSuccess();
        return {
            FunctionName: cdk.stringToCloudFormation(properties.functionName),
            CodeSha256: cdk.stringToCloudFormation(properties.codeSha256),
            Description: cdk.stringToCloudFormation(properties.description),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html
     */
    class VersionResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::Lambda::Version``.
         *
         * @param parent     the ``cdk.Construct`` this ``VersionResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``VersionResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: VersionResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'functionName', this);
            this.version = new Version(this.getAtt('Version'));
        }
        renderProperties() {
            return versionResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    VersionResource.resourceTypeName = "AWS::Lambda::Version";
    cloudformation.VersionResource = VersionResource;
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
class Version extends cdk.Token {
}
exports.Version = Version;
//# sourceMappingURL=data:application/json;base64, 