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

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

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.streamanalytics.kotlin

import com.pulumi.azure.streamanalytics.FunctionJavascriptUdaArgs.builder
import com.pulumi.azure.streamanalytics.kotlin.inputs.FunctionJavascriptUdaInputArgs
import com.pulumi.azure.streamanalytics.kotlin.inputs.FunctionJavascriptUdaInputArgsBuilder
import com.pulumi.azure.streamanalytics.kotlin.inputs.FunctionJavascriptUdaOutputArgs
import com.pulumi.azure.streamanalytics.kotlin.inputs.FunctionJavascriptUdaOutputArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages a JavaScript UDA Function within a Stream Analytics Streaming Job.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = azure.core.getResourceGroup({
 *     name: "example-resources",
 * });
 * const exampleGetJob = example.then(example => azure.streamanalytics.getJob({
 *     name: "example-job",
 *     resourceGroupName: example.name,
 * }));
 * const exampleFunctionJavascriptUda = new azure.streamanalytics.FunctionJavascriptUda("example", {
 *     name: "example-javascript-function",
 *     streamAnalyticsJobId: exampleGetJob.then(exampleGetJob => exampleGetJob.id),
 *     script: `function main() {
 *     this.init = function () {
 *         this.state = 0;
 *     }
 *     this.accumulate = function (value, timestamp) {
 *         this.state += value;
 *     }
 *     this.computeResult = function () {
 *         return this.state;
 *     }
 * }
 * `,
 *     inputs: [{
 *         type: "bigint",
 *     }],
 *     output: {
 *         type: "bigint",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.get_resource_group(name="example-resources")
 * example_get_job = azure.streamanalytics.get_job(name="example-job",
 *     resource_group_name=example.name)
 * example_function_javascript_uda = azure.streamanalytics.FunctionJavascriptUda("example",
 *     name="example-javascript-function",
 *     stream_analytics_job_id=example_get_job.id,
 *     script="""function main() {
 *     this.init = function () {
 *         this.state = 0;
 *     }
 *     this.accumulate = function (value, timestamp) {
 *         this.state += value;
 *     }
 *     this.computeResult = function () {
 *         return this.state;
 *     }
 * }
 * """,
 *     inputs=[azure.streamanalytics.FunctionJavascriptUdaInputArgs(
 *         type="bigint",
 *     )],
 *     output=azure.streamanalytics.FunctionJavascriptUdaOutputArgs(
 *         type="bigint",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = Azure.Core.GetResourceGroup.Invoke(new()
 *     {
 *         Name = "example-resources",
 *     });
 *     var exampleGetJob = Azure.StreamAnalytics.GetJob.Invoke(new()
 *     {
 *         Name = "example-job",
 *         ResourceGroupName = example.Apply(getResourceGroupResult => getResourceGroupResult.Name),
 *     });
 *     var exampleFunctionJavascriptUda = new Azure.StreamAnalytics.FunctionJavascriptUda("example", new()
 *     {
 *         Name = "example-javascript-function",
 *         StreamAnalyticsJobId = exampleGetJob.Apply(getJobResult => getJobResult.Id),
 *         Script = @"function main() {
 *     this.init = function () {
 *         this.state = 0;
 *     }
 *     this.accumulate = function (value, timestamp) {
 *         this.state += value;
 *     }
 *     this.computeResult = function () {
 *         return this.state;
 *     }
 * }
 * ",
 *         Inputs = new[]
 *         {
 *             new Azure.StreamAnalytics.Inputs.FunctionJavascriptUdaInputArgs
 *             {
 *                 Type = "bigint",
 *             },
 *         },
 *         Output = new Azure.StreamAnalytics.Inputs.FunctionJavascriptUdaOutputArgs
 *         {
 *             Type = "bigint",
 *         },
 *     });
 * });
 * ```
 * ```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.LookupResourceGroup(ctx, &core.LookupResourceGroupArgs{
 * 			Name: "example-resources",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleGetJob, err := streamanalytics.LookupJob(ctx, &streamanalytics.LookupJobArgs{
 * 			Name:              "example-job",
 * 			ResourceGroupName: example.Name,
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = streamanalytics.NewFunctionJavascriptUda(ctx, "example", &streamanalytics.FunctionJavascriptUdaArgs{
 * 			Name:                 pulumi.String("example-javascript-function"),
 * 			StreamAnalyticsJobId: pulumi.String(exampleGetJob.Id),
 * 			Script: pulumi.String(`function main() {
 *     this.init = function () {
 *         this.state = 0;
 *     }
 *     this.accumulate = function (value, timestamp) {
 *         this.state += value;
 *     }
 *     this.computeResult = function () {
 *         return this.state;
 *     }
 * }
 * `),
 * 			Inputs: streamanalytics.FunctionJavascriptUdaInputTypeArray{
 * 				&streamanalytics.FunctionJavascriptUdaInputTypeArgs{
 * 					Type: pulumi.String("bigint"),
 * 				},
 * 			},
 * 			Output: &streamanalytics.FunctionJavascriptUdaOutputTypeArgs{
 * 				Type: pulumi.String("bigint"),
 * 			},
 * 		})
 * 		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.CoreFunctions;
 * import com.pulumi.azure.core.inputs.GetResourceGroupArgs;
 * import com.pulumi.azure.streamanalytics.StreamanalyticsFunctions;
 * import com.pulumi.azure.streamanalytics.inputs.GetJobArgs;
 * import com.pulumi.azure.streamanalytics.FunctionJavascriptUda;
 * import com.pulumi.azure.streamanalytics.FunctionJavascriptUdaArgs;
 * import com.pulumi.azure.streamanalytics.inputs.FunctionJavascriptUdaInputArgs;
 * import com.pulumi.azure.streamanalytics.inputs.FunctionJavascriptUdaOutputArgs;
 * 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) {
 *         final var example = CoreFunctions.getResourceGroup(GetResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .build());
 *         final var exampleGetJob = StreamanalyticsFunctions.getJob(GetJobArgs.builder()
 *             .name("example-job")
 *             .resourceGroupName(example.applyValue(getResourceGroupResult -> getResourceGroupResult.name()))
 *             .build());
 *         var exampleFunctionJavascriptUda = new FunctionJavascriptUda("exampleFunctionJavascriptUda", FunctionJavascriptUdaArgs.builder()
 *             .name("example-javascript-function")
 *             .streamAnalyticsJobId(exampleGetJob.applyValue(getJobResult -> getJobResult.id()))
 *             .script("""
 * function main() {
 *     this.init = function () {
 *         this.state = 0;
 *     }
 *     this.accumulate = function (value, timestamp) {
 *         this.state += value;
 *     }
 *     this.computeResult = function () {
 *         return this.state;
 *     }
 * }
 *             """)
 *             .inputs(FunctionJavascriptUdaInputArgs.builder()
 *                 .type("bigint")
 *                 .build())
 *             .output(FunctionJavascriptUdaOutputArgs.builder()
 *                 .type("bigint")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleFunctionJavascriptUda:
 *     type: azure:streamanalytics:FunctionJavascriptUda
 *     name: example
 *     properties:
 *       name: example-javascript-function
 *       streamAnalyticsJobId: ${exampleGetJob.id}
 *       script: |
 *         function main() {
 *             this.init = function () {
 *                 this.state = 0;
 *             }
 *             this.accumulate = function (value, timestamp) {
 *                 this.state += value;
 *             }
 *             this.computeResult = function () {
 *                 return this.state;
 *             }
 *         }
 *       inputs:
 *         - type: bigint
 *       output:
 *         type: bigint
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:core:getResourceGroup
 *       Arguments:
 *         name: example-resources
 *   exampleGetJob:
 *     fn::invoke:
 *       Function: azure:streamanalytics:getJob
 *       Arguments:
 *         name: example-job
 *         resourceGroupName: ${example.name}
 * ```
 * 
 * ## Import
 * Stream Analytics JavaScript UDA Functions can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:streamanalytics/functionJavascriptUda:FunctionJavascriptUda example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StreamAnalytics/streamingJobs/job1/functions/func1
 * ```
 * @property inputs One or more `input` blocks as defined below.
 * @property name The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
 * @property output An `output` block as defined below.
 * @property script The JavaScript of this UDA Function.
 * @property streamAnalyticsJobId The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.
 */
public data class FunctionJavascriptUdaArgs(
    public val inputs: Output>? = null,
    public val name: Output? = null,
    public val output: Output? = null,
    public val script: Output? = null,
    public val streamAnalyticsJobId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.streamanalytics.FunctionJavascriptUdaArgs =
        com.pulumi.azure.streamanalytics.FunctionJavascriptUdaArgs.builder()
            .inputs(inputs?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
            .name(name?.applyValue({ args0 -> args0 }))
            .output(output?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .script(script?.applyValue({ args0 -> args0 }))
            .streamAnalyticsJobId(streamAnalyticsJobId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [FunctionJavascriptUdaArgs].
 */
@PulumiTagMarker
public class FunctionJavascriptUdaArgsBuilder internal constructor() {
    private var inputs: Output>? = null

    private var name: Output? = null

    private var output: Output? = null

    private var script: Output? = null

    private var streamAnalyticsJobId: Output? = null

    /**
     * @param value One or more `input` blocks as defined below.
     */
    @JvmName("fchhogjhvpnhrwdd")
    public suspend fun inputs(`value`: Output>) {
        this.inputs = value
    }

    @JvmName("oxoxuvsqekvdydso")
    public suspend fun inputs(vararg values: Output) {
        this.inputs = Output.all(values.asList())
    }

    /**
     * @param values One or more `input` blocks as defined below.
     */
    @JvmName("ylusywmrpwdphpni")
    public suspend fun inputs(values: List>) {
        this.inputs = Output.all(values)
    }

    /**
     * @param value The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
     */
    @JvmName("pvmalavjcdvtxbat")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value An `output` block as defined below.
     */
    @JvmName("xohloovobfncnlpq")
    public suspend fun output(`value`: Output) {
        this.output = value
    }

    /**
     * @param value The JavaScript of this UDA Function.
     */
    @JvmName("dlumqlbvkyaqbtie")
    public suspend fun script(`value`: Output) {
        this.script = value
    }

    /**
     * @param value The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.
     */
    @JvmName("lskmbiqwufhychup")
    public suspend fun streamAnalyticsJobId(`value`: Output) {
        this.streamAnalyticsJobId = value
    }

    /**
     * @param value One or more `input` blocks as defined below.
     */
    @JvmName("mnkfhcmsfrwvebyq")
    public suspend fun inputs(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.inputs = mapped
    }

    /**
     * @param argument One or more `input` blocks as defined below.
     */
    @JvmName("wimcavixpjqkhwes")
    public suspend
    fun inputs(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            FunctionJavascriptUdaInputArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.inputs = mapped
    }

    /**
     * @param argument One or more `input` blocks as defined below.
     */
    @JvmName("lgowndrlnynsxiss")
    public suspend fun inputs(
        vararg
        argument: suspend FunctionJavascriptUdaInputArgsBuilder.() -> Unit,
    ) {
        val toBeMapped = argument.toList().map {
            FunctionJavascriptUdaInputArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.inputs = mapped
    }

    /**
     * @param argument One or more `input` blocks as defined below.
     */
    @JvmName("nekvfqiraxgeeusw")
    public suspend fun inputs(argument: suspend FunctionJavascriptUdaInputArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            FunctionJavascriptUdaInputArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.inputs = mapped
    }

    /**
     * @param values One or more `input` blocks as defined below.
     */
    @JvmName("ltuqwsqpleuepgib")
    public suspend fun inputs(vararg values: FunctionJavascriptUdaInputArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.inputs = mapped
    }

    /**
     * @param value The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
     */
    @JvmName("gnyhypxqxvjeuvof")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value An `output` block as defined below.
     */
    @JvmName("ndpiflccydabfgii")
    public suspend fun output(`value`: FunctionJavascriptUdaOutputArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.output = mapped
    }

    /**
     * @param argument An `output` block as defined below.
     */
    @JvmName("gaurfctfqdxvammy")
    public suspend fun output(argument: suspend FunctionJavascriptUdaOutputArgsBuilder.() -> Unit) {
        val toBeMapped = FunctionJavascriptUdaOutputArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.output = mapped
    }

    /**
     * @param value The JavaScript of this UDA Function.
     */
    @JvmName("roqudjebybigewsp")
    public suspend fun script(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.script = mapped
    }

    /**
     * @param value The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.
     */
    @JvmName("nsnxqdubpwjbuqnm")
    public suspend fun streamAnalyticsJobId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.streamAnalyticsJobId = mapped
    }

    internal fun build(): FunctionJavascriptUdaArgs = FunctionJavascriptUdaArgs(
        inputs = inputs,
        name = name,
        output = output,
        script = script,
        streamAnalyticsJobId = streamAnalyticsJobId,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy