com.pulumi.azure.storage.kotlin.LocalUser.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.storage.kotlin
import com.pulumi.azure.storage.kotlin.outputs.LocalUserPermissionScope
import com.pulumi.azure.storage.kotlin.outputs.LocalUserSshAuthorizedKey
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 com.pulumi.azure.storage.kotlin.outputs.LocalUserPermissionScope.Companion.toKotlin as localUserPermissionScopeToKotlin
import com.pulumi.azure.storage.kotlin.outputs.LocalUserSshAuthorizedKey.Companion.toKotlin as localUserSshAuthorizedKeyToKotlin
/**
* Builder for [LocalUser].
*/
@PulumiTagMarker
public class LocalUserResourceBuilder internal constructor() {
public var name: String? = null
public var args: LocalUserArgs = LocalUserArgs()
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 LocalUserArgsBuilder.() -> Unit) {
val builder = LocalUserArgsBuilder()
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(): LocalUser {
val builtJavaResource = com.pulumi.azure.storage.LocalUser(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return LocalUser(builtJavaResource)
}
}
/**
* Manages a Storage Account Local 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.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.storage.Container;
* import com.pulumi.azure.storage.ContainerArgs;
* import com.pulumi.azure.storage.LocalUser;
* import com.pulumi.azure.storage.LocalUserArgs;
* import com.pulumi.azure.storage.inputs.LocalUserSshAuthorizedKeyArgs;
* import com.pulumi.azure.storage.inputs.LocalUserPermissionScopeArgs;
* import com.pulumi.azure.storage.inputs.LocalUserPermissionScopePermissionsArgs;
* 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("WestEurope")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .resourceGroupName(exampleResourceGroup.name())
* .location(exampleResourceGroup.location())
* .accountKind("StorageV2")
* .accountTier("Standard")
* .accountReplicationType("LRS")
* .isHnsEnabled(true)
* .build());
* var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
* .storageAccountName(exampleAccount.name())
* .build());
* var exampleLocalUser = new LocalUser("exampleLocalUser", LocalUserArgs.builder()
* .storageAccountId(exampleAccount.id())
* .sshKeyEnabled(true)
* .sshPasswordEnabled(true)
* .homeDirectory("example_path")
* .sshAuthorizedKeys(
* LocalUserSshAuthorizedKeyArgs.builder()
* .description("key1")
* .key(local.first_public_key())
* .build(),
* LocalUserSshAuthorizedKeyArgs.builder()
* .description("key2")
* .key(local.second_public_key())
* .build())
* .permissionScopes(LocalUserPermissionScopeArgs.builder()
* .permissions(LocalUserPermissionScopePermissionsArgs.builder()
* .read(true)
* .create(true)
* .build())
* .service("blob")
* .resourceName(exampleContainer.name())
* .build())
* .build());
* }
* }
* ```
* ## Import
* Storage Account Local Users can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:storage/localUser:LocalUser example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/localUsers/user1
* ```
*
*/
public class LocalUser internal constructor(
override val javaResource: com.pulumi.azure.storage.LocalUser,
) : KotlinCustomResource(javaResource, LocalUserMapper) {
/**
* The home directory of the Storage Account Local User.
*/
public val homeDirectory: Output?
get() = javaResource.homeDirectory().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name which should be used for this Storage Account Local User. Changing this forces a new Storage Account Local User to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The value of the password, which is only available when `ssh_password_enabled` is set to `true`.
*/
public val password: Output
get() = javaResource.password().applyValue({ args0 -> args0 })
/**
* One or more `permission_scope` blocks as defined below.
*/
public val permissionScopes: Output>?
get() = javaResource.permissionScopes().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
localUserPermissionScopeToKotlin(args0)
})
})
}).orElse(null)
})
/**
* The unique Security Identifier of this Storage Account Local User.
*/
public val sid: Output
get() = javaResource.sid().applyValue({ args0 -> args0 })
/**
* One or more `ssh_authorized_key` blocks as defined below.
*/
public val sshAuthorizedKeys: Output>?
get() = javaResource.sshAuthorizedKeys().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
localUserSshAuthorizedKeyToKotlin(args0)
})
})
}).orElse(null)
})
/**
* Specifies whether SSH Key Authentication is enabled. Defaults to `false`.
*/
public val sshKeyEnabled: Output?
get() = javaResource.sshKeyEnabled().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies whether SSH Password Authentication is enabled. Defaults to `false`.
*/
public val sshPasswordEnabled: Output?
get() = javaResource.sshPasswordEnabled().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The ID of the Storage Account that this Storage Account Local User resides in. Changing this forces a new Storage Account Local User to be created.
*/
public val storageAccountId: Output
get() = javaResource.storageAccountId().applyValue({ args0 -> args0 })
}
public object LocalUserMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.storage.LocalUser::class == javaResource::class
override fun map(javaResource: Resource): LocalUser = LocalUser(
javaResource as
com.pulumi.azure.storage.LocalUser,
)
}
/**
* @see [LocalUser].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [LocalUser].
*/
public suspend fun localUser(name: String, block: suspend LocalUserResourceBuilder.() -> Unit):
LocalUser {
val builder = LocalUserResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [LocalUser].
* @param name The _unique_ name of the resulting resource.
*/
public fun localUser(name: String): LocalUser {
val builder = LocalUserResourceBuilder()
builder.name(name)
return builder.build()
}