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

com.pulumi.awsnative.codestarnotifications.kotlin.NotificationRule.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: 1.24.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.codestarnotifications.kotlin

import com.pulumi.awsnative.codestarnotifications.kotlin.enums.NotificationRuleDetailType
import com.pulumi.awsnative.codestarnotifications.kotlin.enums.NotificationRuleStatus
import com.pulumi.awsnative.codestarnotifications.kotlin.outputs.NotificationRuleTarget
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.awsnative.codestarnotifications.kotlin.enums.NotificationRuleDetailType.Companion.toKotlin as notificationRuleDetailTypeToKotlin
import com.pulumi.awsnative.codestarnotifications.kotlin.enums.NotificationRuleStatus.Companion.toKotlin as notificationRuleStatusToKotlin
import com.pulumi.awsnative.codestarnotifications.kotlin.outputs.NotificationRuleTarget.Companion.toKotlin as notificationRuleTargetToKotlin

/**
 * Builder for [NotificationRule].
 */
@PulumiTagMarker
public class NotificationRuleResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: NotificationRuleArgs = NotificationRuleArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend NotificationRuleArgsBuilder.() -> Unit) {
        val builder = NotificationRuleArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): NotificationRule {
        val builtJavaResource =
            com.pulumi.awsnative.codestarnotifications.NotificationRule(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return NotificationRule(builtJavaResource)
    }
}

/**
 * Resource Type definition for AWS::CodeStarNotifications::NotificationRule
 */
public class NotificationRule internal constructor(
    override val javaResource: com.pulumi.awsnative.codestarnotifications.NotificationRule,
) : KotlinCustomResource(javaResource, NotificationRuleMapper) {
    /**
     * The Amazon Resource Name (ARN) of the notification rule.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * The name or email alias of the person who created the notification rule.
     */
    public val createdBy: Output?
        get() = javaResource.createdBy().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The level of detail to include in the notifications for this resource. `BASIC` will include only the contents of the event as it would appear in Amazon CloudWatch. `FULL` will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
     */
    public val detailType: Output
        get() = javaResource.detailType().applyValue({ args0 ->
            args0.let({ args0 ->
                notificationRuleDetailTypeToKotlin(args0)
            })
        })

    /**
     * The event type associated with this notification rule. For a complete list of event types and IDs, see [Notification concepts](https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api) in the *Developer Tools Console User Guide* .
     */
    public val eventTypeId: Output?
        get() = javaResource.eventTypeId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of event types associated with this notification rule. For a complete list of event types and IDs, see [Notification concepts](https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api) in the *Developer Tools Console User Guide* .
     */
    public val eventTypeIds: Output>
        get() = javaResource.eventTypeIds().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The name for the notification rule. Notification rule names must be unique in your AWS account .
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The Amazon Resource Name (ARN) of the resource to associate with the notification rule. Supported resources include pipelines in AWS CodePipeline , repositories in AWS CodeCommit , and build projects in AWS CodeBuild .
     */
    public val resource: Output
        get() = javaResource.resource().applyValue({ args0 -> args0 })

    /**
     * The status of the notification rule. The default value is `ENABLED` . If the status is set to `DISABLED` , notifications aren't sent for the notification rule.
     */
    public val status: Output?
        get() = javaResource.status().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    notificationRuleStatusToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A list of tags to apply to this notification rule. Key names cannot start with " `aws` ".
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The Amazon Resource Name (ARN) of the Amazon SNS topic or AWS Chatbot client.
     */
    public val targetAddress: Output?
        get() = javaResource.targetAddress().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of Amazon Resource Names (ARNs) of Amazon SNS topics and AWS Chatbot clients to associate with the notification rule.
     */
    public val targets: Output>
        get() = javaResource.targets().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    notificationRuleTargetToKotlin(args0)
                })
            })
        })
}

public object NotificationRuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.codestarnotifications.NotificationRule::class == javaResource::class

    override fun map(javaResource: Resource): NotificationRule = NotificationRule(
        javaResource as
            com.pulumi.awsnative.codestarnotifications.NotificationRule,
    )
}

/**
 * @see [NotificationRule].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [NotificationRule].
 */
public suspend fun notificationRule(
    name: String,
    block: suspend NotificationRuleResourceBuilder.() -> Unit,
): NotificationRule {
    val builder = NotificationRuleResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [NotificationRule].
 * @param name The _unique_ name of the resulting resource.
 */
public fun notificationRule(name: String): NotificationRule {
    val builder = NotificationRuleResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy