Please wait. This can take some minutes ...
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.
com.pulumi.azurenative.devtestlab.kotlin.Formula.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azurenative.devtestlab.kotlin
import com.pulumi.azurenative.devtestlab.kotlin.outputs.FormulaPropertiesFromVmResponse
import com.pulumi.azurenative.devtestlab.kotlin.outputs.LabVirtualMachineCreationParameterResponse
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.Map
import com.pulumi.azurenative.devtestlab.kotlin.outputs.FormulaPropertiesFromVmResponse.Companion.toKotlin as formulaPropertiesFromVmResponseToKotlin
import com.pulumi.azurenative.devtestlab.kotlin.outputs.LabVirtualMachineCreationParameterResponse.Companion.toKotlin as labVirtualMachineCreationParameterResponseToKotlin
/**
* Builder for [Formula].
*/
@PulumiTagMarker
public class FormulaResourceBuilder internal constructor() {
public var name: String? = null
public var args: FormulaArgs = FormulaArgs()
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 FormulaArgsBuilder.() -> Unit) {
val builder = FormulaArgsBuilder()
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(): Formula {
val builtJavaResource = com.pulumi.azurenative.devtestlab.Formula(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Formula(builtJavaResource)
}
}
/**
* A formula for creating a VM, specifying an image base and other parameters
* Azure REST API version: 2018-09-15. Prior API version in Azure Native 1.x: 2018-09-15.
* Other available API versions: 2016-05-15.
* ## Example Usage
* ### Formulas_CreateOrUpdate
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AzureNative = Pulumi.AzureNative;
* return await Deployment.RunAsync(() =>
* {
* var formula = new AzureNative.DevTestLab.Formula("formula", new()
* {
* Description = "Formula using a Linux base",
* FormulaContent = new AzureNative.DevTestLab.Inputs.LabVirtualMachineCreationParameterArgs
* {
* AllowClaim = false,
* Artifacts = new[]
* {
* new AzureNative.DevTestLab.Inputs.ArtifactInstallPropertiesArgs
* {
* ArtifactId = "/artifactsources/{artifactSourceName}/artifacts/linux-install-nodejs",
* Parameters = new() { },
* },
* },
* DisallowPublicIpAddress = true,
* GalleryImageReference = new AzureNative.DevTestLab.Inputs.GalleryImageReferenceArgs
* {
* Offer = "0001-com-ubuntu-server-groovy",
* OsType = "Linux",
* Publisher = "canonical",
* Sku = "20_10",
* Version = "latest",
* },
* IsAuthenticationWithSshKey = false,
* LabSubnetName = "Dtl{labName}Subnet",
* LabVirtualNetworkId = "/virtualnetworks/dtl{labName}",
* Location = "{location}",
* NetworkInterface = new AzureNative.DevTestLab.Inputs.NetworkInterfacePropertiesArgs
* {
* SharedPublicIpAddressConfiguration = new AzureNative.DevTestLab.Inputs.SharedPublicIpAddressConfigurationArgs
* {
* InboundNatRules = new[]
* {
* new AzureNative.DevTestLab.Inputs.InboundNatRuleArgs
* {
* BackendPort = 22,
* TransportProtocol = AzureNative.DevTestLab.TransportProtocol.Tcp,
* },
* },
* },
* },
* Notes = "Ubuntu Server 20.10",
* Size = "Standard_B1ms",
* StorageType = "Standard",
* UserName = "user",
* },
* LabName = "{labName}",
* Location = "{location}",
* Name = "{formulaName}",
* ResourceGroupName = "resourceGroupName",
* });
* });
* ```
* ```go
* package main
* import (
* devtestlab "github.com/pulumi/pulumi-azure-native-sdk/devtestlab/v2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := devtestlab.NewFormula(ctx, "formula", &devtestlab.FormulaArgs{
* Description: pulumi.String("Formula using a Linux base"),
* FormulaContent: &devtestlab.LabVirtualMachineCreationParameterArgs{
* AllowClaim: pulumi.Bool(false),
* Artifacts: devtestlab.ArtifactInstallPropertiesArray{
* &devtestlab.ArtifactInstallPropertiesArgs{
* ArtifactId: pulumi.String("/artifactsources/{artifactSourceName}/artifacts/linux-install-nodejs"),
* Parameters: devtestlab.ArtifactParameterPropertiesArray{},
* },
* },
* DisallowPublicIpAddress: pulumi.Bool(true),
* GalleryImageReference: &devtestlab.GalleryImageReferenceArgs{
* Offer: pulumi.String("0001-com-ubuntu-server-groovy"),
* OsType: pulumi.String("Linux"),
* Publisher: pulumi.String("canonical"),
* Sku: pulumi.String("20_10"),
* Version: pulumi.String("latest"),
* },
* IsAuthenticationWithSshKey: pulumi.Bool(false),
* LabSubnetName: pulumi.String("Dtl{labName}Subnet"),
* LabVirtualNetworkId: pulumi.String("/virtualnetworks/dtl{labName}"),
* Location: pulumi.String("{location}"),
* NetworkInterface: &devtestlab.NetworkInterfacePropertiesArgs{
* SharedPublicIpAddressConfiguration: &devtestlab.SharedPublicIpAddressConfigurationArgs{
* InboundNatRules: devtestlab.InboundNatRuleArray{
* &devtestlab.InboundNatRuleArgs{
* BackendPort: pulumi.Int(22),
* TransportProtocol: pulumi.String(devtestlab.TransportProtocolTcp),
* },
* },
* },
* },
* Notes: pulumi.String("Ubuntu Server 20.10"),
* Size: pulumi.String("Standard_B1ms"),
* StorageType: pulumi.String("Standard"),
* UserName: pulumi.String("user"),
* },
* LabName: pulumi.String("{labName}"),
* Location: pulumi.String("{location}"),
* Name: pulumi.String("{formulaName}"),
* ResourceGroupName: pulumi.String("resourceGroupName"),
* })
* 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.azurenative.devtestlab.Formula;
* import com.pulumi.azurenative.devtestlab.FormulaArgs;
* import com.pulumi.azurenative.devtestlab.inputs.LabVirtualMachineCreationParameterArgs;
* import com.pulumi.azurenative.devtestlab.inputs.GalleryImageReferenceArgs;
* import com.pulumi.azurenative.devtestlab.inputs.NetworkInterfacePropertiesArgs;
* import com.pulumi.azurenative.devtestlab.inputs.SharedPublicIpAddressConfigurationArgs;
* 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 formula = new Formula("formula", FormulaArgs.builder()
* .description("Formula using a Linux base")
* .formulaContent(LabVirtualMachineCreationParameterArgs.builder()
* .allowClaim(false)
* .artifacts(ArtifactInstallPropertiesArgs.builder()
* .artifactId("/artifactsources/{artifactSourceName}/artifacts/linux-install-nodejs")
* .parameters()
* .build())
* .disallowPublicIpAddress(true)
* .galleryImageReference(GalleryImageReferenceArgs.builder()
* .offer("0001-com-ubuntu-server-groovy")
* .osType("Linux")
* .publisher("canonical")
* .sku("20_10")
* .version("latest")
* .build())
* .isAuthenticationWithSshKey(false)
* .labSubnetName("Dtl{labName}Subnet")
* .labVirtualNetworkId("/virtualnetworks/dtl{labName}")
* .location("{location}")
* .networkInterface(NetworkInterfacePropertiesArgs.builder()
* .sharedPublicIpAddressConfiguration(SharedPublicIpAddressConfigurationArgs.builder()
* .inboundNatRules(InboundNatRuleArgs.builder()
* .backendPort(22)
* .transportProtocol("Tcp")
* .build())
* .build())
* .build())
* .notes("Ubuntu Server 20.10")
* .size("Standard_B1ms")
* .storageType("Standard")
* .userName("user")
* .build())
* .labName("{labName}")
* .location("{location}")
* .name("{formulaName}")
* .resourceGroupName("resourceGroupName")
* .build());
* }
* }
* ```
* ## Import
* An existing resource can be imported using its type token, name, and identifier, e.g.
* ```sh
* $ pulumi import azure-native:devtestlab:Formula {formulaName} /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}
* ```
*/
public class Formula internal constructor(
override val javaResource: com.pulumi.azurenative.devtestlab.Formula,
) : KotlinCustomResource(javaResource, FormulaMapper) {
/**
* The author of the formula.
*/
public val author: Output
get() = javaResource.author().applyValue({ args0 -> args0 })
/**
* The creation date of the formula.
*/
public val creationDate: Output
get() = javaResource.creationDate().applyValue({ args0 -> args0 })
/**
* The description of the formula.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The content of the formula.
*/
public val formulaContent: Output?
get() = javaResource.formulaContent().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
labVirtualMachineCreationParameterResponseToKotlin(args0)
})
}).orElse(null)
})
/**
* The location of the resource.
*/
public val location: Output?
get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The name of the resource.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The OS type of the formula.
*/
public val osType: Output?
get() = javaResource.osType().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The provisioning status of the resource.
*/
public val provisioningState: Output
get() = javaResource.provisioningState().applyValue({ args0 -> args0 })
/**
* The tags of the resource.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* The type of the resource.
*/
public val type: Output
get() = javaResource.type().applyValue({ args0 -> args0 })
/**
* The unique immutable identifier of a resource (Guid).
*/
public val uniqueIdentifier: Output
get() = javaResource.uniqueIdentifier().applyValue({ args0 -> args0 })
/**
* Information about a VM from which a formula is to be created.
*/
public val vm: Output?
get() = javaResource.vm().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
formulaPropertiesFromVmResponseToKotlin(args0)
})
}).orElse(null)
})
}
public object FormulaMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azurenative.devtestlab.Formula::class == javaResource::class
override fun map(javaResource: Resource): Formula = Formula(
javaResource as
com.pulumi.azurenative.devtestlab.Formula,
)
}
/**
* @see [Formula].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Formula].
*/
public suspend fun formula(name: String, block: suspend FormulaResourceBuilder.() -> Unit): Formula {
val builder = FormulaResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Formula].
* @param name The _unique_ name of the resulting resource.
*/
public fun formula(name: String): Formula {
val builder = FormulaResourceBuilder()
builder.name(name)
return builder.build()
}