"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:05.180Z","fingerprint":"QAqu7woVGAFPm7opLOmXPldT/detK4R86SKQCOyIZk0="}
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 ``SubscriptionResourceProps``
     *
     * @param properties the TypeScript properties of a ``SubscriptionResourceProps``
     *
     * @returns the result of the validation.
     */
    function SubscriptionResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('endpoint', cdk.validateString)(properties.endpoint));
        errors.collect(cdk.propertyValidator('protocol', cdk.validateString)(properties.protocol));
        errors.collect(cdk.propertyValidator('topicArn', cdk.validateString)(properties.topicArn));
        return errors.wrap('supplied properties not correct for "SubscriptionResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::SNS::Subscription`` resource
     *
     * @param properties the TypeScript properties of a ``SubscriptionResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::SNS::Subscription`` resource.
     */
    function subscriptionResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        SubscriptionResourcePropsValidator(properties).assertSuccess();
        return {
            Endpoint: cdk.stringToCloudFormation(properties.endpoint),
            Protocol: cdk.stringToCloudFormation(properties.protocol),
            TopicArn: cdk.stringToCloudFormation(properties.topicArn),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html
     */
    class SubscriptionResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::SNS::Subscription``.
         *
         * @param parent     the ``cdk.Construct`` this ``SubscriptionResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``SubscriptionResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: SubscriptionResource.resourceTypeName, properties });
        }
        renderProperties() {
            return subscriptionResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    SubscriptionResource.resourceTypeName = "AWS::SNS::Subscription";
    cloudformation.SubscriptionResource = SubscriptionResource;
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``TopicResourceProps``
     *
     * @param properties the TypeScript properties of a ``TopicResourceProps``
     *
     * @returns the result of the validation.
     */
    function TopicResourcePropsValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('displayName', cdk.validateString)(properties.displayName));
        errors.collect(cdk.propertyValidator('subscription', cdk.listValidator(TopicResource_SubscriptionPropertyValidator))(properties.subscription));
        errors.collect(cdk.propertyValidator('topicName', cdk.validateString)(properties.topicName));
        return errors.wrap('supplied properties not correct for "TopicResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::SNS::Topic`` resource
     *
     * @param properties the TypeScript properties of a ``TopicResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::SNS::Topic`` resource.
     */
    function topicResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        TopicResourcePropsValidator(properties).assertSuccess();
        return {
            DisplayName: cdk.stringToCloudFormation(properties.displayName),
            Subscription: cdk.listMapper(topicResourceSubscriptionPropertyToCloudFormation)(properties.subscription),
            TopicName: cdk.stringToCloudFormation(properties.topicName),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html
     */
    class TopicResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::SNS::Topic``.
         *
         * @param parent     the ``cdk.Construct`` this ``TopicResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``TopicResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: TopicResource.resourceTypeName, properties });
            this.topicName = new TopicName(this.getAtt('TopicName'));
        }
        renderProperties() {
            return topicResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    TopicResource.resourceTypeName = "AWS::SNS::Topic";
    cloudformation.TopicResource = TopicResource;
    /**
     * Determine whether the given properties match those of a ``SubscriptionProperty``
     *
     * @param properties the TypeScript properties of a ``SubscriptionProperty``
     *
     * @returns the result of the validation.
     */
    function TopicResource_SubscriptionPropertyValidator(properties) {
        if (!cdk.canInspect(properties)) {
            return cdk.VALIDATION_SUCCESS;
        }
        const errors = new cdk.ValidationResults();
        errors.collect(cdk.propertyValidator('endpoint', cdk.requiredValidator)(properties.endpoint));
        errors.collect(cdk.propertyValidator('endpoint', cdk.validateString)(properties.endpoint));
        errors.collect(cdk.propertyValidator('protocol', cdk.requiredValidator)(properties.protocol));
        errors.collect(cdk.propertyValidator('protocol', cdk.validateString)(properties.protocol));
        return errors.wrap('supplied properties not correct for "SubscriptionProperty"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::SNS::Topic.Subscription`` resource
     *
     * @param properties the TypeScript properties of a ``SubscriptionProperty``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::SNS::Topic.Subscription`` resource.
     */
    function topicResourceSubscriptionPropertyToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        TopicResource_SubscriptionPropertyValidator(properties).assertSuccess();
        return {
            Endpoint: cdk.stringToCloudFormation(properties.endpoint),
            Protocol: cdk.stringToCloudFormation(properties.protocol),
        };
    }
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
class TopicName extends cdk.Token {
}
exports.TopicName = TopicName;
(function (cloudformation) {
    /**
     * Determine whether the given properties match those of a ``TopicPolicyResourceProps``
     *
     * @param properties the TypeScript properties of a ``TopicPolicyResourceProps``
     *
     * @returns the result of the validation.
     */
    function TopicPolicyResourcePropsValidator(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('topics', cdk.requiredValidator)(properties.topics));
        errors.collect(cdk.propertyValidator('topics', cdk.listValidator(cdk.validateString))(properties.topics));
        return errors.wrap('supplied properties not correct for "TopicPolicyResourceProps"');
    }
    /**
     * Renders the AWS CloudFormation properties of an ``AWS::SNS::TopicPolicy`` resource
     *
     * @param properties the TypeScript properties of a ``TopicPolicyResourceProps``
     *
     * @returns the AWS CloudFormation properties of an ``AWS::SNS::TopicPolicy`` resource.
     */
    function topicPolicyResourcePropsToCloudFormation(properties) {
        if (!cdk.canInspect(properties)) {
            return properties;
        }
        TopicPolicyResourcePropsValidator(properties).assertSuccess();
        return {
            PolicyDocument: cdk.objectToCloudFormation(properties.policyDocument),
            Topics: cdk.listMapper(cdk.stringToCloudFormation)(properties.topics),
        };
    }
    /**
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html
     */
    class TopicPolicyResource extends cdk.Resource {
        /**
         * Creates a new ``AWS::SNS::TopicPolicy``.
         *
         * @param parent     the ``cdk.Construct`` this ``TopicPolicyResource`` is a part of
         * @param name       the name of the resource in the ``cdk.Construct`` tree
         * @param properties the properties of this ``TopicPolicyResource``
         */
        constructor(parent, name, properties) {
            super(parent, name, { type: TopicPolicyResource.resourceTypeName, properties });
            cdk.requireProperty(properties, 'policyDocument', this);
            cdk.requireProperty(properties, 'topics', this);
        }
        renderProperties() {
            return topicPolicyResourcePropsToCloudFormation(cdk.resolve(this.properties));
        }
    }
    /**
     * The CloudFormation resource type name for this resource class.
     */
    TopicPolicyResource.resourceTypeName = "AWS::SNS::TopicPolicy";
    cloudformation.TopicPolicyResource = TopicPolicyResource;
})(cloudformation = exports.cloudformation || (exports.cloudformation = {}));
//# sourceMappingURL=data:application/json;base64, 