![JAR search and dependency download from the Maven repository](/logo.png)
io.cloudshiftdev.awscdk.services.codepipeline.GitConfiguration.kt Maven / Gradle / Ivy
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.codepipeline
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import kotlin.Unit
import kotlin.collections.List
/**
* Git configuration for trigger.
*
* Example:
*
* ```
* CodeStarConnectionsSourceAction sourceAction;
* CodeBuildAction buildAction;
* Pipeline.Builder.create(this, "Pipeline")
* .pipelineType(PipelineType.V2)
* .stages(List.of(StageProps.builder()
* .stageName("Source")
* .actions(List.of(sourceAction))
* .build(), StageProps.builder()
* .stageName("Build")
* .actions(List.of(buildAction))
* .build()))
* .triggers(List.of(TriggerProps.builder()
* .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)
* .gitConfiguration(GitConfiguration.builder()
* .sourceAction(sourceAction)
* .pushFilter(List.of(GitPushFilter.builder()
* .tagsExcludes(List.of("exclude1", "exclude2"))
* .tagsIncludes(List.of("include*"))
* .build()))
* .build())
* .build()))
* .build();
* ```
*/
public interface GitConfiguration {
/**
* The field where the repository event that will start the pipeline is specified as pull
* requests.
*
* The length must be less than or equal to 3.
*
* Default: - no filter.
*/
public fun pullRequestFilter(): List =
unwrap(this).getPullRequestFilter()?.map(GitPullRequestFilter::wrap) ?: emptyList()
/**
* The field where the repository event that will start the pipeline, such as pushing Git tags, is
* specified with details.
*
* Git tags is the only supported event type.
*
* The length must be less than or equal to 3.
*
* Default: - no filter.
*/
public fun pushFilter(): List =
unwrap(this).getPushFilter()?.map(GitPushFilter::wrap) ?: emptyList()
/**
* The pipeline source action where the trigger configuration, such as Git tags.
*
* The trigger configuration will start the pipeline upon the specified change only.
* You can only specify one trigger configuration per source action.
*
* Since the provider for `sourceAction` must be `CodeStarSourceConnection`, you can use
* `CodeStarConnectionsSourceAction` construct in `aws-codepipeline-actions` module.
*/
public fun sourceAction(): IAction
/**
* A builder for [GitConfiguration]
*/
@CdkDslMarker
public interface Builder {
/**
* @param pullRequestFilter The field where the repository event that will start the pipeline is
* specified as pull requests.
* The length must be less than or equal to 3.
*/
public fun pullRequestFilter(pullRequestFilter: List)
/**
* @param pullRequestFilter The field where the repository event that will start the pipeline is
* specified as pull requests.
* The length must be less than or equal to 3.
*/
public fun pullRequestFilter(vararg pullRequestFilter: GitPullRequestFilter)
/**
* @param pushFilter The field where the repository event that will start the pipeline, such as
* pushing Git tags, is specified with details.
* Git tags is the only supported event type.
*
* The length must be less than or equal to 3.
*/
public fun pushFilter(pushFilter: List)
/**
* @param pushFilter The field where the repository event that will start the pipeline, such as
* pushing Git tags, is specified with details.
* Git tags is the only supported event type.
*
* The length must be less than or equal to 3.
*/
public fun pushFilter(vararg pushFilter: GitPushFilter)
/**
* @param sourceAction The pipeline source action where the trigger configuration, such as Git
* tags.
* The trigger configuration will start the pipeline upon the specified change only.
* You can only specify one trigger configuration per source action.
*
* Since the provider for `sourceAction` must be `CodeStarSourceConnection`, you can use
* `CodeStarConnectionsSourceAction` construct in `aws-codepipeline-actions` module.
*/
public fun sourceAction(sourceAction: IAction)
}
private class BuilderImpl : Builder {
private val cdkBuilder: software.amazon.awscdk.services.codepipeline.GitConfiguration.Builder =
software.amazon.awscdk.services.codepipeline.GitConfiguration.builder()
/**
* @param pullRequestFilter The field where the repository event that will start the pipeline is
* specified as pull requests.
* The length must be less than or equal to 3.
*/
override fun pullRequestFilter(pullRequestFilter: List) {
cdkBuilder.pullRequestFilter(pullRequestFilter.map(GitPullRequestFilter.Companion::unwrap))
}
/**
* @param pullRequestFilter The field where the repository event that will start the pipeline is
* specified as pull requests.
* The length must be less than or equal to 3.
*/
override fun pullRequestFilter(vararg pullRequestFilter: GitPullRequestFilter): Unit =
pullRequestFilter(pullRequestFilter.toList())
/**
* @param pushFilter The field where the repository event that will start the pipeline, such as
* pushing Git tags, is specified with details.
* Git tags is the only supported event type.
*
* The length must be less than or equal to 3.
*/
override fun pushFilter(pushFilter: List) {
cdkBuilder.pushFilter(pushFilter.map(GitPushFilter.Companion::unwrap))
}
/**
* @param pushFilter The field where the repository event that will start the pipeline, such as
* pushing Git tags, is specified with details.
* Git tags is the only supported event type.
*
* The length must be less than or equal to 3.
*/
override fun pushFilter(vararg pushFilter: GitPushFilter): Unit =
pushFilter(pushFilter.toList())
/**
* @param sourceAction The pipeline source action where the trigger configuration, such as Git
* tags.
* The trigger configuration will start the pipeline upon the specified change only.
* You can only specify one trigger configuration per source action.
*
* Since the provider for `sourceAction` must be `CodeStarSourceConnection`, you can use
* `CodeStarConnectionsSourceAction` construct in `aws-codepipeline-actions` module.
*/
override fun sourceAction(sourceAction: IAction) {
cdkBuilder.sourceAction(sourceAction.let(IAction.Companion::unwrap))
}
public fun build(): software.amazon.awscdk.services.codepipeline.GitConfiguration =
cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.codepipeline.GitConfiguration,
) : CdkObject(cdkObject),
GitConfiguration {
/**
* The field where the repository event that will start the pipeline is specified as pull
* requests.
*
* The length must be less than or equal to 3.
*
* Default: - no filter.
*/
override fun pullRequestFilter(): List =
unwrap(this).getPullRequestFilter()?.map(GitPullRequestFilter::wrap) ?: emptyList()
/**
* The field where the repository event that will start the pipeline, such as pushing Git tags,
* is specified with details.
*
* Git tags is the only supported event type.
*
* The length must be less than or equal to 3.
*
* Default: - no filter.
*/
override fun pushFilter(): List =
unwrap(this).getPushFilter()?.map(GitPushFilter::wrap) ?: emptyList()
/**
* The pipeline source action where the trigger configuration, such as Git tags.
*
* The trigger configuration will start the pipeline upon the specified change only.
* You can only specify one trigger configuration per source action.
*
* Since the provider for `sourceAction` must be `CodeStarSourceConnection`, you can use
* `CodeStarConnectionsSourceAction` construct in `aws-codepipeline-actions` module.
*/
override fun sourceAction(): IAction = unwrap(this).getSourceAction().let(IAction::wrap)
}
public companion object {
public operator fun invoke(block: Builder.() -> Unit = {}): GitConfiguration {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.codepipeline.GitConfiguration):
GitConfiguration = CdkObjectWrappers.wrap(cdkObject) as? GitConfiguration ?:
Wrapper(cdkObject)
internal fun unwrap(wrapped: GitConfiguration):
software.amazon.awscdk.services.codepipeline.GitConfiguration = (wrapped as
CdkObject).cdkObject as software.amazon.awscdk.services.codepipeline.GitConfiguration
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy