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

com.pulumi.azure.datafactory.kotlin.LinkedServiceKusto.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.datafactory.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
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: LinkedServiceKustoArgs = LinkedServiceKustoArgs()

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

/**
 * Manages a Linked Service (connection) between a Kusto Cluster and Azure Data Factory.
 * ## Example 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 exampleFactory = new azure.datafactory.Factory("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 * });
 * const exampleCluster = new azure.kusto.Cluster("example", {
 *     name: "kustocluster",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: {
 *         name: "Standard_D13_v2",
 *         capacity: 2,
 *     },
 * });
 * const exampleDatabase = new azure.kusto.Database("example", {
 *     name: "my-kusto-database",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     clusterName: exampleCluster.name,
 * });
 * const exampleLinkedServiceKusto = new azure.datafactory.LinkedServiceKusto("example", {
 *     name: "example",
 *     dataFactoryId: exampleFactory.id,
 *     kustoEndpoint: exampleCluster.uri,
 *     kustoDatabaseName: exampleDatabase.name,
 *     useManagedIdentity: true,
 * });
 * const exampleDatabasePrincipalAssignment = new azure.kusto.DatabasePrincipalAssignment("example", {
 *     name: "KustoPrincipalAssignment",
 *     resourceGroupName: example.name,
 *     clusterName: exampleCluster.name,
 *     databaseName: exampleDatabase.name,
 *     tenantId: exampleFactory.identity.apply(identity => identity?.tenantId),
 *     principalId: exampleFactory.identity.apply(identity => identity?.principalId),
 *     principalType: "App",
 *     role: "Viewer",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_factory = azure.datafactory.Factory("example",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     identity={
 *         "type": "SystemAssigned",
 *     })
 * example_cluster = azure.kusto.Cluster("example",
 *     name="kustocluster",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku={
 *         "name": "Standard_D13_v2",
 *         "capacity": 2,
 *     })
 * example_database = azure.kusto.Database("example",
 *     name="my-kusto-database",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     cluster_name=example_cluster.name)
 * example_linked_service_kusto = azure.datafactory.LinkedServiceKusto("example",
 *     name="example",
 *     data_factory_id=example_factory.id,
 *     kusto_endpoint=example_cluster.uri,
 *     kusto_database_name=example_database.name,
 *     use_managed_identity=True)
 * example_database_principal_assignment = azure.kusto.DatabasePrincipalAssignment("example",
 *     name="KustoPrincipalAssignment",
 *     resource_group_name=example.name,
 *     cluster_name=example_cluster.name,
 *     database_name=example_database.name,
 *     tenant_id=example_factory.identity.tenant_id,
 *     principal_id=example_factory.identity.principal_id,
 *     principal_type="App",
 *     role="Viewer")
 * ```
 * ```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 exampleFactory = new Azure.DataFactory.Factory("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Identity = new Azure.DataFactory.Inputs.FactoryIdentityArgs
 *         {
 *             Type = "SystemAssigned",
 *         },
 *     });
 *     var exampleCluster = new Azure.Kusto.Cluster("example", new()
 *     {
 *         Name = "kustocluster",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = new Azure.Kusto.Inputs.ClusterSkuArgs
 *         {
 *             Name = "Standard_D13_v2",
 *             Capacity = 2,
 *         },
 *     });
 *     var exampleDatabase = new Azure.Kusto.Database("example", new()
 *     {
 *         Name = "my-kusto-database",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         ClusterName = exampleCluster.Name,
 *     });
 *     var exampleLinkedServiceKusto = new Azure.DataFactory.LinkedServiceKusto("example", new()
 *     {
 *         Name = "example",
 *         DataFactoryId = exampleFactory.Id,
 *         KustoEndpoint = exampleCluster.Uri,
 *         KustoDatabaseName = exampleDatabase.Name,
 *         UseManagedIdentity = true,
 *     });
 *     var exampleDatabasePrincipalAssignment = new Azure.Kusto.DatabasePrincipalAssignment("example", new()
 *     {
 *         Name = "KustoPrincipalAssignment",
 *         ResourceGroupName = example.Name,
 *         ClusterName = exampleCluster.Name,
 *         DatabaseName = exampleDatabase.Name,
 *         TenantId = exampleFactory.Identity.Apply(identity => identity?.TenantId),
 *         PrincipalId = exampleFactory.Identity.Apply(identity => identity?.PrincipalId),
 *         PrincipalType = "App",
 *         Role = "Viewer",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/datafactory"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/kusto"
 * 	"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
 * 		}
 * 		exampleFactory, err := datafactory.NewFactory(ctx, "example", &datafactory.FactoryArgs{
 * 			Name:              pulumi.String("example"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Identity: &datafactory.FactoryIdentityArgs{
 * 				Type: pulumi.String("SystemAssigned"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleCluster, err := kusto.NewCluster(ctx, "example", &kusto.ClusterArgs{
 * 			Name:              pulumi.String("kustocluster"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku: &kusto.ClusterSkuArgs{
 * 				Name:     pulumi.String("Standard_D13_v2"),
 * 				Capacity: pulumi.Int(2),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleDatabase, err := kusto.NewDatabase(ctx, "example", &kusto.DatabaseArgs{
 * 			Name:              pulumi.String("my-kusto-database"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			ClusterName:       exampleCluster.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = datafactory.NewLinkedServiceKusto(ctx, "example", &datafactory.LinkedServiceKustoArgs{
 * 			Name:               pulumi.String("example"),
 * 			DataFactoryId:      exampleFactory.ID(),
 * 			KustoEndpoint:      exampleCluster.Uri,
 * 			KustoDatabaseName:  exampleDatabase.Name,
 * 			UseManagedIdentity: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = kusto.NewDatabasePrincipalAssignment(ctx, "example", &kusto.DatabasePrincipalAssignmentArgs{
 * 			Name:              pulumi.String("KustoPrincipalAssignment"),
 * 			ResourceGroupName: example.Name,
 * 			ClusterName:       exampleCluster.Name,
 * 			DatabaseName:      exampleDatabase.Name,
 * 			TenantId: pulumi.String(exampleFactory.Identity.ApplyT(func(identity datafactory.FactoryIdentity) (*string, error) {
 * 				return &identity.TenantId, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			PrincipalId: pulumi.String(exampleFactory.Identity.ApplyT(func(identity datafactory.FactoryIdentity) (*string, error) {
 * 				return &identity.PrincipalId, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			PrincipalType: pulumi.String("App"),
 * 			Role:          pulumi.String("Viewer"),
 * 		})
 * 		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.datafactory.Factory;
 * import com.pulumi.azure.datafactory.FactoryArgs;
 * import com.pulumi.azure.datafactory.inputs.FactoryIdentityArgs;
 * import com.pulumi.azure.kusto.Cluster;
 * import com.pulumi.azure.kusto.ClusterArgs;
 * import com.pulumi.azure.kusto.inputs.ClusterSkuArgs;
 * import com.pulumi.azure.kusto.Database;
 * import com.pulumi.azure.kusto.DatabaseArgs;
 * import com.pulumi.azure.datafactory.LinkedServiceKusto;
 * import com.pulumi.azure.datafactory.LinkedServiceKustoArgs;
 * import com.pulumi.azure.kusto.DatabasePrincipalAssignment;
 * import com.pulumi.azure.kusto.DatabasePrincipalAssignmentArgs;
 * 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());
 *         var exampleFactory = new Factory("exampleFactory", FactoryArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .identity(FactoryIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .build());
 *         var exampleCluster = new Cluster("exampleCluster", ClusterArgs.builder()
 *             .name("kustocluster")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku(ClusterSkuArgs.builder()
 *                 .name("Standard_D13_v2")
 *                 .capacity(2)
 *                 .build())
 *             .build());
 *         var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
 *             .name("my-kusto-database")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .clusterName(exampleCluster.name())
 *             .build());
 *         var exampleLinkedServiceKusto = new LinkedServiceKusto("exampleLinkedServiceKusto", LinkedServiceKustoArgs.builder()
 *             .name("example")
 *             .dataFactoryId(exampleFactory.id())
 *             .kustoEndpoint(exampleCluster.uri())
 *             .kustoDatabaseName(exampleDatabase.name())
 *             .useManagedIdentity(true)
 *             .build());
 *         var exampleDatabasePrincipalAssignment = new DatabasePrincipalAssignment("exampleDatabasePrincipalAssignment", DatabasePrincipalAssignmentArgs.builder()
 *             .name("KustoPrincipalAssignment")
 *             .resourceGroupName(example.name())
 *             .clusterName(exampleCluster.name())
 *             .databaseName(exampleDatabase.name())
 *             .tenantId(exampleFactory.identity().applyValue(identity -> identity.tenantId()))
 *             .principalId(exampleFactory.identity().applyValue(identity -> identity.principalId()))
 *             .principalType("App")
 *             .role("Viewer")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleFactory:
 *     type: azure:datafactory:Factory
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       identity:
 *         type: SystemAssigned
 *   exampleCluster:
 *     type: azure:kusto:Cluster
 *     name: example
 *     properties:
 *       name: kustocluster
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku:
 *         name: Standard_D13_v2
 *         capacity: 2
 *   exampleDatabase:
 *     type: azure:kusto:Database
 *     name: example
 *     properties:
 *       name: my-kusto-database
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       clusterName: ${exampleCluster.name}
 *   exampleLinkedServiceKusto:
 *     type: azure:datafactory:LinkedServiceKusto
 *     name: example
 *     properties:
 *       name: example
 *       dataFactoryId: ${exampleFactory.id}
 *       kustoEndpoint: ${exampleCluster.uri}
 *       kustoDatabaseName: ${exampleDatabase.name}
 *       useManagedIdentity: true
 *   exampleDatabasePrincipalAssignment:
 *     type: azure:kusto:DatabasePrincipalAssignment
 *     name: example
 *     properties:
 *       name: KustoPrincipalAssignment
 *       resourceGroupName: ${example.name}
 *       clusterName: ${exampleCluster.name}
 *       databaseName: ${exampleDatabase.name}
 *       tenantId: ${exampleFactory.identity.tenantId}
 *       principalId: ${exampleFactory.identity.principalId}
 *       principalType: App
 *       role: Viewer
 * ```
 * 
 * ## Import
 * Data Factory Linked Service's can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:datafactory/linkedServiceKusto:LinkedServiceKusto example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.DataFactory/factories/example/linkedservices/example
 * ```
 */
public class LinkedServiceKusto internal constructor(
    override val javaResource: com.pulumi.azure.datafactory.LinkedServiceKusto,
) : KotlinCustomResource(javaResource, LinkedServiceKustoMapper) {
    /**
     * A map of additional properties to associate with the Data Factory Linked Service.
     * The following supported arguments are specific to Azure Kusto Linked Service:
     */
    public val additionalProperties: Output>?
        get() = javaResource.additionalProperties().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.key.to(args0.value) }).toMap()
            }).orElse(null)
        })

    /**
     * List of tags that can be used for describing the Data Factory Linked Service.
     */
    public val annotations: Output>?
        get() = javaResource.annotations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The Data Factory ID in which to associate the Linked Service with. Changing this forces a new resource.
     */
    public val dataFactoryId: Output
        get() = javaResource.dataFactoryId().applyValue({ args0 -> args0 })

    /**
     * The description for the Data Factory Linked Service.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The integration runtime reference to associate with the Data Factory Linked Service.
     */
    public val integrationRuntimeName: Output?
        get() = javaResource.integrationRuntimeName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Kusto Database Name.
     */
    public val kustoDatabaseName: Output
        get() = javaResource.kustoDatabaseName().applyValue({ args0 -> args0 })

    /**
     * The URI of the Kusto Cluster endpoint.
     */
    public val kustoEndpoint: Output
        get() = javaResource.kustoEndpoint().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Data Factory Linked Service. Changing this forces a new resource to be created. Must be unique within a data factory. See the [Microsoft documentation](https://docs.microsoft.com/azure/data-factory/naming-rules) for all restrictions.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A map of parameters to associate with the Data Factory Linked Service.
     */
    public val parameters: Output>?
        get() = javaResource.parameters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The service principal id in which to authenticate against the Kusto Database.
     */
    public val servicePrincipalId: Output?
        get() = javaResource.servicePrincipalId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The service principal key in which to authenticate against the Kusto Database.
     */
    public val servicePrincipalKey: Output?
        get() = javaResource.servicePrincipalKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The service principal tenant id or name in which to authenticate against the Kusto Database.
     * > **NOTE** If `service_principal_id` is used, `service_principal_key` and `tenant` is also required.
     * > **NOTE** One of Managed Identity authentication and Service Principal authentication must be set.
     */
    public val tenant: Output?
        get() = javaResource.tenant().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Whether to use the Data Factory's managed identity to authenticate against the Kusto Database.
     */
    public val useManagedIdentity: Output?
        get() = javaResource.useManagedIdentity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object LinkedServiceKustoMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.datafactory.LinkedServiceKusto::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy