com.pulumi.cloudflare.kotlin.HealthcheckArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-cloudflare-kotlin Show documentation
Show all versions of pulumi-cloudflare-kotlin Show documentation
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.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("fmwbjyckjnuteqtp")
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("mykffjxdgiwguyco")
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("otodkymljkpnrroj")
public suspend fun checkRegions(`value`: Output>) {
this.checkRegions = value
}
@JvmName("ebapumskuurccmtl")
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("trclcbbgxpdlqnof")
public suspend fun checkRegions(values: List