"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:49.560Z","fingerprint":"zJQWPDUqmL9+H0d+p9hiSs/R44tbNozlOY5CSe1XCBo="}
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 ``QueueResourceProps``
     *
     * @param properties the TypeScript properties of a ``QueueResourceProps``
     *
     * @returns the result of the validation.
     */
    function QueueResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('contentBasedDeduplication', cdk.validateBoolean)(properties.contentBasedDeduplication));
        errors.collect(cdk.propertyValidator('delaySeconds', cdk.validateNumber)(properties.delaySeconds));
        errors.collect(cdk.propertyValidator('fifoQueue', cdk.validateBoolean)(properties.fifoQueue));
        errors.collect(cdk.propertyValidator('kmsDataKeyReusePeriodSeconds', cdk.validateNumber)(properties.kmsDataKeyReusePeriodSeconds));
        errors.collect(cdk.propertyValidator('kmsMasterKeyId', cdk.validateString)(properties.kmsMasterKeyId));
        errors.collect(cdk.propertyValidator('maximumMessageSize', cdk.validateNumber)(properties.maximumMessageSize));
        errors.collect(cdk.propertyValidator('messageRetentionPeriod', cdk.validateNumber)(properties.messageRetentionPeriod));
        errors.collect(cdk.propertyValidator('queueName', cdk.validateString)(properties.queueName));
        errors.collect(cdk.propertyValidator('receiveMessageWaitTimeSeconds', cdk.validateNumber)(properties.receiveMessageWaitTimeSeconds));
        errors.collect(cdk.propertyValidator('redrivePolicy', cdk.validateObject)(properties.redrivePolicy));
        errors.collect(cdk.propertyValidator('visibilityTimeout', cdk.validateNumber)(properties.visibilityTimeout));
        return errors.wrap('supplied properties not correct for "QueueResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::SQS::Queue`` resource
     *
     * @param properties the TypeScript properties of a ``QueueResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::SQS::Queue`` resource.
     */
    function queueResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        QueueResourcePropsValidator(properties).assertSuccess();
        return {
            ContentBasedDeduplication: cdk.booleanToCloudFormation(properties.contentBasedDeduplication),
            DelaySeconds: cdk.numberToCloudFormation(properties.delaySeconds),
            FifoQueue: cdk.booleanToCloudFormation(properties.fifoQueue),
            KmsDataKeyReusePeriodSeconds: cdk.numberToCloudFormation(properties.kmsDataKeyReusePeriodSeconds),
            KmsMasterKeyId: cdk.stringToCloudFormation(properties.kmsMasterKeyId),
            MaximumMessageSize: cdk.numberToCloudFormation(properties.maximumMessageSize),
            MessageRetentionPeriod: cdk.numberToCloudFormation(properties.messageRetentionPeriod),
            QueueName: cdk.stringToCloudFormation(properties.queueName),
            ReceiveMessageWaitTimeSeconds: cdk.numberToCloudFormation(properties.receiveMessageWaitTimeSeconds),
            RedrivePolicy: cdk.objectToCloudFormation(properties.redrivePolicy),
            VisibilityTimeout: cdk.numberToCloudFormation(properties.visibilityTimeout),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html
     */
    class QueueResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::SQS::Queue``.
         *
         * @param parent     the ``cdk.Construct`` this ``QueueResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``QueueResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: QueueResource.resourceTypeName, properties });
            this.queueArn = new QueueArn(this.getAtt('Arn'));
            this.queueName = new QueueName(this.getAtt('QueueName'));
        }
        renderProperties() {
            return queueResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    QueueResource.resourceTypeName = "AWS::SQS::Queue";
    cloudformation.QueueResource = QueueResource;
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
class QueueArn extends cdk.Arn {
}
exports.QueueArn = QueueArn;
class QueueName extends cdk.Token {
}
exports.QueueName = QueueName;
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``QueuePolicyResourceProps``
     *
     * @param properties the TypeScript properties of a ``QueuePolicyResourceProps``
     *
     * @returns the result of the validation.
     */
    function QueuePolicyResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('policyDocument', cdk.requiredValidator)(properties.policyDocument));
        errors.collect(cdk.propertyValidator('policyDocument', cdk.validateObject)(properties.policyDocument));
        errors.collect(cdk.propertyValidator('queues', cdk.requiredValidator)(properties.queues));
        errors.collect(cdk.propertyValidator('queues', cdk.listValidator(cdk.validateString))(properties.queues));
        return errors.wrap('supplied properties not correct for "QueuePolicyResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::SQS::QueuePolicy`` resource
     *
     * @param properties the TypeScript properties of a ``QueuePolicyResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::SQS::QueuePolicy`` resource.
     */
    function queuePolicyResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        QueuePolicyResourcePropsValidator(properties).assertSuccess();
        return {
            PolicyDocument: cdk.objectToCloudFormation(properties.policyDocument),
            Queues: cdk.listMapper(cdk.stringToCloudFormation)(properties.queues),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-policy.html
     */
    class QueuePolicyResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::SQS::QueuePolicy``.
         *
         * @param parent     the ``cdk.Construct`` this ``QueuePolicyResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``QueuePolicyResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: QueuePolicyResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'policyDocument', this);
            cdk.requireProperty(properties, 'queues', this);
        }
        renderProperties() {
            return queuePolicyResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    QueuePolicyResource.resourceTypeName = "AWS::SQS::QueuePolicy";
    cloudformation.QueuePolicyResource = QueuePolicyResource;
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
//# sourceMappingURL=data:application/json;base64, 