com.pulumi.gcp.compute.kotlin.TargetPoolArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-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.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.compute.TargetPoolArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Double
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Manages a Target Pool within GCE. This is a collection of instances used as
* target of a network load balancer (Forwarding Rule). For more information see
* [the official
* documentation](https://cloud.google.com/compute/docs/load-balancing/network/target-pools)
* and [API](https://cloud.google.com/compute/docs/reference/latest/targetPools).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
* name: "default",
* requestPath: "/",
* checkIntervalSec: 1,
* timeoutSec: 1,
* });
* const _default = new gcp.compute.TargetPool("default", {
* name: "instance-pool",
* instances: [
* "us-central1-a/myinstance1",
* "us-central1-b/myinstance2",
* ],
* healthChecks: defaultHttpHealthCheck.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default_http_health_check = gcp.compute.HttpHealthCheck("default",
* name="default",
* request_path="/",
* check_interval_sec=1,
* timeout_sec=1)
* default = gcp.compute.TargetPool("default",
* name="instance-pool",
* instances=[
* "us-central1-a/myinstance1",
* "us-central1-b/myinstance2",
* ],
* health_checks=default_http_health_check.name)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var defaultHttpHealthCheck = new Gcp.Compute.HttpHealthCheck("default", new()
* {
* Name = "default",
* RequestPath = "/",
* CheckIntervalSec = 1,
* TimeoutSec = 1,
* });
* var @default = new Gcp.Compute.TargetPool("default", new()
* {
* Name = "instance-pool",
* Instances = new[]
* {
* "us-central1-a/myinstance1",
* "us-central1-b/myinstance2",
* },
* HealthChecks = defaultHttpHealthCheck.Name,
* });
* });
* ```
* ```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 {
* defaultHttpHealthCheck, err := compute.NewHttpHealthCheck(ctx, "default", &compute.HttpHealthCheckArgs{
* Name: pulumi.String("default"),
* RequestPath: pulumi.String("/"),
* CheckIntervalSec: pulumi.Int(1),
* TimeoutSec: pulumi.Int(1),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewTargetPool(ctx, "default", &compute.TargetPoolArgs{
* Name: pulumi.String("instance-pool"),
* Instances: pulumi.StringArray{
* pulumi.String("us-central1-a/myinstance1"),
* pulumi.String("us-central1-b/myinstance2"),
* },
* HealthChecks: defaultHttpHealthCheck.Name,
* })
* 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 com.pulumi.gcp.compute.TargetPool;
* import com.pulumi.gcp.compute.TargetPoolArgs;
* 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 defaultHttpHealthCheck = new HttpHealthCheck("defaultHttpHealthCheck", HttpHealthCheckArgs.builder()
* .name("default")
* .requestPath("/")
* .checkIntervalSec(1)
* .timeoutSec(1)
* .build());
* var default_ = new TargetPool("default", TargetPoolArgs.builder()
* .name("instance-pool")
* .instances(
* "us-central1-a/myinstance1",
* "us-central1-b/myinstance2")
* .healthChecks(defaultHttpHealthCheck.name())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:TargetPool
* properties:
* name: instance-pool
* instances:
* - us-central1-a/myinstance1
* - us-central1-b/myinstance2
* healthChecks: ${defaultHttpHealthCheck.name}
* defaultHttpHealthCheck:
* type: gcp:compute:HttpHealthCheck
* name: default
* properties:
* name: default
* requestPath: /
* checkIntervalSec: 1
* timeoutSec: 1
* ```
*
* ## Import
* Target pools can be imported using any of the following formats:
* * `projects/{{project}}/regions/{{region}}/targetPools/{{name}}`
* * `{{project}}/{{region}}/{{name}}`
* * `{{region}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, target pools can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/targetPool:TargetPool default projects/{{project}}/regions/{{region}}/targetPools/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/targetPool:TargetPool default {{project}}/{{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/targetPool:TargetPool default {{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/targetPool:TargetPool default {{name}}
* ```
* @property backupPool URL to the backup target pool. Must also set
* failover_ratio.
* @property description Textual description field.
* @property failoverRatio Ratio (0 to 1) of failed nodes before using the
* backup pool (which must also be set).
* @property healthChecks List of zero or one health check name or self_link. Only
* legacy `gcp.compute.HttpHealthCheck` is supported.
* @property instances List of instances in the pool. They can be given as
* URLs, or in the form of "zone/name". Note that the instances need not exist
* at the time of target pool creation, so there is no need to use the
* interpolation to create a dependency on the instances from the
* target pool.
* @property name A unique name for the resource, required by GCE. Changing
* this forces a new resource to be created.
* - - -
* @property project The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
* @property region Where the target pool resides. Defaults to project
* region.
* @property securityPolicy The resource URL for the security policy associated with this target pool.
* @property sessionAffinity How to distribute load. Options are "NONE" (no
* affinity). "CLIENT_IP" (hash of the source/dest addresses / ports), and
* "CLIENT_IP_PROTO" also includes the protocol (default "NONE").
*/
public data class TargetPoolArgs(
public val backupPool: Output? = null,
public val description: Output? = null,
public val failoverRatio: Output? = null,
public val healthChecks: Output? = null,
public val instances: Output>? = null,
public val name: Output? = null,
public val project: Output? = null,
public val region: Output? = null,
public val securityPolicy: Output? = null,
public val sessionAffinity: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.compute.TargetPoolArgs =
com.pulumi.gcp.compute.TargetPoolArgs.builder()
.backupPool(backupPool?.applyValue({ args0 -> args0 }))
.description(description?.applyValue({ args0 -> args0 }))
.failoverRatio(failoverRatio?.applyValue({ args0 -> args0 }))
.healthChecks(healthChecks?.applyValue({ args0 -> args0 }))
.instances(instances?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.name(name?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 }))
.region(region?.applyValue({ args0 -> args0 }))
.securityPolicy(securityPolicy?.applyValue({ args0 -> args0 }))
.sessionAffinity(sessionAffinity?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [TargetPoolArgs].
*/
@PulumiTagMarker
public class TargetPoolArgsBuilder internal constructor() {
private var backupPool: Output? = null
private var description: Output? = null
private var failoverRatio: Output? = null
private var healthChecks: Output? = null
private var instances: Output>? = null
private var name: Output? = null
private var project: Output? = null
private var region: Output? = null
private var securityPolicy: Output? = null
private var sessionAffinity: Output? = null
/**
* @param value URL to the backup target pool. Must also set
* failover_ratio.
*/
@JvmName("kujlhvujsrmchwsm")
public suspend fun backupPool(`value`: Output) {
this.backupPool = value
}
/**
* @param value Textual description field.
*/
@JvmName("igaftusojnhjkuek")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value Ratio (0 to 1) of failed nodes before using the
* backup pool (which must also be set).
*/
@JvmName("vawwiandmgorthvs")
public suspend fun failoverRatio(`value`: Output) {
this.failoverRatio = value
}
/**
* @param value List of zero or one health check name or self_link. Only
* legacy `gcp.compute.HttpHealthCheck` is supported.
*/
@JvmName("bqaffpertwjesxsv")
public suspend fun healthChecks(`value`: Output) {
this.healthChecks = value
}
/**
* @param value List of instances in the pool. They can be given as
* URLs, or in the form of "zone/name". Note that the instances need not exist
* at the time of target pool creation, so there is no need to use the
* interpolation to create a dependency on the instances from the
* target pool.
*/
@JvmName("pcpqcgtfvhofumkj")
public suspend fun instances(`value`: Output>) {
this.instances = value
}
@JvmName("knxuhgpmoggfeedf")
public suspend fun instances(vararg values: Output) {
this.instances = Output.all(values.asList())
}
/**
* @param values List of instances in the pool. They can be given as
* URLs, or in the form of "zone/name". Note that the instances need not exist
* at the time of target pool creation, so there is no need to use the
* interpolation to create a dependency on the instances from the
* target pool.
*/
@JvmName("vobbndiqnjvxnupv")
public suspend fun instances(values: List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy