com.pulumi.azure.streamanalytics.kotlin.FunctionJavaScriptUDF.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.streamanalytics.kotlin
import com.pulumi.azure.streamanalytics.kotlin.outputs.FunctionJavaScriptUDFInput
import com.pulumi.azure.streamanalytics.kotlin.outputs.FunctionJavaScriptUDFOutput
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
import kotlin.collections.List
import com.pulumi.azure.streamanalytics.kotlin.outputs.FunctionJavaScriptUDFInput.Companion.toKotlin as functionJavaScriptUDFInputToKotlin
import com.pulumi.azure.streamanalytics.kotlin.outputs.FunctionJavaScriptUDFOutput.Companion.toKotlin as functionJavaScriptUDFOutputToKotlin
/**
* Builder for [FunctionJavaScriptUDF].
*/
@PulumiTagMarker
public class FunctionJavaScriptUDFResourceBuilder internal constructor() {
public var name: String? = null
public var args: FunctionJavaScriptUDFArgs = FunctionJavaScriptUDFArgs()
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 FunctionJavaScriptUDFArgsBuilder.() -> Unit) {
val builder = FunctionJavaScriptUDFArgsBuilder()
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(): FunctionJavaScriptUDF {
val builtJavaResource =
com.pulumi.azure.streamanalytics.FunctionJavaScriptUDF(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return FunctionJavaScriptUDF(builtJavaResource)
}
}
/**
* 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
* ```
*/
public class FunctionJavaScriptUDF internal constructor(
override val javaResource: com.pulumi.azure.streamanalytics.FunctionJavaScriptUDF,
) : KotlinCustomResource(javaResource, FunctionJavaScriptUDFMapper) {
/**
* One or more `input` blocks as defined below.
*/
public val inputs: Output>
get() = javaResource.inputs().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
functionJavaScriptUDFInputToKotlin(args0)
})
})
})
/**
* The name of the JavaScript UDF Function. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* An `output` blocks as defined below.
*/
public val output: Output
get() = javaResource.output().applyValue({ args0 ->
args0.let({ args0 ->
functionJavaScriptUDFOutputToKotlin(args0)
})
})
/**
* The name of the Resource Group where the Stream Analytics Job exists. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The JavaScript of this UDF Function.
*/
public val script: Output
get() = javaResource.script().applyValue({ args0 -> args0 })
/**
* The name of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.
*/
public val streamAnalyticsJobName: Output
get() = javaResource.streamAnalyticsJobName().applyValue({ args0 -> args0 })
}
public object FunctionJavaScriptUDFMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.streamanalytics.FunctionJavaScriptUDF::class == javaResource::class
override fun map(javaResource: Resource): FunctionJavaScriptUDF =
FunctionJavaScriptUDF(javaResource as com.pulumi.azure.streamanalytics.FunctionJavaScriptUDF)
}
/**
* @see [FunctionJavaScriptUDF].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [FunctionJavaScriptUDF].
*/
public suspend fun functionJavaScriptUDF(
name: String,
block: suspend FunctionJavaScriptUDFResourceBuilder.() -> Unit,
): FunctionJavaScriptUDF {
val builder = FunctionJavaScriptUDFResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [FunctionJavaScriptUDF].
* @param name The _unique_ name of the resulting resource.
*/
public fun functionJavaScriptUDF(name: String): FunctionJavaScriptUDF {
val builder = FunctionJavaScriptUDFResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy