Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.streamanalytics.kotlin.FunctionJavascriptUda.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.streamanalytics.kotlin
import com.pulumi.azure.streamanalytics.kotlin.outputs.FunctionJavascriptUdaInput
import com.pulumi.azure.streamanalytics.kotlin.outputs.FunctionJavascriptUdaOutput
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.azure.streamanalytics.kotlin.outputs.FunctionJavascriptUdaInput.Companion.toKotlin as functionJavascriptUdaInputToKotlin
import com.pulumi.azure.streamanalytics.kotlin.outputs.FunctionJavascriptUdaOutput.Companion.toKotlin as functionJavascriptUdaOutputToKotlin
/**
* Builder for [FunctionJavascriptUda].
*/
@PulumiTagMarker
public class FunctionJavascriptUdaResourceBuilder internal constructor() {
public var name: String? = null
public var args: FunctionJavascriptUdaArgs = FunctionJavascriptUdaArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend FunctionJavascriptUdaArgsBuilder.() -> Unit) {
val builder = FunctionJavascriptUdaArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): FunctionJavascriptUda {
val builtJavaResource =
com.pulumi.azure.streamanalytics.FunctionJavascriptUda(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return FunctionJavascriptUda(builtJavaResource)
}
}
/**
* Manages a JavaScript UDA Function within a Stream Analytics Streaming Job.
* ## Example Usage
*
* ```typescript
* 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",
* },
* });
* ```
* ```python
* 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",
* })
* ```
* ```csharp
* 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",
* },
* });
* });
* ```
* ```go
* 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 {
* 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
* })
* }
* ```
* ```java
* 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());
* }
* }
* ```
* ```yaml
* 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}
* ```
*
* ## Import
* Stream Analytics JavaScript UDA Functions can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:streamanalytics/functionJavascriptUda:FunctionJavascriptUda example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StreamAnalytics/streamingJobs/job1/functions/func1
* ```
*/
public class FunctionJavascriptUda internal constructor(
override val javaResource: com.pulumi.azure.streamanalytics.FunctionJavascriptUda,
) : KotlinCustomResource(javaResource, FunctionJavascriptUdaMapper) {
/**
* One or more `input` blocks as defined below.
*/
public val inputs: Output>
get() = javaResource.inputs().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
functionJavascriptUdaInputToKotlin(args0)
})
})
})
/**
* The name of the JavaScript UDA Function. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* An `output` block as defined below.
*/
public val output: Output
get() = javaResource.output().applyValue({ args0 ->
args0.let({ args0 ->
functionJavascriptUdaOutputToKotlin(args0)
})
})
/**
* The JavaScript of this UDA Function.
*/
public val script: Output
get() = javaResource.script().applyValue({ args0 -> args0 })
/**
* The resource ID of the Stream Analytics Job where this Function should be created. Changing this forces a new resource to be created.
*/
public val streamAnalyticsJobId: Output
get() = javaResource.streamAnalyticsJobId().applyValue({ args0 -> args0 })
}
public object FunctionJavascriptUdaMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.streamanalytics.FunctionJavascriptUda::class == javaResource::class
override fun map(javaResource: Resource): FunctionJavascriptUda =
FunctionJavascriptUda(javaResource as com.pulumi.azure.streamanalytics.FunctionJavascriptUda)
}
/**
* @see [FunctionJavascriptUda].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [FunctionJavascriptUda].
*/
public suspend fun functionJavascriptUda(
name: String,
block: suspend FunctionJavascriptUdaResourceBuilder.() -> Unit,
): FunctionJavascriptUda {
val builder = FunctionJavascriptUdaResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [FunctionJavascriptUda].
* @param name The _unique_ name of the resulting resource.
*/
public fun functionJavascriptUda(name: String): FunctionJavascriptUda {
val builder = FunctionJavascriptUdaResourceBuilder()
builder.name(name)
return builder.build()
}