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

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

package com.pulumi.awsnative.synthetics.kotlin

import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryArtifactConfig
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryCode
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryRunConfig
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanarySchedule
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryVisualReference
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryVpcConfig
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.Int
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.synthetics.kotlin.outputs.CanaryArtifactConfig.Companion.toKotlin as canaryArtifactConfigToKotlin
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryCode.Companion.toKotlin as canaryCodeToKotlin
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryRunConfig.Companion.toKotlin as canaryRunConfigToKotlin
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanarySchedule.Companion.toKotlin as canaryScheduleToKotlin
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryVisualReference.Companion.toKotlin as canaryVisualReferenceToKotlin
import com.pulumi.awsnative.synthetics.kotlin.outputs.CanaryVpcConfig.Companion.toKotlin as canaryVpcConfigToKotlin

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

    public var args: CanaryArgs = CanaryArgs()

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

/**
 * Resource Type definition for AWS::Synthetics::Canary
 * ## Example Usage
 * ### Example
 * No Java example available.
 * ### Example
 * No Java example available.
 */
public class Canary internal constructor(
    override val javaResource: com.pulumi.awsnative.synthetics.Canary,
) : KotlinCustomResource(javaResource, CanaryMapper) {
    /**
     * Provide artifact configuration
     */
    public val artifactConfig: Output?
        get() = javaResource.artifactConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> canaryArtifactConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Provide the s3 bucket output location for test results
     */
    public val artifactS3Location: Output
        get() = javaResource.artifactS3Location().applyValue({ args0 -> args0 })

    /**
     * Id of the canary
     */
    public val awsId: Output
        get() = javaResource.awsId().applyValue({ args0 -> args0 })

    /**
     * Provide the canary script source
     */
    public val code: Output
        get() = javaResource.code().applyValue({ args0 ->
            args0.let({ args0 ->
                canaryCodeToKotlin(args0)
            })
        })

    /**
     * Deletes associated lambda resources created by Synthetics if set to True. Default is False
     */
    public val deleteLambdaResourcesOnCanaryDeletion: Output?
        get() = javaResource.deleteLambdaResourcesOnCanaryDeletion().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * Lambda Execution role used to run your canaries
     */
    public val executionRoleArn: Output
        get() = javaResource.executionRoleArn().applyValue({ args0 -> args0 })

    /**
     * Retention period of failed canary runs represented in number of days
     */
    public val failureRetentionPeriod: Output?
        get() = javaResource.failureRetentionPeriod().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * Provide canary run configuration
     */
    public val runConfig: Output?
        get() = javaResource.runConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    canaryRunConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Runtime version of Synthetics Library
     */
    public val runtimeVersion: Output
        get() = javaResource.runtimeVersion().applyValue({ args0 -> args0 })

    /**
     * Frequency to run your canaries
     */
    public val schedule: Output
        get() = javaResource.schedule().applyValue({ args0 ->
            args0.let({ args0 ->
                canaryScheduleToKotlin(args0)
            })
        })

    /**
     * Runs canary if set to True. Default is False
     */
    public val startCanaryAfterCreation: Output?
        get() = javaResource.startCanaryAfterCreation().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * State of the canary
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * Retention period of successful canary runs represented in number of days
     */
    public val successRetentionPeriod: Output?
        get() = javaResource.successRetentionPeriod().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The list of key-value pairs that are associated with the canary.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Visual reference configuration for visual testing
     */
    public val visualReference: Output?
        get() = javaResource.visualReference().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> canaryVisualReferenceToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Provide VPC Configuration if enabled.
     */
    public val vpcConfig: Output?
        get() = javaResource.vpcConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    canaryVpcConfigToKotlin(args0)
                })
            }).orElse(null)
        })
}

public object CanaryMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.synthetics.Canary::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy