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

com.pulumi.cloudflare.kotlin.LoadBalancerMonitor.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.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.kotlin.outputs.LoadBalancerMonitorHeader
import com.pulumi.cloudflare.kotlin.outputs.LoadBalancerMonitorHeader.Companion.toKotlin
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

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

    public var args: LoadBalancerMonitorArgs = LoadBalancerMonitorArgs()

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

/**
 * If Cloudflare's Load Balancing to load-balance across multiple
 * origin servers or data centers, you configure one of these Monitors
 * to actively check the availability of those servers over HTTP(S) or
 * TCP.
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/loadBalancerMonitor:LoadBalancerMonitor example /
 * ```
 */
public class LoadBalancerMonitor internal constructor(
    override val javaResource: com.pulumi.cloudflare.LoadBalancerMonitor,
) : KotlinCustomResource(javaResource, LoadBalancerMonitorMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * Do not validate the certificate when monitor use HTTPS.  Only valid if `type` is "http" or "https".
     */
    public val allowInsecure: Output?
        get() = javaResource.allowInsecure().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times. Defaults to `0`.
     */
    public val consecutiveDown: Output?
        get() = javaResource.consecutiveDown().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * To be marked healthy the monitored origin must pass this healthcheck N consecutive times. Defaults to `0`.
     */
    public val consecutiveUp: Output?
        get() = javaResource.consecutiveUp().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The RFC3339 timestamp of when the load balancer monitor was created.
     */
    public val createdOn: Output
        get() = javaResource.createdOn().applyValue({ args0 -> args0 })

    /**
     * Free text description.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. Only valid if `type` is "http" or "https".
     */
    public val expectedBody: Output?
        get() = javaResource.expectedBody().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The expected HTTP response code or code range of the health check. Eg `2xx`. Only valid and required if `type` is "http" or "https".
     */
    public val expectedCodes: Output?
        get() = javaResource.expectedCodes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Follow redirects if returned by the origin. Only valid if `type` is "http" or "https".
     */
    public val followRedirects: Output?
        get() = javaResource.followRedirects().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.
     */
    public val headers: Output>?
        get() = javaResource.headers().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> toKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Defaults to `60`.
     */
    public val interval: Output?
        get() = javaResource.interval().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The method to use for the health check.
     */
    public val method: Output
        get() = javaResource.method().applyValue({ args0 -> args0 })

    /**
     * The RFC3339 timestamp of when the load balancer monitor was last modified.
     */
    public val modifiedOn: Output
        get() = javaResource.modifiedOn().applyValue({ args0 -> args0 })

    /**
     * The endpoint path to health check against.
     */
    public val path: Output
        get() = javaResource.path().applyValue({ args0 -> args0 })

    /**
     * The port number to use for the healthcheck, required when creating a TCP monitor.
     */
    public val port: Output?
        get() = javaResource.port().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Assign this monitor to emulate the specified zone while probing. Only valid if `type` is "http" or "https".
     */
    public val probeZone: Output?
        get() = javaResource.probeZone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Defaults to `2`.
     */
    public val retries: Output?
        get() = javaResource.retries().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The timeout (in seconds) before marking the health check as failed. Defaults to `5`.
     */
    public val timeout: Output?
        get() = javaResource.timeout().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The protocol to use for the healthcheck. Available values: `http`, `https`, `tcp`, `udp_icmp`, `icmp_ping`, `smtp`. Defaults to `http`.
     */
    public val type: Output?
        get() = javaResource.type().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object LoadBalancerMonitorMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.LoadBalancerMonitor::class == javaResource::class

    override fun map(javaResource: Resource): LoadBalancerMonitor = LoadBalancerMonitor(
        javaResource
            as com.pulumi.cloudflare.LoadBalancerMonitor,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy