We recommend using Azure Native.
azure.streamanalytics.FunctionJavascriptUda
Explore with Pulumi AI
Manages a JavaScript UDA Function within a Stream Analytics Streaming Job.
Example Usage
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",
    },
});
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=[{
        "type": "bigint",
    }],
    output={
        "type": "bigint",
    })
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/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
	})
}
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",
        },
    });
});
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());
    }
}
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}
Create FunctionJavascriptUda Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new FunctionJavascriptUda(name: string, args: FunctionJavascriptUdaArgs, opts?: CustomResourceOptions);@overload
def FunctionJavascriptUda(resource_name: str,
                          args: FunctionJavascriptUdaArgs,
                          opts: Optional[ResourceOptions] = None)
@overload
def FunctionJavascriptUda(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          inputs: Optional[Sequence[FunctionJavascriptUdaInputArgs]] = None,
                          output: Optional[FunctionJavascriptUdaOutputArgs] = None,
                          script: Optional[str] = None,
                          stream_analytics_job_id: Optional[str] = None,
                          name: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var functionJavascriptUdaResource = new Azure.StreamAnalytics.FunctionJavascriptUda("functionJavascriptUdaResource", new()
{
    Inputs = new[]
    {
        new Azure.StreamAnalytics.Inputs.FunctionJavascriptUdaInputArgs
        {
            Type = "string",
            ConfigurationParameter = false,
        },
    },
    Output = new Azure.StreamAnalytics.Inputs.FunctionJavascriptUdaOutputArgs
    {
        Type = "string",
    },
    Script = "string",
    StreamAnalyticsJobId = "string",
    Name = "string",
});
example, err := streamanalytics.NewFunctionJavascriptUda(ctx, "functionJavascriptUdaResource", &streamanalytics.FunctionJavascriptUdaArgs{
	Inputs: streamanalytics.FunctionJavascriptUdaInputTypeArray{
		&streamanalytics.FunctionJavascriptUdaInputTypeArgs{
			Type:                   pulumi.String("string"),
			ConfigurationParameter: pulumi.Bool(false),
		},
	},
	Output: &streamanalytics.FunctionJavascriptUdaOutputTypeArgs{
		Type: pulumi.String("string"),
	},
	Script:               pulumi.String("string"),
	StreamAnalyticsJobId: pulumi.String("string"),
	Name:                 pulumi.String("string"),
})
var functionJavascriptUdaResource = new FunctionJavascriptUda("functionJavascriptUdaResource", FunctionJavascriptUdaArgs.builder()
    .inputs(FunctionJavascriptUdaInputArgs.builder()
        .type("string")
        .configurationParameter(false)
        .build())
    .output(FunctionJavascriptUdaOutputArgs.builder()
        .type("string")
        .build())
    .script("string")
    .streamAnalyticsJobId("string")
    .name("string")
    .build());
function_javascript_uda_resource = azure.streamanalytics.FunctionJavascriptUda("functionJavascriptUdaResource",
    inputs=[{
        "type": "string",
        "configuration_parameter": False,
    }],
    output={
        "type": "string",
    },
    script="string",
    stream_analytics_job_id="string",
    name="string")
const functionJavascriptUdaResource = new azure.streamanalytics.FunctionJavascriptUda("functionJavascriptUdaResource", {
    inputs: [{
        type: "string",
        configurationParameter: false,
    }],
    output: {
        type: "string",
    },
    script: "string",
    streamAnalyticsJobId: "string",
    name: "string",
});
type: azure:streamanalytics:FunctionJavascriptUda
properties:
    inputs:
        - configurationParameter: false
          type: string
    name: string
    output:
        type: string
    script: string
    streamAnalyticsJobId: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The FunctionJavascriptUda resource accepts the following input properties:
- Inputs
List<FunctionJavascript Uda Input> 
- One or more inputblocks as defined below.
- Output
FunctionJavascript Uda Output 
- An outputblock as defined below.
- Script string
- The JavaScript of this UDA Function.
- StreamAnalytics stringJob Id 
- 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
[]FunctionJavascript Uda Input Type Args 
- One or more inputblocks as defined below.
- Output
FunctionJavascript Uda Output Type Args 
- An outputblock as defined below.
- Script string
- The JavaScript of this UDA Function.
- StreamAnalytics stringJob Id 
- 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<FunctionJavascript Uda Input> 
- One or more inputblocks as defined below.
- output
FunctionJavascript Uda Output 
- An outputblock as defined below.
- script String
- The JavaScript of this UDA Function.
- streamAnalytics StringJob Id 
- 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
FunctionJavascript Uda Input[] 
- One or more inputblocks as defined below.
- output
FunctionJavascript Uda Output 
- An outputblock as defined below.
- script string
- The JavaScript of this UDA Function.
- streamAnalytics stringJob Id 
- 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[FunctionJavascript Uda Input Args] 
- One or more inputblocks as defined below.
- output
FunctionJavascript Uda Output Args 
- An outputblock as defined below.
- script str
- The JavaScript of this UDA Function.
- stream_analytics_ strjob_ id 
- 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 inputblocks as defined below.
- output Property Map
- An outputblock as defined below.
- script String
- The JavaScript of this UDA Function.
- streamAnalytics StringJob Id 
- 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) -> FunctionJavascriptUdafunc 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)resources:  _:    type: azure:streamanalytics:FunctionJavascriptUda    get:      id: ${id}- 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.
- Inputs
List<FunctionJavascript Uda Input> 
- One or more inputblocks as defined below.
- Name string
- The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
- Output
FunctionJavascript Uda Output 
- An outputblock as defined below.
- Script string
- The JavaScript of this UDA Function.
- StreamAnalytics stringJob Id 
- The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.
- Inputs
[]FunctionJavascript Uda Input Type Args 
- One or more inputblocks as defined below.
- Name string
- The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
- Output
FunctionJavascript Uda Output Type Args 
- An outputblock as defined below.
- Script string
- The JavaScript of this UDA Function.
- StreamAnalytics stringJob Id 
- 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<FunctionJavascript Uda Input> 
- One or more inputblocks as defined below.
- name String
- The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
- output
FunctionJavascript Uda Output 
- An outputblock as defined below.
- script String
- The JavaScript of this UDA Function.
- streamAnalytics StringJob Id 
- The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.
- inputs
FunctionJavascript Uda Input[] 
- One or more inputblocks as defined below.
- name string
- The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
- output
FunctionJavascript Uda Output 
- An outputblock as defined below.
- script string
- The JavaScript of this UDA Function.
- streamAnalytics stringJob Id 
- 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[FunctionJavascript Uda Input Args] 
- One or more inputblocks as defined below.
- name str
- The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
- output
FunctionJavascript Uda Output Args 
- An outputblock as defined below.
- script str
- The JavaScript of this UDA Function.
- stream_analytics_ strjob_ id 
- 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 inputblocks 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 outputblock as defined below.
- script String
- The JavaScript of this UDA Function.
- streamAnalytics StringJob Id 
- 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, FunctionJavascriptUdaInputArgs        
- Type string
- The input data type of this JavaScript Function. Possible values include any,array,bigint,datetime,float,nvarchar(max)andrecord.
- 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)andrecord.
- 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)andrecord.
- 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)andrecord.
- 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)andrecord.
- 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)andrecord.
- configurationParameter Boolean
- Is this input parameter a configuration parameter? Defaults to false.
FunctionJavascriptUdaOutput, FunctionJavascriptUdaOutputArgs        
- Type string
- The output data type from this JavaScript Function. Possible values include any,array,bigint,datetime,float,nvarchar(max)andrecord.
- Type string
- The output data type from this JavaScript Function. Possible values include any,array,bigint,datetime,float,nvarchar(max)andrecord.
- type String
- The output data type from this JavaScript Function. Possible values include any,array,bigint,datetime,float,nvarchar(max)andrecord.
- type string
- The output data type from this JavaScript Function. Possible values include any,array,bigint,datetime,float,nvarchar(max)andrecord.
- type str
- The output data type from this JavaScript Function. Possible values include any,array,bigint,datetime,float,nvarchar(max)andrecord.
- type String
- The output data type from this JavaScript Function. Possible values include any,array,bigint,datetime,float,nvarchar(max)andrecord.
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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.