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

com.pulumi.awsnative.connect.kotlin.Rule.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.connect.kotlin

import com.pulumi.awsnative.connect.kotlin.enums.RulePublishStatus
import com.pulumi.awsnative.connect.kotlin.outputs.RuleActions
import com.pulumi.awsnative.connect.kotlin.outputs.RuleTriggerEventSource
import com.pulumi.awsnative.kotlin.outputs.Tag
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 com.pulumi.awsnative.connect.kotlin.enums.RulePublishStatus.Companion.toKotlin as rulePublishStatusToKotlin
import com.pulumi.awsnative.connect.kotlin.outputs.RuleActions.Companion.toKotlin as ruleActionsToKotlin
import com.pulumi.awsnative.connect.kotlin.outputs.RuleTriggerEventSource.Companion.toKotlin as ruleTriggerEventSourceToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

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

    public var args: RuleArgs = RuleArgs()

    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 RuleArgsBuilder.() -> Unit) {
        val builder = RuleArgsBuilder()
        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(): Rule {
        val builtJavaResource = com.pulumi.awsnative.connect.Rule(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Rule(builtJavaResource)
    }
}

/**
 * Resource Type definition for AWS:Connect::Rule
 */
public class Rule internal constructor(
    override val javaResource: com.pulumi.awsnative.connect.Rule,
) : KotlinCustomResource(javaResource, RuleMapper) {
    /**
     * The list of actions that will be executed when a rule is triggered.
     */
    public val actions: Output
        get() = javaResource.actions().applyValue({ args0 ->
            args0.let({ args0 ->
                ruleActionsToKotlin(args0)
            })
        })

    /**
     * The conditions of a rule.
     */
    public val function: Output
        get() = javaResource.function().applyValue({ args0 -> args0 })

    /**
     * The Amazon Resource Name (ARN) of the instance.
     */
    public val instanceArn: Output
        get() = javaResource.instanceArn().applyValue({ args0 -> args0 })

    /**
     * The name of the rule.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The publish status of a rule, either draft or published.
     */
    public val publishStatus: Output
        get() = javaResource.publishStatus().applyValue({ args0 ->
            args0.let({ args0 ->
                rulePublishStatusToKotlin(args0)
            })
        })

    /**
     * The Amazon Resource Name (ARN) of the rule.
     */
    public val ruleArn: Output
        get() = javaResource.ruleArn().applyValue({ args0 -> args0 })

    /**
     * One or more tags.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The event source that triggers the rule.
     */
    public val triggerEventSource: Output
        get() = javaResource.triggerEventSource().applyValue({ args0 ->
            args0.let({ args0 ->
                ruleTriggerEventSourceToKotlin(args0)
            })
        })
}

public object RuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.connect.Rule::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy