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

com.pulumi.azure.datashare.kotlin.DatasetDataLakeGen2.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.datashare.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 [DatasetDataLakeGen2].
 */
@PulumiTagMarker
public class DatasetDataLakeGen2ResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: DatasetDataLakeGen2Args = DatasetDataLakeGen2Args()

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

/**
 * Manages a Data Share Data Lake Gen2 Dataset.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as azuread from "@pulumi/azuread";
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.datashare.Account("example", {
 *     name: "example-dsa",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 * });
 * const exampleShare = new azure.datashare.Share("example", {
 *     name: "example_ds",
 *     accountId: exampleAccount.id,
 *     kind: "CopyBased",
 * });
 * const exampleAccount2 = new azure.storage.Account("example", {
 *     name: "examplestr",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     accountKind: "BlobStorage",
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleDataLakeGen2Filesystem = new azure.storage.DataLakeGen2Filesystem("example", {
 *     name: "example-dlg2fs",
 *     storageAccountId: exampleAccount2.id,
 * });
 * const example = azuread.getServicePrincipalOutput({
 *     displayName: exampleAccount.name,
 * });
 * const exampleAssignment = new azure.authorization.Assignment("example", {
 *     scope: exampleAccount2.id,
 *     roleDefinitionName: "Storage Blob Data Reader",
 *     principalId: example.apply(example => example.objectId),
 * });
 * const exampleDatasetDataLakeGen2 = new azure.datashare.DatasetDataLakeGen2("example", {
 *     name: "accexample-dlg2ds",
 *     shareId: exampleShare.id,
 *     storageAccountId: exampleAccount2.id,
 *     fileSystemName: exampleDataLakeGen2Filesystem.name,
 *     filePath: "myfile.txt",
 * }, {
 *     dependsOn: [exampleAssignment],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_azuread as azuread
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_account = azure.datashare.Account("example",
 *     name="example-dsa",
 *     location=example_resource_group.location,
 *     resource_group_name=example_resource_group.name,
 *     identity={
 *         "type": "SystemAssigned",
 *     })
 * example_share = azure.datashare.Share("example",
 *     name="example_ds",
 *     account_id=example_account.id,
 *     kind="CopyBased")
 * example_account2 = azure.storage.Account("example",
 *     name="examplestr",
 *     resource_group_name=example_resource_group.name,
 *     location=example_resource_group.location,
 *     account_kind="BlobStorage",
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("example",
 *     name="example-dlg2fs",
 *     storage_account_id=example_account2.id)
 * example = azuread.get_service_principal_output(display_name=example_account.name)
 * example_assignment = azure.authorization.Assignment("example",
 *     scope=example_account2.id,
 *     role_definition_name="Storage Blob Data Reader",
 *     principal_id=example.object_id)
 * example_dataset_data_lake_gen2 = azure.datashare.DatasetDataLakeGen2("example",
 *     name="accexample-dlg2ds",
 *     share_id=example_share.id,
 *     storage_account_id=example_account2.id,
 *     file_system_name=example_data_lake_gen2_filesystem.name,
 *     file_path="myfile.txt",
 *     opts = pulumi.ResourceOptions(depends_on=[example_assignment]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using AzureAD = Pulumi.AzureAD;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.DataShare.Account("example", new()
 *     {
 *         Name = "example-dsa",
 *         Location = exampleResourceGroup.Location,
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Identity = new Azure.DataShare.Inputs.AccountIdentityArgs
 *         {
 *             Type = "SystemAssigned",
 *         },
 *     });
 *     var exampleShare = new Azure.DataShare.Share("example", new()
 *     {
 *         Name = "example_ds",
 *         AccountId = exampleAccount.Id,
 *         Kind = "CopyBased",
 *     });
 *     var exampleAccount2 = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "examplestr",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Location = exampleResourceGroup.Location,
 *         AccountKind = "BlobStorage",
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleDataLakeGen2Filesystem = new Azure.Storage.DataLakeGen2Filesystem("example", new()
 *     {
 *         Name = "example-dlg2fs",
 *         StorageAccountId = exampleAccount2.Id,
 *     });
 *     var example = AzureAD.GetServicePrincipal.Invoke(new()
 *     {
 *         DisplayName = exampleAccount.Name,
 *     });
 *     var exampleAssignment = new Azure.Authorization.Assignment("example", new()
 *     {
 *         Scope = exampleAccount2.Id,
 *         RoleDefinitionName = "Storage Blob Data Reader",
 *         PrincipalId = example.Apply(getServicePrincipalResult => getServicePrincipalResult.ObjectId),
 *     });
 *     var exampleDatasetDataLakeGen2 = new Azure.DataShare.DatasetDataLakeGen2("example", new()
 *     {
 *         Name = "accexample-dlg2ds",
 *         ShareId = exampleShare.Id,
 *         StorageAccountId = exampleAccount2.Id,
 *         FileSystemName = exampleDataLakeGen2Filesystem.Name,
 *         FilePath = "myfile.txt",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             exampleAssignment,
 *         },
 *     });
 * });
 * ```
 * ```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/datashare"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := datashare.NewAccount(ctx, "example", &datashare.AccountArgs{
 * 			Name:              pulumi.String("example-dsa"),
 * 			Location:          exampleResourceGroup.Location,
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			Identity: &datashare.AccountIdentityArgs{
 * 				Type: pulumi.String("SystemAssigned"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleShare, err := datashare.NewShare(ctx, "example", &datashare.ShareArgs{
 * 			Name:      pulumi.String("example_ds"),
 * 			AccountId: exampleAccount.ID(),
 * 			Kind:      pulumi.String("CopyBased"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount2, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("examplestr"),
 * 			ResourceGroupName:      exampleResourceGroup.Name,
 * 			Location:               exampleResourceGroup.Location,
 * 			AccountKind:            pulumi.String("BlobStorage"),
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleDataLakeGen2Filesystem, err := storage.NewDataLakeGen2Filesystem(ctx, "example", &storage.DataLakeGen2FilesystemArgs{
 * 			Name:             pulumi.String("example-dlg2fs"),
 * 			StorageAccountId: exampleAccount2.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example := azuread.LookupServicePrincipalOutput(ctx, azuread.GetServicePrincipalOutputArgs{
 * 			DisplayName: exampleAccount.Name,
 * 		}, nil)
 * 		exampleAssignment, err := authorization.NewAssignment(ctx, "example", &authorization.AssignmentArgs{
 * 			Scope:              exampleAccount2.ID(),
 * 			RoleDefinitionName: pulumi.String("Storage Blob Data Reader"),
 * 			PrincipalId: pulumi.String(example.ApplyT(func(example azuread.GetServicePrincipalResult) (*string, error) {
 * 				return &example.ObjectId, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = datashare.NewDatasetDataLakeGen2(ctx, "example", &datashare.DatasetDataLakeGen2Args{
 * 			Name:             pulumi.String("accexample-dlg2ds"),
 * 			ShareId:          exampleShare.ID(),
 * 			StorageAccountId: exampleAccount2.ID(),
 * 			FileSystemName:   exampleDataLakeGen2Filesystem.Name,
 * 			FilePath:         pulumi.String("myfile.txt"),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			exampleAssignment,
 * 		}))
 * 		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.datashare.Account;
 * import com.pulumi.azure.datashare.AccountArgs;
 * import com.pulumi.azure.datashare.inputs.AccountIdentityArgs;
 * import com.pulumi.azure.datashare.Share;
 * import com.pulumi.azure.datashare.ShareArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.storage.DataLakeGen2Filesystem;
 * import com.pulumi.azure.storage.DataLakeGen2FilesystemArgs;
 * import com.pulumi.azuread.AzureadFunctions;
 * import com.pulumi.azuread.inputs.GetServicePrincipalArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * import com.pulumi.azure.datashare.DatasetDataLakeGen2;
 * import com.pulumi.azure.datashare.DatasetDataLakeGen2Args;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("example-dsa")
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .identity(AccountIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .build());
 *         var exampleShare = new Share("exampleShare", ShareArgs.builder()
 *             .name("example_ds")
 *             .accountId(exampleAccount.id())
 *             .kind("CopyBased")
 *             .build());
 *         var exampleAccount2 = new Account("exampleAccount2", AccountArgs.builder()
 *             .name("examplestr")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .accountKind("BlobStorage")
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleDataLakeGen2Filesystem = new DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", DataLakeGen2FilesystemArgs.builder()
 *             .name("example-dlg2fs")
 *             .storageAccountId(exampleAccount2.id())
 *             .build());
 *         final var example = AzureadFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
 *             .displayName(exampleAccount.name())
 *             .build());
 *         var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
 *             .scope(exampleAccount2.id())
 *             .roleDefinitionName("Storage Blob Data Reader")
 *             .principalId(example.applyValue(getServicePrincipalResult -> getServicePrincipalResult).applyValue(example -> example.applyValue(getServicePrincipalResult -> getServicePrincipalResult.objectId())))
 *             .build());
 *         var exampleDatasetDataLakeGen2 = new DatasetDataLakeGen2("exampleDatasetDataLakeGen2", DatasetDataLakeGen2Args.builder()
 *             .name("accexample-dlg2ds")
 *             .shareId(exampleShare.id())
 *             .storageAccountId(exampleAccount2.id())
 *             .fileSystemName(exampleDataLakeGen2Filesystem.name())
 *             .filePath("myfile.txt")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(exampleAssignment)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:datashare:Account
 *     name: example
 *     properties:
 *       name: example-dsa
 *       location: ${exampleResourceGroup.location}
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       identity:
 *         type: SystemAssigned
 *   exampleShare:
 *     type: azure:datashare:Share
 *     name: example
 *     properties:
 *       name: example_ds
 *       accountId: ${exampleAccount.id}
 *       kind: CopyBased
 *   exampleAccount2:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: examplestr
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       location: ${exampleResourceGroup.location}
 *       accountKind: BlobStorage
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleDataLakeGen2Filesystem:
 *     type: azure:storage:DataLakeGen2Filesystem
 *     name: example
 *     properties:
 *       name: example-dlg2fs
 *       storageAccountId: ${exampleAccount2.id}
 *   exampleAssignment:
 *     type: azure:authorization:Assignment
 *     name: example
 *     properties:
 *       scope: ${exampleAccount2.id}
 *       roleDefinitionName: Storage Blob Data Reader
 *       principalId: ${example.objectId}
 *   exampleDatasetDataLakeGen2:
 *     type: azure:datashare:DatasetDataLakeGen2
 *     name: example
 *     properties:
 *       name: accexample-dlg2ds
 *       shareId: ${exampleShare.id}
 *       storageAccountId: ${exampleAccount2.id}
 *       fileSystemName: ${exampleDataLakeGen2Filesystem.name}
 *       filePath: myfile.txt
 *     options:
 *       dependson:
 *         - ${exampleAssignment}
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azuread:getServicePrincipal
 *       Arguments:
 *         displayName: ${exampleAccount.name}
 * ```
 * 
 * ## Import
 * Data Share Data Lake Gen2 Datasets can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:datashare/datasetDataLakeGen2:DatasetDataLakeGen2 example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataShare/accounts/account1/shares/share1/dataSets/dataSet1
 * ```
 */
