com.pulumi.gcp.compute.kotlin.Image.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.ImageGuestOsFeature
import com.pulumi.gcp.compute.kotlin.outputs.ImageImageEncryptionKey
import com.pulumi.gcp.compute.kotlin.outputs.ImageRawDisk
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.compute.kotlin.outputs.ImageGuestOsFeature.Companion.toKotlin as imageGuestOsFeatureToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.ImageImageEncryptionKey.Companion.toKotlin as imageImageEncryptionKeyToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.ImageRawDisk.Companion.toKotlin as imageRawDiskToKotlin
/**
* 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.gcp.compute.Image(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Image(builtJavaResource)
}
}
/**
* Represents an Image resource.
* Google Compute Engine uses operating system images to create the root
* persistent disks for your instances. You specify an image when you create
* an instance. Images contain a boot loader, an operating system, and a
* root file system. Linux operating system images are also capable of
* running containers on Compute Engine.
* Images can be either public or custom.
* Public images are provided and maintained by Google, open-source
* communities, and third-party vendors. By default, all projects have
* access to these images and can use them to create instances. Custom
* images are available only to your project. You can create a custom image
* from root persistent disks and other images. Then, use the custom image
* to create an instance.
* To get more information about Image, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/v1/images)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/compute/docs/images)
* ## Example Usage
* ### Image Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const example = new gcp.compute.Image("example", {
* name: "example-image",
* rawDisk: {
* source: "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* example = gcp.compute.Image("example",
* name="example-image",
* raw_disk=gcp.compute.ImageRawDiskArgs(
* source="https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var example = new Gcp.Compute.Image("example", new()
* {
* Name = "example-image",
* RawDisk = new Gcp.Compute.Inputs.ImageRawDiskArgs
* {
* Source = "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* },
* });
* });
* ```
* ```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.NewImage(ctx, "example", &compute.ImageArgs{
* Name: pulumi.String("example-image"),
* RawDisk: &compute.ImageRawDiskArgs{
* Source: pulumi.String("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz"),
* },
* })
* 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.Image;
* import com.pulumi.gcp.compute.ImageArgs;
* import com.pulumi.gcp.compute.inputs.ImageRawDiskArgs;
* 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 example = new Image("example", ImageArgs.builder()
* .name("example-image")
* .rawDisk(ImageRawDiskArgs.builder()
* .source("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: gcp:compute:Image
* properties:
* name: example-image
* rawDisk:
* source: https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz
* ```
*
* ### Image Guest Os
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const example = new gcp.compute.Image("example", {
* name: "example-image",
* rawDisk: {
* source: "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* },
* guestOsFeatures: [
* {
* type: "SECURE_BOOT",
* },
* {
* type: "MULTI_IP_SUBNET",
* },
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* example = gcp.compute.Image("example",
* name="example-image",
* raw_disk=gcp.compute.ImageRawDiskArgs(
* source="https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* ),
* guest_os_features=[
* gcp.compute.ImageGuestOsFeatureArgs(
* type="SECURE_BOOT",
* ),
* gcp.compute.ImageGuestOsFeatureArgs(
* type="MULTI_IP_SUBNET",
* ),
* ])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var example = new Gcp.Compute.Image("example", new()
* {
* Name = "example-image",
* RawDisk = new Gcp.Compute.Inputs.ImageRawDiskArgs
* {
* Source = "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* },
* GuestOsFeatures = new[]
* {
* new Gcp.Compute.Inputs.ImageGuestOsFeatureArgs
* {
* Type = "SECURE_BOOT",
* },
* new Gcp.Compute.Inputs.ImageGuestOsFeatureArgs
* {
* Type = "MULTI_IP_SUBNET",
* },
* },
* });
* });
* ```
* ```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.NewImage(ctx, "example", &compute.ImageArgs{
* Name: pulumi.String("example-image"),
* RawDisk: &compute.ImageRawDiskArgs{
* Source: pulumi.String("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz"),
* },
* GuestOsFeatures: compute.ImageGuestOsFeatureArray{
* &compute.ImageGuestOsFeatureArgs{
* Type: pulumi.String("SECURE_BOOT"),
* },
* &compute.ImageGuestOsFeatureArgs{
* Type: pulumi.String("MULTI_IP_SUBNET"),
* },
* },
* })
* 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.Image;
* import com.pulumi.gcp.compute.ImageArgs;
* import com.pulumi.gcp.compute.inputs.ImageRawDiskArgs;
* import com.pulumi.gcp.compute.inputs.ImageGuestOsFeatureArgs;
* 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 example = new Image("example", ImageArgs.builder()
* .name("example-image")
* .rawDisk(ImageRawDiskArgs.builder()
* .source("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz")
* .build())
* .guestOsFeatures(
* ImageGuestOsFeatureArgs.builder()
* .type("SECURE_BOOT")
* .build(),
* ImageGuestOsFeatureArgs.builder()
* .type("MULTI_IP_SUBNET")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: gcp:compute:Image
* properties:
* name: example-image
* rawDisk:
* source: https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz
* guestOsFeatures:
* - type: SECURE_BOOT
* - type: MULTI_IP_SUBNET
* ```
*
* ### Image Basic Storage Location
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const example = new gcp.compute.Image("example", {
* name: "example-sl-image",
* rawDisk: {
* source: "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* },
* storageLocations: ["us-central1"],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* example = gcp.compute.Image("example",
* name="example-sl-image",
* raw_disk=gcp.compute.ImageRawDiskArgs(
* source="https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* ),
* storage_locations=["us-central1"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var example = new Gcp.Compute.Image("example", new()
* {
* Name = "example-sl-image",
* RawDisk = new Gcp.Compute.Inputs.ImageRawDiskArgs
* {
* Source = "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz",
* },
* StorageLocations = new[]
* {
* "us-central1",
* },
* });
* });
* ```
* ```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.NewImage(ctx, "example", &compute.ImageArgs{
* Name: pulumi.String("example-sl-image"),
* RawDisk: &compute.ImageRawDiskArgs{
* Source: pulumi.String("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz"),
* },
* StorageLocations: pulumi.StringArray{
* pulumi.String("us-central1"),
* },
* })
* 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.Image;
* import com.pulumi.gcp.compute.ImageArgs;
* import com.pulumi.gcp.compute.inputs.ImageRawDiskArgs;
* 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 example = new Image("example", ImageArgs.builder()
* .name("example-sl-image")
* .rawDisk(ImageRawDiskArgs.builder()
* .source("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz")
* .build())
* .storageLocations("us-central1")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: gcp:compute:Image
* properties:
* name: example-sl-image
* rawDisk:
* source: https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz
* storageLocations:
* - us-central1
* ```
*
* ## Import
* Image can be imported using any of these accepted formats:
* * `projects/{{project}}/global/images/{{name}}`
* * `{{project}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Image can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/image:Image default projects/{{project}}/global/images/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/image:Image default {{project}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/image:Image default {{name}}
* ```
*/
public class Image internal constructor(
override val javaResource: com.pulumi.gcp.compute.Image,
) : KotlinCustomResource(javaResource, ImageMapper) {
/**
* 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 })
/**
* An optional description of this resource. Provide this property when
* you create the resource.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Size of the image when restored onto a persistent disk (in GB).
*/
public val diskSizeGb: Output
get() = javaResource.diskSizeGb().applyValue({ args0 -> 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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy