"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const actions = require("@aws-cdk/aws-codepipeline-api");
/**
 * Source that is provided by a specific Amazon S3 object.
 */
class AmazonS3Source extends actions.SourceAction {
    constructor(parent, name, props) {
        super(parent, name, {
            stage: props.stage,
            provider: 'S3',
            configuration: {
                S3Bucket: props.bucket.bucketName,
                S3ObjectKey: props.bucketKey,
                PollForSourceChanges: props.pollForSourceChanges || true
            },
            artifactName: props.artifactName
        });
        // pipeline needs permissions to read from the S3 bucket
        props.bucket.grantRead(props.stage.pipelineRole);
    }
}
exports.AmazonS3Source = AmazonS3Source;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiczMtc291cmNlLWFjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInMzLXNvdXJjZS1hY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5REFBMEQ7QUFpQzFEOztHQUVHO0FBQ0gsTUFBYSxjQUFlLFNBQVEsT0FBTyxDQUFDLFlBQVk7SUFDcEQsWUFBWSxNQUFxQixFQUFFLElBQVksRUFBRSxLQUEwQjtRQUN2RSxLQUFLLENBQUMsTUFBTSxFQUFFLElBQUksRUFBRTtZQUNoQixLQUFLLEVBQUUsS0FBSyxDQUFDLEtBQUs7WUFDbEIsUUFBUSxFQUFFLElBQUk7WUFDZCxhQUFhLEVBQUU7Z0JBQ1gsUUFBUSxFQUFFLEtBQUssQ0FBQyxNQUFNLENBQUMsVUFBVTtnQkFDakMsV0FBVyxFQUFFLEtBQUssQ0FBQyxTQUFTO2dCQUM1QixvQkFBb0IsRUFBRSxLQUFLLENBQUMsb0JBQW9CLElBQUksSUFBSTthQUMzRDtZQUNELFlBQVksRUFBRSxLQUFLLENBQUMsWUFBWTtTQUNuQyxDQUFDLENBQUM7UUFFSCx3REFBd0Q7UUFDeEQsS0FBSyxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxZQUFZLENBQUMsQ0FBQztJQUNyRCxDQUFDO0NBQ0o7QUFoQkQsd0NBZ0JDIn0=