"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.CfnPermissionPropsMixin = exports.CfnCertificateAuthorityActivationPropsMixin = exports.CfnCertificateAuthorityPropsMixin = exports.CfnCertificatePropsMixin = 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-acmpca"));
/**
 * The `AWS::ACMPCA::Certificate` resource is used to issue a certificate using your private certificate authority.
 *
 * For more information, see the [IssueCertificate](https://docs.aws.amazon.com/privateca/latest/APIReference/API_IssueCertificate.html) action.
 *
 * @cloudformationResource AWS::ACMPCA::Certificate
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-acmpca-certificate.html
 */
class CfnCertificatePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_acmpca.CfnCertificatePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["apiPassthrough", "certificateAuthorityArn", "certificateSigningRequest", "signingAlgorithm", "templateArn", "validity", "validityNotBefore"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::ACMPCA::Certificate`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_acmpca_CfnCertificateMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnCertificatePropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnCertificateMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnCertificate.isCfnCertificate(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnCertificatePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnCertificatePropsMixin = CfnCertificatePropsMixin;
// @ts-ignore TS6133
function flattenCfnCertificateMixinProps(props) {
    const ret = {};
    if ((props.certificateAuthorityArn !== undefined))
        ret.certificateAuthorityArn = cdk.getRefProperty(props.certificateAuthorityArn?.certificateAuthorityRef, 'certificateAuthorityArn') ?? cdk.ensureStringOrUndefined(props.certificateAuthorityArn, "certificateAuthorityArn", "acmpca.ICertificateAuthorityRef | string");
    if ((props.certificateSigningRequest !== undefined))
        ret.certificateSigningRequest = props.certificateSigningRequest;
    if ((props.templateArn !== undefined))
        ret.templateArn = cdk.getRefProperty(props.templateArn?.certificateAuthorityRef, 'certificateAuthorityArn') ?? cdk.ensureStringOrUndefined(props.templateArn, "templateArn", "acmpca.ICertificateAuthorityRef | string");
    return ret;
}
/**
 * Use the `AWS::ACMPCA::CertificateAuthority` resource to create a private CA.
 *
 * Once the CA exists, you can use the `AWS::ACMPCA::Certificate` resource to issue a new CA certificate. Alternatively, you can issue a CA certificate using an on-premises CA, and then use the `AWS::ACMPCA::CertificateAuthorityActivation` resource to import the new CA certificate and activate the CA.
 *
 * > Before removing a `AWS::ACMPCA::CertificateAuthority` resource from the CloudFormation stack, disable the affected CA. Otherwise, the action will fail. You can disable the CA by removing its associated `AWS::ACMPCA::CertificateAuthorityActivation` resource from CloudFormation.
 *
 * @cloudformationResource AWS::ACMPCA::CertificateAuthority
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-acmpca-certificateauthority.html
 */
class CfnCertificateAuthorityPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_acmpca.CfnCertificateAuthorityPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["csrExtensions", "keyAlgorithm", "keyStorageSecurityStandard", "revocationConfiguration", "signingAlgorithm", "subject", "tags", "type", "usageMode"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::ACMPCA::CertificateAuthority`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_acmpca_CfnCertificateAuthorityMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnCertificateAuthorityPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnCertificateAuthorityMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnCertificateAuthority.isCfnCertificateAuthority(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnCertificateAuthorityPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnCertificateAuthorityPropsMixin = CfnCertificateAuthorityPropsMixin;
// @ts-ignore TS6133
function flattenCfnCertificateAuthorityPropsMixinCrlConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        crlDistributionPointExtensionConfiguration: (!props.crlDistributionPointExtensionConfiguration ? undefined : props.crlDistributionPointExtensionConfiguration),
        crlType: (!props.crlType ? undefined : props.crlType),
        customCname: (!props.customCname ? undefined : props.customCname),
        customPath: (!props.customPath ? undefined : props.customPath),
        enabled: (!props.enabled ? undefined : props.enabled),
        expirationInDays: (!props.expirationInDays ? undefined : props.expirationInDays),
        s3BucketName: (!props.s3BucketName ? undefined : cdk.getRefProperty(props.s3BucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.s3BucketName, "s3BucketName", "s3.IBucketRef | string")),
        s3ObjectAcl: (!props.s3ObjectAcl ? undefined : props.s3ObjectAcl)
    };
}
// @ts-ignore TS6133
function flattenCfnCertificateAuthorityPropsMixinRevocationConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        crlConfiguration: (!props.crlConfiguration ? undefined : (!props.crlConfiguration ? undefined : flattenCfnCertificateAuthorityPropsMixinCrlConfigurationProperty(props.crlConfiguration))),
        ocspConfiguration: (!props.ocspConfiguration ? undefined : props.ocspConfiguration)
    };
}
// @ts-ignore TS6133
function flattenCfnCertificateAuthorityMixinProps(props) {
    const ret = {};
    if ((props.revocationConfiguration !== undefined))
        ret.revocationConfiguration = flattenCfnCertificateAuthorityPropsMixinRevocationConfigurationProperty(props.revocationConfiguration);
    return ret;
}
/**
 * The `AWS::ACMPCA::CertificateAuthorityActivation` resource creates and installs a CA certificate on a CA.
 *
 * If no status is specified, the `AWS::ACMPCA::CertificateAuthorityActivation` resource status defaults to ACTIVE. Once the CA has a CA certificate installed, you can use the resource to toggle the CA status field between `ACTIVE` and `DISABLED` .
 *
 * @cloudformationResource AWS::ACMPCA::CertificateAuthorityActivation
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-acmpca-certificateauthorityactivation.html
 */
class CfnCertificateAuthorityActivationPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_acmpca.CfnCertificateAuthorityActivationPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["certificate", "certificateAuthorityArn", "certificateChain", "status"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::ACMPCA::CertificateAuthorityActivation`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_acmpca_CfnCertificateAuthorityActivationMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnCertificateAuthorityActivationPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnCertificateAuthorityActivationMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnCertificateAuthorityActivation.isCfnCertificateAuthorityActivation(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnCertificateAuthorityActivationPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnCertificateAuthorityActivationPropsMixin = CfnCertificateAuthorityActivationPropsMixin;
// @ts-ignore TS6133
function flattenCfnCertificateAuthorityActivationMixinProps(props) {
    const ret = {};
    if ((props.certificateAuthorityArn !== undefined))
        ret.certificateAuthorityArn = cdk.getRefProperty(props.certificateAuthorityArn?.certificateAuthorityRef, 'certificateAuthorityArn') ?? cdk.ensureStringOrUndefined(props.certificateAuthorityArn, "certificateAuthorityArn", "acmpca.ICertificateAuthorityRef | string");
    return ret;
}
/**
 * Grants permissions to the Certificate Manager ( ACM ) service principal ( `acm.amazonaws.com` ) to perform [IssueCertificate](https://docs.aws.amazon.com/privateca/latest/APIReference/API_IssueCertificate.html) , [GetCertificate](https://docs.aws.amazon.com/privateca/latest/APIReference/API_GetCertificate.html) , and [ListPermissions](https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListPermissions.html) actions on a CA. These actions are needed for the ACM principal to renew private PKI certificates requested through ACM and residing in the same AWS account as the CA.
 *
 * **About permissions** - If the private CA and the certificates it issues reside in the same account, you can use `AWS::ACMPCA::Permission` to grant permissions for ACM to carry out automatic certificate renewals.
 * - For automatic certificate renewal to succeed, the ACM service principal needs permissions to create, retrieve, and list permissions.
 * - If the private CA and the ACM certificates reside in different accounts, then permissions cannot be used to enable automatic renewals. Instead, the ACM certificate owner must set up a resource-based policy to enable cross-account issuance and renewals. For more information, see [Using a Resource Based Policy with AWS Private CA](https://docs.aws.amazon.com/privateca/latest/userguide/pca-rbp.html) .
 *
 * > To update an `AWS::ACMPCA::Permission` resource, you must first delete the existing permission resource from the CloudFormation stack and then create a new permission resource with updated properties.
 *
 * @cloudformationResource AWS::ACMPCA::Permission
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-acmpca-permission.html
 */
class CfnPermissionPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_acmpca.CfnPermissionPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["actions", "certificateAuthorityArn", "principal", "sourceAccount"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::ACMPCA::Permission`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_acmpca_CfnPermissionMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnPermissionPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnPermissionMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnPermission.isCfnPermission(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnPermissionPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnPermissionPropsMixin = CfnPermissionPropsMixin;
// @ts-ignore TS6133
function flattenCfnPermissionMixinProps(props) {
    const ret = {};
    if ((props.certificateAuthorityArn !== undefined))
        ret.certificateAuthorityArn = cdk.getRefProperty(props.certificateAuthorityArn?.certificateAuthorityRef, 'certificateAuthorityArn') ?? cdk.ensureStringOrUndefined(props.certificateAuthorityArn, "certificateAuthorityArn", "acmpca.ICertificateAuthorityRef | string");
    return ret;
}
