"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:38:11.547Z","fingerprint":"Bwjkqshi5caAmiYWB8fKvFD/MT1p4tm+ApaKHxg2DZ4="}
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 ``RepositoryResourceProps``
     *
     * @param properties the TypeScript properties of a ``RepositoryResourceProps``
     *
     * @returns the result of the validation.
     */
    function RepositoryResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('repositoryDescription', cdk.validateString)(properties.repositoryDescription));
        errors.collect(cdk.propertyValidator('repositoryName', cdk.requiredValidator)(properties.repositoryName));
        errors.collect(cdk.propertyValidator('repositoryName', cdk.validateString)(properties.repositoryName));
        errors.collect(cdk.propertyValidator('triggers', cdk.listValidator(RepositoryResource_RepositoryTriggerPropertyValidator))(properties.triggers));
        return errors.wrap('supplied properties not correct for "RepositoryResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeCommit::Repository`` resource
     *
     * @param properties the TypeScript properties of a ``RepositoryResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeCommit::Repository`` resource.
     */
    function repositoryResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RepositoryResourcePropsValidator(properties).assertSuccess();
        return {
            RepositoryName: cdk.stringToCloudFormation(properties.repositoryName),
            RepositoryDescription: cdk.stringToCloudFormation(properties.repositoryDescription),
            Triggers: cdk.listMapper(repositoryResourceRepositoryTriggerPropertyToCloudFormation)(properties.triggers),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html
     */
    class RepositoryResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::CodeCommit::Repository``.
         *
         * @param parent     the ``cdk.Construct`` this ``RepositoryResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``RepositoryResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: RepositoryResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'repositoryName', this);
            this.repositoryArn = new RepositoryArn(this.getAtt('Arn'));
            this.repositoryCloneUrlHttp = new RepositoryCloneUrlHttp(this.getAtt('CloneUrlHttp'));
            this.repositoryCloneUrlSsh = new RepositoryCloneUrlSsh(this.getAtt('CloneUrlSsh'));
            this.repositoryName = new RepositoryName(this.getAtt('Name'));
        }
        renderProperties() {
            return repositoryResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    RepositoryResource.resourceTypeName = "AWS::CodeCommit::Repository";
    cloudformation.RepositoryResource = RepositoryResource;
    /**
     * Determine whether the given properties match those of a ``RepositoryTriggerProperty``
     *
     * @param properties the TypeScript properties of a ``RepositoryTriggerProperty``
     *
     * @returns the result of the validation.
     */
    function RepositoryResource_RepositoryTriggerPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('branches', cdk.listValidator(cdk.validateString))(properties.branches));
        errors.collect(cdk.propertyValidator('customData', cdk.validateString)(properties.customData));
        errors.collect(cdk.propertyValidator('destinationArn', cdk.validateString)(properties.destinationArn));
        errors.collect(cdk.propertyValidator('events', cdk.listValidator(cdk.validateString))(properties.events));
        errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
        return errors.wrap('supplied properties not correct for "RepositoryTriggerProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeCommit::Repository.RepositoryTrigger`` resource
     *
     * @param properties the TypeScript properties of a ``RepositoryTriggerProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeCommit::Repository.RepositoryTrigger`` resource.
     */
    function repositoryResourceRepositoryTriggerPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        RepositoryResource_RepositoryTriggerPropertyValidator(properties).assertSuccess();
        return {
            Branches: cdk.listMapper(cdk.stringToCloudFormation)(properties.branches),
            CustomData: cdk.stringToCloudFormation(properties.customData),
            DestinationArn: cdk.stringToCloudFormation(properties.destinationArn),
            Events: cdk.listMapper(cdk.stringToCloudFormation)(properties.events),
            Name: cdk.stringToCloudFormation(properties.name),
        };
    }
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
class RepositoryArn extends cdk.Arn {
}
exports.RepositoryArn = RepositoryArn;
class RepositoryCloneUrlHttp extends cdk.Token {
}
exports.RepositoryCloneUrlHttp = RepositoryCloneUrlHttp;
class RepositoryCloneUrlSsh extends cdk.Token {
}
exports.RepositoryCloneUrlSsh = RepositoryCloneUrlSsh;
class RepositoryName extends cdk.Token {
}
exports.RepositoryName = RepositoryName;
//# sourceMappingURL=data:application/json;base64, 