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

com.pulumi.cloudflare.kotlin.HealthcheckArgs.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: 5.40.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.HealthcheckArgs.builder
import com.pulumi.cloudflare.kotlin.inputs.HealthcheckHeaderArgs
import com.pulumi.cloudflare.kotlin.inputs.HealthcheckHeaderArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Standalone Health Checks provide a way to monitor origin servers
 * without needing a Cloudflare Load Balancer.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * // HTTPS Healthcheck
 * const httpHealthCheck = new cloudflare.Healthcheck("http_health_check", {
 *     zoneId: cloudflareZoneId,
 *     name: "http-health-check",
 *     description: "example http health check",
 *     address: "example.com",
 *     suspended: false,
 *     checkRegions: [
 *         "WEU",
 *         "EEU",
 *     ],
 *     type: "HTTPS",
 *     port: 443,
 *     method: "GET",
 *     path: "/health",
 *     expectedBody: "alive",
 *     expectedCodes: [
 *         "2xx",
 *         "301",
 *     ],
 *     followRedirects: true,
 *     allowInsecure: false,
 *     headers: [{
 *         header: "Host",
 *         values: ["example.com"],
 *     }],
 *     timeout: 10,
 *     retries: 2,
 *     interval: 60,
 *     consecutiveFails: 3,
 *     consecutiveSuccesses: 2,
 * });
 * // TCP Healthcheck
 * const tcpHealthCheck = new cloudflare.Healthcheck("tcp_health_check", {
 *     zoneId: cloudflareZoneId,
 *     name: "tcp-health-check",
 *     description: "example tcp health check",
 *     address: "example.com",
 *     suspended: false,
 *     checkRegions: [
 *         "WEU",
 *         "EEU",
 *     ],
 *     type: "TCP",
 *     port: 22,
 *     method: "connection_established",
 *     timeout: 10,
 *     retries: 2,
 *     interval: 60,
 *     consecutiveFails: 3,
 *     consecutiveSuccesses: 2,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * # HTTPS Healthcheck
 * http_health_check = cloudflare.Healthcheck("http_health_check",
 *     zone_id=cloudflare_zone_id,
 *     name="http-health-check",
 *     description="example http health check",
 *     address="example.com",
 *     suspended=False,
 *     check_regions=[
 *         "WEU",
 *         "EEU",
 *     ],
 *     type="HTTPS",
 *     port=443,
 *     method="GET",
 *     path="/health",
 *     expected_body="alive",
 *     expected_codes=[
 *         "2xx",
 *         "301",
 *     ],
 *     follow_redirects=True,
 *     allow_insecure=False,
 *     headers=[{
 *         "header": "Host",
 *         "values": ["example.com"],
 *     }],
 *     timeout=10,
 *     retries=2,
 *     interval=60,
 *     consecutive_fails=3,
 *     consecutive_successes=2)
 * # TCP Healthcheck
 * tcp_health_check = cloudflare.Healthcheck("tcp_health_check",
 *     zone_id=cloudflare_zone_id,
 *     name="tcp-health-check",
 *     description="example tcp health check",
 *     address="example.com",
 *     suspended=False,
 *     check_regions=[
 *         "WEU",
 *         "EEU",
 *     ],
 *     type="TCP",
 *     port=22,
 *     method="connection_established",
 *     timeout=10,
 *     retries=2,
 *     interval=60,
 *     consecutive_fails=3,
 *     consecutive_successes=2)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     // HTTPS Healthcheck
 *     var httpHealthCheck = new Cloudflare.Healthcheck("http_health_check", new()
 *     {
 *         ZoneId = cloudflareZoneId,
 *         Name = "http-health-check",
 *         Description = "example http health check",
 *         Address = "example.com",
 *         Suspended = false,
 *         CheckRegions = new[]
 *         {
 *             "WEU",
 *             "EEU",
 *         },
 *         Type = "HTTPS",
 *         Port = 443,
 *         Method = "GET",
 *         Path = "/health",
 *         ExpectedBody = "alive",
 *         ExpectedCodes = new[]
 *         {
 *             "2xx",
 *             "301",
 *         },
 *         FollowRedirects = true,
 *         AllowInsecure = false,
 *         Headers = new[]
 *         {
 *             new Cloudflare.Inputs.HealthcheckHeaderArgs
 *             {
 *                 Header = "Host",
 *                 Values = new[]
 *                 {
 *                     "example.com",
 *                 },
 *             },
 *         },
 *         Timeout = 10,
 *         Retries = 2,
 *         Interval = 60,
 *         ConsecutiveFails = 3,
 *         ConsecutiveSuccesses = 2,
 *     });
 *     // TCP Healthcheck
 *     var tcpHealthCheck = new Cloudflare.Healthcheck("tcp_health_check", new()
 *     {
 *         ZoneId = cloudflareZoneId,
 *         Name = "tcp-health-check",
 *         Description = "example tcp health check",
 *         Address = "example.com",
 *         Suspended = false,
 *         CheckRegions = new[]
 *         {
 *             "WEU",
 *             "EEU",
 *         },
 *         Type = "TCP",
 *         Port = 22,
 *         Method = "connection_established",
 *         Timeout = 10,
 *         Retries = 2,
 *         Interval = 60,
 *         ConsecutiveFails = 3,
 *         ConsecutiveSuccesses = 2,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		// HTTPS Healthcheck
 * 		_, err := cloudflare.NewHealthcheck(ctx, "http_health_check", &cloudflare.HealthcheckArgs{
 * 			ZoneId:      pulumi.Any(cloudflareZoneId),
 * 			Name:        pulumi.String("http-health-check"),
 * 			Description: pulumi.String("example http health check"),
 * 			Address:     pulumi.String("example.com"),
 * 			Suspended:   pulumi.Bool(false),
 * 			CheckRegions: pulumi.StringArray{
 * 				pulumi.String("WEU"),
 * 				pulumi.String("EEU"),
 * 			},
 * 			Type:         pulumi.String("HTTPS"),
 * 			Port:         pulumi.Int(443),
 * 			Method:       pulumi.String("GET"),
 * 			Path:         pulumi.String("/health"),
 * 			ExpectedBody: pulumi.String("alive"),
 * 			ExpectedCodes: pulumi.StringArray{
 * 				pulumi.String("2xx"),
 * 				pulumi.String("301"),
 * 			},
 * 			FollowRedirects: pulumi.Bool(true),
 * 			AllowInsecure:   pulumi.Bool(false),
 * 			Headers: cloudflare.HealthcheckHeaderArray{
 * 				&cloudflare.HealthcheckHeaderArgs{
 * 					Header: pulumi.String("Host"),
 * 					Values: pulumi.StringArray{
 * 						pulumi.String("example.com"),
 * 					},
 * 				},
 * 			},
 * 			Timeout:              pulumi.Int(10),
 * 			Retries:              pulumi.Int(2),
 * 			Interval:             pulumi.Int(60),
 * 			ConsecutiveFails:     pulumi.Int(3),
 * 			ConsecutiveSuccesses: pulumi.Int(2),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// TCP Healthcheck
 * 		_, err = cloudflare.NewHealthcheck(ctx, "tcp_health_check", &cloudflare.HealthcheckArgs{
 * 			ZoneId:      pulumi.Any(cloudflareZoneId),
 * 			Name:        pulumi.String("tcp-health-check"),
 * 			Description: pulumi.String("example tcp health check"),
 * 			Address:     pulumi.String("example.com"),
 * 			Suspended:   pulumi.Bool(false),
 * 			CheckRegions: pulumi.StringArray{
 * 				pulumi.String("WEU"),
 * 				pulumi.String("EEU"),
 * 			},
 * 			Type:                 pulumi.String("TCP"),
 * 			Port:                 pulumi.Int(22),
 * 			Method:               pulumi.String("connection_established"),
 * 			Timeout:              pulumi.Int(10),
 * 			Retries:              pulumi.Int(2),
 * 			Interval:             pulumi.Int(60),
 * 			ConsecutiveFails:     pulumi.Int(3),
 * 			ConsecutiveSuccesses: pulumi.Int(2),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.cloudflare.Healthcheck;
 * import com.pulumi.cloudflare.HealthcheckArgs;
 * import com.pulumi.cloudflare.inputs.HealthcheckHeaderArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         // HTTPS Healthcheck
 *         var httpHealthCheck = new Healthcheck("httpHealthCheck", HealthcheckArgs.builder()
 *             .zoneId(cloudflareZoneId)
 *             .name("http-health-check")
 *             .description("example http health check")
 *             .address("example.com")
 *             .suspended(false)
 *             .checkRegions(
 *                 "WEU",
 *                 "EEU")
 *             .type("HTTPS")
 *             .port(443)
 *             .method("GET")
 *             .path("/health")
 *             .expectedBody("alive")
 *             .expectedCodes(
 *                 "2xx",
 *                 "301")
 *             .followRedirects(true)
 *             .allowInsecure(false)
 *             .headers(HealthcheckHeaderArgs.builder()
 *                 .header("Host")
 *                 .values("example.com")
 *                 .build())
 *             .timeout(10)
 *             .retries(2)
 *             .interval(60)
 *             .consecutiveFails(3)
 *             .consecutiveSuccesses(2)
 *             .build());
 *         // TCP Healthcheck
 *         var tcpHealthCheck = new Healthcheck("tcpHealthCheck", HealthcheckArgs.builder()
 *             .zoneId(cloudflareZoneId)
 *             .name("tcp-health-check")
 *             .description("example tcp health check")
 *             .address("example.com")
 *             .suspended(false)
 *             .checkRegions(
 *                 "WEU",
 *                 "EEU")
 *             .type("TCP")
 *             .port(22)
 *             .method("connection_established")
 *             .timeout(10)
 *             .retries(2)
 *             .interval(60)
 *             .consecutiveFails(3)
 *             .consecutiveSuccesses(2)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # HTTPS Healthcheck
 *   httpHealthCheck:
 *     type: cloudflare:Healthcheck
 *     name: http_health_check
 *     properties:
 *       zoneId: ${cloudflareZoneId}
 *       name: http-health-check
 *       description: example http health check
 *       address: example.com
 *       suspended: false
 *       checkRegions:
 *         - WEU
 *         - EEU
 *       type: HTTPS
 *       port: 443
 *       method: GET
 *       path: /health
 *       expectedBody: alive
 *       expectedCodes:
 *         - 2xx
 *         - '301'
 *       followRedirects: true
 *       allowInsecure: false
 *       headers:
 *         - header: Host
 *           values:
 *             - example.com
 *       timeout: 10
 *       retries: 2
 *       interval: 60
 *       consecutiveFails: 3
 *       consecutiveSuccesses: 2
 *   # TCP Healthcheck
 *   tcpHealthCheck:
 *     type: cloudflare:Healthcheck
 *     name: tcp_health_check
 *     properties:
 *       zoneId: ${cloudflareZoneId}
 *       name: tcp-health-check
 *       description: example tcp health check
 *       address: example.com
 *       suspended: false
 *       checkRegions:
 *         - WEU
 *         - EEU
 *       type: TCP
 *       port: 22
 *       method: connection_established
 *       timeout: 10
 *       retries: 2
 *       interval: 60
 *       consecutiveFails: 3
 *       consecutiveSuccesses: 2
 * ```
 * 
 * ## Import
 * Use the Zone ID and Healthcheck ID to import.
 * ```sh
 * $ pulumi import cloudflare:index/healthcheck:Healthcheck example /
 * ```
 * @property address The hostname or IP address of the origin server to run health checks on.
 * @property allowInsecure Do not validate the certificate when the health check uses HTTPS. Defaults to `false`.
 * @property checkRegions A list of regions from which to run health checks. If not set, Cloudflare will pick a default region. Available values: `WNAM`, `ENAM`, `WEU`, `EEU`, `NSAM`, `SSAM`, `OC`, `ME`, `NAF`, `SAF`, `IN`, `SEAS`, `NEAS`, `ALL_REGIONS`.
 * @property consecutiveFails The number of consecutive fails required from a health check before changing the health to unhealthy. Defaults to `1`.
 * @property consecutiveSuccesses The number of consecutive successes required from a health check before changing the health to healthy. Defaults to `1`.
 * @property description A human-readable description of the health check.
 * @property expectedBody 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.
 * @property expectedCodes The expected HTTP response codes (e.g. '200') or code ranges (e.g. '2xx' for all codes starting with 2) of the health check.
 * @property followRedirects Follow redirects if the origin returns a 3xx status code. Defaults to `false`.
 * @property headers 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.
 * @property interval The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase the load on the origin as we check from multiple locations. Defaults to `60`.
 * @property method The HTTP method to use for the health check. Available values: `connection_established`, `GET`, `HEAD`.
 * @property name A short name to identify the health check. Only alphanumeric characters, hyphens, and underscores are allowed.
 * @property path The endpoint path to health check against. Defaults to `/`.
 * @property port Port number to connect to for the health check. Defaults to `80`.
 * @property retries The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Defaults to `2`.
 * @property suspended If suspended, no health checks are sent to the origin. Defaults to `false`.
 * @property timeout The timeout (in seconds) before marking the health check as failed. Defaults to `5`.
 * @property type The protocol to use for the health check. Available values: `TCP`, `HTTP`, `HTTPS`.
 * @property zoneId The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
 */
public data class HealthcheckArgs(
    public val address: Output? = null,
    public val allowInsecure: Output? = null,
    public val checkRegions: Output>? = null,
    public val consecutiveFails: Output? = null,
    public val consecutiveSuccesses: Output? = null,
    public val description: Output? = null,
    public val expectedBody: Output? = null,
    public val expectedCodes: Output>? = null,
    public val followRedirects: Output? = null,
    public val headers: Output>? = null,
    public val interval: Output? = null,
    public val method: Output? = null,
    public val name: Output? = null,
    public val path: Output? = null,
    public val port: Output? = null,
    public val retries: Output? = null,
    public val suspended: Output? = null,
    public val timeout: Output? = null,
    public val type: Output? = null,
    public val zoneId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.cloudflare.HealthcheckArgs =
        com.pulumi.cloudflare.HealthcheckArgs.builder()
            .address(address?.applyValue({ args0 -> args0 }))
            .allowInsecure(allowInsecure?.applyValue({ args0 -> args0 }))
            .checkRegions(checkRegions?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .consecutiveFails(consecutiveFails?.applyValue({ args0 -> args0 }))
            .consecutiveSuccesses(consecutiveSuccesses?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .expectedBody(expectedBody?.applyValue({ args0 -> args0 }))
            .expectedCodes(expectedCodes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .followRedirects(followRedirects?.applyValue({ args0 -> args0 }))
            .headers(
                headers?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .interval(interval?.applyValue({ args0 -> args0 }))
            .method(method?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .path(path?.applyValue({ args0 -> args0 }))
            .port(port?.applyValue({ args0 -> args0 }))
            .retries(retries?.applyValue({ args0 -> args0 }))
            .suspended(suspended?.applyValue({ args0 -> args0 }))
            .timeout(timeout?.applyValue({ args0 -> args0 }))
            .type(type?.applyValue({ args0 -> args0 }))
            .zoneId(zoneId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [HealthcheckArgs].
 */
@PulumiTagMarker
public class HealthcheckArgsBuilder internal constructor() {
    private var address: Output? = null

    private var allowInsecure: Output? = null

    private var checkRegions: Output>? = null

    private var consecutiveFails: Output? = null

    private var consecutiveSuccesses: Output? = null

    private var description: Output? = null

    private var expectedBody: Output? = null

    private var expectedCodes: Output>? = null

    private var followRedirects: Output? = null

    private var headers: Output>? = null

    private var interval: Output? = null

    private var method: Output? = null

    private var name: Output? = null

    private var path: Output? = null

    private var port: Output? = null

    private var retries: Output? = null

    private var suspended: Output? = null

    private var timeout: Output? = null

    private var type: Output? = null

    private var zoneId: Output? = null

    /**
     * @param value The hostname or IP address of the origin server to run health checks on.
     */
    @JvmName("omjifxpnlcddxygb")
    public suspend fun address(`value`: Output) {
        this.address = value
    }

    /**
     * @param value Do not validate the certificate when the health check uses HTTPS. Defaults to `false`.
     */
    @JvmName("ubpcukbkcnskhydh")
    public suspend fun allowInsecure(`value`: Output) {
        this.allowInsecure = value
    }

    /**
     * @param value A list of regions from which to run health checks. If not set, Cloudflare will pick a default region. Available values: `WNAM`, `ENAM`, `WEU`, `EEU`, `NSAM`, `SSAM`, `OC`, `ME`, `NAF`, `SAF`, `IN`, `SEAS`, `NEAS`, `ALL_REGIONS`.
     */
    @JvmName("pyaulxcsrdungmdr")
    public suspend fun checkRegions(`value`: Output>) {
        this.checkRegions = value
    }

    @JvmName("yyuegxgdjwbmwxaa")
    public suspend fun checkRegions(vararg values: Output) {
        this.checkRegions = Output.all(values.asList())
    }

    /**
     * @param values A list of regions from which to run health checks. If not set, Cloudflare will pick a default region. Available values: `WNAM`, `ENAM`, `WEU`, `EEU`, `NSAM`, `SSAM`, `OC`, `ME`, `NAF`, `SAF`, `IN`, `SEAS`, `NEAS`, `ALL_REGIONS`.
     */
    @JvmName("cftnfbsckwyxrbis")
    public suspend fun checkRegions(values: List>) {
        this.checkRegions = Output.all(values)
    }

    /**
     * @param value The number of consecutive fails required from a health check before changing the health to unhealthy. Defaults to `1`.
     */
    @JvmName("obpyeicgmsnmplme")
    public suspend fun consecutiveFails(`value`: Output) {
        this.consecutiveFails = value
    }

    /**
     * @param value The number of consecutive successes required from a health check before changing the health to healthy. Defaults to `1`.
     */
    @JvmName("lkhebfipkkeuaqxa")
    public suspend fun consecutiveSuccesses(`value`: Output) {
        this.consecutiveSuccesses = value
    }

    /**
     * @param value A human-readable description of the health check.
     */
    @JvmName("uiebrrujosoqjxvv")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value 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.
     */
    @JvmName("tabsbxjshimvukrs")
    public suspend fun expectedBody(`value`: Output) {
        this.expectedBody = value
    }

    /**
     * @param value The expected HTTP response codes (e.g. '200') or code ranges (e.g. '2xx' for all codes starting with 2) of the health check.
     */
    @JvmName("btgqvavskmlnjmfx")
    public suspend fun expectedCodes(`value`: Output>) {
        this.expectedCodes = value
    }

    @JvmName("rliannflimppvtdv")
    public suspend fun expectedCodes(vararg values: Output) {
        this.expectedCodes = Output.all(values.asList())
    }

    /**
     * @param values The expected HTTP response codes (e.g. '200') or code ranges (e.g. '2xx' for all codes starting with 2) of the health check.
     */
    @JvmName("kvuihcivlxaaosnb")
    public suspend fun expectedCodes(values: List>) {
        this.expectedCodes = Output.all(values)
    }

    /**
     * @param value Follow redirects if the origin returns a 3xx status code. Defaults to `false`.
     */
    @JvmName("gxvvqribtrcmnkdo")
    public suspend fun followRedirects(`value`: Output) {
        this.followRedirects = value
    }

    /**
     * @param value 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.
     */
    @JvmName("ngstdqxphapmjtly")
    public suspend fun headers(`value`: Output>) {
        this.headers = value
    }

    @JvmName("xgbgpqqqwugqikro")
    public suspend fun headers(vararg values: Output) {
        this.headers = Output.all(values.asList())
    }

    /**
     * @param values 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.
     */
    @JvmName("ntjaghvtfevtmlwf")
    public suspend fun headers(values: List>) {
        this.headers = Output.all(values)
    }

    /**
     * @param value The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase the load on the origin as we check from multiple locations. Defaults to `60`.
     */
    @JvmName("foycqqgyuhpgasmp")
    public suspend fun interval(`value`: Output) {
        this.interval = value
    }

    /**
     * @param value The HTTP method to use for the health check. Available values: `connection_established`, `GET`, `HEAD`.
     */
    @JvmName("ilguyjaiqhexmtnu")
    public suspend fun method(`value`: Output) {
        this.method = value
    }

    /**
     * @param value A short name to identify the health check. Only alphanumeric characters, hyphens, and underscores are allowed.
     */
    @JvmName("dqsqputmuyvktamm")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The endpoint path to health check against. Defaults to `/`.
     */
    @JvmName("wyqaxbhfiuhmwydd")
    public suspend fun path(`value`: Output) {
        this.path = value
    }

    /**
     * @param value Port number to connect to for the health check. Defaults to `80`.
     */
    @JvmName("ytufvlxeypyjvdww")
    public suspend fun port(`value`: Output) {
        this.port = value
    }

    /**
     * @param value The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Defaults to `2`.
     */
    @JvmName("lcwihpwdbgivfkgf")
    public suspend fun retries(`value`: Output) {
        this.retries = value
    }

    /**
     * @param value If suspended, no health checks are sent to the origin. Defaults to `false`.
     */
    @JvmName("dfmqbsadpqolghtv")
    public suspend fun suspended(`value`: Output) {
        this.suspended = value
    }

    /**
     * @param value The timeout (in seconds) before marking the health check as failed. Defaults to `5`.
     */
    @JvmName("pavvehnshcigdymj")
    public suspend fun timeout(`value`: Output) {
        this.timeout = value
    }

    /**
     * @param value The protocol to use for the health check. Available values: `TCP`, `HTTP`, `HTTPS`.
     */
    @JvmName("mqkcpmoljtylygpa")
    public suspend fun type(`value`: Output) {
        this.type = value
    }

    /**
     * @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("olpcngpluvsabffc")
    public suspend fun zoneId(`value`: Output) {
        this.zoneId = value
    }

    /**
     * @param value The hostname or IP address of the origin server to run health checks on.
     */
    @JvmName("cphijvvucntkaihj")
    public suspend fun address(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.address = mapped
    }

    /**
     * @param value Do not validate the certificate when the health check uses HTTPS. Defaults to `false`.
     */
    @JvmName("epbdthvowjkfdbbn")
    public suspend fun allowInsecure(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.allowInsecure = mapped
    }

    /**
     * @param value A list of regions from which to run health checks. If not set, Cloudflare will pick a default region. Available values: `WNAM`, `ENAM`, `WEU`, `EEU`, `NSAM`, `SSAM`, `OC`, `ME`, `NAF`, `SAF`, `IN`, `SEAS`, `NEAS`, `ALL_REGIONS`.
     */
    @JvmName("utccnssyodlwrpuf")
    public suspend fun checkRegions(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.checkRegions = mapped
    }

    /**
     * @param values A list of regions from which to run health checks. If not set, Cloudflare will pick a default region. Available values: `WNAM`, `ENAM`, `WEU`, `EEU`, `NSAM`, `SSAM`, `OC`, `ME`, `NAF`, `SAF`, `IN`, `SEAS`, `NEAS`, `ALL_REGIONS`.
     */
    @JvmName("wythyibwmbtwjqql")
    public suspend fun checkRegions(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.checkRegions = mapped
    }

    /**
     * @param value The number of consecutive fails required from a health check before changing the health to unhealthy. Defaults to `1`.
     */
    @JvmName("vmlxaalworinmwof")
    public suspend fun consecutiveFails(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.consecutiveFails = mapped
    }

    /**
     * @param value The number of consecutive successes required from a health check before changing the health to healthy. Defaults to `1`.
     */
    @JvmName("hpygmvrklbbisxwj")
    public suspend fun consecutiveSuccesses(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.consecutiveSuccesses = mapped
    }

    /**
     * @param value A human-readable description of the health check.
     */
    @JvmName("ugquyeofxaeyolyr")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("mrfsnauxpwpclsfj")
    public suspend fun expectedBody(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.expectedBody = mapped
    }

    /**
     * @param value The expected HTTP response codes (e.g. '200') or code ranges (e.g. '2xx' for all codes starting with 2) of the health check.
     */
    @JvmName("mjuadqxqrvtdjqwn")
    public suspend fun expectedCodes(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.expectedCodes = mapped
    }

    /**
     * @param values The expected HTTP response codes (e.g. '200') or code ranges (e.g. '2xx' for all codes starting with 2) of the health check.
     */
    @JvmName("amvrfngabelyxjcq")
    public suspend fun expectedCodes(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.expectedCodes = mapped
    }

    /**
     * @param value Follow redirects if the origin returns a 3xx status code. Defaults to `false`.
     */
    @JvmName("sxshoexbpmaemtys")
    public suspend fun followRedirects(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.followRedirects = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("mcbvemyxefmstbac")
    public suspend fun headers(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.headers = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("xakevnfkwwuvlytg")
    public suspend fun headers(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            HealthcheckHeaderArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.headers = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("mdylakhbaumxecfs")
    public suspend fun headers(vararg argument: suspend HealthcheckHeaderArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            HealthcheckHeaderArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.headers = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("kepfrkqacbcdlcbi")
    public suspend fun headers(argument: suspend HealthcheckHeaderArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(HealthcheckHeaderArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.headers = mapped
    }

    /**
     * @param values 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.
     */
    @JvmName("xfeaqolloargsncw")
    public suspend fun headers(vararg values: HealthcheckHeaderArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.headers = mapped
    }

    /**
     * @param value The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase the load on the origin as we check from multiple locations. Defaults to `60`.
     */
    @JvmName("kcasgwrngfiypnyv")
    public suspend fun interval(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.interval = mapped
    }

    /**
     * @param value The HTTP method to use for the health check. Available values: `connection_established`, `GET`, `HEAD`.
     */
    @JvmName("aoqroohwwionaodh")
    public suspend fun method(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.method = mapped
    }

    /**
     * @param value A short name to identify the health check. Only alphanumeric characters, hyphens, and underscores are allowed.
     */
    @JvmName("kfcurnkfuqpusdcf")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The endpoint path to health check against. Defaults to `/`.
     */
    @JvmName("afevnpviwdfndawg")
    public suspend fun path(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.path = mapped
    }

    /**
     * @param value Port number to connect to for the health check. Defaults to `80`.
     */
    @JvmName("erlvgcqxifpovjvw")
    public suspend fun port(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.port = mapped
    }

    /**
     * @param value The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Defaults to `2`.
     */
    @JvmName("dkhrkvhmflfvgqjx")
    public suspend fun retries(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.retries = mapped
    }

    /**
     * @param value If suspended, no health checks are sent to the origin. Defaults to `false`.
     */
    @JvmName("epictdvsdbfgmlhh")
    public suspend fun suspended(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.suspended = mapped
    }

    /**
     * @param value The timeout (in seconds) before marking the health check as failed. Defaults to `5`.
     */
    @JvmName("noxirkncpwmxdshi")
    public suspend fun timeout(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.timeout = mapped
    }

    /**
     * @param value The protocol to use for the health check. Available values: `TCP`, `HTTP`, `HTTPS`.
     */
    @JvmName("momuhcjmurptcwii")
    public suspend fun type(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.type = mapped
    }

    /**
     * @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("ppaoeqjtmrwhhovk")
    public suspend fun zoneId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.zoneId = mapped
    }

    internal fun build(): HealthcheckArgs = HealthcheckArgs(
        address = address,
        allowInsecure = allowInsecure,
        checkRegions = checkRegions,
        consecutiveFails = consecutiveFails,
        consecutiveSuccesses = consecutiveSuccesses,
        description = description,
        expectedBody = expectedBody,
        expectedCodes = expectedCodes,
        followRedirects = followRedirects,
        headers = headers,
        interval = interval,
        method = method,
        name = name,
        path = path,
        port = port,
        retries = retries,
        suspended = suspended,
        timeout = timeout,
        type = type,
        zoneId = zoneId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy