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

com.pulumi.gcp.compute.kotlin.RegionInstanceTemplate.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.gcp.compute.kotlin.outputs.RegionInstanceTemplateAdvancedMachineFeatures
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateConfidentialInstanceConfig
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateDisk
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateGuestAccelerator
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateNetworkInterface
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateNetworkPerformanceConfig
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateReservationAffinity
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateScheduling
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateServiceAccount
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateShieldedInstanceConfig
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.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateAdvancedMachineFeatures.Companion.toKotlin as regionInstanceTemplateAdvancedMachineFeaturesToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateConfidentialInstanceConfig.Companion.toKotlin as regionInstanceTemplateConfidentialInstanceConfigToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateDisk.Companion.toKotlin as regionInstanceTemplateDiskToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateGuestAccelerator.Companion.toKotlin as regionInstanceTemplateGuestAcceleratorToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateNetworkInterface.Companion.toKotlin as regionInstanceTemplateNetworkInterfaceToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateNetworkPerformanceConfig.Companion.toKotlin as regionInstanceTemplateNetworkPerformanceConfigToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateReservationAffinity.Companion.toKotlin as regionInstanceTemplateReservationAffinityToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateScheduling.Companion.toKotlin as regionInstanceTemplateSchedulingToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateServiceAccount.Companion.toKotlin as regionInstanceTemplateServiceAccountToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceTemplateShieldedInstanceConfig.Companion.toKotlin as regionInstanceTemplateShieldedInstanceConfigToKotlin

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

    public var args: RegionInstanceTemplateArgs = RegionInstanceTemplateArgs()

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

/**
 *
 * ## Import
 * Instance templates can be imported using any of these accepted formats:
 * * `projects/{{project}}/regions/{{region}}/instanceTemplates/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, instance templates can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/regionInstanceTemplate:RegionInstanceTemplate default projects/{{project}}/regions/{{region}}/instanceTemplates/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/regionInstanceTemplate:RegionInstanceTemplate default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/regionInstanceTemplate:RegionInstanceTemplate default {{name}}
 * ```
 */
