![JAR search and dependency download from the Maven repository](/logo.png)
com.pulumi.digitalocean.kotlin.CustomImage.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-digitalocean-kotlin Show documentation
Show all versions of pulumi-digitalocean-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.digitalocean.kotlin
import com.pulumi.core.Output
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.Double
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [CustomImage].
*/
@PulumiTagMarker
public class CustomImageResourceBuilder internal constructor() {
public var name: String? = null
public var args: CustomImageArgs = CustomImageArgs()
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 CustomImageArgsBuilder.() -> Unit) {
val builder = CustomImageArgsBuilder()
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(): CustomImage {
val builtJavaResource = com.pulumi.digitalocean.CustomImage(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return CustomImage(builtJavaResource)
}
}
/**
* 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
* ```
*
*/
public class CustomImage internal constructor(
override val javaResource: com.pulumi.digitalocean.CustomImage,
) : KotlinCustomResource(javaResource, CustomImageMapper) {
/**
* A time value given in ISO8601 combined date and time format that represents when the image was created.
*/
public val createdAt: Output
get() = javaResource.createdAt().applyValue({ args0 -> args0 })
/**
* An optional description for the image.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* An optional distribution name for the image. Valid values are documented [here](https://docs.digitalocean.com/reference/api/api-reference/#operation/create_custom_image)
*/
public val distribution: Output?
get() = javaResource.distribution().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A unique number that can be used to identify and reference a specific image.
*/
public val imageId: Output
get() = javaResource.imageId().applyValue({ args0 -> args0 })
/**
* The minimum disk size in GB required for a Droplet to use this image.
*/
public val minDiskSize: Output
get() = javaResource.minDiskSize().applyValue({ args0 -> args0 })
/**
* A name for the Custom Image.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Indicates whether the image in question is public or not.
*/
public val `public`: Output
get() = javaResource.public_().applyValue({ args0 -> args0 })
/**
* A list of regions. (Currently only one is supported).
*/
public val regions: Output>
get() = javaResource.regions().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* The size of the image in gigabytes.
*/
public val sizeGigabytes: Output
get() = javaResource.sizeGigabytes().applyValue({ args0 -> args0 })
/**
* A uniquely identifying string for each image.
*/
public val slug: Output
get() = javaResource.slug().applyValue({ args0 -> args0 })
/**
* A status string indicating the state of a custom image.
*/
public val status: Output
get() = javaResource.status().applyValue({ args0 -> args0 })
/**
* A list of optional tags for the image.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
/**
* Describes the kind of image.
*/
public val type: Output
get() = javaResource.type().applyValue({ args0 -> args0 })
/**
* A URL from which the custom Linux virtual machine image may be retrieved.
*/
public val url: Output
get() = javaResource.url().applyValue({ args0 -> args0 })
}
public object CustomImageMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.digitalocean.CustomImage::class == javaResource::class
override fun map(javaResource: Resource): CustomImage = CustomImage(
javaResource as
com.pulumi.digitalocean.CustomImage,
)
}
/**
* @see [CustomImage].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [CustomImage].
*/
public suspend fun customImage(name: String, block: suspend CustomImageResourceBuilder.() -> Unit): CustomImage {
val builder = CustomImageResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [CustomImage].
* @param name The _unique_ name of the resulting resource.
*/
public fun customImage(name: String): CustomImage {
val builder = CustomImageResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy