"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.CfnWebhookPropsMixin = exports.CfnPipelinePropsMixin = exports.CfnCustomActionTypePropsMixin = 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-codepipeline"));
/**
 * The `AWS::CodePipeline::CustomActionType` resource creates a custom action for activities that aren't included in the CodePipeline default actions, such as running an internally developed build process or a test suite.
 *
 * You can use these custom actions in the stage of a pipeline. For more information, see [Create and Add a Custom Action in AWS CodePipeline](https://docs.aws.amazon.com/codepipeline/latest/userguide/how-to-create-custom-action.html) in the *AWS CodePipeline User Guide* .
 *
 * @cloudformationResource AWS::CodePipeline::CustomActionType
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html
 */
class CfnCustomActionTypePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_codepipeline.CfnCustomActionTypePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["category", "configurationProperties", "inputArtifactDetails", "outputArtifactDetails", "provider", "settings", "tags", "version"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::CodePipeline::CustomActionType`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_codepipeline_CfnCustomActionTypeMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnCustomActionTypePropsMixin);
            }
            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.CfnCustomActionType.isCfnCustomActionType(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnCustomActionTypePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnCustomActionTypePropsMixin = CfnCustomActionTypePropsMixin;
/**
 * The `AWS::CodePipeline::Pipeline` resource creates a CodePipeline pipeline that describes how software changes go through a release process.
 *
 * For more information, see [What Is CodePipeline?](https://docs.aws.amazon.com/codepipeline/latest/userguide/welcome.html) in the *CodePipeline User Guide* .
 *
 * For an example in YAML and JSON that contains the parameters in this reference, see [Examples](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#aws-resource-codepipeline-pipeline--examples) .
 *
 * @cloudformationResource AWS::CodePipeline::Pipeline
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html
 */
class CfnPipelinePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_codepipeline.CfnPipelinePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["artifactStore", "artifactStores", "disableInboundStageTransitions", "executionMode", "name", "pipelineType", "restartExecutionOnUpdate", "roleArn", "stages", "tags", "triggers", "variables"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::CodePipeline::Pipeline`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_codepipeline_CfnPipelineMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnPipelinePropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnPipelineMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnPipeline.isCfnPipeline(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnPipelinePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnPipelinePropsMixin = CfnPipelinePropsMixin;
// @ts-ignore TS6133
function flattenCfnPipelinePropsMixinEncryptionKeyProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        id: (!props.id ? undefined : cdk.getRefProperty(props.id?.keyRef, 'keyArn') ?? cdk.ensureStringOrUndefined(props.id, "id", "kms.IKeyRef | string")),
        type: (!props.type ? undefined : props.type)
    };
}
// @ts-ignore TS6133
function flattenCfnPipelinePropsMixinArtifactStoreProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        encryptionKey: (!props.encryptionKey ? undefined : (!props.encryptionKey ? undefined : flattenCfnPipelinePropsMixinEncryptionKeyProperty(props.encryptionKey))),
        location: (!props.location ? undefined : cdk.getRefProperty(props.location?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.location, "location", "s3.IBucketRef | string")),
        type: (!props.type ? undefined : props.type)
    };
}
// @ts-ignore TS6133
function flattenCfnPipelinePropsMixinArtifactStoreMapProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        artifactStore: (!props.artifactStore ? undefined : flattenCfnPipelinePropsMixinArtifactStoreProperty(props.artifactStore)),
        region: (!props.region ? undefined : props.region)
    };
}
// @ts-ignore TS6133
function flattenCfnPipelinePropsMixinActionDeclarationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        actionTypeId: (!props.actionTypeId ? undefined : props.actionTypeId),
        commands: (!props.commands ? undefined : props.commands),
        configuration: (!props.configuration ? undefined : props.configuration),
        environmentVariables: (!props.environmentVariables ? undefined : props.environmentVariables),
        inputArtifacts: (!props.inputArtifacts ? undefined : props.inputArtifacts),
        name: (!props.name ? undefined : props.name),
        namespace: (!props.namespace ? undefined : props.namespace),
        outputArtifacts: (!props.outputArtifacts ? undefined : props.outputArtifacts),
        outputVariables: (!props.outputVariables ? undefined : props.outputVariables),
        region: (!props.region ? undefined : props.region),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string")),
        runOrder: (!props.runOrder ? undefined : props.runOrder),
        timeoutInMinutes: (!props.timeoutInMinutes ? undefined : props.timeoutInMinutes)
    };
}
// @ts-ignore TS6133
function flattenCfnPipelinePropsMixinStageDeclarationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        actions: (!props.actions ? undefined : (cdk.isResolvableObject(props.actions) ? props.actions : cdk.mapArrayInPlace(props.actions, (item) => flattenCfnPipelinePropsMixinActionDeclarationProperty(item)))),
        beforeEntry: (!props.beforeEntry ? undefined : props.beforeEntry),
        blockers: (!props.blockers ? undefined : props.blockers),
        name: (!props.name ? undefined : props.name),
        onFailure: (!props.onFailure ? undefined : props.onFailure),
        onSuccess: (!props.onSuccess ? undefined : props.onSuccess)
    };
}
// @ts-ignore TS6133
function flattenCfnPipelineMixinProps(props) {
    const ret = {};
    if ((props.artifactStore !== undefined))
        ret.artifactStore = flattenCfnPipelinePropsMixinArtifactStoreProperty(props.artifactStore);
    if ((props.artifactStores !== undefined))
        ret.artifactStores = (cdk.isResolvableObject(props.artifactStores) ? props.artifactStores : cdk.mapArrayInPlace(props.artifactStores, (item) => flattenCfnPipelinePropsMixinArtifactStoreMapProperty(item)));
    if ((props.roleArn !== undefined))
        ret.roleArn = cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string");
    if ((props.stages !== undefined))
        ret.stages = (cdk.isResolvableObject(props.stages) ? props.stages : cdk.mapArrayInPlace(props.stages, (item) => flattenCfnPipelinePropsMixinStageDeclarationProperty(item)));
    return ret;
}
/**
 * The `AWS::CodePipeline::Webhook` resource creates and registers your webhook.
 *
 * After the webhook is created and registered, it triggers your pipeline to start every time an external event occurs. For more information, see [Migrate polling pipelines to use event-based change detection](https://docs.aws.amazon.com/codepipeline/latest/userguide/update-change-detection.html) in the *AWS CodePipeline User Guide* .
 *
 * We strongly recommend that you use AWS Secrets Manager to store your credentials. If you use Secrets Manager, you must have already configured and stored your secret parameters in Secrets Manager. For more information, see [Using Dynamic References to Specify Template Values](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#dynamic-references-secretsmanager) .
 *
 * > When passing secret parameters, do not enter the value directly into the template. The value is rendered as plaintext and is therefore readable. For security reasons, do not use plaintext in your AWS CloudFormation template to store your credentials.
 *
 * @cloudformationResource AWS::CodePipeline::Webhook
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html
 */
class CfnWebhookPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_codepipeline.CfnWebhookPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["authentication", "authenticationConfiguration", "filters", "name", "registerWithThirdParty", "targetAction", "targetPipeline", "targetPipelineVersion"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::CodePipeline::Webhook`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_codepipeline_CfnWebhookMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnWebhookPropsMixin);
            }
            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.CfnWebhook.isCfnWebhook(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnWebhookPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnWebhookPropsMixin = CfnWebhookPropsMixin;
