com.pulumi.gcp.dataproc.kotlin.AutoscalingPolicyArgs.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.dataproc.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.dataproc.AutoscalingPolicyArgs.builder
import com.pulumi.gcp.dataproc.kotlin.inputs.AutoscalingPolicyBasicAlgorithmArgs
import com.pulumi.gcp.dataproc.kotlin.inputs.AutoscalingPolicyBasicAlgorithmArgsBuilder
import com.pulumi.gcp.dataproc.kotlin.inputs.AutoscalingPolicySecondaryWorkerConfigArgs
import com.pulumi.gcp.dataproc.kotlin.inputs.AutoscalingPolicySecondaryWorkerConfigArgsBuilder
import com.pulumi.gcp.dataproc.kotlin.inputs.AutoscalingPolicyWorkerConfigArgs
import com.pulumi.gcp.dataproc.kotlin.inputs.AutoscalingPolicyWorkerConfigArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* Describes an autoscaling policy for Dataproc cluster autoscaler.
* ## Example Usage
* ### Dataproc Autoscaling Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const asp = new gcp.dataproc.AutoscalingPolicy("asp", {
* policyId: "dataproc-policy",
* location: "us-central1",
* workerConfig: {
* maxInstances: 3,
* },
* basicAlgorithm: {
* yarnConfig: {
* gracefulDecommissionTimeout: "30s",
* scaleUpFactor: 0.5,
* scaleDownFactor: 0.5,
* },
* },
* });
* const basic = new gcp.dataproc.Cluster("basic", {
* name: "dataproc-policy",
* region: "us-central1",
* clusterConfig: {
* autoscalingConfig: {
* policyUri: asp.name,
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* asp = gcp.dataproc.AutoscalingPolicy("asp",
* policy_id="dataproc-policy",
* location="us-central1",
* worker_config=gcp.dataproc.AutoscalingPolicyWorkerConfigArgs(
* max_instances=3,
* ),
* basic_algorithm=gcp.dataproc.AutoscalingPolicyBasicAlgorithmArgs(
* yarn_config=gcp.dataproc.AutoscalingPolicyBasicAlgorithmYarnConfigArgs(
* graceful_decommission_timeout="30s",
* scale_up_factor=0.5,
* scale_down_factor=0.5,
* ),
* ))
* basic = gcp.dataproc.Cluster("basic",
* name="dataproc-policy",
* region="us-central1",
* cluster_config=gcp.dataproc.ClusterClusterConfigArgs(
* autoscaling_config=gcp.dataproc.ClusterClusterConfigAutoscalingConfigArgs(
* policy_uri=asp.name,
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var asp = new Gcp.Dataproc.AutoscalingPolicy("asp", new()
* {
* PolicyId = "dataproc-policy",
* Location = "us-central1",
* WorkerConfig = new Gcp.Dataproc.Inputs.AutoscalingPolicyWorkerConfigArgs
* {
* MaxInstances = 3,
* },
* BasicAlgorithm = new Gcp.Dataproc.Inputs.AutoscalingPolicyBasicAlgorithmArgs
* {
* YarnConfig = new Gcp.Dataproc.Inputs.AutoscalingPolicyBasicAlgorithmYarnConfigArgs
* {
* GracefulDecommissionTimeout = "30s",
* ScaleUpFactor = 0.5,
* ScaleDownFactor = 0.5,
* },
* },
* });
* var basic = new Gcp.Dataproc.Cluster("basic", new()
* {
* Name = "dataproc-policy",
* Region = "us-central1",
* ClusterConfig = new Gcp.Dataproc.Inputs.ClusterClusterConfigArgs
* {
* AutoscalingConfig = new Gcp.Dataproc.Inputs.ClusterClusterConfigAutoscalingConfigArgs
* {
* PolicyUri = asp.Name,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/dataproc"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* asp, err := dataproc.NewAutoscalingPolicy(ctx, "asp", &dataproc.AutoscalingPolicyArgs{
* PolicyId: pulumi.String("dataproc-policy"),
* Location: pulumi.String("us-central1"),
* WorkerConfig: &dataproc.AutoscalingPolicyWorkerConfigArgs{
* MaxInstances: pulumi.Int(3),
* },
* BasicAlgorithm: &dataproc.AutoscalingPolicyBasicAlgorithmArgs{
* YarnConfig: &dataproc.AutoscalingPolicyBasicAlgorithmYarnConfigArgs{
* GracefulDecommissionTimeout: pulumi.String("30s"),
* ScaleUpFactor: pulumi.Float64(0.5),
* ScaleDownFactor: pulumi.Float64(0.5),
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = dataproc.NewCluster(ctx, "basic", &dataproc.ClusterArgs{
* Name: pulumi.String("dataproc-policy"),
* Region: pulumi.String("us-central1"),
* ClusterConfig: &dataproc.ClusterClusterConfigArgs{
* AutoscalingConfig: &dataproc.ClusterClusterConfigAutoscalingConfigArgs{
* PolicyUri: asp.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.dataproc.AutoscalingPolicy;
* import com.pulumi.gcp.dataproc.AutoscalingPolicyArgs;
* import com.pulumi.gcp.dataproc.inputs.AutoscalingPolicyWorkerConfigArgs;
* import com.pulumi.gcp.dataproc.inputs.AutoscalingPolicyBasicAlgorithmArgs;
* import com.pulumi.gcp.dataproc.inputs.AutoscalingPolicyBasicAlgorithmYarnConfigArgs;
* import com.pulumi.gcp.dataproc.Cluster;
* import com.pulumi.gcp.dataproc.ClusterArgs;
* import com.pulumi.gcp.dataproc.inputs.ClusterClusterConfigArgs;
* import com.pulumi.gcp.dataproc.inputs.ClusterClusterConfigAutoscalingConfigArgs;
* 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 asp = new AutoscalingPolicy("asp", AutoscalingPolicyArgs.builder()
* .policyId("dataproc-policy")
* .location("us-central1")
* .workerConfig(AutoscalingPolicyWorkerConfigArgs.builder()
* .maxInstances(3)
* .build())
* .basicAlgorithm(AutoscalingPolicyBasicAlgorithmArgs.builder()
* .yarnConfig(AutoscalingPolicyBasicAlgorithmYarnConfigArgs.builder()
* .gracefulDecommissionTimeout("30s")
* .scaleUpFactor(0.5)
* .scaleDownFactor(0.5)
* .build())
* .build())
* .build());
* var basic = new Cluster("basic", ClusterArgs.builder()
* .name("dataproc-policy")
* .region("us-central1")
* .clusterConfig(ClusterClusterConfigArgs.builder()
* .autoscalingConfig(ClusterClusterConfigAutoscalingConfigArgs.builder()
* .policyUri(asp.name())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* basic:
* type: gcp:dataproc:Cluster
* properties:
* name: dataproc-policy
* region: us-central1
* clusterConfig:
* autoscalingConfig:
* policyUri: ${asp.name}
* asp:
* type: gcp:dataproc:AutoscalingPolicy
* properties:
* policyId: dataproc-policy
* location: us-central1
* workerConfig:
* maxInstances: 3
* basicAlgorithm:
* yarnConfig:
* gracefulDecommissionTimeout: 30s
* scaleUpFactor: 0.5
* scaleDownFactor: 0.5
* ```
*
* ## Import
* AutoscalingPolicy can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/autoscalingPolicies/{{policy_id}}`
* * `{{project}}/{{location}}/{{policy_id}}`
* * `{{location}}/{{policy_id}}`
* When using the `pulumi import` command, AutoscalingPolicy can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:dataproc/autoscalingPolicy:AutoscalingPolicy default projects/{{project}}/locations/{{location}}/autoscalingPolicies/{{policy_id}}
* ```
* ```sh
* $ pulumi import gcp:dataproc/autoscalingPolicy:AutoscalingPolicy default {{project}}/{{location}}/{{policy_id}}
* ```
* ```sh
* $ pulumi import gcp:dataproc/autoscalingPolicy:AutoscalingPolicy default {{location}}/{{policy_id}}
* ```
* @property basicAlgorithm Basic algorithm for autoscaling.
* Structure is documented below.
* @property location The location where the autoscaling policy should reside.
* The default value is `global`.
* @property policyId The policy id. The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_),
* and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between
* 3 and 50 characters.
* - - -
* @property project The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
* @property secondaryWorkerConfig Describes how the autoscaler will operate for secondary workers.
* Structure is documented below.
* @property workerConfig Describes how the autoscaler will operate for primary workers.
* Structure is documented below.
*/
public data class AutoscalingPolicyArgs(
public val basicAlgorithm: Output? = null,
public val location: Output? = null,
public val policyId: Output? = null,
public val project: Output? = null,
public val secondaryWorkerConfig: Output? = null,
public val workerConfig: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.dataproc.AutoscalingPolicyArgs =
com.pulumi.gcp.dataproc.AutoscalingPolicyArgs.builder()
.basicAlgorithm(basicAlgorithm?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.location(location?.applyValue({ args0 -> args0 }))
.policyId(policyId?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 }))
.secondaryWorkerConfig(
secondaryWorkerConfig?.applyValue({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
}),
)
.workerConfig(workerConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}
/**
* Builder for [AutoscalingPolicyArgs].
*/
@PulumiTagMarker
public class AutoscalingPolicyArgsBuilder internal constructor() {
private var basicAlgorithm: Output? = null
private var location: Output? = null
private var policyId: Output? = null
private var project: Output? = null
private var secondaryWorkerConfig: Output? = null
private var workerConfig: Output? = null
/**
* @param value Basic algorithm for autoscaling.
* Structure is documented below.
*/
@JvmName("ylqogoyibgnoywcp")
public suspend fun basicAlgorithm(`value`: Output) {
this.basicAlgorithm = value
}
/**
* @param value The location where the autoscaling policy should reside.
* The default value is `global`.
*/
@JvmName("etoewyplloybemnr")
public suspend fun location(`value`: Output) {
this.location = value
}
/**
* @param value The policy id. The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_),
* and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between
* 3 and 50 characters.
* - - -
*/
@JvmName("drugfdounefgbctd")
public suspend fun policyId(`value`: Output) {
this.policyId = value
}
/**
* @param value The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
@JvmName("elekcbyjygceoigg")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value Describes how the autoscaler will operate for secondary workers.
* Structure is documented below.
*/
@JvmName("vossikktjqxfvrxk")
public suspend fun secondaryWorkerConfig(`value`: Output) {
this.secondaryWorkerConfig = value
}
/**
* @param value Describes how the autoscaler will operate for primary workers.
* Structure is documented below.
*/
@JvmName("jejcokvfcdxdchcu")
public suspend fun workerConfig(`value`: Output) {
this.workerConfig = value
}
/**
* @param value Basic algorithm for autoscaling.
* Structure is documented below.
*/
@JvmName("vpccemhlubdoerew")
public suspend fun basicAlgorithm(`value`: AutoscalingPolicyBasicAlgorithmArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.basicAlgorithm = mapped
}
/**
* @param argument Basic algorithm for autoscaling.
* Structure is documented below.
*/
@JvmName("ubowpfisqvcuskke")
public suspend fun basicAlgorithm(argument: suspend AutoscalingPolicyBasicAlgorithmArgsBuilder.() -> Unit) {
val toBeMapped = AutoscalingPolicyBasicAlgorithmArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.basicAlgorithm = mapped
}
/**
* @param value The location where the autoscaling policy should reside.
* The default value is `global`.
*/
@JvmName("bllumcbhnpleqtbv")
public suspend fun location(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.location = mapped
}
/**
* @param value The policy id. The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_),
* and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between
* 3 and 50 characters.
* - - -
*/
@JvmName("coveduisgbphfrvi")
public suspend fun policyId(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.policyId = mapped
}
/**
* @param value The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
@JvmName("eyadlvhxkccqddow")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
/**
* @param value Describes how the autoscaler will operate for secondary workers.
* Structure is documented below.
*/
@JvmName("vmqfvqhrdoywdgmc")
public suspend fun secondaryWorkerConfig(`value`: AutoscalingPolicySecondaryWorkerConfigArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.secondaryWorkerConfig = mapped
}
/**
* @param argument Describes how the autoscaler will operate for secondary workers.
* Structure is documented below.
*/
@JvmName("gsldnfyjxrwbclov")
public suspend fun secondaryWorkerConfig(argument: suspend AutoscalingPolicySecondaryWorkerConfigArgsBuilder.() -> Unit) {
val toBeMapped = AutoscalingPolicySecondaryWorkerConfigArgsBuilder().applySuspend {
argument()
}.build()
val mapped = of(toBeMapped)
this.secondaryWorkerConfig = mapped
}
/**
* @param value Describes how the autoscaler will operate for primary workers.
* Structure is documented below.
*/
@JvmName("qeynkeuvrorkgbjf")
public suspend fun workerConfig(`value`: AutoscalingPolicyWorkerConfigArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.workerConfig = mapped
}
/**
* @param argument Describes how the autoscaler will operate for primary workers.
* Structure is documented below.
*/
@JvmName("bptoluhuacrmhuyr")
public suspend fun workerConfig(argument: suspend AutoscalingPolicyWorkerConfigArgsBuilder.() -> Unit) {
val toBeMapped = AutoscalingPolicyWorkerConfigArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.workerConfig = mapped
}
internal fun build(): AutoscalingPolicyArgs = AutoscalingPolicyArgs(
basicAlgorithm = basicAlgorithm,
location = location,
policyId = policyId,
project = project,
secondaryWorkerConfig = secondaryWorkerConfig,
workerConfig = workerConfig,
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy