"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CfnCrossAccountAttachmentPropsMixin = exports.CfnListenerPropsMixin = exports.CfnEndpointGroupPropsMixin = exports.CfnAcceleratorPropsMixin = void 0;
const jsiiDeprecationWarnings = require("../../../.warnings.jsii.js");
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
/* eslint-disable @stylistic/max-len, eol-last */
const cdk = __importStar(require("aws-cdk-lib/core"));
const service = __importStar(require("aws-cdk-lib/aws-globalaccelerator"));
/**
 * The `AWS::GlobalAccelerator::Accelerator` resource is a Global Accelerator resource type that contains information about how you create an accelerator.
 *
 * An accelerator includes one or more listeners that process inbound connections and direct traffic to one or more endpoint groups, each of which includes endpoints, such as Application Load Balancers, Network Load Balancers, and Amazon EC2 instances.
 *
 * @cloudformationResource AWS::GlobalAccelerator::Accelerator
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-accelerator.html
 */
class CfnAcceleratorPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_globalaccelerator.CfnAcceleratorPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["enabled", "flowLogsEnabled", "flowLogsS3Bucket", "flowLogsS3Prefix", "ipAddresses", "ipAddressType", "name", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::GlobalAccelerator::Accelerator`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_globalaccelerator_CfnAcceleratorMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnAcceleratorPropsMixin);
            }
            throw error;
        }
        this.props = props;
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnAccelerator.isCfnAccelerator(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnAcceleratorPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnAcceleratorPropsMixin = CfnAcceleratorPropsMixin;
/**
 * The `AWS::GlobalAccelerator::EndpointGroup` resource is a Global Accelerator resource type that contains information about how you create an endpoint group for the specified listener.
 *
 * An endpoint group is a collection of endpoints in one AWS Region .
 *
 * @cloudformationResource AWS::GlobalAccelerator::EndpointGroup
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html
 */
class CfnEndpointGroupPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_globalaccelerator.CfnEndpointGroupPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["endpointConfigurations", "endpointGroupRegion", "healthCheckIntervalSeconds", "healthCheckPath", "healthCheckPort", "healthCheckProtocol", "listenerArn", "portOverrides", "thresholdCount", "trafficDialPercentage"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::GlobalAccelerator::EndpointGroup`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_globalaccelerator_CfnEndpointGroupMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnEndpointGroupPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnEndpointGroupMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnEndpointGroup.isCfnEndpointGroup(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnEndpointGroupPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnEndpointGroupPropsMixin = CfnEndpointGroupPropsMixin;
// @ts-ignore TS6133
function flattenCfnEndpointGroupPropsMixinEndpointConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        attachmentArn: (!props.attachmentArn ? undefined : props.attachmentArn),
        clientIpPreservationEnabled: (!props.clientIpPreservationEnabled ? undefined : props.clientIpPreservationEnabled),
        endpointId: (!props.endpointId ? undefined : cdk.getRefProperty(props.endpointId?.loadBalancerRef, 'loadBalancerArn') ?? cdk.ensureStringOrUndefined(props.endpointId, "endpointId", "elasticloadbalancingv2.ILoadBalancerRef | string")),
        weight: (!props.weight ? undefined : props.weight)
    };
}
// @ts-ignore TS6133
function flattenCfnEndpointGroupMixinProps(props) {
    const ret = {};
    if ((props.endpointConfigurations !== undefined))
        ret.endpointConfigurations = (cdk.isResolvableObject(props.endpointConfigurations) ? props.endpointConfigurations : cdk.mapArrayInPlace(props.endpointConfigurations, (item) => flattenCfnEndpointGroupPropsMixinEndpointConfigurationProperty(item)));
    if ((props.listenerArn !== undefined))
        ret.listenerArn = cdk.getRefProperty(props.listenerArn?.listenerRef, 'listenerArn') ?? cdk.ensureStringOrUndefined(props.listenerArn, "listenerArn", "globalaccelerator.IListenerRef | string");
    return ret;
}
/**
 * The `AWS::GlobalAccelerator::Listener` resource is a Global Accelerator resource type that contains information about how you create a listener to process inbound connections from clients to an accelerator.
 *
 * Connections arrive to assigned static IP addresses on a port, port range, or list of port ranges that you specify.
 *
 * @cloudformationResource AWS::GlobalAccelerator::Listener
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-listener.html
 */
class CfnListenerPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_globalaccelerator.CfnListenerPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["acceleratorArn", "clientAffinity", "portRanges", "protocol"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::GlobalAccelerator::Listener`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_globalaccelerator_CfnListenerMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnListenerPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnListenerMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnListener.isCfnListener(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnListenerPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnListenerPropsMixin = CfnListenerPropsMixin;
// @ts-ignore TS6133
function flattenCfnListenerMixinProps(props) {
    const ret = {};
    if ((props.acceleratorArn !== undefined))
        ret.acceleratorArn = cdk.getRefProperty(props.acceleratorArn?.acceleratorRef, 'acceleratorArn') ?? cdk.ensureStringOrUndefined(props.acceleratorArn, "acceleratorArn", "globalaccelerator.IAcceleratorRef | string");
    return ret;
}
/**
 * Create a cross-account attachment in AWS Global Accelerator .
 *
 * You create a cross-account attachment to specify the *principals* who have permission to work with *resources* in accelerators in their own account. You specify, in the same attachment, the resources that are shared.
 *
 * A principal can be an AWS account number or the Amazon Resource Name (ARN) for an accelerator. For account numbers that are listed as principals, to work with a resource listed in the attachment, you must sign in to an account specified as a principal. Then, you can work with resources that are listed, with any of your accelerators. If an accelerator ARN is listed in the cross-account attachment as a principal, anyone with permission to make updates to the accelerator can work with resources that are listed in the attachment.
 *
 * Specify each principal and resource separately. To specify two CIDR address pools, list them individually under `Resources` , and so on. For a command line operation, for example, you might use a statement like the following:
 *
 * `"Resources": [{"Cidr": "169.254.60.0/24"},{"Cidr": "169.254.59.0/24"}]`
 *
 * For more information, see [Working with cross-account attachments and resources in AWS Global Accelerator](https://docs.aws.amazon.com/global-accelerator/latest/dg/cross-account-resources.html) in the *AWS Global Accelerator Developer Guide* .
 *
 * @cloudformationResource AWS::GlobalAccelerator::CrossAccountAttachment
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-crossaccountattachment.html
 */
class CfnCrossAccountAttachmentPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_globalaccelerator.CfnCrossAccountAttachmentPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["name", "principals", "resources", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::GlobalAccelerator::CrossAccountAttachment`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_globalaccelerator_CfnCrossAccountAttachmentMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnCrossAccountAttachmentPropsMixin);
            }
            throw error;
        }
        this.props = props;
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnCrossAccountAttachment.isCfnCrossAccountAttachment(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnCrossAccountAttachmentPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnCrossAccountAttachmentPropsMixin = CfnCrossAccountAttachmentPropsMixin;
