Skip to content

azurermStreamAnalyticsFunctionJavascriptUdf

Manages a JavaScript UDF Function within 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 azurermStreamAnalyticsFunctionJavascriptUdfExample =
  new azurerm.streamAnalyticsFunctionJavascriptUdf.StreamAnalyticsFunctionJavascriptUdf(
    this,
    "example_2",
    {
      input: [
        {
          type: "bigint",
        },
      ],
      name: "example-javascript-function",
      output: [
        {
          type: "bigint",
        },
      ],
      resource_group_name:
        dataAzurermStreamAnalyticsJobExample.resourceGroupName,
      script: "function getRandomNumber(in) {\n  return in;\n}\n",
      stream_analytics_job_name: dataAzurermStreamAnalyticsJobExample.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.*/
azurermStreamAnalyticsFunctionJavascriptUdfExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

  • resourceGroupName - (Required) The name of the Resource Group where the Stream Analytics Job exists. Changing this forces a new resource to be created.

  • streamAnalyticsJobName - (Required) The name 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 blocks as defined below.

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


A input block supports the following:

  • type - (Required) The Data Type for the Input Argument of this JavaScript Function. Possible values include array, any, bigint, datetime, float, nvarchar(max) and record.

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


A output block supports the following:

  • type - (Required) The Data Type output from this JavaScript Function. Possible values include array, any, 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 UDF 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 UDF Function.
  • update - (Defaults to 30 minutes) Used when updating the Stream Analytics JavaScript UDF Function.
  • read - (Defaults to 5 minutes) Used when retrieving the Stream Analytics JavaScript UDF Function.
  • delete - (Defaults to 30 minutes) Used when deleting the Stream Analytics JavaScript UDF Function.

Import

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

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