com.pulumi.gcp.compute.kotlin.NodeTemplate.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.gcp.compute.kotlin.outputs.NodeTemplateNodeTypeFlexibility
import com.pulumi.gcp.compute.kotlin.outputs.NodeTemplateServerBinding
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.gcp.compute.kotlin.outputs.NodeTemplateNodeTypeFlexibility.Companion.toKotlin as nodeTemplateNodeTypeFlexibilityToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.NodeTemplateServerBinding.Companion.toKotlin as nodeTemplateServerBindingToKotlin
/**
* Builder for [NodeTemplate].
*/
@PulumiTagMarker
public class NodeTemplateResourceBuilder internal constructor() {
public var name: String? = null
public var args: NodeTemplateArgs = NodeTemplateArgs()
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 NodeTemplateArgsBuilder.() -> Unit) {
val builder = NodeTemplateArgsBuilder()
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(): NodeTemplate {
val builtJavaResource = com.pulumi.gcp.compute.NodeTemplate(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return NodeTemplate(builtJavaResource)
}
}
/**
* 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}}
* ```
*/
public class NodeTemplate internal constructor(
override val javaResource: com.pulumi.gcp.compute.NodeTemplate,
) : KotlinCustomResource(javaResource, NodeTemplateMapper) {
/**
* CPU overcommit.
* Default value is `NONE`.
* Possible values are: `ENABLED`, `NONE`.
*/
public val cpuOvercommitType: Output?
get() = javaResource.cpuOvercommitType().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 textual description of the resource.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Name of the resource.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Labels to use for node affinity, which will be used in
* instance scheduling.
*/
public val nodeAffinityLabels: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy