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

com.pulumi.gcp.compute.kotlin.HttpHealthCheck.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.compute.kotlin

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

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

    public var args: HttpHealthCheckArgs = HttpHealthCheckArgs()

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

/**
 * An HttpHealthCheck resource. This resource defines a template for how
 * individual VMs should be checked for health, via HTTP.
 * > **Note:** gcp.compute.HttpHealthCheck is a legacy health check.
 * The newer [gcp.compute.HealthCheck](https://www.terraform.io/docs/providers/google/r/compute_health_check.html)
 * should be preferred for all uses except
 * [Network Load Balancers](https://cloud.google.com/compute/docs/load-balancing/network/)
 * which still require the legacy version.
 * To get more information about HttpHealthCheck, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks)
 * * How-to Guides
 *     * [Adding Health Checks](https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)
 * ## Example Usage
 * ### Http Health Check Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.compute.HttpHealthCheck("default", {
 *     name: "authentication-health-check",
 *     requestPath: "/health_check",
 *     timeoutSec: 1,
 *     checkIntervalSec: 1,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.compute.HttpHealthCheck("default",
 *     name="authentication-health-check",
 *     request_path="/health_check",
 *     timeout_sec=1,
 *     check_interval_sec=1)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Compute.HttpHealthCheck("default", new()
 *     {
 *         Name = "authentication-health-check",
 *         RequestPath = "/health_check",
 *         TimeoutSec = 1,
 *         CheckIntervalSec = 1,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := compute.NewHttpHealthCheck(ctx, "default", &compute.HttpHealthCheckArgs{
 * 			Name:             pulumi.String("authentication-health-check"),
 * 			RequestPath:      pulumi.String("/health_check"),
 * 			TimeoutSec:       pulumi.Int(1),
 * 			CheckIntervalSec: pulumi.Int(1),
 * 		})
 * 		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.gcp.compute.HttpHealthCheck;
 * import com.pulumi.gcp.compute.HttpHealthCheckArgs;
 * 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) {
 *         var default_ = new HttpHealthCheck("default", HttpHealthCheckArgs.builder()
 *             .name("authentication-health-check")
 *             .requestPath("/health_check")
 *             .timeoutSec(1)
 *             .checkIntervalSec(1)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:compute:HttpHealthCheck
 *     properties:
 *       name: authentication-health-check
 *       requestPath: /health_check
 *       timeoutSec: 1
 *       checkIntervalSec: 1
 * ```
 * 
 * ## Import
 * HttpHealthCheck can be imported using any of these accepted formats:
 * * `projects/{{project}}/global/httpHealthChecks/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, HttpHealthCheck can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/httpHealthCheck:HttpHealthCheck default projects/{{project}}/global/httpHealthChecks/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/httpHealthCheck:HttpHealthCheck default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/httpHealthCheck:HttpHealthCheck default {{name}}
 * ```
 */
public class HttpHealthCheck internal constructor(
    override val javaResource: com.pulumi.gcp.compute.HttpHealthCheck,
) : KotlinCustomResource(javaResource, HttpHealthCheckMapper) {
    /**
     * How often (in seconds) to send a health check. The default value is 5
     * seconds.
     */
    public val checkIntervalSec: Output?
        get() = javaResource.checkIntervalSec().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * An optional description of this resource. Provide this property when
     * you create the resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A so-far unhealthy instance will be marked healthy after this many
     * consecutive successes. The default value is 2.
     */
    public val healthyThreshold: Output?
        get() = javaResource.healthyThreshold().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The value of the host header in the HTTP health check request. If
     * left empty (default value), the public IP on behalf of which this
     * health check is performed will be used.
     */
    public val host: Output?
        get() = javaResource.host().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Name of the resource. Provided by the client when the resource is
     * created. The name must be 1-63 characters long, and comply with
     * RFC1035.  Specifically, the name must be 1-63 characters long and
     * match the regular expression `a-z?` which means
     * the first character must be a lowercase letter, and all following
     * characters must be a dash, lowercase letter, or digit, except the
     * last character, which cannot be a dash.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The TCP port number for the HTTP health check request.
     * The default value is 80.
     */
    public val port: Output?
        get() = javaResource.port().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The request path of the HTTP health check request.
     * The default value is /.
     */
    public val requestPath: Output?
        get() = javaResource.requestPath().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The URI of the created resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * How long (in seconds) to wait before claiming failure.
     * The default value is 5 seconds.  It is invalid for timeoutSec to have
     * greater value than checkIntervalSec.
     */
    public val timeoutSec: Output?
        get() = javaResource.timeoutSec().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A so-far healthy instance will be marked unhealthy after this many
     * consecutive failures. The default value is 2.
     */
    public val unhealthyThreshold: Output?
        get() = javaResource.unhealthyThreshold().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object HttpHealthCheckMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.HttpHealthCheck::class == javaResource::class

    override fun map(javaResource: Resource): HttpHealthCheck = HttpHealthCheck(
        javaResource as
            com.pulumi.gcp.compute.HttpHealthCheck,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy