software.aws.awsprototypingsdk.pipeline.PDKPipeline Maven / Gradle / Ivy
package software.aws.awsprototypingsdk.pipeline;
/**
* An extension to CodePipeline which configures sane defaults for a NX Monorepo codebase.
*
* In addition to this, it also creates a CodeCommit repository with
* automated PR builds and approvals.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.71.0 (build f1f58ae)", date = "2022-12-07T01:30:43.797Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = software.aws.awsprototypingsdk.$Module.class, fqn = "aws-prototyping-sdk.pipeline.PDKPipeline")
public class PDKPipeline extends software.amazon.awscdk.pipelines.CodePipeline {
protected PDKPipeline(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected PDKPipeline(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public PDKPipeline(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.aws.awsprototypingsdk.pipeline.PDKPipelineProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* Deploy a single Stage by itself.
*
* Add a Stage to the pipeline, to be deployed in sequence with other
* Stages added to the pipeline. All Stacks in the stage will be deployed
* in an order automatically determined by their relative dependencies.
*
* @param stage This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.pipelines.StageDeployment addStage(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.Stage stage, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.pipelines.AddStageOpts options) {
return software.amazon.jsii.Kernel.call(this, "addStage", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.pipelines.StageDeployment.class), new Object[] { java.util.Objects.requireNonNull(stage, "stage is required"), options });
}
/**
* Deploy a single Stage by itself.
*
* Add a Stage to the pipeline, to be deployed in sequence with other
* Stages added to the pipeline. All Stacks in the stage will be deployed
* in an order automatically determined by their relative dependencies.
*
* @param stage This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.pipelines.StageDeployment addStage(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.Stage stage) {
return software.amazon.jsii.Kernel.call(this, "addStage", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.pipelines.StageDeployment.class), new Object[] { java.util.Objects.requireNonNull(stage, "stage is required") });
}
/**
* Send the current pipeline definition to the engine, and construct the pipeline.
*
* It is not possible to modify the pipeline after calling this method.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public void buildPipeline() {
software.amazon.jsii.Kernel.call(this, "buildPipeline", software.amazon.jsii.NativeType.VOID);
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void suppressCDKViolations() {
software.amazon.jsii.Kernel.call(this, "suppressCDKViolations", software.amazon.jsii.NativeType.VOID);
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.codecommit.Repository getCodeRepository() {
return software.amazon.jsii.Kernel.get(this, "codeRepository", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.codecommit.Repository.class));
}
/**
* A fluent builder for {@link software.aws.awsprototypingsdk.pipeline.PDKPipeline}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private final software.aws.awsprototypingsdk.pipeline.PDKPipelineProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new software.aws.awsprototypingsdk.pipeline.PDKPipelineProps.Builder();
}
/**
* The build step that produces the CDK Cloud Assembly.
*
* The primary output of this step needs to be the cdk.out
directory
* generated by the cdk synth
command.
*
* If you use a ShellStep
here and you don't configure an output directory,
* the output directory will automatically be assumed to be cdk.out
.
*
* @return {@code this}
* @param synth The build step that produces the CDK Cloud Assembly. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder synth(final software.amazon.awscdk.pipelines.IFileSetProducer synth) {
this.props.synth(synth);
return this;
}
/**
* Additional customizations to apply to the asset publishing CodeBuild projects.
*
* Default: - Only `codeBuildDefaults` are applied
*
* @return {@code this}
* @param assetPublishingCodeBuildDefaults Additional customizations to apply to the asset publishing CodeBuild projects. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder assetPublishingCodeBuildDefaults(final software.amazon.awscdk.pipelines.CodeBuildOptions assetPublishingCodeBuildDefaults) {
this.props.assetPublishingCodeBuildDefaults(assetPublishingCodeBuildDefaults);
return this;
}
/**
* CDK CLI version to use in self-mutation and asset publishing steps.
*
* If you want to lock the CDK CLI version used in the pipeline, by steps
* that are automatically generated for you, specify the version here.
*
* We recommend you do not specify this value, as not specifying it always
* uses the latest CLI version which is backwards compatible with old versions.
*
* If you do specify it, be aware that this version should always be equal to or higher than the
* version of the CDK framework used by the CDK app, when the CDK commands are
* run during your pipeline execution. When you change this version, the next
* time the SelfMutate
step runs it will still be using the CLI of the the
* previous version that was in this property: it will only start using the
* new version after SelfMutate
completes successfully. That means that if
* you want to update both framework and CLI version, you should update the
* CLI version first, commit, push and deploy, and only then update the
* framework version.
*
* Default: - Latest version
*
* @return {@code this}
* @param cliVersion CDK CLI version to use in self-mutation and asset publishing steps. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder cliVersion(final java.lang.String cliVersion) {
this.props.cliVersion(cliVersion);
return this;
}
/**
* Customize the CodeBuild projects created for this pipeline.
*
* Default: - All projects run non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_5_0
*
* @return {@code this}
* @param codeBuildDefaults Customize the CodeBuild projects created for this pipeline. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder codeBuildDefaults(final software.amazon.awscdk.pipelines.CodeBuildOptions codeBuildDefaults) {
this.props.codeBuildDefaults(codeBuildDefaults);
return this;
}
/**
* An existing Pipeline to be reused and built upon.
*
* [disable-awslint:ref-via-interface]
*
* Default: - a new underlying pipeline is created.
*
* @return {@code this}
* @param codePipeline An existing Pipeline to be reused and built upon. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder codePipeline(final software.amazon.awscdk.services.codepipeline.Pipeline codePipeline) {
this.props.codePipeline(codePipeline);
return this;
}
/**
* Create KMS keys for the artifact buckets, allowing cross-account deployments.
*
* The artifact buckets have to be encrypted to support deploying CDK apps to
* another account, so if you want to do that or want to have your artifact
* buckets encrypted, be sure to set this value to true
.
*
* Be aware there is a cost associated with maintaining the KMS keys.
*
* Default: false
*
* @return {@code this}
* @param crossAccountKeys Create KMS keys for the artifact buckets, allowing cross-account deployments. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder crossAccountKeys(final java.lang.Boolean crossAccountKeys) {
this.props.crossAccountKeys(crossAccountKeys);
return this;
}
/**
* A list of credentials used to authenticate to Docker registries.
*
* Specify any credentials necessary within the pipeline to build, synth, update, or publish assets.
*
* Default: []
*
* @return {@code this}
* @param dockerCredentials A list of credentials used to authenticate to Docker registries. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder dockerCredentials(final java.util.List extends software.amazon.awscdk.pipelines.DockerCredential> dockerCredentials) {
this.props.dockerCredentials(dockerCredentials);
return this;
}
/**
* Enable Docker for the self-mutate step.
*
* Set this to true if the pipeline itself uses Docker container assets
* (for example, if you use LinuxBuildImage.fromAsset()
as the build
* image of a CodeBuild step in the pipeline).
*
* You do not need to set it if you build Docker image assets in the
* application Stages and Stacks that are deployed by this pipeline.
*
* Configures privileged mode for the self-mutation CodeBuild action.
*
* If you are about to turn this on in an already-deployed Pipeline,
* set the value to true
first, commit and allow the pipeline to
* self-update, and only then use the Docker asset in the pipeline.
*
* Default: false
*
* @return {@code this}
* @param dockerEnabledForSelfMutation Enable Docker for the self-mutate step. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder dockerEnabledForSelfMutation(final java.lang.Boolean dockerEnabledForSelfMutation) {
this.props.dockerEnabledForSelfMutation(dockerEnabledForSelfMutation);
return this;
}
/**
* Enable Docker for the 'synth' step.
*
* Set this to true if you are using file assets that require
* "bundling" anywhere in your application (meaning an asset
* compilation step will be run with the tools provided by
* a Docker image), both for the Pipeline stack as well as the
* application stacks.
*
* A common way to use bundling assets in your application is by
* using the @aws-cdk/aws-lambda-nodejs
library.
*
* Configures privileged mode for the synth CodeBuild action.
*
* If you are about to turn this on in an already-deployed Pipeline,
* set the value to true
first, commit and allow the pipeline to
* self-update, and only then use the bundled asset.
*
* Default: false
*
* @return {@code this}
* @param dockerEnabledForSynth Enable Docker for the 'synth' step. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder dockerEnabledForSynth(final java.lang.Boolean dockerEnabledForSynth) {
this.props.dockerEnabledForSynth(dockerEnabledForSynth);
return this;
}
/**
* The name of the CodePipeline pipeline.
*
* Default: - Automatically generated
*
* @return {@code this}
* @param pipelineName The name of the CodePipeline pipeline. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder pipelineName(final java.lang.String pipelineName) {
this.props.pipelineName(pipelineName);
return this;
}
/**
* Publish assets in multiple CodeBuild projects.
*
* If set to false, use one Project per type to publish all assets.
*
* Publishing in parallel improves concurrency and may reduce publishing
* latency, but may also increase overall provisioning time of the CodeBuild
* projects.
*
* Experiment and see what value works best for you.
*
* Default: true
*
* @return {@code this}
* @param publishAssetsInParallel Publish assets in multiple CodeBuild projects. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder publishAssetsInParallel(final java.lang.Boolean publishAssetsInParallel) {
this.props.publishAssetsInParallel(publishAssetsInParallel);
return this;
}
/**
* Reuse the same cross region support stack for all pipelines in the App.
*
* Default: - true (Use the same support stack for all pipelines in App)
*
* @return {@code this}
* @param reuseCrossRegionSupportStacks Reuse the same cross region support stack for all pipelines in the App. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder reuseCrossRegionSupportStacks(final java.lang.Boolean reuseCrossRegionSupportStacks) {
this.props.reuseCrossRegionSupportStacks(reuseCrossRegionSupportStacks);
return this;
}
/**
* The IAM role to be assumed by this Pipeline.
*
* Default: - A new role is created
*
* @return {@code this}
* @param role The IAM role to be assumed by this Pipeline. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder role(final software.amazon.awscdk.services.iam.IRole role) {
this.props.role(role);
return this;
}
/**
* Whether the pipeline will update itself.
*
* This needs to be set to true
to allow the pipeline to reconfigure
* itself when assets or stages are being added to it, and true
is the
* recommended setting.
*
* You can temporarily set this to false
while you are iterating
* on the pipeline itself and prefer to deploy changes using cdk deploy
.
*
* Default: true
*
* @return {@code this}
* @param selfMutation Whether the pipeline will update itself. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder selfMutation(final java.lang.Boolean selfMutation) {
this.props.selfMutation(selfMutation);
return this;
}
/**
* Additional customizations to apply to the self mutation CodeBuild projects.
*
* Default: - Only `codeBuildDefaults` are applied
*
* @return {@code this}
* @param selfMutationCodeBuildDefaults Additional customizations to apply to the self mutation CodeBuild projects. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder selfMutationCodeBuildDefaults(final software.amazon.awscdk.pipelines.CodeBuildOptions selfMutationCodeBuildDefaults) {
this.props.selfMutationCodeBuildDefaults(selfMutationCodeBuildDefaults);
return this;
}
/**
* Additional customizations to apply to the synthesize CodeBuild projects.
*
* Default: - Only `codeBuildDefaults` are applied
*
* @return {@code this}
* @param synthCodeBuildDefaults Additional customizations to apply to the synthesize CodeBuild projects. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder synthCodeBuildDefaults(final software.amazon.awscdk.pipelines.CodeBuildOptions synthCodeBuildDefaults) {
this.props.synthCodeBuildDefaults(synthCodeBuildDefaults);
return this;
}
/**
* Deploy every stack by creating a change set and executing it.
*
* When enabled, creates a "Prepare" and "Execute" action for each stack. Disable
* to deploy the stack in one pipeline action.
*
* Default: true
*
* @return {@code this}
* @param useChangeSets Deploy every stack by creating a change set and executing it. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder useChangeSets(final java.lang.Boolean useChangeSets) {
this.props.useChangeSets(useChangeSets);
return this;
}
/**
* Output directory for cdk synthesized artifacts i.e: packages/infra/cdk.out.
*
* @return {@code this}
* @param primarySynthDirectory Output directory for cdk synthesized artifacts i.e: packages/infra/cdk.out. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder primarySynthDirectory(final java.lang.String primarySynthDirectory) {
this.props.primarySynthDirectory(primarySynthDirectory);
return this;
}
/**
* Name of the CodeCommit repository to create.
*
* @return {@code this}
* @param repositoryName Name of the CodeCommit repository to create. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder repositoryName(final java.lang.String repositoryName) {
this.props.repositoryName(repositoryName);
return this;
}
/**
* Possible values for a resource's Removal Policy The removal policy controls what happens to the resource if it stops being managed by CloudFormation.
*
* @return {@code this}
* @param codeCommitRemovalPolicy Possible values for a resource's Removal Policy The removal policy controls what happens to the resource if it stops being managed by CloudFormation. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder codeCommitRemovalPolicy(final software.amazon.awscdk.RemovalPolicy codeCommitRemovalPolicy) {
this.props.codeCommitRemovalPolicy(codeCommitRemovalPolicy);
return this;
}
/**
* Branch to trigger the pipeline execution.
*
* Default: mainline
*
* @return {@code this}
* @param defaultBranchName Branch to trigger the pipeline execution. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder defaultBranchName(final java.lang.String defaultBranchName) {
this.props.defaultBranchName(defaultBranchName);
return this;
}
/**
* Configuration for enabling Sonarqube code scanning on a successful synth.
*
* Default: undefined
*
* @return {@code this}
* @param sonarCodeScannerConfig Configuration for enabling Sonarqube code scanning on a successful synth. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder sonarCodeScannerConfig(final software.aws.awsprototypingsdk.pipeline.SonarCodeScannerConfig sonarCodeScannerConfig) {
this.props.sonarCodeScannerConfig(sonarCodeScannerConfig);
return this;
}
/**
* PDKPipeline by default assumes a NX Monorepo structure for it's codebase and uses sane defaults for the install and run commands.
*
* To override these defaults
* and/or provide additional inputs, specify env settings, etc you can provide
* a partial ShellStepProps.
*
* @return {@code this}
* @param synthShellStepPartialProps PDKPipeline by default assumes a NX Monorepo structure for it's codebase and uses sane defaults for the install and run commands. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder synthShellStepPartialProps(final software.amazon.awscdk.pipelines.ShellStepProps synthShellStepPartialProps) {
this.props.synthShellStepPartialProps(synthShellStepPartialProps);
return this;
}
/**
* @returns a newly built instance of {@link software.aws.awsprototypingsdk.pipeline.PDKPipeline}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public software.aws.awsprototypingsdk.pipeline.PDKPipeline build() {
return new software.aws.awsprototypingsdk.pipeline.PDKPipeline(
this.scope,
this.id,
this.props.build()
);
}
}
}