com.pulumi.azure.lab.kotlin.User.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.lab.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.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [User].
*/
@PulumiTagMarker
public class UserResourceBuilder internal constructor() {
public var name: String? = null
public var args: UserArgs = UserArgs()
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 UserArgsBuilder.() -> Unit) {
val builder = UserArgsBuilder()
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.opts(block)
}
internal fun build(): User {
val builtJavaResource = com.pulumi.azure.lab.User(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return User(builtJavaResource)
}
}
/**
* Manages a Lab Service User.
* ## Example Usage
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.lab.Lab;
* import com.pulumi.azure.lab.LabArgs;
* import com.pulumi.azure.lab.inputs.LabSecurityArgs;
* import com.pulumi.azure.lab.inputs.LabVirtualMachineArgs;
* import com.pulumi.azure.lab.inputs.LabVirtualMachineAdminUserArgs;
* import com.pulumi.azure.lab.inputs.LabVirtualMachineImageReferenceArgs;
* import com.pulumi.azure.lab.inputs.LabVirtualMachineSkuArgs;
* import com.pulumi.azure.lab.User;
* import com.pulumi.azure.lab.UserArgs;
* 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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
* .location("West Europe")
* .build());
* var exampleLab = new Lab("exampleLab", LabArgs.builder()
* .resourceGroupName(exampleResourceGroup.name())
* .location(exampleResourceGroup.location())
* .title("Test Title")
* .security(LabSecurityArgs.builder()
* .openAccessEnabled(false)
* .build())
* .virtualMachine(LabVirtualMachineArgs.builder()
* .adminUser(LabVirtualMachineAdminUserArgs.builder()
* .username("testadmin")
* .password("Password1234!")
* .build())
* .imageReference(LabVirtualMachineImageReferenceArgs.builder()
* .offer("0001-com-ubuntu-server-focal")
* .publisher("canonical")
* .sku("20_04-lts")
* .version("latest")
* .build())
* .sku(LabVirtualMachineSkuArgs.builder()
* .name("Classic_Fsv2_2_4GB_128_S_SSD")
* .capacity(1)
* .build())
* .build())
* .build());
* var exampleUser = new User("exampleUser", UserArgs.builder()
* .labId(exampleLab.id())
* .email("[email protected]")
* .build());
* }
* }
* ```
* ## Import
* Lab Service Users can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:lab/user:User example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.LabServices/labs/lab1/users/user1
* ```
*
*/
public class User internal constructor(
override val javaResource: com.pulumi.azure.lab.User,
) : KotlinCustomResource(javaResource, UserMapper) {
/**
* The amount of usage quota time the Lab Service User gets in addition to the lab usage quota. Defaults to `PT0S`.
*/
public val additionalUsageQuota: Output?
get() = javaResource.additionalUsageQuota().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The email address of the Lab Service User. Changing this forces a new resource to be created.
*/
public val email: Output
get() = javaResource.email().applyValue({ args0 -> args0 })
/**
* The resource ID of the Lab Service Lab. Changing this forces a new resource to be created.
*/
public val labId: Output
get() = javaResource.labId().applyValue({ args0 -> args0 })
/**
* The name which should be used for this Lab Service User. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
}
public object UserMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.lab.User::class == javaResource::class
override fun map(javaResource: Resource): User = User(javaResource as com.pulumi.azure.lab.User)
}
/**
* @see [User].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [User].
*/
public suspend fun user(name: String, block: suspend UserResourceBuilder.() -> Unit): User {
val builder = UserResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [User].
* @param name The _unique_ name of the resulting resource.
*/
public fun user(name: String): User {
val builder = UserResourceBuilder()
builder.name(name)
return builder.build()
}