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

com.pulumi.awsnative.route53recoverycontrol.kotlin.SafetyRule.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.route53recoverycontrol.kotlin

import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.awsnative.route53recoverycontrol.kotlin.enums.SafetyRuleStatus
import com.pulumi.awsnative.route53recoverycontrol.kotlin.outputs.SafetyRuleAssertionRule
import com.pulumi.awsnative.route53recoverycontrol.kotlin.outputs.SafetyRuleGatingRule
import com.pulumi.awsnative.route53recoverycontrol.kotlin.outputs.SafetyRuleRuleConfig
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.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin
import com.pulumi.awsnative.route53recoverycontrol.kotlin.enums.SafetyRuleStatus.Companion.toKotlin as safetyRuleStatusToKotlin
import com.pulumi.awsnative.route53recoverycontrol.kotlin.outputs.SafetyRuleAssertionRule.Companion.toKotlin as safetyRuleAssertionRuleToKotlin
import com.pulumi.awsnative.route53recoverycontrol.kotlin.outputs.SafetyRuleGatingRule.Companion.toKotlin as safetyRuleGatingRuleToKotlin
import com.pulumi.awsnative.route53recoverycontrol.kotlin.outputs.SafetyRuleRuleConfig.Companion.toKotlin as safetyRuleRuleConfigToKotlin

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

    public var args: SafetyRuleArgs = SafetyRuleArgs()

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

/**
 * Resource schema for AWS Route53 Recovery Control basic constructs and validation rules.
 */
public class SafetyRule internal constructor(
    override val javaResource: com.pulumi.awsnative.route53recoverycontrol.SafetyRule,
) : KotlinCustomResource(javaResource, SafetyRuleMapper) {
    /**
     * An assertion rule enforces that, when you change a routing control state, that the criteria that you set in the rule configuration is met. Otherwise, the change to the routing control is not accepted. For example, the criteria might be that at least one routing control state is `On` after the transaction so that traffic continues to flow to at least one cell for the application. This ensures that you avoid a fail-open scenario.
     */
    public val assertionRule: Output?
        get() = javaResource.assertionRule().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> safetyRuleAssertionRuleToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The Amazon Resource Name (ARN) of the control panel.
     */
    public val controlPanelArn: Output?
        get() = javaResource.controlPanelArn().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A gating rule verifies that a gating routing control or set of gating routing controls, evaluates as true, based on a rule configuration that you specify, which allows a set of routing control state changes to complete.
     * For example, if you specify one gating routing control and you set the `Type` in the rule configuration to `OR` , that indicates that you must set the gating routing control to `On` for the rule to evaluate as true; that is, for the gating control switch to be On. When you do that, then you can update the routing control states for the target routing controls that you specify in the gating rule.
     */
    public val gatingRule: Output?
        get() = javaResource.gatingRule().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    safetyRuleGatingRuleToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The name of the assertion rule. The name must be unique within a control panel. You can use any non-white space character in the name except the following: & > < ' (single quote) " (double quote) ; (semicolon)
     */
    public val name: Output?
        get() = javaResource.name().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The criteria that you set for specific assertion controls (routing controls) that designate how many control states must be `ON` as the result of a transaction. For example, if you have three assertion controls, you might specify `ATLEAST 2` for your rule configuration. This means that at least two assertion controls must be `ON` , so that at least two AWS Regions have traffic flowing to them.
     */
    public val ruleConfig: Output?
        get() = javaResource.ruleConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    safetyRuleRuleConfigToKotlin(args0)
                })
            }).orElse(null)
        })

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

    /**
     * The deployment status of the routing control. Status can be one of the following: PENDING, DEPLOYED, PENDING_DELETION.
     */
    public val status: Output
        get() = javaResource.status().applyValue({ args0 ->
            args0.let({ args0 ->
                safetyRuleStatusToKotlin(args0)
            })
        })

    /**
     * A collection of tags associated with a resource
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object SafetyRuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.route53recoverycontrol.SafetyRule::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy