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

com.pulumi.azure.streamanalytics.kotlin.Job.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.streamanalytics.kotlin

import com.pulumi.azure.streamanalytics.kotlin.outputs.JobIdentity
import com.pulumi.azure.streamanalytics.kotlin.outputs.JobJobStorageAccount
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.streamanalytics.kotlin.outputs.JobIdentity.Companion.toKotlin as jobIdentityToKotlin
import com.pulumi.azure.streamanalytics.kotlin.outputs.JobJobStorageAccount.Companion.toKotlin as jobJobStorageAccountToKotlin

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

    public var args: JobArgs = JobArgs()

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

/**
 * Manages a Stream Analytics Job.
 * ## 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 exampleJob = new azure.streamanalytics.Job("example", {
 *     name: "example-job",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     compatibilityLevel: "1.2",
 *     dataLocale: "en-GB",
 *     eventsLateArrivalMaxDelayInSeconds: 60,
 *     eventsOutOfOrderMaxDelayInSeconds: 50,
 *     eventsOutOfOrderPolicy: "Adjust",
 *     outputErrorPolicy: "Drop",
 *     streamingUnits: 3,
 *     tags: {
 *         environment: "Example",
 *     },
 *     transformationQuery: `    SELECT *
 *     INTO [YourOutputAlias]
 *     FROM [YourInputAlias]
 * `,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_job = azure.streamanalytics.Job("example",
 *     name="example-job",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     compatibility_level="1.2",
 *     data_locale="en-GB",
 *     events_late_arrival_max_delay_in_seconds=60,
 *     events_out_of_order_max_delay_in_seconds=50,
 *     events_out_of_order_policy="Adjust",
 *     output_error_policy="Drop",
 *     streaming_units=3,
 *     tags={
 *         "environment": "Example",
 *     },
 *     transformation_query="""    SELECT *
 *     INTO [YourOutputAlias]
 *     FROM [YourInputAlias]
 * """)
 * ```
 * ```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 exampleJob = new Azure.StreamAnalytics.Job("example", new()
 *     {
 *         Name = "example-job",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         CompatibilityLevel = "1.2",
 *         DataLocale = "en-GB",
 *         EventsLateArrivalMaxDelayInSeconds = 60,
 *         EventsOutOfOrderMaxDelayInSeconds = 50,
 *         EventsOutOfOrderPolicy = "Adjust",
 *         OutputErrorPolicy = "Drop",
 *         StreamingUnits = 3,
 *         Tags =
 *         {
 *             { "environment", "Example" },
 *         },
 *         TransformationQuery = @"    SELECT *
 *     INTO [YourOutputAlias]
 *     FROM [YourInputAlias]
 * ",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/streamanalytics"
 * 	"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 = streamanalytics.NewJob(ctx, "example", &streamanalytics.JobArgs{
 * 			Name:                               pulumi.String("example-job"),
 * 			ResourceGroupName:                  example.Name,
 * 			Location:                           example.Location,
 * 			CompatibilityLevel:                 pulumi.String("1.2"),
 * 			DataLocale:                         pulumi.String("en-GB"),
 * 			EventsLateArrivalMaxDelayInSeconds: pulumi.Int(60),
 * 			EventsOutOfOrderMaxDelayInSeconds:  pulumi.Int(50),
 * 			EventsOutOfOrderPolicy:             pulumi.String("Adjust"),
 * 			OutputErrorPolicy:                  pulumi.String("Drop"),
 * 			StreamingUnits:                     pulumi.Int(3),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("Example"),
 * 			},
 * 			TransformationQuery: pulumi.String("    SELECT *\n    INTO [YourOutputAlias]\n    FROM [YourInputAlias]\n"),
 * 		})
 * 		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.streamanalytics.Job;
 * import com.pulumi.azure.streamanalytics.JobArgs;
 * 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 exampleJob = new Job("exampleJob", JobArgs.builder()
 *             .name("example-job")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .compatibilityLevel("1.2")
 *             .dataLocale("en-GB")
 *             .eventsLateArrivalMaxDelayInSeconds(60)
 *             .eventsOutOfOrderMaxDelayInSeconds(50)
 *             .eventsOutOfOrderPolicy("Adjust")
 *             .outputErrorPolicy("Drop")
 *             .streamingUnits(3)
 *             .tags(Map.of("environment", "Example"))
 *             .transformationQuery("""
 *     SELECT *
 *     INTO [YourOutputAlias]
 *     FROM [YourInputAlias]
 *             """)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleJob:
 *     type: azure:streamanalytics:Job
 *     name: example
 *     properties:
 *       name: example-job
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       compatibilityLevel: '1.2'
 *       dataLocale: en-GB
 *       eventsLateArrivalMaxDelayInSeconds: 60
 *       eventsOutOfOrderMaxDelayInSeconds: 50
 *       eventsOutOfOrderPolicy: Adjust
 *       outputErrorPolicy: Drop
 *       streamingUnits: 3
 *       tags:
 *         environment: Example
 *       transformationQuery: |2
 *             SELECT *
 *             INTO [YourOutputAlias]
 *             FROM [YourInputAlias]
 * ```
 * 
 * ## Import
 * Stream Analytics Job's can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:streamanalytics/job:Job example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StreamAnalytics/streamingJobs/job1
 * ```
 */
public class Job internal constructor(
    override val javaResource: com.pulumi.azure.streamanalytics.Job,
) : KotlinCustomResource(javaResource, JobMapper) {
    /**
     * Specifies the compatibility level for this job - which controls certain runtime behaviours of the streaming job. Possible values are `1.0`, `1.1` and `1.2`.
     * > **NOTE:** Support for Compatibility Level 1.2 is dependent on a new version of the Stream Analytics API, which [being tracked in this issue](https://github.com/Azure/azure-rest-api-specs/issues/5604).
     */
    public val compatibilityLevel: Output
        get() = javaResource.compatibilityLevel().applyValue({ args0 -> args0 })

    /**
     * The policy for storing stream analytics content. Possible values are `JobStorageAccount`, `SystemAccount`. Defaults to `SystemAccount`.
     */
    public val contentStoragePolicy: Output?
        get() = javaResource.contentStoragePolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the Data Locale of the Job, which [should be a supported .NET Culture](https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx).
     */
    public val dataLocale: Output
        get() = javaResource.dataLocale().applyValue({ args0 -> args0 })

    /**
     * Specifies the maximum tolerable delay in seconds where events arriving late could be included. Supported range is `-1` (indefinite) to `1814399` (20d 23h 59m 59s). Default is `5`.
     */
    public val eventsLateArrivalMaxDelayInSeconds: Output?
        get() = javaResource.eventsLateArrivalMaxDelayInSeconds().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * Specifies the maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. Supported range is `0` to `599` (9m 59s). Default is `0`.
     */
    public val eventsOutOfOrderMaxDelayInSeconds: Output?
        get() = javaResource.eventsOutOfOrderMaxDelayInSeconds().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * Specifies the policy which should be applied to events which arrive out of order in the input event stream. Possible values are `Adjust` and `Drop`. Default is `Adjust`.
     */
    public val eventsOutOfOrderPolicy: Output?
        get() = javaResource.eventsOutOfOrderPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    jobIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The Job ID assigned by the Stream Analytics Job.
     */
    public val jobId: Output
        get() = javaResource.jobId().applyValue({ args0 -> args0 })

    /**
     * The details of the job storage account. A `job_storage_account` block as defined below.
     */
    public val jobStorageAccounts: Output>?
        get() = javaResource.jobStorageAccounts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        jobJobStorageAccountToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The Azure Region in which the Resource Group exists. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

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

    /**
     * Specifies the policy which should be applied to events which arrive at the output and cannot be written to the external storage due to being malformed (such as missing column values, column values of wrong type or size). Possible values are `Drop` and `Stop`. Default is `Drop`.
     */
    public val outputErrorPolicy: Output?
        get() = javaResource.outputErrorPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group where the Stream Analytics Job should exist. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The SKU Name to use for the Stream Analytics Job. Possible values are `Standard`, `StandardV2`. Defaults to `Standard`.
     */
    public val skuName: Output?
        get() = javaResource.skuName().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The ID of an existing Stream Analytics Cluster where the Stream Analytics Job should run.
     */
    public val streamAnalyticsClusterId: Output?
        get() = javaResource.streamAnalyticsClusterId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the number of streaming units that the streaming job uses. Supported values are `1`, `3`, `6` and multiples of `6` up to `120`.
     * > **NOTE:** `streaming_units` must be set when `type` is `Cloud`.
     */
    public val streamingUnits: Output?
        get() = javaResource.streamingUnits().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    public val transformationQuery: Output
        get() = javaResource.transformationQuery().applyValue({ args0 -> args0 })

    /**
     * The type of the Stream Analytics Job. Possible values are `Cloud` and `Edge`. Defaults to `Cloud`. Changing this forces a new resource to be created.
     * > **NOTE:** `Edge` doesn't support `stream_analytics_cluster_id` and `streaming_units`.
     */
    public val type: Output?
        get() = javaResource.type().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object JobMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.streamanalytics.Job::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy