"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.CfnDirectoryBucketPropsMixin = exports.CfnBucketPolicyPropsMixin = exports.CfnAccessPointPropsMixin = 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-s3express"));
/**
 * Access points simplify managing data access at scale for shared datasets in Amazon S3 .
 *
 * Access points are unique hostnames you create to enforce distinct permissions and network controls for all requests made through an access point. You can create hundreds of access points per bucket, each with a distinct name and permissions customized for each application. Each access point works in conjunction with the bucket policy that is attached to the underlying bucket. For more information, see [Managing access to shared datasets in directory buckets with access points](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-directory-buckets.html) .
 *
 * @cloudformationResource AWS::S3Express::AccessPoint
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3express-accesspoint.html
 */
class CfnAccessPointPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_s3express.CfnAccessPointPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["bucket", "bucketAccountId", "name", "policy", "publicAccessBlockConfiguration", "scope", "tags", "vpcConfiguration"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::S3Express::AccessPoint`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_s3express_CfnAccessPointMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnAccessPointPropsMixin);
            }
            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.CfnAccessPoint.isCfnAccessPoint(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnAccessPointPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnAccessPointPropsMixin = CfnAccessPointPropsMixin;
/**
 * The `AWS::S3Express::BucketPolicy` resource defines an Amazon S3 bucket policy to an Amazon S3 directory bucket.
 *
 * - **Permissions** - If you are using an identity other than the root user of the AWS account that owns the bucket, the calling identity must both have the required permissions on the specified bucket and belong to the bucket owner's account in order to use this operation. For more information about directory bucket policies and permissions, see [AWS Identity and Access Management (IAM) for S3 Express One Zone](https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-security-iam.html) in the *Amazon S3 User Guide* .
 *
 * > To ensure that bucket owners don't inadvertently lock themselves out of their own buckets, the root principal in a bucket owner's AWS account can perform the `GetBucketPolicy` , `PutBucketPolicy` , and `DeleteBucketPolicy` API actions, even if their bucket policy explicitly denies the root principal's access. Bucket owner root principals can only be blocked from performing these API actions by VPC endpoint policies and AWS Organizations policies.
 *
 * The required permissions for CloudFormation to use are based on the operations that are performed on the stack.
 *
 * - Create
 *
 * - s3express:GetBucketPolicy
 * - s3express:PutBucketPolicy
 * - Read
 *
 * - s3express:GetBucketPolicy
 * - Update
 *
 * - s3express:GetBucketPolicy
 * - s3express:PutBucketPolicy
 * - Delete
 *
 * - s3express:GetBucketPolicy
 * - s3express:DeleteBucketPolicy
 * - List
 *
 * - s3express:GetBucketPolicy
 * - s3express:ListAllMyDirectoryBuckets
 *
 * For more information about example bucket policies, see [Example bucket policies for S3 Express One Zone](https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-security-iam-example-bucket-policies.html) in the *Amazon S3 User Guide* .
 *
 * The following operations are related to `AWS::S3Express::BucketPolicy` :
 *
 * - [PutBucketPolicy](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketPolicy.html)
 * - [GetBucketPolicy](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketPolicy.html)
 * - [DeleteBucketPolicy](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketPolicy.html)
 * - [ListDirectoryBuckets](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListDirectoryBuckets.html)
 *
 * @cloudformationResource AWS::S3Express::BucketPolicy
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3express-bucketpolicy.html
 */
class CfnBucketPolicyPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_s3express.CfnBucketPolicyPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["bucket", "policyDocument"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::S3Express::BucketPolicy`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_s3express_CfnBucketPolicyMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnBucketPolicyPropsMixin);
            }
            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.CfnBucketPolicy.isCfnBucketPolicy(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnBucketPolicyPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnBucketPolicyPropsMixin = CfnBucketPolicyPropsMixin;
/**
 * The `AWS::S3Express::DirectoryBucket` resource defines an Amazon S3 directory bucket in the same AWS Region where you create the AWS CloudFormation stack.
 *
 * To control how AWS CloudFormation handles the bucket when the stack is deleted, you can set a deletion policy for your bucket. You can choose to *retain* the bucket or to *delete* the bucket. For more information, see [DeletionPolicy attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html) .
 *
 * > You can only delete empty buckets. Deletion fails for buckets that have contents.
 *
 * - **Permissions** - The required permissions for CloudFormation to use are based on the operations that are performed on the stack.
 *
 * - Create
 *
 * - s3express:CreateBucket
 * - s3express:ListAllMyDirectoryBuckets
 * - Read
 *
 * - s3express:ListAllMyDirectoryBuckets
 * - ec2:DescribeAvailabilityZones
 * - Delete
 *
 * - s3express:DeleteBucket
 * - s3express:ListAllMyDirectoryBuckets
 * - List
 *
 * - s3express:ListAllMyDirectoryBuckets
 * - PutBucketEncryption
 *
 * - s3express:PutEncryptionConfiguration
 * - To set a directory bucket default encryption with SSE-KMS, you must also have the kms:GenerateDataKey and kms:Decrypt permissions in IAM identity-based policies and AWS KMS key policies for the target AWS KMS key.
 * - GetBucketEncryption
 *
 * - s3express:GetBucketEncryption
 * - DeleteBucketEncryption
 *
 * - s3express:PutEncryptionConfiguration
 *
 * The following operations are related to `AWS::S3Express::DirectoryBucket` :
 *
 * - [CreateBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html)
 * - [ListDirectoryBuckets](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListDirectoryBuckets.html)
 * - [DeleteBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html)
 *
 * @cloudformationResource AWS::S3Express::DirectoryBucket
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3express-directorybucket.html
 */
class CfnDirectoryBucketPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_s3express.CfnDirectoryBucketPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["bucketEncryption", "bucketName", "dataRedundancy", "inventoryConfigurations", "lifecycleConfiguration", "locationName", "metricsConfigurations", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::S3Express::DirectoryBucket`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_s3express_CfnDirectoryBucketMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnDirectoryBucketPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnDirectoryBucketMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnDirectoryBucket.isCfnDirectoryBucket(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnDirectoryBucketPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnDirectoryBucketPropsMixin = CfnDirectoryBucketPropsMixin;
// @ts-ignore TS6133
function flattenCfnDirectoryBucketPropsMixinServerSideEncryptionByDefaultProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        kmsMasterKeyId: (!props.kmsMasterKeyId ? undefined : cdk.getRefProperty(props.kmsMasterKeyId?.keyRef, 'keyArn') ?? cdk.getRefProperty(props.kmsMasterKeyId?.keyRef, 'keyId') ?? cdk.ensureStringOrUndefined(props.kmsMasterKeyId, "kmsMasterKeyId", "kms.IKeyRef | string")),
        sseAlgorithm: (!props.sseAlgorithm ? undefined : props.sseAlgorithm)
    };
}
// @ts-ignore TS6133
function flattenCfnDirectoryBucketPropsMixinServerSideEncryptionRuleProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        bucketKeyEnabled: (!props.bucketKeyEnabled ? undefined : props.bucketKeyEnabled),
        serverSideEncryptionByDefault: (!props.serverSideEncryptionByDefault ? undefined : (!props.serverSideEncryptionByDefault ? undefined : flattenCfnDirectoryBucketPropsMixinServerSideEncryptionByDefaultProperty(props.serverSideEncryptionByDefault)))
    };
}
// @ts-ignore TS6133
function flattenCfnDirectoryBucketPropsMixinBucketEncryptionProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        serverSideEncryptionConfiguration: (!props.serverSideEncryptionConfiguration ? undefined : (cdk.isResolvableObject(props.serverSideEncryptionConfiguration) ? props.serverSideEncryptionConfiguration : cdk.mapArrayInPlace(props.serverSideEncryptionConfiguration, (item) => flattenCfnDirectoryBucketPropsMixinServerSideEncryptionRuleProperty(item))))
    };
}
// @ts-ignore TS6133
function flattenCfnDirectoryBucketMixinProps(props) {
    const ret = {};
    if ((props.bucketEncryption !== undefined))
        ret.bucketEncryption = flattenCfnDirectoryBucketPropsMixinBucketEncryptionProperty(props.bucketEncryption);
    return ret;
}