public class RegionInstanceTemplate internal constructor(
    override val javaResource: com.pulumi.gcp.compute.RegionInstanceTemplate,
) : KotlinCustomResource(javaResource, RegionInstanceTemplateMapper) {
    /**
     * Configure Nested Virtualisation and Simultaneous Hyper Threading on this VM. Structure is documented below
     */
    public val advancedMachineFeatures: Output?
        get() = javaResource.advancedMachineFeatures().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceTemplateAdvancedMachineFeaturesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Whether to allow sending and receiving of
     * packets with non-matching source or destination IPs. This defaults to false.
     */
    public val canIpForward: Output?
        get() = javaResource.canIpForward().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Enable [Confidential Mode](https://cloud.google.com/compute/confidential-vm/docs/about-cvm) on this VM. Structure is documented below
     */
    public val confidentialInstanceConfig: Output
        get() = javaResource.confidentialInstanceConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                regionInstanceTemplateConfidentialInstanceConfigToKotlin(args0)
            })
        })

    /**
     * A brief description of this resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Disks to attach to instances created from this template.
     * This can be specified multiple times for multiple disks. Structure is
     * documented below.
     */
    public val disks: Output>
        get() = javaResource.disks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceTemplateDiskToKotlin(args0)
                })
            })
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Enable [Virtual Displays](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display#verify_display_driver) on this instance.
     * **Note**: `allow_stopping_for_update` must be set to true in order to update this field.
     */
    public val enableDisplay: Output?
        get() = javaResource.enableDisplay().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * List of the type and count of accelerator cards attached to the instance. Structure documented below.
     */
    public val guestAccelerators: Output>?
        get() = javaResource.guestAccelerators().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        regionInstanceTemplateGuestAcceleratorToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * A brief description to use for instances
     * created from this template.
     */
    public val instanceDescription: Output?
        get() = javaResource.instanceDescription().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A set of key/value label pairs to assign to instances
     * created from this template.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field 'effective_labels' for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The machine type to create.
     * To create a machine with a [custom type](https://cloud.google.com/dataproc/docs/concepts/compute/custom-machine-types) (such as extended memory), format the value like `custom-VCPUS-MEM_IN_MB` like `custom-6-20480` for 6 vCPU and 20GB of RAM.
     * - - -
     */
    public val machineType: Output
        get() = javaResource.machineType().applyValue({ args0 -> args0 })

    /**
     * Metadata key/value pairs to make available from
     * within instances created from this template.
     */
    public val metadata: Output>?
        get() = javaResource.metadata().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The unique fingerprint of the metadata.
     */
    public val metadataFingerprint: Output
        get() = javaResource.metadataFingerprint().applyValue({ args0 -> args0 })

    /**
     * An alternative to using the
     * startup-script metadata key, mostly to match the compute_instance resource.
     * This replaces the startup-script metadata key on the created instance and
     * thus the two mechanisms are not allowed to be used simultaneously.
     */
    public val metadataStartupScript: Output?
        get() = javaResource.metadataStartupScript().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as
     * `Intel Haswell` or `Intel Skylake`. See the complete list [here](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform).
     */
    public val minCpuPlatform: Output?
        get() = javaResource.minCpuPlatform().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Creates a unique name beginning with the specified
     * prefix. Conflicts with `name`.
     */
    public val namePrefix: Output
        get() = javaResource.namePrefix().applyValue({ args0 -> args0 })

    /**
     * Networks to attach to instances created from
     * this template. This can be specified multiple times for multiple networks.
     * Structure is documented below.
     */
    public val networkInterfaces: Output>?
        get() = javaResource.networkInterfaces().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        regionInstanceTemplateNetworkInterfaceToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Configures network performance settings for the instance created from the
     * template. Structure is documented below. **Note**: `machine_type`
     * must be a [supported type](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration),
     * the `image` used must include the [`GVNIC`](https://cloud.google.com/compute/docs/networking/using-gvnic#create-instance-gvnic-image)
     * in `guest-os-features`, and `network_interface.0.nic-type` must be `GVNIC`
     * in order for this setting to take effect.
     */
    public val networkPerformanceConfig: Output?
        get() = javaResource.networkPerformanceConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceTemplateNetworkPerformanceConfigToKotlin(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 combination of labels configured directly on the resource and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

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

    /**
     * Specifies the reservations that this instance can consume from.
     * Structure is documented below.
     */
    public val reservationAffinity: Output?
        get() = javaResource.reservationAffinity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceTemplateReservationAffinityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A set of key/value resource manager tag pairs to bind to the instance. Keys must be in the format tagKeys/{tag_key_id}, and values are in the format tagValues/456.
     */
    public val resourceManagerTags: Output>?
        get() = javaResource.resourceManagerTags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.key.to(args0.value) }).toMap()
            }).orElse(null)
        })

    /**
     * - A list of self_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported.
     */
    public val resourcePolicies: Output?
        get() = javaResource.resourcePolicies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The scheduling strategy to use. More details about
     * this configuration option are detailed below.
     */
    public val scheduling: Output
        get() = javaResource.scheduling().applyValue({ args0 ->
            args0.let({ args0 ->
                regionInstanceTemplateSchedulingToKotlin(args0)
            })
        })

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

    /**
     * Service account to attach to the instance. Structure is documented below.
     */
    public val serviceAccount: Output?
        get() = javaResource.serviceAccount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> regionInstanceTemplateServiceAccountToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Enable [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm) on this instance. Shielded VM provides verifiable integrity to prevent against malware and rootkits. Defaults to disabled. Structure is documented below.
     * **Note**: `shielded_instance_config` can only be used with boot images with shielded vm support. See the complete list [here](https://cloud.google.com/compute/docs/images#shielded-images).
     */
    public val shieldedInstanceConfig: Output
        get() = javaResource.shieldedInstanceConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                regionInstanceTemplateShieldedInstanceConfigToKotlin(args0)
            })
        })

    /**
     * Tags to attach to the instance.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The unique fingerprint of the tags.
     */
    public val tagsFingerprint: Output
        get() = javaResource.tagsFingerprint().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy