azure.streamanalytics.FunctionJavascriptUda

Explore with Pulumi AI

Manages a JavaScript UDA Function within a Stream Analytics Streaming Job.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var exampleResourceGroup = Azure.Core.GetResourceGroup.Invoke(new()
    {
        Name = "example-resources",
    });

    var exampleJob = Azure.StreamAnalytics.GetJob.Invoke(new()
    {
        Name = "example-job",
        ResourceGroupName = exampleResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult.Name),
    });

    var exampleFunctionJavascriptUda = new Azure.StreamAnalytics.FunctionJavascriptUda("exampleFunctionJavascriptUda", new()
    {
        StreamAnalyticsJobId = exampleJob.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",
        },
    });

});
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 {
		exampleResourceGroup, err := core.LookupResourceGroup(ctx, &core.LookupResourceGroupArgs{
			Name: "example-resources",
		}, nil)
		if err != nil {
			return err
		}
		exampleJob, err := streamanalytics.LookupJob(ctx, &streamanalytics.LookupJobArgs{
			Name:              "example-job",
			ResourceGroupName: exampleResourceGroup.Name,
		}, nil)
		if err != nil {
			return err
		}
		_, err = streamanalytics.NewFunctionJavascriptUda(ctx, "exampleFunctionJavascriptUda", &streamanalytics.FunctionJavascriptUdaArgs{
			StreamAnalyticsJobId: *pulumi.String(exampleJob.Id),
			Script:               pulumi.String("function main() {\n    this.init = function () {\n        this.state = 0;\n    }\n\n    this.accumulate = function (value, timestamp) {\n        this.state += value;\n    }\n\n    this.computeResult = function () {\n        return this.state;\n    }\n}\n"),
			Inputs: streamanalytics.FunctionJavascriptUdaInputTypeArray{
				&streamanalytics.FunctionJavascriptUdaInputTypeArgs{
					Type: pulumi.String("bigint"),
				},
			},
			Output: &streamanalytics.FunctionJavascriptUdaOutputTypeArgs{
				Type: pulumi.String("bigint"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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 exampleResourceGroup = CoreFunctions.getResourceGroup(GetResourceGroupArgs.builder()
            .name("example-resources")
            .build());

        final var exampleJob = StreamanalyticsFunctions.getJob(GetJobArgs.builder()
            .name("example-job")
            .resourceGroupName(exampleResourceGroup.applyValue(getResourceGroupResult -> getResourceGroupResult.name()))
            .build());

        var exampleFunctionJavascriptUda = new FunctionJavascriptUda("exampleFunctionJavascriptUda", FunctionJavascriptUdaArgs.builder()        
            .streamAnalyticsJobId(exampleJob.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());

    }
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.get_resource_group(name="example-resources")
example_job = azure.streamanalytics.get_job(name="example-job",
    resource_group_name=example_resource_group.name)
example_function_javascript_uda = azure.streamanalytics.FunctionJavascriptUda("exampleFunctionJavascriptUda",
    stream_analytics_job_id=example_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",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = azure.core.getResourceGroup({
    name: "example-resources",
});
const exampleJob = exampleResourceGroup.then(exampleResourceGroup => azure.streamanalytics.getJob({
    name: "example-job",
    resourceGroupName: exampleResourceGroup.name,
}));
const exampleFunctionJavascriptUda = new azure.streamanalytics.FunctionJavascriptUda("exampleFunctionJavascriptUda", {
    streamAnalyticsJobId: exampleJob.then(exampleJob => exampleJob.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",
    },
});
resources:
  exampleFunctionJavascriptUda:
    type: azure:streamanalytics:FunctionJavascriptUda
    properties:
      streamAnalyticsJobId: ${exampleJob.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:
  exampleResourceGroup:
    fn::invoke:
      Function: azure:core:getResourceGroup
      Arguments:
        name: example-resources
  exampleJob:
    fn::invoke:
      Function: azure:streamanalytics:getJob
      Arguments:
        name: example-job
        resourceGroupName: ${exampleResourceGroup.name}

Create FunctionJavascriptUda Resource

new FunctionJavascriptUda(name: string, args: FunctionJavascriptUdaArgs, opts?: CustomResourceOptions);
@overload
def FunctionJavascriptUda(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          inputs: Optional[Sequence[FunctionJavascriptUdaInputArgs]] = None,
                          name: Optional[str] = None,
                          output: Optional[FunctionJavascriptUdaOutputArgs] = None,
                          script: Optional[str] = None,
                          stream_analytics_job_id: Optional[str] = None)
@overload
def FunctionJavascriptUda(resource_name: str,
                          args: FunctionJavascriptUdaArgs,
                          opts: Optional[ResourceOptions] = None)
func NewFunctionJavascriptUda(ctx *Context, name string, args FunctionJavascriptUdaArgs, opts ...ResourceOption) (*FunctionJavascriptUda, error)
public FunctionJavascriptUda(string name, FunctionJavascriptUdaArgs args, CustomResourceOptions? opts = null)
public FunctionJavascriptUda(String name, FunctionJavascriptUdaArgs args)
public FunctionJavascriptUda(String name, FunctionJavascriptUdaArgs args, CustomResourceOptions options)
type: azure:streamanalytics:FunctionJavascriptUda
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FunctionJavascriptUdaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args FunctionJavascriptUdaArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FunctionJavascriptUdaArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FunctionJavascriptUdaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FunctionJavascriptUdaArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

FunctionJavascriptUda Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The FunctionJavascriptUda resource accepts the following input properties:

Inputs List<FunctionJavascriptUdaInputArgs>

One or more input blocks as defined below.

Output FunctionJavascriptUdaOutputArgs

An output block as defined below.

Script string

The JavaScript of this UDA Function.

StreamAnalyticsJobId string

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

Name string

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

Inputs []FunctionJavascriptUdaInputTypeArgs

One or more input blocks as defined below.

Output FunctionJavascriptUdaOutputTypeArgs

An output block as defined below.

Script string

The JavaScript of this UDA Function.

StreamAnalyticsJobId string

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

Name string

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

inputs List<FunctionJavascriptUdaInputArgs>

One or more input blocks as defined below.

output FunctionJavascriptUdaOutputArgs

An output block as defined below.

script String

The JavaScript of this UDA Function.

streamAnalyticsJobId String

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

name String

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

inputs FunctionJavascriptUdaInputArgs[]

One or more input blocks as defined below.

output FunctionJavascriptUdaOutputArgs

An output block as defined below.

script string

The JavaScript of this UDA Function.

streamAnalyticsJobId string

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

name string

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

inputs Sequence[FunctionJavascriptUdaInputArgs]

One or more input blocks as defined below.

output FunctionJavascriptUdaOutputArgs

An output block as defined below.

script str

The JavaScript of this UDA Function.

stream_analytics_job_id str

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

name str

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

inputs List<Property Map>

One or more input blocks as defined below.

output Property Map

An output block as defined below.

script String

The JavaScript of this UDA Function.

streamAnalyticsJobId String

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

name String

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the FunctionJavascriptUda resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing FunctionJavascriptUda Resource

Get an existing FunctionJavascriptUda resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FunctionJavascriptUdaState, opts?: CustomResourceOptions): FunctionJavascriptUda
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        inputs: Optional[Sequence[FunctionJavascriptUdaInputArgs]] = None,
        name: Optional[str] = None,
        output: Optional[FunctionJavascriptUdaOutputArgs] = None,
        script: Optional[str] = None,
        stream_analytics_job_id: Optional[str] = None) -> FunctionJavascriptUda
func GetFunctionJavascriptUda(ctx *Context, name string, id IDInput, state *FunctionJavascriptUdaState, opts ...ResourceOption) (*FunctionJavascriptUda, error)
public static FunctionJavascriptUda Get(string name, Input<string> id, FunctionJavascriptUdaState? state, CustomResourceOptions? opts = null)
public static FunctionJavascriptUda get(String name, Output<String> id, FunctionJavascriptUdaState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Inputs List<FunctionJavascriptUdaInputArgs>

One or more input blocks as defined below.

Name string

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

Output FunctionJavascriptUdaOutputArgs

An output block as defined below.

Script string

The JavaScript of this UDA Function.

StreamAnalyticsJobId string

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

Inputs []FunctionJavascriptUdaInputTypeArgs

One or more input blocks as defined below.

Name string

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

Output FunctionJavascriptUdaOutputTypeArgs

An output block as defined below.

Script string

The JavaScript of this UDA Function.

StreamAnalyticsJobId string

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

inputs List<FunctionJavascriptUdaInputArgs>

One or more input blocks as defined below.

name String

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

output FunctionJavascriptUdaOutputArgs

An output block as defined below.

script String

The JavaScript of this UDA Function.

streamAnalyticsJobId String

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

inputs FunctionJavascriptUdaInputArgs[]

One or more input blocks as defined below.

name string

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

output FunctionJavascriptUdaOutputArgs

An output block as defined below.

script string

The JavaScript of this UDA Function.

streamAnalyticsJobId string

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

inputs Sequence[FunctionJavascriptUdaInputArgs]

One or more input blocks as defined below.

name str

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

output FunctionJavascriptUdaOutputArgs

An output block as defined below.

script str

The JavaScript of this UDA Function.

stream_analytics_job_id str

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

inputs List<Property Map>

One or more input blocks as defined below.

name String

The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

output Property Map

An output block as defined below.

script String

The JavaScript of this UDA Function.

streamAnalyticsJobId String

The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

Supporting Types

FunctionJavascriptUdaInput

Type string

The input data type of this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

ConfigurationParameter bool

Is this input parameter a configuration parameter? Defaults to false.

Type string

The input data type of this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

ConfigurationParameter bool

Is this input parameter a configuration parameter? Defaults to false.

type String

The input data type of this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

configurationParameter Boolean

Is this input parameter a configuration parameter? Defaults to false.

type string

The input data type of this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

configurationParameter boolean

Is this input parameter a configuration parameter? Defaults to false.

type str

The input data type of this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

configuration_parameter bool

Is this input parameter a configuration parameter? Defaults to false.

type String

The input data type of this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

configurationParameter Boolean

Is this input parameter a configuration parameter? Defaults to false.

FunctionJavascriptUdaOutput

Type string

The output data type from this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

Type string

The output data type from this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

type String

The output data type from this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

type string

The output data type from this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

type str

The output data type from this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

type String

The output data type from this JavaScript Function. Possible values include any, array, bigint, datetime, float, nvarchar(max) and record.

Import

Stream Analytics JavaScript UDA Functions can be imported using the resource id, e.g.

 $ pulumi import azure:streamanalytics/functionJavascriptUda:FunctionJavascriptUda example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StreamAnalytics/streamingJobs/job1/functions/func1

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.