All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.netapp.kotlin.Account.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.netapp.kotlin

import com.pulumi.azure.netapp.kotlin.outputs.AccountActiveDirectory
import com.pulumi.azure.netapp.kotlin.outputs.AccountIdentity
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.azure.netapp.kotlin.outputs.AccountActiveDirectory.Companion.toKotlin as accountActiveDirectoryToKotlin
import com.pulumi.azure.netapp.kotlin.outputs.AccountIdentity.Companion.toKotlin as accountIdentityToKotlin

/**
 * Builder for [Account].
 */
@PulumiTagMarker
public class AccountResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AccountArgs = AccountArgs()

    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 AccountArgsBuilder.() -> Unit) {
        val builder = AccountArgsBuilder()
        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(): Account {
        val builtJavaResource = com.pulumi.azure.netapp.Account(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Account(builtJavaResource)
    }
}

/**
 * Manages a NetApp Account.
 * > **NOTE:** Azure allows only one active directory can be joined to a single subscription at a time for NetApp Account.
 * ## NetApp Account Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const current = azure.core.getClientConfig({});
 * const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
 *     name: "anf-user-assigned-identity",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleAccount = new azure.netapp.Account("example", {
 *     name: "netappaccount",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     activeDirectory: {
 *         username: "aduser",
 *         password: "aduserpwd",
 *         smbServerName: "SMBSERVER",
 *         dnsServers: ["1.2.3.4"],
 *         domain: "westcentralus.com",
 *         organizationalUnit: "OU=FirstLevel",
 *     },
 *     identity: {
 *         type: "UserAssigned",
 *         identityIds: [exampleUserAssignedIdentity.id],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * current = azure.core.get_client_config()
 * example_user_assigned_identity = azure.authorization.UserAssignedIdentity("example",
 *     name="anf-user-assigned-identity",
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_account = azure.netapp.Account("example",
 *     name="netappaccount",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     active_directory={
 *         "username": "aduser",
 *         "password": "aduserpwd",
 *         "smb_server_name": "SMBSERVER",
 *         "dns_servers": ["1.2.3.4"],
 *         "domain": "westcentralus.com",
 *         "organizational_unit": "OU=FirstLevel",
 *     },
 *     identity={
 *         "type": "UserAssigned",
 *         "identity_ids": [example_user_assigned_identity.id],
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var exampleUserAssignedIdentity = new Azure.Authorization.UserAssignedIdentity("example", new()
 *     {
 *         Name = "anf-user-assigned-identity",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleAccount = new Azure.NetApp.Account("example", new()
 *     {
 *         Name = "netappaccount",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         ActiveDirectory = new Azure.NetApp.Inputs.AccountActiveDirectoryArgs
 *         {
 *             Username = "aduser",
 *             Password = "aduserpwd",
 *             SmbServerName = "SMBSERVER",
 *             DnsServers = new[]
 *             {
 *                 "1.2.3.4",
 *             },
 *             Domain = "westcentralus.com",
 *             OrganizationalUnit = "OU=FirstLevel",
 *         },
 *         Identity = new Azure.NetApp.Inputs.AccountIdentityArgs
 *         {
 *             Type = "UserAssigned",
 *             IdentityIds = new[]
 *             {
 *                 exampleUserAssignedIdentity.Id,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/netapp"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleUserAssignedIdentity, err := authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
 * 			Name:              pulumi.String("anf-user-assigned-identity"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = netapp.NewAccount(ctx, "example", &netapp.AccountArgs{
 * 			Name:              pulumi.String("netappaccount"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			ActiveDirectory: &netapp.AccountActiveDirectoryArgs{
 * 				Username:      pulumi.String("aduser"),
 * 				Password:      pulumi.String("aduserpwd"),
 * 				SmbServerName: pulumi.String("SMBSERVER"),
 * 				DnsServers: pulumi.StringArray{
 * 					pulumi.String("1.2.3.4"),
 * 				},
 * 				Domain:             pulumi.String("westcentralus.com"),
 * 				OrganizationalUnit: pulumi.String("OU=FirstLevel"),
 * 			},
 * 			Identity: &netapp.AccountIdentityArgs{
 * 				Type: pulumi.String("UserAssigned"),
 * 				IdentityIds: pulumi.StringArray{
 * 					exampleUserAssignedIdentity.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.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.core.CoreFunctions;
 * import com.pulumi.azure.authorization.UserAssignedIdentity;
 * import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
 * import com.pulumi.azure.netapp.Account;
 * import com.pulumi.azure.netapp.AccountArgs;
 * import com.pulumi.azure.netapp.inputs.AccountActiveDirectoryArgs;
 * import com.pulumi.azure.netapp.inputs.AccountIdentityArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         final var current = CoreFunctions.getClientConfig();
 *         var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
 *             .name("anf-user-assigned-identity")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("netappaccount")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .activeDirectory(AccountActiveDirectoryArgs.builder()
 *                 .username("aduser")
 *                 .password("aduserpwd")
 *                 .smbServerName("SMBSERVER")
 *                 .dnsServers("1.2.3.4")
 *                 .domain("westcentralus.com")
 *                 .organizationalUnit("OU=FirstLevel")
 *                 .build())
 *             .identity(AccountIdentityArgs.builder()
 *                 .type("UserAssigned")
 *                 .identityIds(exampleUserAssignedIdentity.id())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleUserAssignedIdentity:
 *     type: azure:authorization:UserAssignedIdentity
 *     name: example
 *     properties:
 *       name: anf-user-assigned-identity
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleAccount:
 *     type: azure:netapp:Account
 *     name: example
 *     properties:
 *       name: netappaccount
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       activeDirectory:
 *         username: aduser
 *         password: aduserpwd
 *         smbServerName: SMBSERVER
 *         dnsServers:
 *           - 1.2.3.4
 *         domain: westcentralus.com
 *         organizationalUnit: OU=FirstLevel
 *       identity:
 *         type: UserAssigned
 *         identityIds:
 *           - ${exampleUserAssignedIdentity.id}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * NetApp Accounts can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:netapp/account:Account example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.NetApp/netAppAccounts/account1
 * ```
 * ~> **IMPORTANT:** When importing a NetApp account, the `active_directory.password` and `active_directory.server_root_ca_certificate` values *cannot* be retrieved from the Azure API and will need to be redeclared within the resource.
 */
public class Account internal constructor(
    override val javaResource: com.pulumi.azure.netapp.Account,
) : KotlinCustomResource(javaResource, AccountMapper) {
    /**
     * A `active_directory` block as defined below.
     */
    public val activeDirectory: Output?
        get() = javaResource.activeDirectory().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> accountActiveDirectoryToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The `identity` block where it is used when customer managed keys based encryption will be enabled as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    accountIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies 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 })

    /**
     * The name of the NetApp Account. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group where the NetApp Account should be created. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to 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)
        })
}

public object AccountMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.netapp.Account::class == javaResource::class

    override fun map(javaResource: Resource): Account = Account(
        javaResource as
            com.pulumi.azure.netapp.Account,
    )
}

/**
 * @see [Account].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Account].
 */
public suspend fun account(name: String, block: suspend AccountResourceBuilder.() -> Unit): Account {
    val builder = AccountResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Account].
 * @param name The _unique_ name of the resulting resource.
 */
public fun account(name: String): Account {
    val builder = AccountResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy