Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.kusto.kotlin.Script.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.kusto.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 [Script].
*/
@PulumiTagMarker
public class ScriptResourceBuilder internal constructor() {
public var name: String? = null
public var args: ScriptArgs = ScriptArgs()
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 ScriptArgsBuilder.() -> Unit) {
val builder = ScriptArgsBuilder()
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(): Script {
val builtJavaResource = com.pulumi.azure.kusto.Script(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Script(builtJavaResource)
}
}
/**
* Manages a Kusto Script.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const exampleResourceGroup = new azure.core.ResourceGroup("example", {
* name: "example",
* location: "West Europe",
* });
* const exampleCluster = new azure.kusto.Cluster("example", {
* name: "example",
* location: exampleResourceGroup.location,
* resourceGroupName: exampleResourceGroup.name,
* sku: {
* name: "Dev(No SLA)_Standard_D11_v2",
* capacity: 1,
* },
* });
* const exampleDatabase = new azure.kusto.Database("example", {
* name: "example",
* resourceGroupName: exampleResourceGroup.name,
* location: exampleResourceGroup.location,
* clusterName: exampleCluster.name,
* });
* const exampleAccount = new azure.storage.Account("example", {
* name: "example",
* resourceGroupName: exampleResourceGroup.name,
* location: exampleResourceGroup.location,
* accountTier: "Standard",
* accountReplicationType: "LRS",
* });
* const exampleContainer = new azure.storage.Container("example", {
* name: "setup-files",
* storageAccountName: exampleAccount.name,
* containerAccessType: "private",
* });
* const exampleBlob = new azure.storage.Blob("example", {
* name: "script.txt",
* storageAccountName: exampleAccount.name,
* storageContainerName: exampleContainer.name,
* type: "Block",
* sourceContent: ".create table MyTable (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)",
* });
* const example = azure.storage.getAccountBlobContainerSASOutput({
* connectionString: exampleAccount.primaryConnectionString,
* containerName: exampleContainer.name,
* httpsOnly: true,
* start: "2017-03-21",
* expiry: "2022-03-21",
* permissions: {
* read: true,
* add: false,
* create: false,
* write: true,
* "delete": false,
* list: true,
* },
* });
* const exampleScript = new azure.kusto.Script("example", {
* name: "example",
* databaseId: exampleDatabase.id,
* url: exampleBlob.id,
* sasToken: example.apply(example => example.sas),
* continueOnErrorsEnabled: true,
* forceAnUpdateWhenValueChanged: "first",
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example_resource_group = azure.core.ResourceGroup("example",
* name="example",
* location="West Europe")
* example_cluster = azure.kusto.Cluster("example",
* name="example",
* location=example_resource_group.location,
* resource_group_name=example_resource_group.name,
* sku={
* "name": "Dev(No SLA)_Standard_D11_v2",
* "capacity": 1,
* })
* example_database = azure.kusto.Database("example",
* name="example",
* resource_group_name=example_resource_group.name,
* location=example_resource_group.location,
* cluster_name=example_cluster.name)
* example_account = azure.storage.Account("example",
* name="example",
* resource_group_name=example_resource_group.name,
* location=example_resource_group.location,
* account_tier="Standard",
* account_replication_type="LRS")
* example_container = azure.storage.Container("example",
* name="setup-files",
* storage_account_name=example_account.name,
* container_access_type="private")
* example_blob = azure.storage.Blob("example",
* name="script.txt",
* storage_account_name=example_account.name,
* storage_container_name=example_container.name,
* type="Block",
* source_content=".create table MyTable (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)")
* example = azure.storage.get_account_blob_container_sas_output(connection_string=example_account.primary_connection_string,
* container_name=example_container.name,
* https_only=True,
* start="2017-03-21",
* expiry="2022-03-21",
* permissions={
* "read": True,
* "add": False,
* "create": False,
* "write": True,
* "delete": False,
* "list": True,
* })
* example_script = azure.kusto.Script("example",
* name="example",
* database_id=example_database.id,
* url=example_blob.id,
* sas_token=example.sas,
* continue_on_errors_enabled=True,
* force_an_update_when_value_changed="first")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example",
* Location = "West Europe",
* });
* var exampleCluster = new Azure.Kusto.Cluster("example", new()
* {
* Name = "example",
* Location = exampleResourceGroup.Location,
* ResourceGroupName = exampleResourceGroup.Name,
* Sku = new Azure.Kusto.Inputs.ClusterSkuArgs
* {
* Name = "Dev(No SLA)_Standard_D11_v2",
* Capacity = 1,
* },
* });
* var exampleDatabase = new Azure.Kusto.Database("example", new()
* {
* Name = "example",
* ResourceGroupName = exampleResourceGroup.Name,
* Location = exampleResourceGroup.Location,
* ClusterName = exampleCluster.Name,
* });
* var exampleAccount = new Azure.Storage.Account("example", new()
* {
* Name = "example",
* ResourceGroupName = exampleResourceGroup.Name,
* Location = exampleResourceGroup.Location,
* AccountTier = "Standard",
* AccountReplicationType = "LRS",
* });
* var exampleContainer = new Azure.Storage.Container("example", new()
* {
* Name = "setup-files",
* StorageAccountName = exampleAccount.Name,
* ContainerAccessType = "private",
* });
* var exampleBlob = new Azure.Storage.Blob("example", new()
* {
* Name = "script.txt",
* StorageAccountName = exampleAccount.Name,
* StorageContainerName = exampleContainer.Name,
* Type = "Block",
* SourceContent = ".create table MyTable (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)",
* });
* var example = Azure.Storage.GetAccountBlobContainerSAS.Invoke(new()
* {
* ConnectionString = exampleAccount.PrimaryConnectionString,
* ContainerName = exampleContainer.Name,
* HttpsOnly = true,
* Start = "2017-03-21",
* Expiry = "2022-03-21",
* Permissions = new Azure.Storage.Inputs.GetAccountBlobContainerSASPermissionsInputArgs
* {
* Read = true,
* Add = false,
* Create = false,
* Write = true,
* Delete = false,
* List = true,
* },
* });
* var exampleScript = new Azure.Kusto.Script("example", new()
* {
* Name = "example",
* DatabaseId = exampleDatabase.Id,
* Url = exampleBlob.Id,
* SasToken = example.Apply(getAccountBlobContainerSASResult => getAccountBlobContainerSASResult.Sas),
* ContinueOnErrorsEnabled = true,
* ForceAnUpdateWhenValueChanged = "first",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/kusto"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
* "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"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleCluster, err := kusto.NewCluster(ctx, "example", &kusto.ClusterArgs{
* Name: pulumi.String("example"),
* Location: exampleResourceGroup.Location,
* ResourceGroupName: exampleResourceGroup.Name,
* Sku: &kusto.ClusterSkuArgs{
* Name: pulumi.String("Dev(No SLA)_Standard_D11_v2"),
* Capacity: pulumi.Int(1),
* },
* })
* if err != nil {
* return err
* }
* exampleDatabase, err := kusto.NewDatabase(ctx, "example", &kusto.DatabaseArgs{
* Name: pulumi.String("example"),
* ResourceGroupName: exampleResourceGroup.Name,
* Location: exampleResourceGroup.Location,
* ClusterName: exampleCluster.Name,
* })
* if err != nil {
* return err
* }
* exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
* Name: pulumi.String("example"),
* ResourceGroupName: exampleResourceGroup.Name,
* Location: exampleResourceGroup.Location,
* AccountTier: pulumi.String("Standard"),
* AccountReplicationType: pulumi.String("LRS"),
* })
* if err != nil {
* return err
* }
* exampleContainer, err := storage.NewContainer(ctx, "example", &storage.ContainerArgs{
* Name: pulumi.String("setup-files"),
* StorageAccountName: exampleAccount.Name,
* ContainerAccessType: pulumi.String("private"),
* })
* if err != nil {
* return err
* }
* exampleBlob, err := storage.NewBlob(ctx, "example", &storage.BlobArgs{
* Name: pulumi.String("script.txt"),
* StorageAccountName: exampleAccount.Name,
* StorageContainerName: exampleContainer.Name,
* Type: pulumi.String("Block"),
* SourceContent: pulumi.String(".create table MyTable (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)"),
* })
* if err != nil {
* return err
* }
* example := storage.GetAccountBlobContainerSASOutput(ctx, storage.GetAccountBlobContainerSASOutputArgs{
* ConnectionString: exampleAccount.PrimaryConnectionString,
* ContainerName: exampleContainer.Name,
* HttpsOnly: pulumi.Bool(true),
* Start: pulumi.String("2017-03-21"),
* Expiry: pulumi.String("2022-03-21"),
* Permissions: &storage.GetAccountBlobContainerSASPermissionsArgs{
* Read: pulumi.Bool(true),
* Add: pulumi.Bool(false),
* Create: pulumi.Bool(false),
* Write: pulumi.Bool(true),
* Delete: pulumi.Bool(false),
* List: pulumi.Bool(true),
* },
* }, nil)
* _, err = kusto.NewScript(ctx, "example", &kusto.ScriptArgs{
* Name: pulumi.String("example"),
* DatabaseId: exampleDatabase.ID(),
* Url: exampleBlob.ID(),
* SasToken: pulumi.String(example.ApplyT(func(example storage.GetAccountBlobContainerSASResult) (*string, error) {
* return &example.Sas, nil
* }).(pulumi.StringPtrOutput)),
* ContinueOnErrorsEnabled: pulumi.Bool(true),
* ForceAnUpdateWhenValueChanged: pulumi.String("first"),
* })
* 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.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.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.Blob;
* import com.pulumi.azure.storage.BlobArgs;
* import com.pulumi.azure.storage.StorageFunctions;
* import com.pulumi.azure.storage.inputs.GetAccountBlobContainerSASArgs;
* import com.pulumi.azure.storage.inputs.GetAccountBlobContainerSASPermissionsArgs;
* import com.pulumi.azure.kusto.Script;
* import com.pulumi.azure.kusto.ScriptArgs;
* 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")
* .location("West Europe")
* .build());
* var exampleCluster = new Cluster("exampleCluster", ClusterArgs.builder()
* .name("example")
* .location(exampleResourceGroup.location())
* .resourceGroupName(exampleResourceGroup.name())
* .sku(ClusterSkuArgs.builder()
* .name("Dev(No SLA)_Standard_D11_v2")
* .capacity(1)
* .build())
* .build());
* var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
* .name("example")
* .resourceGroupName(exampleResourceGroup.name())
* .location(exampleResourceGroup.location())
* .clusterName(exampleCluster.name())
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("example")
* .resourceGroupName(exampleResourceGroup.name())
* .location(exampleResourceGroup.location())
* .accountTier("Standard")
* .accountReplicationType("LRS")
* .build());
* var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
* .name("setup-files")
* .storageAccountName(exampleAccount.name())
* .containerAccessType("private")
* .build());
* var exampleBlob = new Blob("exampleBlob", BlobArgs.builder()
* .name("script.txt")
* .storageAccountName(exampleAccount.name())
* .storageContainerName(exampleContainer.name())
* .type("Block")
* .sourceContent(".create table MyTable (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)")
* .build());
* final var example = StorageFunctions.getAccountBlobContainerSAS(GetAccountBlobContainerSASArgs.builder()
* .connectionString(exampleAccount.primaryConnectionString())
* .containerName(exampleContainer.name())
* .httpsOnly(true)
* .start("2017-03-21")
* .expiry("2022-03-21")
* .permissions(GetAccountBlobContainerSASPermissionsArgs.builder()
* .read(true)
* .add(false)
* .create(false)
* .write(true)
* .delete(false)
* .list(true)
* .build())
* .build());
* var exampleScript = new Script("exampleScript", ScriptArgs.builder()
* .name("example")
* .databaseId(exampleDatabase.id())
* .url(exampleBlob.id())
* .sasToken(example.applyValue(getAccountBlobContainerSASResult -> getAccountBlobContainerSASResult).applyValue(example -> example.applyValue(getAccountBlobContainerSASResult -> getAccountBlobContainerSASResult.sas())))
* .continueOnErrorsEnabled(true)
* .forceAnUpdateWhenValueChanged("first")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleResourceGroup:
* type: azure:core:ResourceGroup
* name: example
* properties:
* name: example
* location: West Europe
* exampleCluster:
* type: azure:kusto:Cluster
* name: example
* properties:
* name: example
* location: ${exampleResourceGroup.location}
* resourceGroupName: ${exampleResourceGroup.name}
* sku:
* name: Dev(No SLA)_Standard_D11_v2
* capacity: 1
* exampleDatabase:
* type: azure:kusto:Database
* name: example
* properties:
* name: example
* resourceGroupName: ${exampleResourceGroup.name}
* location: ${exampleResourceGroup.location}
* clusterName: ${exampleCluster.name}
* exampleAccount:
* type: azure:storage:Account
* name: example
* properties:
* name: example
* resourceGroupName: ${exampleResourceGroup.name}
* location: ${exampleResourceGroup.location}
* accountTier: Standard
* accountReplicationType: LRS
* exampleContainer:
* type: azure:storage:Container
* name: example
* properties:
* name: setup-files
* storageAccountName: ${exampleAccount.name}
* containerAccessType: private
* exampleBlob:
* type: azure:storage:Blob
* name: example
* properties:
* name: script.txt
* storageAccountName: ${exampleAccount.name}
* storageContainerName: ${exampleContainer.name}
* type: Block
* sourceContent: .create table MyTable (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)
* exampleScript:
* type: azure:kusto:Script
* name: example
* properties:
* name: example
* databaseId: ${exampleDatabase.id}
* url: ${exampleBlob.id}
* sasToken: ${example.sas}
* continueOnErrorsEnabled: true
* forceAnUpdateWhenValueChanged: first
* variables:
* example:
* fn::invoke:
* Function: azure:storage:getAccountBlobContainerSAS
* Arguments:
* connectionString: ${exampleAccount.primaryConnectionString}
* containerName: ${exampleContainer.name}
* httpsOnly: true
* start: 2017-03-21
* expiry: 2022-03-21
* permissions:
* read: true
* add: false
* create: false
* write: true
* delete: false
* list: true
* ```
*
* ## Import
* Kusto Scripts can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:kusto/script:Script example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1/scripts/script1
* ```
*/
public class Script internal constructor(
override val javaResource: com.pulumi.azure.kusto.Script,
) : KotlinCustomResource(javaResource, ScriptMapper) {
/**
* Flag that indicates whether to continue if one of the command fails.
*/
public val continueOnErrorsEnabled: Output?
get() = javaResource.continueOnErrorsEnabled().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The ID of the Kusto Database. Changing this forces a new Kusto Script to be created.
*/
public val databaseId: Output
get() = javaResource.databaseId().applyValue({ args0 -> args0 })
/**
* A unique string. If changed the script will be applied again.
*/
public val forceAnUpdateWhenValueChanged: Output
get() = javaResource.forceAnUpdateWhenValueChanged().applyValue({ args0 -> args0 })
/**
* The name which should be used for this Kusto Script. Changing this forces a new Kusto Script to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The SAS token used to access the script. Must be provided when using scriptUrl property. Changing this forces a new resource to be created.
*/
public val sasToken: Output?
get() = javaResource.sasToken().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The script content. This property should be used when the script is provide inline and not through file in a SA. Must not be used together with `url` and `sas_token` properties. Changing this forces a new resource to be created.
*/
public val scriptContent: Output?
get() = javaResource.scriptContent().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The url to the KQL script blob file. Must not be used together with scriptContent property. Please reference [this documentation](https://docs.microsoft.com/azure/data-explorer/database-script) that describes the commands that are allowed in the script.
*/
public val url: Output?
get() = javaResource.url().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object ScriptMapper : ResourceMapper