"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:21.714Z","fingerprint":"za02hrPxoJCWMyOY/i98Brlwa/QOdhw6arSvqMhZXkM="}
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 ``ProjectResourceProps``
     *
     * @param properties the TypeScript properties of a ``ProjectResourceProps``
     *
     * @returns the result of the validation.
     */
    function ProjectResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('artifacts', cdk.requiredValidator)(properties.artifacts));
        errors.collect(cdk.propertyValidator('artifacts', ProjectResource_ArtifactsPropertyValidator)(properties.artifacts));
        errors.collect(cdk.propertyValidator('badgeEnabled', cdk.validateBoolean)(properties.badgeEnabled));
        errors.collect(cdk.propertyValidator('cache', ProjectResource_ProjectCachePropertyValidator)(properties.cache));
        errors.collect(cdk.propertyValidator('description', cdk.validateString)(properties.description));
        errors.collect(cdk.propertyValidator('encryptionKey', cdk.validateString)(properties.encryptionKey));
        errors.collect(cdk.propertyValidator('environment', cdk.requiredValidator)(properties.environment));
        errors.collect(cdk.propertyValidator('environment', ProjectResource_EnvironmentPropertyValidator)(properties.environment));
        errors.collect(cdk.propertyValidator('projectName', cdk.validateString)(properties.projectName));
        errors.collect(cdk.propertyValidator('serviceRole', cdk.requiredValidator)(properties.serviceRole));
        errors.collect(cdk.propertyValidator('serviceRole', cdk.validateString)(properties.serviceRole));
        errors.collect(cdk.propertyValidator('source', cdk.requiredValidator)(properties.source));
        errors.collect(cdk.propertyValidator('source', ProjectResource_SourcePropertyValidator)(properties.source));
        errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateTag))(properties.tags));
        errors.collect(cdk.propertyValidator('timeoutInMinutes', cdk.validateNumber)(properties.timeoutInMinutes));
        errors.collect(cdk.propertyValidator('triggers', ProjectResource_ProjectTriggersPropertyValidator)(properties.triggers));
        errors.collect(cdk.propertyValidator('vpcConfig', ProjectResource_VpcConfigPropertyValidator)(properties.vpcConfig));
        return errors.wrap('supplied properties not correct for "ProjectResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project`` resource
     *
     * @param properties the TypeScript properties of a ``ProjectResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project`` resource.
     */
    function projectResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResourcePropsValidator(properties).assertSuccess();
        return {
            Artifacts: projectResourceArtifactsPropertyToCloudFormation(properties.artifacts),
            Environment: projectResourceEnvironmentPropertyToCloudFormation(properties.environment),
            ServiceRole: cdk.stringToCloudFormation(properties.serviceRole),
            Source: projectResourceSourcePropertyToCloudFormation(properties.source),
            BadgeEnabled: cdk.booleanToCloudFormation(properties.badgeEnabled),
            Cache: projectResourceProjectCachePropertyToCloudFormation(properties.cache),
            Description: cdk.stringToCloudFormation(properties.description),
            EncryptionKey: cdk.stringToCloudFormation(properties.encryptionKey),
            Name: cdk.stringToCloudFormation(properties.projectName),
            Tags: cdk.listMapper(cdk.tagToCloudFormation)(properties.tags),
            TimeoutInMinutes: cdk.numberToCloudFormation(properties.timeoutInMinutes),
            Triggers: projectResourceProjectTriggersPropertyToCloudFormation(properties.triggers),
            VpcConfig: projectResourceVpcConfigPropertyToCloudFormation(properties.vpcConfig),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html
     */
    class ProjectResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::CodeBuild::Project``.
         *
         * @param parent     the ``cdk.Construct`` this ``ProjectResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``ProjectResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: ProjectResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'artifacts', this);
            cdk.requireProperty(properties, 'environment', this);
            cdk.requireProperty(properties, 'serviceRole', this);
            cdk.requireProperty(properties, 'source', this);
            this.projectArn = new ProjectArn(this.getAtt('Arn'));
        }
        renderProperties() {
            return projectResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    ProjectResource.resourceTypeName = "AWS::CodeBuild::Project";
    cloudformation.ProjectResource = ProjectResource;
    /**
     * Determine whether the given properties match those of a ``ArtifactsProperty``
     *
     * @param properties the TypeScript properties of a ``ArtifactsProperty``
     *
     * @returns the result of the validation.
     */
    function ProjectResource_ArtifactsPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('location', cdk.validateString)(properties.location));
        errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
        errors.collect(cdk.propertyValidator('namespaceType', cdk.validateString)(properties.namespaceType));
        errors.collect(cdk.propertyValidator('packaging', cdk.validateString)(properties.packaging));
        errors.collect(cdk.propertyValidator('path', cdk.validateString)(properties.path));
        errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type));
        errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type));
        return errors.wrap('supplied properties not correct for "ArtifactsProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.Artifacts`` resource
     *
     * @param properties the TypeScript properties of a ``ArtifactsProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.Artifacts`` resource.
     */
    function projectResourceArtifactsPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResource_ArtifactsPropertyValidator(properties).assertSuccess();
        return {
            Location: cdk.stringToCloudFormation(properties.location),
            Name: cdk.stringToCloudFormation(properties.name),
            NamespaceType: cdk.stringToCloudFormation(properties.namespaceType),
            Packaging: cdk.stringToCloudFormation(properties.packaging),
            Path: cdk.stringToCloudFormation(properties.path),
            Type: cdk.stringToCloudFormation(properties.type),
        };
    }
    /**
     * 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 ProjectResource_EnvironmentPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('computeType', cdk.requiredValidator)(properties.computeType));
        errors.collect(cdk.propertyValidator('computeType', cdk.validateString)(properties.computeType));
        errors.collect(cdk.propertyValidator('environmentVariables', cdk.listValidator(ProjectResource_EnvironmentVariablePropertyValidator))(properties.environmentVariables));
        errors.collect(cdk.propertyValidator('image', cdk.requiredValidator)(properties.image));
        errors.collect(cdk.propertyValidator('image', cdk.validateString)(properties.image));
        errors.collect(cdk.propertyValidator('privilegedMode', cdk.validateBoolean)(properties.privilegedMode));
        errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type));
        errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type));
        return errors.wrap('supplied properties not correct for "EnvironmentProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.Environment`` resource
     *
     * @param properties the TypeScript properties of a ``EnvironmentProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.Environment`` resource.
     */
    function projectResourceEnvironmentPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResource_EnvironmentPropertyValidator(properties).assertSuccess();
        return {
            ComputeType: cdk.stringToCloudFormation(properties.computeType),
            EnvironmentVariables: cdk.listMapper(projectResourceEnvironmentVariablePropertyToCloudFormation)(properties.environmentVariables),
            Image: cdk.stringToCloudFormation(properties.image),
            PrivilegedMode: cdk.booleanToCloudFormation(properties.privilegedMode),
            Type: cdk.stringToCloudFormation(properties.type),
        };
    }
    /**
     * Determine whether the given properties match those of a ``EnvironmentVariableProperty``
     *
     * @param properties the TypeScript properties of a ``EnvironmentVariableProperty``
     *
     * @returns the result of the validation.
     */
    function ProjectResource_EnvironmentVariablePropertyValidator(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('type', cdk.validateString)(properties.type));
        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 "EnvironmentVariableProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.EnvironmentVariable`` resource
     *
     * @param properties the TypeScript properties of a ``EnvironmentVariableProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.EnvironmentVariable`` resource.
     */
    function projectResourceEnvironmentVariablePropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResource_EnvironmentVariablePropertyValidator(properties).assertSuccess();
        return {
            Name: cdk.stringToCloudFormation(properties.name),
            Type: cdk.stringToCloudFormation(properties.type),
            Value: cdk.stringToCloudFormation(properties.value),
        };
    }
    /**
     * Determine whether the given properties match those of a ``ProjectCacheProperty``
     *
     * @param properties the TypeScript properties of a ``ProjectCacheProperty``
     *
     * @returns the result of the validation.
     */
    function ProjectResource_ProjectCachePropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('location', cdk.validateString)(properties.location));
        errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type));
        errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type));
        return errors.wrap('supplied properties not correct for "ProjectCacheProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.ProjectCache`` resource
     *
     * @param properties the TypeScript properties of a ``ProjectCacheProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.ProjectCache`` resource.
     */
    function projectResourceProjectCachePropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResource_ProjectCachePropertyValidator(properties).assertSuccess();
        return {
            Location: cdk.stringToCloudFormation(properties.location),
            Type: cdk.stringToCloudFormation(properties.type),
        };
    }
    /**
     * Determine whether the given properties match those of a ``ProjectTriggersProperty``
     *
     * @param properties the TypeScript properties of a ``ProjectTriggersProperty``
     *
     * @returns the result of the validation.
     */
    function ProjectResource_ProjectTriggersPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('webhook', cdk.validateBoolean)(properties.webhook));
        return errors.wrap('supplied properties not correct for "ProjectTriggersProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.ProjectTriggers`` resource
     *
     * @param properties the TypeScript properties of a ``ProjectTriggersProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.ProjectTriggers`` resource.
     */
    function projectResourceProjectTriggersPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResource_ProjectTriggersPropertyValidator(properties).assertSuccess();
        return {
            Webhook: cdk.booleanToCloudFormation(properties.webhook),
        };
    }
    /**
     * Determine whether the given properties match those of a ``SourceProperty``
     *
     * @param properties the TypeScript properties of a ``SourceProperty``
     *
     * @returns the result of the validation.
     */
    function ProjectResource_SourcePropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('auth', ProjectResource_SourceAuthPropertyValidator)(properties.auth));
        errors.collect(cdk.propertyValidator('buildSpec', cdk.validateString)(properties.buildSpec));
        errors.collect(cdk.propertyValidator('gitCloneDepth', cdk.validateNumber)(properties.gitCloneDepth));
        errors.collect(cdk.propertyValidator('insecureSsl', cdk.validateBoolean)(properties.insecureSsl));
        errors.collect(cdk.propertyValidator('location', cdk.validateString)(properties.location));
        errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type));
        errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type));
        return errors.wrap('supplied properties not correct for "SourceProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.Source`` resource
     *
     * @param properties the TypeScript properties of a ``SourceProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.Source`` resource.
     */
    function projectResourceSourcePropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResource_SourcePropertyValidator(properties).assertSuccess();
        return {
            Auth: projectResourceSourceAuthPropertyToCloudFormation(properties.auth),
            BuildSpec: cdk.stringToCloudFormation(properties.buildSpec),
            GitCloneDepth: cdk.numberToCloudFormation(properties.gitCloneDepth),
            InsecureSsl: cdk.booleanToCloudFormation(properties.insecureSsl),
            Location: cdk.stringToCloudFormation(properties.location),
            Type: cdk.stringToCloudFormation(properties.type),
        };
    }
    /**
     * Determine whether the given properties match those of a ``SourceAuthProperty``
     *
     * @param properties the TypeScript properties of a ``SourceAuthProperty``
     *
     * @returns the result of the validation.
     */
    function ProjectResource_SourceAuthPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('resource', cdk.validateString)(properties.resource));
        errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type));
        errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type));
        return errors.wrap('supplied properties not correct for "SourceAuthProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.SourceAuth`` resource
     *
     * @param properties the TypeScript properties of a ``SourceAuthProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.SourceAuth`` resource.
     */
    function projectResourceSourceAuthPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResource_SourceAuthPropertyValidator(properties).assertSuccess();
        return {
            Resource: cdk.stringToCloudFormation(properties.resource),
            Type: cdk.stringToCloudFormation(properties.type),
        };
    }
    /**
     * 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 ProjectResource_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('subnets', cdk.requiredValidator)(properties.subnets));
        errors.collect(cdk.propertyValidator('subnets', cdk.listValidator(cdk.validateString))(properties.subnets));
        errors.collect(cdk.propertyValidator('vpcId', cdk.requiredValidator)(properties.vpcId));
        errors.collect(cdk.propertyValidator('vpcId', cdk.validateString)(properties.vpcId));
        return errors.wrap('supplied properties not correct for "VpcConfigProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.VpcConfig`` resource
     *
     * @param properties the TypeScript properties of a ``VpcConfigProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::CodeBuild::Project.VpcConfig`` resource.
     */
    function projectResourceVpcConfigPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        ProjectResource_VpcConfigPropertyValidator(properties).assertSuccess();
        return {
            SecurityGroupIds: cdk.listMapper(cdk.stringToCloudFormation)(properties.securityGroupIds),
            Subnets: cdk.listMapper(cdk.stringToCloudFormation)(properties.subnets),
            VpcId: cdk.stringToCloudFormation(properties.vpcId),
        };
    }
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
class ProjectArn extends cdk.Arn {
}
exports.ProjectArn = ProjectArn;
//# sourceMappingURL=data:application/json;base64, 