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

com.pulumi.azure.streamanalytics.kotlin.FunctionJavaScriptUDFArgs.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.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.streamanalytics.kotlin

import com.pulumi.azure.streamanalytics.FunctionJavaScriptUDFArgs.builder
import com.pulumi.azure.streamanalytics.kotlin.inputs.FunctionJavaScriptUDFInputArgs
import com.pulumi.azure.streamanalytics.kotlin.inputs.FunctionJavaScriptUDFInputArgsBuilder
import com.pulumi.azure.streamanalytics.kotlin.inputs.FunctionJavaScriptUDFOutputArgs
import com.pulumi.azure.streamanalytics.kotlin.inputs.FunctionJavaScriptUDFOutputArgsBuilder
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 UDF Function within 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 exampleFunctionJavaScriptUDF = new azure.streamanalytics.FunctionJavaScriptUDF("example", {
 *     name: "example-javascript-function",
 *     streamAnalyticsJobName: exampleGetJob.then(exampleGetJob => exampleGetJob.name),
 *     resourceGroupName: exampleGetJob.then(exampleGetJob => exampleGetJob.resourceGroupName),
 *     script: `function getRandomNumber(in) {
 *   return in;
 * }
 * `,
 *     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_java_script_udf = azure.streamanalytics.FunctionJavaScriptUDF("example",
 *     name="example-javascript-function",
 *     stream_analytics_job_name=example_get_job.name,
 *     resource_group_name=example_get_job.resource_group_name,
 *     script="""function getRandomNumber(in) {
 *   return in;
 * }
 * """,
 *     inputs=[azure.streamanalytics.FunctionJavaScriptUDFInputArgs(
 *         type="bigint",
 *     )],
 *     output=azure.streamanalytics.FunctionJavaScriptUDFOutputArgs(
 *         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 exampleFunctionJavaScriptUDF = new Azure.StreamAnalytics.FunctionJavaScriptUDF("example", new()
 *     {
 *         Name = "example-javascript-function",
 *         StreamAnalyticsJobName = exampleGetJob.Apply(getJobResult => getJobResult.Name),
 *         ResourceGroupName = exampleGetJob.Apply(getJobResult => getJobResult.ResourceGroupName),
 *         Script = @"function getRandomNumber(in) {
 *   return in;
 * }
 * ",
 *         Inputs = new[]
 *         {
 *             new Azure.StreamAnalytics.Inputs.FunctionJavaScriptUDFInputArgs
 *             {
 *                 Type = "bigint",
 *             },
 *         },
 *         Output = new Azure.StreamAnalytics.Inputs.FunctionJavaScriptUDFOutputArgs
 *         {
 *             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.NewFunctionJavaScriptUDF(ctx, "example", &streamanalytics.FunctionJavaScriptUDFArgs{
 * 			Name:                   pulumi.String("example-javascript-function"),
 * 			StreamAnalyticsJobName: pulumi.String(exampleGetJob.Name),
 * 			ResourceGroupName:      pulumi.String(exampleGetJob.ResourceGroupName),
 * 			Script:                 pulumi.String("function getRandomNumber(in) {\n  return in;\n}\n"),
 * 			Inputs: streamanalytics.FunctionJavaScriptUDFInputTypeArray{
 * 				&streamanalytics.FunctionJavaScriptUDFInputTypeArgs{
 * 					Type: pulumi.String("bigint"),
 * 				},
 * 			},
 * 			Output: &streamanalytics.FunctionJavaScriptUDFOutputTypeArgs{
 * 				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.FunctionJavaScriptUDF;
 * import com.pulumi.azure.streamanalytics.FunctionJavaScriptUDFArgs;
 * import com.pulumi.azure.streamanalytics.inputs.FunctionJavaScriptUDFInputArgs;
 * import com.pulumi.azure.streamanalytics.inputs.FunctionJavaScriptUDFOutputArgs;
 * 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 exampleFunctionJavaScriptUDF = new FunctionJavaScriptUDF("exampleFunctionJavaScriptUDF", FunctionJavaScriptUDFArgs.builder()
 *             .name("example-javascript-function")
 *             .streamAnalyticsJobName(exampleGetJob.applyValue(getJobResult -> getJobResult.name()))
 *             .resourceGroupName(exampleGetJob.applyValue(getJobResult -> getJobResult.resourceGroupName()))
 *             .script("""
 * function getRandomNumber(in) {
 *   return in;
 * }
 *             """)
 *             .inputs(FunctionJavaScriptUDFInputArgs.builder()
 *                 .type("bigint")
 *                 .build())
 *             .output(FunctionJavaScriptUDFOutputArgs.builder()
 *                 .type("bigint")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleFunctionJavaScriptUDF:
 *     type: azure:streamanalytics:FunctionJavaScriptUDF
 *     name: example
 *     properties:
 *       name: example-javascript-function
 *       streamAnalyticsJobName: ${exampleGetJob.name}
 *       resourceGroupName: ${exampleGetJob.resourceGroupName}
 *       script: |
 *         function getRandomNumber(in) {
 *           return in;
 *         }
 *       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 UDF Functions can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:streamanalytics/functionJavaScriptUDF:FunctionJavaScriptUDF 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 UDF Function. Changing this forces a new resource to be created.
 * @property output An `output` blocks as defined below.
 * @property resourceGroupName The name of the Resource Group where the Stream Analytics Job exists. Changing this forces a new resource to be created.
 * @property script The JavaScript of this UDF Function.
 * @property streamAnalyticsJobName The name of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.
 */
public data class FunctionJavaScriptUDFArgs(
    public val inputs: Output>? = null,
    public val name: Output? = null,
    public val output: Output? = null,
    public val resourceGroupName: Output? = null,
    public val script: Output? = null,
    public val streamAnalyticsJobName: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.streamanalytics.FunctionJavaScriptUDFArgs =
        com.pulumi.azure.streamanalytics.FunctionJavaScriptUDFArgs.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() }) }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .script(script?.applyValue({ args0 -> args0 }))
            .streamAnalyticsJobName(streamAnalyticsJobName?.applyValue({ args0 -> args0 })).build()
}

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

    private var name: Output? = null

    private var output: Output? = null

    private var resourceGroupName: Output? = null

    private var script: Output? = null

    private var streamAnalyticsJobName: Output? = null

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

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

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

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

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

    /**
     * @param value The name of the Resource Group where the Stream Analytics Job exists. Changing this forces a new resource to be created.
     */
    @JvmName("hbxykpfogfkuvoyx")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

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

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

    /**
     * @param value One or more `input` blocks as defined below.
     */
    @JvmName("fqmayehcagfmtolm")
    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("runkvpshdsehkxul")
    public suspend
    fun inputs(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            FunctionJavaScriptUDFInputArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.inputs = mapped
    }

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

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

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

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

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

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

    /**
     * @param value The name of the Resource Group where the Stream Analytics Job exists. Changing this forces a new resource to be created.
     */
    @JvmName("hfshgsmuvpceertb")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

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

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

    internal fun build(): FunctionJavaScriptUDFArgs = FunctionJavaScriptUDFArgs(
        inputs = inputs,
        name = name,
        output = output,
        resourceGroupName = resourceGroupName,
        script = script,
        streamAnalyticsJobName = streamAnalyticsJobName,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy