Skip to content

azurermStreamAnalyticsFunctionJavascriptUda

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

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const dataAzurermResourceGroupExample =
  new azurerm.dataAzurermResourceGroup.DataAzurermResourceGroup(
    this,
    "example",
    {
      name: "example-resources",
    }
  );
const dataAzurermStreamAnalyticsJobExample =
  new azurerm.dataAzurermStreamAnalyticsJob.DataAzurermStreamAnalyticsJob(
    this,
    "example_1",
    {
      name: "example-job",
      resource_group_name: dataAzurermResourceGroupExample.name,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzurermStreamAnalyticsJobExample.overrideLogicalId("example");
const azurermStreamAnalyticsFunctionJavascriptUdaExample =
  new azurerm.streamAnalyticsFunctionJavascriptUda.StreamAnalyticsFunctionJavascriptUda(
    this,
    "example_2",
    {
      input: [
        {
          type: "bigint",
        },
      ],
      name: "example-javascript-function",
      output: [
        {
          type: "bigint",
        },
      ],
      script:
        "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",
      stream_analytics_job_id: dataAzurermStreamAnalyticsJobExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStreamAnalyticsFunctionJavascriptUdaExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the JavaScript UDA Function. Changing this forces a new resource to be created.

  • streamAnalyticsJobId - (Required) The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.

  • input - (Required) One or more input blocks as defined below.

  • output - (Required) An output block as defined below.

  • script - (Required) The JavaScript of this UDA Function.


An input block supports the following:

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

  • configurationParameter - (Optional) Is this input parameter a configuration parameter? Defaults to false.


An output block supports the following:

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

Attributes Reference

The following attributes are exported in addition to the arguments listed above:

  • id - The ID of the Stream Analytics JavaScript UDA Function.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Stream Analytics JavaScript UDA Function.
  • update - (Defaults to 30 minutes) Used when updating the Stream Analytics JavaScript UDA Function.
  • read - (Defaults to 5 minutes) Used when retrieving the Stream Analytics JavaScript UDA Function.
  • delete - (Defaults to 30 minutes) Used when deleting the Stream Analytics JavaScript UDA Function.

Import

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

terraform import azurerm_stream_analytics_function_javascript_uda.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StreamAnalytics/streamingJobs/job1/functions/func1