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

com.pulumi.googlenative.compute.v1.kotlin.Image.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.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.compute.v1.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.compute.v1.kotlin.outputs.CustomerEncryptionKeyResponse
import com.pulumi.googlenative.compute.v1.kotlin.outputs.DeprecationStatusResponse
import com.pulumi.googlenative.compute.v1.kotlin.outputs.GuestOsFeatureResponse
import com.pulumi.googlenative.compute.v1.kotlin.outputs.ImageRawDiskResponse
import com.pulumi.googlenative.compute.v1.kotlin.outputs.InitialStateConfigResponse
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.List
import kotlin.collections.Map
import com.pulumi.googlenative.compute.v1.kotlin.outputs.CustomerEncryptionKeyResponse.Companion.toKotlin as customerEncryptionKeyResponseToKotlin
import com.pulumi.googlenative.compute.v1.kotlin.outputs.DeprecationStatusResponse.Companion.toKotlin as deprecationStatusResponseToKotlin
import com.pulumi.googlenative.compute.v1.kotlin.outputs.GuestOsFeatureResponse.Companion.toKotlin as guestOsFeatureResponseToKotlin
import com.pulumi.googlenative.compute.v1.kotlin.outputs.ImageRawDiskResponse.Companion.toKotlin as imageRawDiskResponseToKotlin
import com.pulumi.googlenative.compute.v1.kotlin.outputs.InitialStateConfigResponse.Companion.toKotlin as initialStateConfigResponseToKotlin

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

    public var args: ImageArgs = ImageArgs()

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

/**
 * Creates an image in the specified project using the data included in the request.
 */
public class Image internal constructor(
    override val javaResource: com.pulumi.googlenative.compute.v1.Image,
) : KotlinCustomResource(javaResource, ImageMapper) {
    /**
     * The architecture of the image. Valid values are ARM64 or X86_64.
     */
    public val architecture: Output
        get() = javaResource.architecture().applyValue({ args0 -> args0 })

    /**
     * Size of the image tar.gz archive stored in Google Cloud Storage (in bytes).
     */
    public val archiveSizeBytes: Output
        get() = javaResource.archiveSizeBytes().applyValue({ args0 -> args0 })

    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * The deprecation status associated with this image.
     */
    public val deprecated: Output
        get() = javaResource.deprecated().applyValue({ args0 ->
            args0.let({ args0 ->
                deprecationStatusResponseToKotlin(args0)
            })
        })

    /**
     * An optional description of this resource. Provide this property when you create the resource.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * Size of the image when restored onto a persistent disk (in GB).
     */
    public val diskSizeGb: Output
        get() = javaResource.diskSizeGb().applyValue({ args0 -> args0 })

    /**
     * The name of the image family to which this image belongs. The image family name can be from a publicly managed image family provided by Compute Engine, or from a custom image family you create. For example, centos-stream-9 is a publicly available image family. For more information, see Image family best practices. When creating disks, you can specify an image family instead of a specific image name. The image family always returns its latest image that is not deprecated. The name of the image family must comply with RFC1035.
     */
    public val family: Output
        get() = javaResource.family().applyValue({ args0 -> args0 })

    /**
     * Force image creation if true.
     */
    public val forceCreate: Output?
        get() = javaResource.forceCreate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of features to enable on the guest operating system. Applicable only for bootable images. To see a list of available options, see the guestOSfeatures[].type parameter.
     */
    public val guestOsFeatures: Output>
        get() = javaResource.guestOsFeatures().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> guestOsFeatureResponseToKotlin(args0) })
            })
        })

    /**
     * Encrypts the image using a customer-supplied encryption key. After you encrypt an image with a customer-supplied key, you must provide the same key if you use the image later (e.g. to create a disk from the image). Customer-supplied encryption keys do not protect access to metadata of the disk. If you do not provide an encryption key when creating the image, then the disk will be encrypted using an automatically generated key and you do not need to provide a key to use the image later.
     */
    public val imageEncryptionKey: Output
        get() = javaResource.imageEncryptionKey().applyValue({ args0 ->
            args0.let({ args0 ->
                customerEncryptionKeyResponseToKotlin(args0)
            })
        })

    /**
     * Type of the resource. Always compute#image for images.
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * A fingerprint for the labels being applied to this image, which is essentially a hash of the labels used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an image.
     */
    public val labelFingerprint: Output
        get() = javaResource.labelFingerprint().applyValue({ args0 -> args0 })

    /**
     * Labels to apply to this image. These can be later modified by the setLabels method.
     */
    public val labels: Output>
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Integer license codes indicating which licenses are attached to this image.
     */
    public val licenseCodes: Output>
        get() = javaResource.licenseCodes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Any applicable license URI.
     */
    public val licenses: Output>
        get() = javaResource.licenses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

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

    /**
     * The parameters of the raw disk image.
     */
    public val rawDisk: Output
        get() = javaResource.rawDisk().applyValue({ args0 ->
            args0.let({ args0 ->
                imageRawDiskResponseToKotlin(args0)
            })
        })

    /**
     * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
     */
    public val requestId: Output?
        get() = javaResource.requestId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Reserved for future use.
     */
    public val satisfiesPzs: Output
        get() = javaResource.satisfiesPzs().applyValue({ args0 -> args0 })

    /**
     * Server-defined URL for the resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * Set the secure boot keys of shielded instance.
     */
    public val shieldedInstanceInitialState: Output
        get() = javaResource.shieldedInstanceInitialState().applyValue({ args0 ->
            args0.let({ args0 ->
                initialStateConfigResponseToKotlin(args0)
            })
        })

    /**
     * URL of the source disk used to create this image. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /disks/disk - projects/project/zones/zone/disks/disk - zones/zone/disks/disk In order to create an image, you must provide the full or partial URL of one of the following: - The rawDisk.source URL - The sourceDisk URL - The sourceImage URL - The sourceSnapshot URL
     */
    public val sourceDisk: Output
        get() = javaResource.sourceDisk().applyValue({ args0 -> args0 })

    /**
     * The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key.
     */
    public val sourceDiskEncryptionKey: Output
        get() = javaResource.sourceDiskEncryptionKey().applyValue({ args0 ->
            args0.let({ args0 ->
                customerEncryptionKeyResponseToKotlin(args0)
            })
        })

    /**
     * The ID value of the disk used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given disk name.
     */
    public val sourceDiskId: Output
        get() = javaResource.sourceDiskId().applyValue({ args0 -> args0 })

    /**
     * URL of the source image used to create this image. The following are valid formats for the URL: - https://www.googleapis.com/compute/v1/projects/project_id/global/ images/image_name - projects/project_id/global/images/image_name In order to create an image, you must provide the full or partial URL of one of the following: - The rawDisk.source URL - The sourceDisk URL - The sourceImage URL - The sourceSnapshot URL
     */
    public val sourceImage: Output
        get() = javaResource.sourceImage().applyValue({ args0 -> args0 })

    /**
     * The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key.
     */
    public val sourceImageEncryptionKey: Output
        get() = javaResource.sourceImageEncryptionKey().applyValue({ args0 ->
            args0.let({ args0 ->
                customerEncryptionKeyResponseToKotlin(args0)
            })
        })

    /**
     * The ID value of the image used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given image name.
     */
    public val sourceImageId: Output
        get() = javaResource.sourceImageId().applyValue({ args0 -> args0 })

    /**
     * URL of the source snapshot used to create this image. The following are valid formats for the URL: - https://www.googleapis.com/compute/v1/projects/project_id/global/ snapshots/snapshot_name - projects/project_id/global/snapshots/snapshot_name In order to create an image, you must provide the full or partial URL of one of the following: - The rawDisk.source URL - The sourceDisk URL - The sourceImage URL - The sourceSnapshot URL
     */
    public val sourceSnapshot: Output
        get() = javaResource.sourceSnapshot().applyValue({ args0 -> args0 })

    /**
     * The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key.
     */
    public val sourceSnapshotEncryptionKey: Output
        get() = javaResource.sourceSnapshotEncryptionKey().applyValue({ args0 ->
            args0.let({ args0 ->
                customerEncryptionKeyResponseToKotlin(args0)
            })
        })

    /**
     * The ID value of the snapshot used to create this image. This value may be used to determine whether the snapshot was taken from the current or a previous instance of a given snapshot name.
     */
    public val sourceSnapshotId: Output
        get() = javaResource.sourceSnapshotId().applyValue({ args0 -> args0 })

    /**
     * The type of the image used to create this disk. The default and only valid value is RAW.
     */
    public val sourceType: Output
        get() = javaResource.sourceType().applyValue({ args0 -> args0 })

    /**
     * The status of the image. An image can be used to create other resources, such as instances, only after the image has been successfully created and the status is set to READY. Possible values are FAILED, PENDING, or READY.
     */
    public val status: Output
        get() = javaResource.status().applyValue({ args0 -> args0 })

    /**
     * Cloud Storage bucket storage location of the image (regional or multi-regional).
     */
    public val storageLocations: Output>
        get() = javaResource.storageLocations().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}

public object ImageMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.compute.v1.Image::class == javaResource::class

    override fun map(javaResource: Resource): Image = Image(
        javaResource as
            com.pulumi.googlenative.compute.v1.Image,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy