All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.codepipeline.kotlin.WebhookArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.codepipeline.kotlin

import com.pulumi.aws.codepipeline.WebhookArgs.builder
import com.pulumi.aws.codepipeline.kotlin.inputs.WebhookAuthenticationConfigurationArgs
import com.pulumi.aws.codepipeline.kotlin.inputs.WebhookAuthenticationConfigurationArgsBuilder
import com.pulumi.aws.codepipeline.kotlin.inputs.WebhookFilterArgs
import com.pulumi.aws.codepipeline.kotlin.inputs.WebhookFilterArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Provides a CodePipeline Webhook.
 * ## Example Usage
 * 
 * ```yaml
 * resources:
 *   bar:
 *     type: aws:codepipeline:Pipeline
 *     properties:
 *       name: tf-test-pipeline
 *       roleArn: ${barAwsIamRole.arn}
 *       artifactStores:
 *         - location: ${barAwsS3Bucket.bucket}
 *           type: S3
 *           encryptionKey:
 *             id: ${s3kmskey.arn}
 *             type: KMS
 *       stages:
 *         - name: Source
 *           actions:
 *             - name: Source
 *               category: Source
 *               owner: ThirdParty
 *               provider: GitHub
 *               version: '1'
 *               outputArtifacts:
 *                 - test
 *               configuration:
 *                 Owner: my-organization
 *                 Repo: test
 *                 Branch: master
 *         - name: Build
 *           actions:
 *             - name: Build
 *               category: Build
 *               owner: AWS
 *               provider: CodeBuild
 *               inputArtifacts:
 *                 - test
 *               version: '1'
 *               configuration:
 *                 ProjectName: test
 *   barWebhook:
 *     type: aws:codepipeline:Webhook
 *     name: bar
 *     properties:
 *       name: test-webhook-github-bar
 *       authentication: GITHUB_HMAC
 *       targetAction: Source
 *       targetPipeline: ${bar.name}
 *       authenticationConfiguration:
 *         secretToken: ${webhookSecret}
 *       filters:
 *         - jsonPath: $.ref
 *           matchEquals: refs/heads/{Branch}
 *   # Wire the CodePipeline webhook into a GitHub repository.
 *   barRepositoryWebhook:
 *     type: github:RepositoryWebhook
 *     name: bar
 *     properties:
 *       repository: ${repo.name}
 *       name: web
 *       configuration:
 *         url: ${barWebhook.url}
 *         contentType: json
 *         insecureSsl: true
 *         secret: ${webhookSecret}
 *       events:
 *         - push
 * variables:
 *   webhookSecret: super-secret
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import CodePipeline Webhooks using their ARN. For example:
 * ```sh
 * $ pulumi import aws:codepipeline/webhook:Webhook example arn:aws:codepipeline:us-west-2:123456789012:webhook:example
 * ```
 * @property authentication The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
 * @property authenticationConfiguration An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
 * @property filters One or more `filter` blocks. Filter blocks are documented below.
 * @property name The name of the webhook.
 * @property tags A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
 * @property targetAction The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
 * @property targetPipeline The name of the pipeline.
 */
public data class WebhookArgs(
    public val authentication: Output? = null,
    public val authenticationConfiguration: Output? = null,
    public val filters: Output>? = null,
    public val name: Output? = null,
    public val tags: Output>? = null,
    public val targetAction: Output? = null,
    public val targetPipeline: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.codepipeline.WebhookArgs =
        com.pulumi.aws.codepipeline.WebhookArgs.builder()
            .authentication(authentication?.applyValue({ args0 -> args0 }))
            .authenticationConfiguration(
                authenticationConfiguration?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .filters(
                filters?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .targetAction(targetAction?.applyValue({ args0 -> args0 }))
            .targetPipeline(targetPipeline?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [WebhookArgs].
 */
@PulumiTagMarker
public class WebhookArgsBuilder internal constructor() {
    private var authentication: Output? = null

    private var authenticationConfiguration: Output? = null

    private var filters: Output>? = null

    private var name: Output? = null

    private var tags: Output>? = null

    private var targetAction: Output? = null

    private var targetPipeline: Output? = null

    /**
     * @param value The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
     */
    @JvmName("dkigeolkfhjbeame")
    public suspend fun authentication(`value`: Output) {
        this.authentication = value
    }

    /**
     * @param value An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
     */
    @JvmName("unnbyqioesncmgvp")
    public suspend fun authenticationConfiguration(`value`: Output) {
        this.authenticationConfiguration = value
    }

    /**
     * @param value One or more `filter` blocks. Filter blocks are documented below.
     */
    @JvmName("nsqfoyhjpskqxeak")
    public suspend fun filters(`value`: Output>) {
        this.filters = value
    }

    @JvmName("driudfpftfaglmgc")
    public suspend fun filters(vararg values: Output) {
        this.filters = Output.all(values.asList())
    }

    /**
     * @param values One or more `filter` blocks. Filter blocks are documented below.
     */
    @JvmName("agruonnksnsnhqtq")
    public suspend fun filters(values: List>) {
        this.filters = Output.all(values)
    }

    /**
     * @param value The name of the webhook.
     */
    @JvmName("sioqwffhgxdhtcvm")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("qfotxqmilbopkqfr")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
     */
    @JvmName("sioetypntalrfhor")
    public suspend fun targetAction(`value`: Output) {
        this.targetAction = value
    }

    /**
     * @param value The name of the pipeline.
     */
    @JvmName("mjqjgrfoieshirgp")
    public suspend fun targetPipeline(`value`: Output) {
        this.targetPipeline = value
    }

    /**
     * @param value The type of authentication  to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
     */
    @JvmName("wodosdkwnrtcdkdo")
    public suspend fun authentication(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authentication = mapped
    }

    /**
     * @param value An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
     */
    @JvmName("nnbajqswheleukfu")
    public suspend fun authenticationConfiguration(`value`: WebhookAuthenticationConfigurationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authenticationConfiguration = mapped
    }

    /**
     * @param argument An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
     */
    @JvmName("ydaichaprnjrvebh")
    public suspend fun authenticationConfiguration(argument: suspend WebhookAuthenticationConfigurationArgsBuilder.() -> Unit) {
        val toBeMapped = WebhookAuthenticationConfigurationArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.authenticationConfiguration = mapped
    }

    /**
     * @param value One or more `filter` blocks. Filter blocks are documented below.
     */
    @JvmName("ycrjenkgvsdywtie")
    public suspend fun filters(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.filters = mapped
    }

    /**
     * @param argument One or more `filter` blocks. Filter blocks are documented below.
     */
    @JvmName("wlvisydeidwgevda")
    public suspend fun filters(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            WebhookFilterArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param argument One or more `filter` blocks. Filter blocks are documented below.
     */
    @JvmName("fmrpwupnnyrfccfm")
    public suspend fun filters(vararg argument: suspend WebhookFilterArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            WebhookFilterArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param argument One or more `filter` blocks. Filter blocks are documented below.
     */
    @JvmName("keixgkxdyjbfmwex")
    public suspend fun filters(argument: suspend WebhookFilterArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(WebhookFilterArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param values One or more `filter` blocks. Filter blocks are documented below.
     */
    @JvmName("enfmerwjadpknich")
    public suspend fun filters(vararg values: WebhookFilterArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.filters = mapped
    }

    /**
     * @param value The name of the webhook.
     */
    @JvmName("cifyyvvpufwddbnl")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("liybxttylqnyrpsn")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("mvfogpeswlbjhsqq")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
     */
    @JvmName("ykcuatvhvrcjneur")
    public suspend fun targetAction(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.targetAction = mapped
    }

    /**
     * @param value The name of the pipeline.
     */
    @JvmName("fvsmbmmmwhujihls")
    public suspend fun targetPipeline(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.targetPipeline = mapped
    }

    internal fun build(): WebhookArgs = WebhookArgs(
        authentication = authentication,
        authenticationConfiguration = authenticationConfiguration,
        filters = filters,
        name = name,
        tags = tags,
        targetAction = targetAction,
        targetPipeline = targetPipeline,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy