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

com.pulumi.gcp.compute.kotlin.NodeTemplateArgs.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.core.Output.of
import com.pulumi.gcp.compute.NodeTemplateArgs.builder
import com.pulumi.gcp.compute.kotlin.inputs.NodeTemplateNodeTypeFlexibilityArgs
import com.pulumi.gcp.compute.kotlin.inputs.NodeTemplateNodeTypeFlexibilityArgsBuilder
import com.pulumi.gcp.compute.kotlin.inputs.NodeTemplateServerBindingArgs
import com.pulumi.gcp.compute.kotlin.inputs.NodeTemplateServerBindingArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Represents a NodeTemplate resource. Node templates specify properties
 * for creating sole-tenant nodes, such as node type, vCPU and memory
 * requirements, node affinity labels, and region.
 * To get more information about NodeTemplate, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/nodeTemplates)
 * * How-to Guides
 *     * [Sole-Tenant Nodes](https://cloud.google.com/compute/docs/nodes/)
 * ## Example Usage
 * ### Node Template Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const template = new gcp.compute.NodeTemplate("template", {
 *     name: "soletenant-tmpl",
 *     region: "us-central1",
 *     nodeType: "n1-node-96-624",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * template = gcp.compute.NodeTemplate("template",
 *     name="soletenant-tmpl",
 *     region="us-central1",
 *     node_type="n1-node-96-624")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var template = new Gcp.Compute.NodeTemplate("template", new()
 *     {
 *         Name = "soletenant-tmpl",
 *         Region = "us-central1",
 *         NodeType = "n1-node-96-624",
 *     });
 * });
 * ```
 * ```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.NewNodeTemplate(ctx, "template", &compute.NodeTemplateArgs{
 * 			Name:     pulumi.String("soletenant-tmpl"),
 * 			Region:   pulumi.String("us-central1"),
 * 			NodeType: pulumi.String("n1-node-96-624"),
 * 		})
 * 		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.NodeTemplate;
 * import com.pulumi.gcp.compute.NodeTemplateArgs;
 * 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 template = new NodeTemplate("template", NodeTemplateArgs.builder()
 *             .name("soletenant-tmpl")
 *             .region("us-central1")
 *             .nodeType("n1-node-96-624")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   template:
 *     type: gcp:compute:NodeTemplate
 *     properties:
 *       name: soletenant-tmpl
 *       region: us-central1
 *       nodeType: n1-node-96-624
 * ```
 * 
 * ### Node Template Server Binding
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const central1a = gcp.compute.getNodeTypes({
 *     zone: "us-central1-a",
 * });
 * const template = new gcp.compute.NodeTemplate("template", {
 *     name: "soletenant-with-licenses",
 *     region: "us-central1",
 *     nodeType: "n1-node-96-624",
 *     nodeAffinityLabels: {
 *         foo: "baz",
 *     },
 *     serverBinding: {
 *         type: "RESTART_NODE_ON_MINIMAL_SERVERS",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * central1a = gcp.compute.get_node_types(zone="us-central1-a")
 * template = gcp.compute.NodeTemplate("template",
 *     name="soletenant-with-licenses",
 *     region="us-central1",
 *     node_type="n1-node-96-624",
 *     node_affinity_labels={
 *         "foo": "baz",
 *     },
 *     server_binding=gcp.compute.NodeTemplateServerBindingArgs(
 *         type="RESTART_NODE_ON_MINIMAL_SERVERS",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var central1a = Gcp.Compute.GetNodeTypes.Invoke(new()
 *     {
 *         Zone = "us-central1-a",
 *     });
 *     var template = new Gcp.Compute.NodeTemplate("template", new()
 *     {
 *         Name = "soletenant-with-licenses",
 *         Region = "us-central1",
 *         NodeType = "n1-node-96-624",
 *         NodeAffinityLabels =
 *         {
 *             { "foo", "baz" },
 *         },
 *         ServerBinding = new Gcp.Compute.Inputs.NodeTemplateServerBindingArgs
 *         {
 *             Type = "RESTART_NODE_ON_MINIMAL_SERVERS",
 *         },
 *     });
 * });
 * ```
 * ```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.GetNodeTypes(ctx, &compute.GetNodeTypesArgs{
 * 			Zone: pulumi.StringRef("us-central1-a"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewNodeTemplate(ctx, "template", &compute.NodeTemplateArgs{
 * 			Name:     pulumi.String("soletenant-with-licenses"),
 * 			Region:   pulumi.String("us-central1"),
 * 			NodeType: pulumi.String("n1-node-96-624"),
 * 			NodeAffinityLabels: pulumi.StringMap{
 * 				"foo": pulumi.String("baz"),
 * 			},
 * 			ServerBinding: &compute.NodeTemplateServerBindingArgs{
 * 				Type: pulumi.String("RESTART_NODE_ON_MINIMAL_SERVERS"),
 * 			},
 * 		})
 * 		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.ComputeFunctions;
 * import com.pulumi.gcp.compute.inputs.GetNodeTypesArgs;
 * import com.pulumi.gcp.compute.NodeTemplate;
 * import com.pulumi.gcp.compute.NodeTemplateArgs;
 * import com.pulumi.gcp.compute.inputs.NodeTemplateServerBindingArgs;
 * 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) {
 *         final var central1a = ComputeFunctions.getNodeTypes(GetNodeTypesArgs.builder()
 *             .zone("us-central1-a")
 *             .build());
 *         var template = new NodeTemplate("template", NodeTemplateArgs.builder()
 *             .name("soletenant-with-licenses")
 *             .region("us-central1")
 *             .nodeType("n1-node-96-624")
 *             .nodeAffinityLabels(Map.of("foo", "baz"))
 *             .serverBinding(NodeTemplateServerBindingArgs.builder()
 *                 .type("RESTART_NODE_ON_MINIMAL_SERVERS")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   template:
 *     type: gcp:compute:NodeTemplate
 *     properties:
 *       name: soletenant-with-licenses
 *       region: us-central1
 *       nodeType: n1-node-96-624
 *       nodeAffinityLabels:
 *         foo: baz
 *       serverBinding:
 *         type: RESTART_NODE_ON_MINIMAL_SERVERS
 * variables:
 *   central1a:
 *     fn::invoke:
 *       Function: gcp:compute:getNodeTypes
 *       Arguments:
 *         zone: us-central1-a
 * ```
 * 
 * ## Import
 * NodeTemplate can be imported using any of these accepted formats:
 * * `projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}`
 * * `{{project}}/{{region}}/{{name}}`
 * * `{{region}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, NodeTemplate can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/nodeTemplate:NodeTemplate default projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/nodeTemplate:NodeTemplate default {{project}}/{{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/nodeTemplate:NodeTemplate default {{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/nodeTemplate:NodeTemplate default {{name}}
 * ```
 * @property cpuOvercommitType CPU overcommit.
 * Default value is `NONE`.
 * Possible values are: `ENABLED`, `NONE`.
 * @property description An optional textual description of the resource.
 * @property name Name of the resource.
 * @property nodeAffinityLabels Labels to use for node affinity, which will be used in
 * instance scheduling.
 * @property nodeType Node type to use for nodes group that are created from this template.
 * Only one of nodeTypeFlexibility and nodeType can be specified.
 * @property nodeTypeFlexibility Flexible properties for the desired node type. Node groups that
 * use this node template will create nodes of a type that matches
 * these properties. Only one of nodeTypeFlexibility and nodeType can
 * be specified.
 * Structure is documented below.
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property region Region where nodes using the node template will be created.
 * If it is not provided, the provider region is used.
 * @property serverBinding The server binding policy for nodes using this template. Determines
 * where the nodes should restart following a maintenance event.
 * Structure is documented below.
 */
public data class NodeTemplateArgs(
    public val cpuOvercommitType: Output? = null,
    public val description: Output? = null,
    public val name: Output? = null,
    public val nodeAffinityLabels: Output>? = null,
    public val nodeType: Output? = null,
    public val nodeTypeFlexibility: Output? = null,
    public val project: Output? = null,
    public val region: Output? = null,
    public val serverBinding: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.compute.NodeTemplateArgs =
        com.pulumi.gcp.compute.NodeTemplateArgs.builder()
            .cpuOvercommitType(cpuOvercommitType?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .nodeAffinityLabels(
                nodeAffinityLabels?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .nodeType(nodeType?.applyValue({ args0 -> args0 }))
            .nodeTypeFlexibility(
                nodeTypeFlexibility?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .project(project?.applyValue({ args0 -> args0 }))
            .region(region?.applyValue({ args0 -> args0 }))
            .serverBinding(serverBinding?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}

/**
 * Builder for [NodeTemplateArgs].
 */
@PulumiTagMarker
public class NodeTemplateArgsBuilder internal constructor() {
    private var cpuOvercommitType: Output? = null

    private var description: Output? = null

    private var name: Output? = null

    private var nodeAffinityLabels: Output>? = null

    private var nodeType: Output? = null

    private var nodeTypeFlexibility: Output? = null

    private var project: Output? = null

    private var region: Output? = null

    private var serverBinding: Output? = null

    /**
     * @param value CPU overcommit.
     * Default value is `NONE`.
     * Possible values are: `ENABLED`, `NONE`.
     */
    @JvmName("dbefopqoifoxnfhh")
    public suspend fun cpuOvercommitType(`value`: Output) {
        this.cpuOvercommitType = value
    }

    /**
     * @param value An optional textual description of the resource.
     */
    @JvmName("hhnchjlduiabiwlo")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Name of the resource.
     */
    @JvmName("oplhkqncsaqutaum")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Labels to use for node affinity, which will be used in
     * instance scheduling.
     */
    @JvmName("tlnbwjhekbdpwkwh")
    public suspend fun nodeAffinityLabels(`value`: Output>) {
        this.nodeAffinityLabels = value
    }

    /**
     * @param value Node type to use for nodes group that are created from this template.
     * Only one of nodeTypeFlexibility and nodeType can be specified.
     */
    @JvmName("nurgelbrewbpghet")
    public suspend fun nodeType(`value`: Output) {
        this.nodeType = value
    }

    /**
     * @param value Flexible properties for the desired node type. Node groups that
     * use this node template will create nodes of a type that matches
     * these properties. Only one of nodeTypeFlexibility and nodeType can
     * be specified.
     * Structure is documented below.
     */
    @JvmName("vvguwljbegsqbnta")
    public suspend fun nodeTypeFlexibility(`value`: Output) {
        this.nodeTypeFlexibility = value
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("eccfckytrkbtlywb")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value Region where nodes using the node template will be created.
     * If it is not provided, the provider region is used.
     */
    @JvmName("qhdfmgvpghyakxtv")
    public suspend fun region(`value`: Output) {
        this.region = value
    }

    /**
     * @param value The server binding policy for nodes using this template. Determines
     * where the nodes should restart following a maintenance event.
     * Structure is documented below.
     */
    @JvmName("mgiowcslsvsfcklb")
    public suspend fun serverBinding(`value`: Output) {
        this.serverBinding = value
    }

    /**
     * @param value CPU overcommit.
     * Default value is `NONE`.
     * Possible values are: `ENABLED`, `NONE`.
     */
    @JvmName("nrqqfijiwnrgpbge")
    public suspend fun cpuOvercommitType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.cpuOvercommitType = mapped
    }

    /**
     * @param value An optional textual description of the resource.
     */
    @JvmName("syibygecdcglyupl")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Name of the resource.
     */
    @JvmName("wbxwxkpxnlxcoxai")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Labels to use for node affinity, which will be used in
     * instance scheduling.
     */
    @JvmName("frdrjblymrwttxkx")
    public suspend fun nodeAffinityLabels(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.nodeAffinityLabels = mapped
    }

    /**
     * @param values Labels to use for node affinity, which will be used in
     * instance scheduling.
     */
    @JvmName("ygeobfyipinsykvo")
    public fun nodeAffinityLabels(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.nodeAffinityLabels = mapped
    }

    /**
     * @param value Node type to use for nodes group that are created from this template.
     * Only one of nodeTypeFlexibility and nodeType can be specified.
     */
    @JvmName("ctafmtyvxdcdmddg")
    public suspend fun nodeType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.nodeType = mapped
    }

    /**
     * @param value Flexible properties for the desired node type. Node groups that
     * use this node template will create nodes of a type that matches
     * these properties. Only one of nodeTypeFlexibility and nodeType can
     * be specified.
     * Structure is documented below.
     */
    @JvmName("fqveuetrhankglfa")
    public suspend fun nodeTypeFlexibility(`value`: NodeTemplateNodeTypeFlexibilityArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.nodeTypeFlexibility = mapped
    }

    /**
     * @param argument Flexible properties for the desired node type. Node groups that
     * use this node template will create nodes of a type that matches
     * these properties. Only one of nodeTypeFlexibility and nodeType can
     * be specified.
     * Structure is documented below.
     */
    @JvmName("cnrundkuwolnflrx")
    public suspend fun nodeTypeFlexibility(argument: suspend NodeTemplateNodeTypeFlexibilityArgsBuilder.() -> Unit) {
        val toBeMapped = NodeTemplateNodeTypeFlexibilityArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.nodeTypeFlexibility = mapped
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("ofjghfcfqirrgwry")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value Region where nodes using the node template will be created.
     * If it is not provided, the provider region is used.
     */
    @JvmName("jngaopeiiqqahuyi")
    public suspend fun region(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.region = mapped
    }

    /**
     * @param value The server binding policy for nodes using this template. Determines
     * where the nodes should restart following a maintenance event.
     * Structure is documented below.
     */
    @JvmName("msoatryimxnavfoo")
    public suspend fun serverBinding(`value`: NodeTemplateServerBindingArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serverBinding = mapped
    }

    /**
     * @param argument The server binding policy for nodes using this template. Determines
     * where the nodes should restart following a maintenance event.
     * Structure is documented below.
     */
    @JvmName("nhmedvtkwthrqgij")
    public suspend fun serverBinding(argument: suspend NodeTemplateServerBindingArgsBuilder.() -> Unit) {
        val toBeMapped = NodeTemplateServerBindingArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.serverBinding = mapped
    }

    internal fun build(): NodeTemplateArgs = NodeTemplateArgs(
        cpuOvercommitType = cpuOvercommitType,
        description = description,
        name = name,
        nodeAffinityLabels = nodeAffinityLabels,
        nodeType = nodeType,
        nodeTypeFlexibility = nodeTypeFlexibility,
        project = project,
        region = region,
        serverBinding = serverBinding,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy