Azure Classic

Pulumi Official
Package maintained by Pulumi
v5.5.0 published on Wednesday, May 4, 2022 by Pulumi

FunctionJavascriptUda

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

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleResourceGroup = Output.Create(Azure.Core.GetResourceGroup.InvokeAsync(new Azure.Core.GetResourceGroupArgs
        {
            Name = "example-resources",
        }));
        var exampleJob = Output.Create(Azure.StreamAnalytics.GetJob.InvokeAsync(new Azure.StreamAnalytics.GetJobArgs
        {
            Name = "example-job",
            ResourceGroupName = azurerm_resource_group.Example.Name,
        }));
        var exampleFunctionJavascriptUda = new Azure.StreamAnalytics.FunctionJavascriptUda("exampleFunctionJavascriptUda", new Azure.StreamAnalytics.FunctionJavascriptUdaArgs
        {
            StreamAnalyticsJobId = exampleJob.Apply(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 = 
            {
                new Azure.StreamAnalytics.Inputs.FunctionJavascriptUdaInputArgs
                {
                    Type = "bigint",
                },
            },
            Output = new Azure.StreamAnalytics.Inputs.FunctionJavascriptUdaOutputArgs
            {
                Type = "bigint",
            },
        });
    }

}
package main

import (
	"fmt"

	"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 {
		_, 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: azurerm_resource_group.Example.Name,
		}, nil)
		if err != nil {
			return err
		}
		_, err = streamanalytics.NewFunctionJavascriptUda(ctx, "exampleFunctionJavascriptUda", &streamanalytics.FunctionJavascriptUdaArgs{
			StreamAnalyticsJobId: pulumi.String(exampleJob.Id),
			Script:               pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v", "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.FunctionJavascriptUdaInputArray{
				&streamanalytics.FunctionJavascriptUdaInputArgs{
					Type: pulumi.String("bigint"),
				},
			},
			Output: streamanalytics.FunctionJavascriptUdaOutputArgs{
				Type: pulumi.String("bigint"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var exampleResourceGroup = Output.of(CoreFunctions.getResourceGroup(GetBudgetResourceGroupArgs.builder()
            .name("example-resources")
            .build()));

        final var exampleJob = Output.of(StreamanalyticsFunctions.getJob(GetJobArgs.builder()
            .name("example-job")
            .resourceGroupName(azurerm_resource_group.getExample().getName())
            .build()));

        var exampleFunctionJavascriptUda = new FunctionJavascriptUda("exampleFunctionJavascriptUda", FunctionJavascriptUdaArgs.builder()        
            .streamAnalyticsJobId(exampleJob.apply(getJobResult -> getJobResult.getId()))
            .script("""
function main() {
    this.init = function () {
        this.state = 0;
    }

    this.accumulate = function (value, timestamp) {
        this.state += value;
    }

    this.computeResult = function () {
        return this.state;
    }
}
            """)
            .inputs(FunctionJavascriptUdaInput.builder()
                .type("bigint")
                .build())
            .output(FunctionJavascriptUdaOutput.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=azurerm_resource_group["example"]["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 = azure.streamanalytics.getJob({
    name: "example-job",
    resourceGroupName: azurerm_resource_group.example.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: ${azurerm_resource_group.example.name}

Create a 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 ListJavascriptUdaInputArgs>

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

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 an 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 ListJavascriptUdaInputArgs>

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

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.

Type string

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

type String

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

type string

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

type str

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

type String

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

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
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.