public class DatasetDataLakeGen2 internal constructor(
    override val javaResource: com.pulumi.azure.datashare.DatasetDataLakeGen2,
) : KotlinCustomResource(javaResource, DatasetDataLakeGen2Mapper) {
    /**
     * The name of the Data Share Dataset.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * The path of the file in the data lake file system to be shared with the receiver. Conflicts with `folder_path` Changing this forces a new Data Share Data Lake Gen2 Dataset to be created.
     */
    public val filePath: Output?
        get() = javaResource.filePath().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the data lake file system to be shared with the receiver. Changing this forces a new Data Share Data Lake Gen2 Dataset to be created.
     */
    public val fileSystemName: Output
        get() = javaResource.fileSystemName().applyValue({ args0 -> args0 })

    /**
     * The folder path in the data lake file system to be shared with the receiver. Conflicts with `file_path` Changing this forces a new Data Share Data Lake Gen2 Dataset to be created.
     */
    public val folderPath: Output?
        get() = javaResource.folderPath().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name which should be used for this Data Share Data Lake Gen2 Dataset. Changing this forces a new Data Share Data Lake Gen2 Dataset to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The resource ID of the Data Share where this Data Share Data Lake Gen2 Dataset should be created. Changing this forces a new Data Share Data Lake Gen2 Dataset to be created.
     */
    public val shareId: Output
        get() = javaResource.shareId().applyValue({ args0 -> args0 })

    /**
     * The resource id of the storage account of the data lake file system to be shared with the receiver. Changing this forces a new Data Share Data Lake Gen2 Dataset to be created.
     */
    public val storageAccountId: Output
        get() = javaResource.storageAccountId().applyValue({ args0 -> args0 })
}

public object DatasetDataLakeGen2Mapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.datashare.DatasetDataLakeGen2::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy