com.pulumi.azure.kusto.Script Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azure.kusto;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.kusto.ScriptArgs;
import com.pulumi.azure.kusto.inputs.ScriptState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages a Kusto Script.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## 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
* ```
*
*/
@ResourceType(type="azure:kusto/script:Script")
public class Script extends com.pulumi.resources.CustomResource {
/**
* Flag that indicates whether to continue if one of the command fails.
*
*/
@Export(name="continueOnErrorsEnabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> continueOnErrorsEnabled;
/**
* @return Flag that indicates whether to continue if one of the command fails.
*
*/
public Output> continueOnErrorsEnabled() {
return Codegen.optional(this.continueOnErrorsEnabled);
}
/**
* The ID of the Kusto Database. Changing this forces a new Kusto Script to be created.
*
*/
@Export(name="databaseId", refs={String.class}, tree="[0]")
private Output databaseId;
/**
* @return The ID of the Kusto Database. Changing this forces a new Kusto Script to be created.
*
*/
public Output databaseId() {
return this.databaseId;
}
/**
* A unique string. If changed the script will be applied again.
*
*/
@Export(name="forceAnUpdateWhenValueChanged", refs={String.class}, tree="[0]")
private Output forceAnUpdateWhenValueChanged;
/**
* @return A unique string. If changed the script will be applied again.
*
*/
public Output forceAnUpdateWhenValueChanged() {
return this.forceAnUpdateWhenValueChanged;
}
/**
* The name which should be used for this Kusto Script. Changing this forces a new Kusto Script to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name which should be used for this Kusto Script. Changing this forces a new Kusto Script to be created.
*
*/
public Output name() {
return this.name;
}
/**
* The SAS token used to access the script. Must be provided when using scriptUrl property. Changing this forces a new resource to be created.
*
*/
@Export(name="sasToken", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sasToken;
/**
* @return 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 Output> sasToken() {
return Codegen.optional(this.sasToken);
}
/**
* 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.
*
*/
@Export(name="scriptContent", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> scriptContent;
/**
* @return 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 Output> scriptContent() {
return Codegen.optional(this.scriptContent);
}
/**
* 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.
*
*/
@Export(name="url", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> url;
/**
* @return 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 Output> url() {
return Codegen.optional(this.url);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Script(java.lang.String name) {
this(name, ScriptArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Script(java.lang.String name, ScriptArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public Script(java.lang.String name, ScriptArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:kusto/script:Script", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Script(java.lang.String name, Output id, @Nullable ScriptState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:kusto/script:Script", name, state, makeResourceOptions(options, id), false);
}
private static ScriptArgs makeArgs(ScriptArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ScriptArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.additionalSecretOutputs(List.of(
"sasToken",
"scriptContent"
))
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static Script get(java.lang.String name, Output id, @Nullable ScriptState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Script(name, id, state, options);
}
}