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

com.pulumi.awsnative.xray.kotlin.SamplingRule.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.xray.kotlin

import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.awsnative.xray.kotlin.outputs.SamplingRuleRecord
import com.pulumi.awsnative.xray.kotlin.outputs.SamplingRuleUpdate
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.xray.kotlin.outputs.SamplingRule.Companion.toKotlin as samplingRuleToKotlin
import com.pulumi.awsnative.xray.kotlin.outputs.SamplingRuleRecord.Companion.toKotlin as samplingRuleRecordToKotlin
import com.pulumi.awsnative.xray.kotlin.outputs.SamplingRuleUpdate.Companion.toKotlin as samplingRuleUpdateToKotlin

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

    public var args: SamplingRuleArgs = SamplingRuleArgs()

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

/**
 * This schema provides construct and validation rules for AWS-XRay SamplingRule resource parameters.
 */
public class SamplingRule internal constructor(
    override val javaResource: com.pulumi.awsnative.xray.SamplingRule,
) : KotlinCustomResource(javaResource, SamplingRuleMapper) {
    /**
     * The sampling rule ARN that was created or updated.
     */
    public val ruleArn: Output
        get() = javaResource.ruleArn().applyValue({ args0 -> args0 })

    public val ruleName: Output?
        get() = javaResource.ruleName().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The sampling rule to be created or updated.
     */
    public val samplingRule: Output?
        get() = javaResource.samplingRule().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    samplingRuleToKotlin(args0)
                })
            }).orElse(null)
        })

    public val samplingRuleRecord: Output?
        get() = javaResource.samplingRuleRecord().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> samplingRuleRecordToKotlin(args0) })
            }).orElse(null)
        })

    public val samplingRuleUpdate: Output?
        get() = javaResource.samplingRuleUpdate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> samplingRuleUpdateToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * An array of key-value pairs to apply to this 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 SamplingRuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.xray.SamplingRule::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy