import cloudwatch = require('@aws-cdk/aws-cloudwatch');
import events = require('@aws-cdk/aws-events');
import iam = require('@aws-cdk/aws-iam');
import kms = require('@aws-cdk/aws-kms');
import s3 = require('@aws-cdk/aws-s3');
import cdk = require('@aws-cdk/cdk');
import { BuildArtifacts } from './artifacts';
import { ProjectArn } from './codebuild.generated';
import { BuildSource } from './source';
/**
 * Properties of a reference to a CodeBuild Project.
 *
 * @see ProjectRef.import
 * @see ProjectRef.export
 */
export interface ProjectRefProps {
    /**
     * The human-readable name of the CodeBuild Project we're referencing.
     * The Project must be in the same account and region as the root Stack.
     */
    projectName: ProjectName;
}
/**
 * Represents a reference to a CodeBuild Project.
 *
 * If you're managing the Project alongside the rest of your CDK resources,
 * use the {@link Project} class.
 *
 * If you want to reference an already existing Project
 * (or one defined in a different CDK Stack),
 * use the {@link import} method.
 */
export declare abstract class ProjectRef extends cdk.Construct implements events.IEventRuleTarget {
    /**
     * Import a Project defined either outside the CDK,
     * or in a different CDK Stack
     * (and exported using the {@link export} method).
     *
     * @note if you're importing a CodeBuild Project for use
     *   in a CodePipeline, make sure the existing Project
     *   has permissions to access the S3 Bucket of that Pipeline -
     *   otherwise, builds in that Pipeline will always fail.
     *
     * @param parent the parent Construct for this Construct
     * @param name the logical name of this Construct
     * @param props the properties of the referenced Project
     * @returns a reference to the existing Project
     */
    static import(parent: cdk.Construct, name: string, props: ProjectRefProps): ProjectRef;
    /** The ARN of this Project. */
    abstract readonly projectArn: ProjectArn;
    /** The human-visible name of this Project. */
    abstract readonly projectName: ProjectName;
    /** The IAM service Role of this Project. Undefined for imported Projects. */
    abstract readonly role?: iam.Role;
    /** A role used by CloudWatch events to trigger a build */
    private eventsRole?;
    /**
     * Export this Project. Allows referencing this Project in a different CDK Stack.
     */
    export(): ProjectRefProps;
    /**
     * Defines a CloudWatch event rule triggered when the build project state
     * changes. You can filter specific build status events using an event
     * pattern filter on the `build-status` detail field:
     *
     *      const rule = project.onStateChange('OnBuildStarted', target);
     *      rule.addEventPattern({
     *          detail: {
     *              'build-status': [
     *                  "IN_PROGRESS",
     *                  "SUCCEEDED",
     *                  "FAILED",
     *                  "STOPPED"
     *              ]
     *          }
     *      });
     *
     * You can also use the methods `onBuildFailed` and `onBuildSucceeded` to define rules for
     * these specific state changes.
     *
     * @see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html
     */
    onStateChange(name: string, target?: events.IEventRuleTarget, options?: events.EventRuleProps): events.EventRule;
    /**
     * Defines a CloudWatch event rule that triggers upon phase change of this
     * build project.
     *
     * @see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html
     */
    onPhaseChange(name: string, target?: events.IEventRuleTarget, options?: events.EventRuleProps): events.EventRule;
    /**
     * Defines an event rule which triggers when a build starts.
     */
    onBuildStarted(name: string, target?: events.IEventRuleTarget, options?: events.EventRuleProps): events.EventRule;
    /**
     * Defines an event rule which triggers when a build fails.
     */
    onBuildFailed(name: string, target?: events.IEventRuleTarget, options?: events.EventRuleProps): events.EventRule;
    /**
     * Defines an event rule which triggers when a build completes successfully.
     */
    onBuildSucceeded(name: string, target?: events.IEventRuleTarget, options?: events.EventRuleProps): events.EventRule;
    /**
     * @returns a CloudWatch metric associated with this build project.
     * @param metricName The name of the metric
     * @param props Customization properties
     */
    metric(metricName: string, props: cloudwatch.MetricCustomization): cloudwatch.Metric;
    /**
     * Measures the number of builds triggered.
     *
     * Units: Count
     *
     * Valid CloudWatch statistics: Sum
     *
     * @default sum over 5 minutes
     */
    metricBuilds(props?: cloudwatch.MetricCustomization): cloudwatch.Metric;
    /**
     * Measures the duration of all builds over time.
     *
     * Units: Seconds
     *
     * Valid CloudWatch statistics: Average (recommended), Maximum, Minimum
     *
     * @default average over 5 minutes
     */
    metricDuration(props?: cloudwatch.MetricCustomization): cloudwatch.Metric;
    /**
     * Measures the number of successful builds.
     *
     * Units: Count
     *
     * Valid CloudWatch statistics: Sum
     *
     * @default sum over 5 minutes
     */
    metricSucceededBuilds(props?: cloudwatch.MetricCustomization): cloudwatch.Metric;
    /**
     * Measures the number of builds that failed because of client error or
     * because of a timeout.
     *
     * Units: Count
     *
     * Valid CloudWatch statistics: Sum
     *
     * @default sum over 5 minutes
     */
    metricFailedBuilds(props?: cloudwatch.MetricCustomization): cloudwatch.Metric;
    /**
     * Allows using build projects as event rule targets.
     */
    asEventRuleTarget(_ruleArn: events.RuleArn, _ruleId: string): events.EventRuleTargetProps;
}
export interface CommonProjectProps {
    /**
     * A description of the project. Use the description to identify the purpose
     * of the project.
     */
    description?: string;
    /**
     * Filename or contents of buildspec in JSON format.
     * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-example
     */
    buildSpec?: any;
    /**
     * Service Role to assume while running the build.
     * If not specified, a role will be created.
     */
    role?: iam.Role;
    /**
     * Encryption key to use to read and write artifacts
     * If not specified, a role will be created.
     */
    encryptionKey?: kms.EncryptionKeyRef;
    /**
     * Bucket to store cached source artifacts
     * If not specified, source artifacts will not be cached.
     */
    cacheBucket?: s3.BucketRef;
    /**
     * Subdirectory to store cached artifacts
     */
    cacheDir?: string;
    /**
     * Build environment to use for the build.
     */
    environment?: BuildEnvironment;
    /**
     * Indicates whether AWS CodeBuild generates a publicly accessible URL for
     * your project's build badge. For more information, see Build Badges Sample
     * in the AWS CodeBuild User Guide.
     */
    badge?: boolean;
    /**
     * The number of minutes after which AWS CodeBuild stops the build if it's
     * not complete. For valid values, see the timeoutInMinutes field in the AWS
     * CodeBuild User Guide.
     */
    timeout?: number;
    /**
     * Additional environment variables to add to the build environment.
     */
    environmentVariables?: {
        [name: string]: BuildEnvironmentVariable;
    };
    /**
     * The physical, human-readable name of the CodeBuild Project.
     */
    projectName?: string;
}
export interface ProjectProps extends CommonProjectProps {
    /**
     * The source of the build.
     */
    source: BuildSource;
    /**
     * Defines where build artifacts will be stored.
     * Could be: PipelineBuildArtifacts, NoBuildArtifacts and S3BucketBuildArtifacts.
     *
     * @default NoBuildArtifacts
     */
    artifacts?: BuildArtifacts;
}
/**
 * A representation of a CodeBuild Project.
 */
export declare class Project extends ProjectRef {
    /**
     * The IAM role for this project.
     */
    readonly role?: iam.Role;
    /**
     * The ARN of the project.
     */
    readonly projectArn: ProjectArn;
    /**
     * The name of the project.
     */
    readonly projectName: ProjectName;
    constructor(parent: cdk.Construct, name: string, props: ProjectProps);
    /**
     * Add a permission only if there's a policy attached.
     * @param statement The permissions statement to add
     */
    addToRolePolicy(statement: cdk.PolicyStatement): void;
    private createLoggingPermission;
    private renderEnvironment;
    private parseArtifacts;
    private validateCodePipelineSettings;
}
/**
 * Build machine compute type.
 */
export declare enum ComputeType {
    Small = "BUILD_GENERAL1_SMALL",
    Medium = "BUILD_GENERAL1_MEDIUM",
    Large = "BUILD_GENERAL1_LARGE"
}
export interface BuildEnvironment {
    /**
     * The image used for the builds.
     *
     * @default LinuxBuildImage.UBUNTU_14_04_BASE
     */
    buildImage?: IBuildImage;
    /**
     * The type of compute to use for this build.
     * See the {@link ComputeType} enum for the possible values.
     *
     * @default taken from {@link #buildImage#defaultComputeType}
     */
    computeType?: ComputeType;
    /**
     * Indicates how the project builds Docker images. Specify true to enable
     * running the Docker daemon inside a Docker container. This value must be
     * set to true only if this build project will be used to build Docker
     * images, and the specified build environment image is not one provided by
     * AWS CodeBuild with Docker support. Otherwise, all associated builds that
     * attempt to interact with the Docker daemon will fail.
     *
     * @default false
     */
    priviledged?: boolean;
    /**
     * The environment variables that your builds can use.
     */
    environmentVariables?: {
        [name: string]: BuildEnvironmentVariable;
    };
}
/**
 * Represents a Docker image used for the CodeBuild Project builds.
 * Use the concrete subclasses, either:
 * {@link LinuxBuildImage} or {@link WindowsBuildImage}.
 */
export interface IBuildImage {
    /**
     * The type of build environment.
     */
    readonly type: string;
    /**
     * The Docker image identifier that the build environment uses.
     *
     * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
     */
    readonly imageId: string;
    /**
     * The default {@link ComputeType} to use with this image,
     * if one was not specified in {@link BuildEnvironment#computeType} explicitly.
     */
    readonly defaultComputeType: ComputeType;
    /**
     * Allows the image a chance to validate whether the passed configuration is correct.
     *
     * @param buildEnvironment the current build environment
     */
    validate(buildEnvironment: BuildEnvironment): string[];
}
/**
 * A CodeBuild image running Linux.
 * This class has a bunch of public constants that represent the most popular images.
 * If you need to use with an image that isn't in the named constants,
 * you can always instantiate it directly.
 *
 * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
 */
export declare class LinuxBuildImage implements IBuildImage {
    readonly imageId: string;
    static readonly UBUNTU_14_04_BASE: LinuxBuildImage;
    static readonly UBUNTU_14_04_ANDROID_JAVA8_24_4_1: LinuxBuildImage;
    static readonly UBUNTU_14_04_ANDROID_JAVA8_26_1_1: LinuxBuildImage;
    static readonly UBUNTU_14_04_DOCKER_17_09_0: LinuxBuildImage;
    static readonly UBUNTU_14_04_GOLANG_1_10: LinuxBuildImage;
    static readonly UBUNTU_14_04_OPEN_JDK_8: LinuxBuildImage;
    static readonly UBUNTU_14_04_OPEN_JDK_9: LinuxBuildImage;
    static readonly UBUNTU_14_04_NODEJS_10_1_0: LinuxBuildImage;
    static readonly UBUNTU_14_04_NODEJS_8_11_0: LinuxBuildImage;
    static readonly UBUNTU_14_04_NODEJS_6_3_1: LinuxBuildImage;
    static readonly UBUNTU_14_04_PHP_5_6: LinuxBuildImage;
    static readonly UBUNTU_14_04_PHP_7_0: LinuxBuildImage;
    static readonly UBUNTU_14_04_PYTHON_3_6_5: LinuxBuildImage;
    static readonly UBUNTU_14_04_PYTHON_3_5_2: LinuxBuildImage;
    static readonly UBUNTU_14_04_PYTHON_3_4_5: LinuxBuildImage;
    static readonly UBUNTU_14_04_PYTHON_3_3_6: LinuxBuildImage;
    static readonly UBUNTU_14_04_PYTHON_2_7_12: LinuxBuildImage;
    static readonly UBUNTU_14_04_RUBY_2_5_1: LinuxBuildImage;
    static readonly UBUNTU_14_04_RUBY_2_3_1: LinuxBuildImage;
    static readonly UBUNTU_14_04_RUBY_2_2_5: LinuxBuildImage;
    static readonly UBUNTU_14_04_DOTNET_CORE_1_1: LinuxBuildImage;
    static readonly UBUNTU_14_04_DOTNET_CORE_2_0: LinuxBuildImage;
    static readonly UBUNTU_14_04_DOTNET_CORE_2_1: LinuxBuildImage;
    readonly type: string;
    readonly defaultComputeType: ComputeType;
    constructor(imageId: string);
    validate(_: BuildEnvironment): string[];
}
/**
 * A CodeBuild image running Windows.
 * This class has a bunch of public constants that represent the most popular images.
 * If you need to use with an image that isn't in the named constants,
 * you can always instantiate it directly.
 *
 * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
 */
export declare class WindowsBuildImage implements IBuildImage {
    readonly imageId: string;
    static readonly WIN_SERVER_CORE_2016_BASE: WindowsBuildImage;
    readonly type: string;
    readonly defaultComputeType: ComputeType;
    constructor(imageId: string);
    validate(buildEnvironment: BuildEnvironment): string[];
}
export interface BuildEnvironmentVariable {
    /**
     * The type of environment variable.
     * @default PlainText
     */
    type?: BuildEnvironmentVariableType;
    /**
     * The value of the environment variable (or the name of the parameter in
     * the SSM parameter store.)
     */
    value: any;
}
export declare enum BuildEnvironmentVariableType {
    /**
     * An environment variable in plaintext format.
     */
    PlainText = "PLAINTEXT",
    /**
     * An environment variable stored in Systems Manager Parameter Store.
     */
    ParameterStore = "PARAMETER_STORE"
}
export declare class ProjectName extends cdk.Token {
}
