"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cdk_1 = require("@aws-cdk/cdk");
/**
 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-parameter-override-functions.html
 */
class ArtifactAttribute extends cdk_1.Token {
    constructor(artifact, attributeName) {
        super(() => ({ 'Fn::GetArtifactAtt': [artifact.name, attributeName] }));
    }
}
exports.ArtifactAttribute = ArtifactAttribute;
/**
 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-parameter-override-functions.html
 */
class ArtifactGetParam extends cdk_1.Token {
    constructor(artifact, jsonFile, keyName) {
        super(() => ({ 'Fn::GetParam': [artifact.name, jsonFile, keyName] }));
    }
}
exports.ArtifactGetParam = ArtifactGetParam;
/**
 * An output artifact of an action. Artifacts can be used as input by some actions.
 */
class Artifact extends cdk_1.Construct {
    constructor(parent, name) {
        super(parent, name);
        this.name = name;
    }
    /**
     * Returns an ArtifactPath for a file within this artifact.
     * Output is in the form "<artifact-name>::<file-name>"
     * @param fileName The name of the file
     */
    subartifact(fileName) {
        return new ArtifactPath(this, fileName);
    }
    /**
     * The artifact attribute for the name of the S3 bucket where the artifact is stored.
     */
    get bucketName() {
        return new ArtifactAttribute(this, 'BucketName');
    }
    /**
     * The artifact attribute for The name of the .zip file that contains the artifact that is
     * generated by AWS CodePipeline, such as 1ABCyZZ.zip.
     */
    get objectKey() {
        return new ArtifactAttribute(this, 'ObjectKey');
    }
    /**
     * The artifact attribute of the Amazon Simple Storage Service (Amazon S3) URL of the artifact,
     * such as https://s3-us-west-2.amazonaws.com/artifactstorebucket-yivczw8jma0c/test/TemplateSo/1ABCyZZ.zip.
     */
    get url() {
        return new ArtifactAttribute(this, 'URL');
    }
    /**
     * Returns a token for a value inside a JSON file within this artifact.
     * @param jsonFile The JSON file name.
     * @param keyName The hash key.
     */
    getParam(jsonFile, keyName) {
        return new ArtifactGetParam(this, jsonFile, keyName);
    }
    toString() {
        return this.name;
    }
}
exports.Artifact = Artifact;
/**
 * A specific file within an output artifact.
 *
 * The most common use case for this is specifying the template file
 * for a CloudFormation action.
 */
class ArtifactPath {
    constructor(artifact, fileName) {
        this.artifact = artifact;
        this.fileName = fileName;
    }
    get location() {
        return `${this.artifact.name}::${this.fileName}`;
    }
}
exports.ArtifactPath = ArtifactPath;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJ0aWZhY3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhcnRpZmFjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHNDQUFnRDtBQUdoRDs7R0FFRztBQUNILE1BQWEsaUJBQWtCLFNBQVEsV0FBSztJQUN4QyxZQUFZLFFBQWtCLEVBQUUsYUFBcUI7UUFDakQsS0FBSyxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUMsRUFBRSxvQkFBb0IsRUFBRSxDQUFDLFFBQVEsQ0FBQyxJQUFJLEVBQUUsYUFBYSxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7SUFDNUUsQ0FBQztDQUNKO0FBSkQsOENBSUM7QUFFRDs7R0FFRztBQUNILE1BQWEsZ0JBQWlCLFNBQVEsV0FBSztJQUN2QyxZQUFZLFFBQWtCLEVBQUUsUUFBZ0IsRUFBRSxPQUFlO1FBQzdELEtBQUssQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFDLEVBQUUsY0FBYyxFQUFFLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSxRQUFRLEVBQUUsT0FBTyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7SUFDMUUsQ0FBQztDQUNKO0FBSkQsNENBSUM7QUFFRDs7R0FFRztBQUNILE1BQWEsUUFBUyxTQUFRLGVBQVM7SUFDbkMsWUFBWSxNQUFjLEVBQVcsSUFBWTtRQUM3QyxLQUFLLENBQUMsTUFBTSxFQUFFLElBQUksQ0FBQyxDQU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