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

com.pulumi.digitalocean.kotlin.CustomImageArgs.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: 4.35.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.digitalocean.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.digitalocean.CustomImageArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Provides a resource which can be used to create a [custom image](https://www.digitalocean.com/docs/images/custom-images/)
 * from a URL. The URL must point to an image in one of the following file formats:
 * - Raw (.img) with an MBR or GPT partition table
 * - qcow2
 * - VHDX
 * - VDI
 * - VMDK
 * The image may be compressed using gzip or bzip2. See the DigitalOcean Custom
 * Image documentation for [additional requirements](https://www.digitalocean.com/docs/images/custom-images/#image-requirements).
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as digitalocean from "@pulumi/digitalocean";
 * const flatcar = new digitalocean.CustomImage("flatcar", {
 *     name: "flatcar",
 *     url: "https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2",
 *     regions: ["nyc3"],
 * });
 * const example = new digitalocean.Droplet("example", {
 *     image: flatcar.id,
 *     name: "example-01",
 *     region: digitalocean.Region.NYC3,
 *     size: digitalocean.DropletSlug.DropletS1VCPU1GB,
 *     sshKeys: ["12345"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_digitalocean as digitalocean
 * flatcar = digitalocean.CustomImage("flatcar",
 *     name="flatcar",
 *     url="https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2",
 *     regions=["nyc3"])
 * example = digitalocean.Droplet("example",
 *     image=flatcar.id,
 *     name="example-01",
 *     region=digitalocean.Region.NYC3,
 *     size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
 *     ssh_keys=["12345"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using DigitalOcean = Pulumi.DigitalOcean;
 * return await Deployment.RunAsync(() =>
 * {
 *     var flatcar = new DigitalOcean.CustomImage("flatcar", new()
 *     {
 *         Name = "flatcar",
 *         Url = "https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2",
 *         Regions = new[]
 *         {
 *             "nyc3",
 *         },
 *     });
 *     var example = new DigitalOcean.Droplet("example", new()
 *     {
 *         Image = flatcar.Id,
 *         Name = "example-01",
 *         Region = DigitalOcean.Region.NYC3,
 *         Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
 *         SshKeys = new[]
 *         {
 *             "12345",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		flatcar, err := digitalocean.NewCustomImage(ctx, "flatcar", &digitalocean.CustomImageArgs{
 * 			Name: pulumi.String("flatcar"),
 * 			Url:  pulumi.String("https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2"),
 * 			Regions: pulumi.StringArray{
 * 				pulumi.String("nyc3"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = digitalocean.NewDroplet(ctx, "example", &digitalocean.DropletArgs{
 * 			Image:  flatcar.ID(),
 * 			Name:   pulumi.String("example-01"),
 * 			Region: pulumi.String(digitalocean.RegionNYC3),
 * 			Size:   pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
 * 			SshKeys: pulumi.StringArray{
 * 				pulumi.String("12345"),
 * 			},
 * 		})
 * 		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.digitalocean.CustomImage;
 * import com.pulumi.digitalocean.CustomImageArgs;
 * import com.pulumi.digitalocean.Droplet;
 * import com.pulumi.digitalocean.DropletArgs;
 * 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 flatcar = new CustomImage("flatcar", CustomImageArgs.builder()
 *             .name("flatcar")
 *             .url("https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2")
 *             .regions("nyc3")
 *             .build());
 *         var example = new Droplet("example", DropletArgs.builder()
 *             .image(flatcar.id())
 *             .name("example-01")
 *             .region("nyc3")
 *             .size("s-1vcpu-1gb")
 *             .sshKeys(12345)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   flatcar:
 *     type: digitalocean:CustomImage
 *     properties:
 *       name: flatcar
 *       url: https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2
 *       regions:
 *         - nyc3
 *   example:
 *     type: digitalocean:Droplet
 *     properties:
 *       image: ${flatcar.id}
 *       name: example-01
 *       region: nyc3
 *       size: s-1vcpu-1gb
 *       sshKeys:
 *         - 12345
 * ```
 * 
 * @property description An optional description for the image.
 * @property distribution An optional distribution name for the image. Valid values are documented [here](https://docs.digitalocean.com/reference/api/api-reference/#operation/create_custom_image)
 * @property name A name for the Custom Image.
 * @property regions A list of regions. (Currently only one is supported).
 * @property tags A list of optional tags for the image.
 * @property url A URL from which the custom Linux virtual machine image may be retrieved.
 */
public data class CustomImageArgs(
    public val description: Output? = null,
    public val distribution: Output? = null,
    public val name: Output? = null,
    public val regions: Output>? = null,
    public val tags: Output>? = null,
    public val url: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.digitalocean.CustomImageArgs =
        com.pulumi.digitalocean.CustomImageArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .distribution(distribution?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .regions(regions?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .url(url?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [CustomImageArgs].
 */
@PulumiTagMarker
public class CustomImageArgsBuilder internal constructor() {
    private var description: Output? = null

    private var distribution: Output? = null

    private var name: Output? = null

    private var regions: Output>? = null

    private var tags: Output>? = null

    private var url: Output? = null

    /**
     * @param value An optional description for the image.
     */
    @JvmName("cdhmhyyirkbbjamr")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value An optional distribution name for the image. Valid values are documented [here](https://docs.digitalocean.com/reference/api/api-reference/#operation/create_custom_image)
     */
    @JvmName("pkgdkcnvvnntmpuh")
    public suspend fun distribution(`value`: Output) {
        this.distribution = value
    }

    /**
     * @param value A name for the Custom Image.
     */
    @JvmName("krjnwwehyxcymqqn")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value A list of regions. (Currently only one is supported).
     */
    @JvmName("nnoqljpnwwlttxnd")
    public suspend fun regions(`value`: Output>) {
        this.regions = value
    }

    @JvmName("pojmrmqvchhvtqqe")
    public suspend fun regions(vararg values: Output) {
        this.regions = Output.all(values.asList())
    }

    /**
     * @param values A list of regions. (Currently only one is supported).
     */
    @JvmName("xarbjotujlootnvw")
    public suspend fun regions(values: List>) {
        this.regions = Output.all(values)
    }

    /**
     * @param value A list of optional tags for the image.
     */
    @JvmName("kcrwgniogckprbax")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    @JvmName("skricxikwovtfjns")
    public suspend fun tags(vararg values: Output) {
        this.tags = Output.all(values.asList())
    }

    /**
     * @param values A list of optional tags for the image.
     */
    @JvmName("yuauobnmvfnegtqg")
    public suspend fun tags(values: List>) {
        this.tags = Output.all(values)
    }

    /**
     * @param value A URL from which the custom Linux virtual machine image may be retrieved.
     */
    @JvmName("exubqmcxhetkeyse")
    public suspend fun url(`value`: Output) {
        this.url = value
    }

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

    /**
     * @param value An optional distribution name for the image. Valid values are documented [here](https://docs.digitalocean.com/reference/api/api-reference/#operation/create_custom_image)
     */
    @JvmName("inlfifxaqixykgwd")
    public suspend fun distribution(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.distribution = mapped
    }

    /**
     * @param value A name for the Custom Image.
     */
    @JvmName("avftymlkiorggaid")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value A list of regions. (Currently only one is supported).
     */
    @JvmName("mqiajkdhgvvycedr")
    public suspend fun regions(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.regions = mapped
    }

    /**
     * @param values A list of regions. (Currently only one is supported).
     */
    @JvmName("kpmnixhuvskcgwyl")
    public suspend fun regions(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.regions = mapped
    }

    /**
     * @param value A list of optional tags for the image.
     */
    @JvmName("gkycwlmguxjqaabs")
    public suspend fun tags(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A list of optional tags for the image.
     */
    @JvmName("ljusfidrclieahtf")
    public suspend fun tags(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value A URL from which the custom Linux virtual machine image may be retrieved.
     */
    @JvmName("kscqvmraxumfnxjr")
    public suspend fun url(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.url = mapped
    }

    internal fun build(): CustomImageArgs = CustomImageArgs(
        description = description,
        distribution = distribution,
        name = name,
        regions = regions,
        tags = tags,
        url = url,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy