Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.compute.kotlin
import com.pulumi.azure.compute.kotlin.outputs.ImageDataDisk
import com.pulumi.azure.compute.kotlin.outputs.ImageOsDisk
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.compute.kotlin.outputs.ImageDataDisk.Companion.toKotlin as imageDataDiskToKotlin
import com.pulumi.azure.compute.kotlin.outputs.ImageOsDisk.Companion.toKotlin as imageOsDiskToKotlin
/**
* 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.azure.compute.Image(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Image(builtJavaResource)
}
}
/**
* Manages a custom virtual machine image that can be used to create virtual machines.
* ## Example Usage
* > **Note:** For a more complete example, see the `examples/image` directory within the GitHub Repository.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = azure.compute.getVirtualMachine({
* name: "examplevm",
* resourceGroupName: "example-resources",
* });
* const exampleImage = new azure.compute.Image("example", {
* name: "exampleimage",
* location: example.then(example => example.location),
* resourceGroupName: example.then(example => example.name),
* sourceVirtualMachineId: example.then(example => example.id),
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.compute.get_virtual_machine(name="examplevm",
* resource_group_name="example-resources")
* example_image = azure.compute.Image("example",
* name="exampleimage",
* location=example.location,
* resource_group_name=example.name,
* source_virtual_machine_id=example.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = Azure.Compute.GetVirtualMachine.Invoke(new()
* {
* Name = "examplevm",
* ResourceGroupName = "example-resources",
* });
* var exampleImage = new Azure.Compute.Image("example", new()
* {
* Name = "exampleimage",
* Location = example.Apply(getVirtualMachineResult => getVirtualMachineResult.Location),
* ResourceGroupName = example.Apply(getVirtualMachineResult => getVirtualMachineResult.Name),
* SourceVirtualMachineId = example.Apply(getVirtualMachineResult => getVirtualMachineResult.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := compute.LookupVirtualMachine(ctx, &compute.LookupVirtualMachineArgs{
* Name: "examplevm",
* ResourceGroupName: "example-resources",
* }, nil)
* if err != nil {
* return err
* }
* _, err = compute.NewImage(ctx, "example", &compute.ImageArgs{
* Name: pulumi.String("exampleimage"),
* Location: pulumi.String(example.Location),
* ResourceGroupName: pulumi.String(example.Name),
* SourceVirtualMachineId: pulumi.String(example.Id),
* })
* 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.azure.compute.ComputeFunctions;
* import com.pulumi.azure.compute.inputs.GetVirtualMachineArgs;
* import com.pulumi.azure.compute.Image;
* import com.pulumi.azure.compute.ImageArgs;
* 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) {
* final var example = ComputeFunctions.getVirtualMachine(GetVirtualMachineArgs.builder()
* .name("examplevm")
* .resourceGroupName("example-resources")
* .build());
* var exampleImage = new Image("exampleImage", ImageArgs.builder()
* .name("exampleimage")
* .location(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.location()))
* .resourceGroupName(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.name()))
* .sourceVirtualMachineId(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.id()))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleImage:
* type: azure:compute:Image
* name: example
* properties:
* name: exampleimage
* location: ${example.location}
* resourceGroupName: ${example.name}
* sourceVirtualMachineId: ${example.id}
* variables:
* example:
* fn::invoke:
* Function: azure:compute:getVirtualMachine
* Arguments:
* name: examplevm
* resourceGroupName: example-resources
* ```
*
* ## Import
* Images can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:compute/image:Image example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/images/image1
* ```
*/
public class Image internal constructor(
override val javaResource: com.pulumi.azure.compute.Image,
) : KotlinCustomResource(javaResource, ImageMapper) {
/**
* One or more `data_disk` blocks as defined below.
*/
public val dataDisks: Output>?
get() = javaResource.dataDisks().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> imageDataDiskToKotlin(args0) })
})
}).orElse(null)
})
/**
* The HyperVGenerationType of the VirtualMachine created from the image as `V1`, `V2`. Defaults to `V1`. Changing this forces a new resource to be created.
* > **Note:** `zone_resilient` can only be set to `true` if the image is stored in a region that supports availability zones.
*/
public val hyperVGeneration: Output?
get() = javaResource.hyperVGeneration().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* Specifies the name of the image. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* One or more `os_disk` blocks as defined below. Changing this forces a new resource to be created.
*/
public val osDisk: Output?
get() = javaResource.osDisk().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
imageOsDiskToKotlin(args0)
})
}).orElse(null)
})
/**
* The name of the resource group in which to create the image. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The Virtual Machine ID from which to create the image.
*/
public val sourceVirtualMachineId: Output?
get() = javaResource.sourceVirtualMachineId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output