All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.logicapps.kotlin.ActionCustom.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.logicapps.kotlin

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

/**
 * Builder for [ActionCustom].
 */
@PulumiTagMarker
public class ActionCustomResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ActionCustomArgs = ActionCustomArgs()

    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 ActionCustomArgsBuilder.() -> Unit) {
        val builder = ActionCustomArgsBuilder()
        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(): ActionCustom {
        val builtJavaResource = com.pulumi.azure.logicapps.ActionCustom(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ActionCustom(builtJavaResource)
    }
}

/**
 * Manages a Custom Action within a Logic App Workflow
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "workflow-resources",
 *     location: "West Europe",
 * });
 * const exampleWorkflow = new azure.logicapps.Workflow("example", {
 *     name: "workflow1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleActionCustom = new azure.logicapps.ActionCustom("example", {
 *     name: "example-action",
 *     logicAppId: exampleWorkflow.id,
 *     body: `{
 *     "description": "A variable to configure the auto expiration age in days. Configured in negative number. Default is -30 (30 days old).",
 *     "inputs": {
 *         "variables": [
 *             {
 *                 "name": "ExpirationAgeInDays",
 *                 "type": "Integer",
 *                 "value": -30
 *             }
 *         ]
 *     },
 *     "runAfter": {},
 *     "type": "InitializeVariable"
 * }
 * `,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="workflow-resources",
 *     location="West Europe")
 * example_workflow = azure.logicapps.Workflow("example",
 *     name="workflow1",
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_action_custom = azure.logicapps.ActionCustom("example",
 *     name="example-action",
 *     logic_app_id=example_workflow.id,
 *     body="""{
 *     "description": "A variable to configure the auto expiration age in days. Configured in negative number. Default is -30 (30 days old).",
 *     "inputs": {
 *         "variables": [
 *             {
 *                 "name": "ExpirationAgeInDays",
 *                 "type": "Integer",
 *                 "value": -30
 *             }
 *         ]
 *     },
 *     "runAfter": {},
 *     "type": "InitializeVariable"
 * }
 * """)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "workflow-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleWorkflow = new Azure.LogicApps.Workflow("example", new()
 *     {
 *         Name = "workflow1",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleActionCustom = new Azure.LogicApps.ActionCustom("example", new()
 *     {
 *         Name = "example-action",
 *         LogicAppId = exampleWorkflow.Id,
 *         Body = @"{
 *     ""description"": ""A variable to configure the auto expiration age in days. Configured in negative number. Default is -30 (30 days old)."",
 *     ""inputs"": {
 *         ""variables"": [
 *             {
 *                 ""name"": ""ExpirationAgeInDays"",
 *                 ""type"": ""Integer"",
 *                 ""value"": -30
 *             }
 *         ]
 *     },
 *     ""runAfter"": {},
 *     ""type"": ""InitializeVariable""
 * }
 * ",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/logicapps"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("workflow-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleWorkflow, err := logicapps.NewWorkflow(ctx, "example", &logicapps.WorkflowArgs{
 * 			Name:              pulumi.String("workflow1"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logicapps.NewActionCustom(ctx, "example", &logicapps.ActionCustomArgs{
 * 			Name:       pulumi.String("example-action"),
 * 			LogicAppId: exampleWorkflow.ID(),
 * 			Body: pulumi.String(`{
 *     "description": "A variable to configure the auto expiration age in days. Configured in negative number. Default is -30 (30 days old).",
 *     "inputs": {
 *         "variables": [
 *             {
 *                 "name": "ExpirationAgeInDays",
 *                 "type": "Integer",
 *                 "value": -30
 *             }
 *         ]
 *     },
 *     "runAfter": {},
 *     "type": "InitializeVariable"
 * }
 * `),
 * 		})
 * 		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.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.logicapps.Workflow;
 * import com.pulumi.azure.logicapps.WorkflowArgs;
 * import com.pulumi.azure.logicapps.ActionCustom;
 * import com.pulumi.azure.logicapps.ActionCustomArgs;
 * 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) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("workflow-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleWorkflow = new Workflow("exampleWorkflow", WorkflowArgs.builder()
 *             .name("workflow1")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleActionCustom = new ActionCustom("exampleActionCustom", ActionCustomArgs.builder()
 *             .name("example-action")
 *             .logicAppId(exampleWorkflow.id())
 *             .body("""
 * {
 *     "description": "A variable to configure the auto expiration age in days. Configured in negative number. Default is -30 (30 days old).",
 *     "inputs": {
 *         "variables": [
 *             {
 *                 "name": "ExpirationAgeInDays",
 *                 "type": "Integer",
 *                 "value": -30
 *             }
 *         ]
 *     },
 *     "runAfter": {},
 *     "type": "InitializeVariable"
 * }
 *             """)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: workflow-resources
 *       location: West Europe
 *   exampleWorkflow:
 *     type: azure:logicapps:Workflow
 *     name: example
 *     properties:
 *       name: workflow1
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleActionCustom:
 *     type: azure:logicapps:ActionCustom
 *     name: example
 *     properties:
 *       name: example-action
 *       logicAppId: ${exampleWorkflow.id}
 *       body: |
 *         {
 *             "description": "A variable to configure the auto expiration age in days. Configured in negative number. Default is -30 (30 days old).",
 *             "inputs": {
 *                 "variables": [
 *                     {
 *                         "name": "ExpirationAgeInDays",
 *                         "type": "Integer",
 *                         "value": -30
 *                     }
 *                 ]
 *             },
 *             "runAfter": {},
 *             "type": "InitializeVariable"
 *         }
 * ```
 * 
 * ## Import
 * Logic App Custom Actions can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:logicapps/actionCustom:ActionCustom custom1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Logic/workflows/workflow1/actions/custom1
 * ```
 */
public class ActionCustom internal constructor(
    override val javaResource: com.pulumi.azure.logicapps.ActionCustom,
) : KotlinCustomResource(javaResource, ActionCustomMapper) {
    /**
     * Specifies the JSON Blob defining the Body of this Custom Action.
     */
    public val body: Output
        get() = javaResource.body().applyValue({ args0 -> args0 })

    /**
     * Specifies the ID of the Logic App Workflow. Changing this forces a new resource to be created.
     */
    public val logicAppId: Output
        get() = javaResource.logicAppId().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the HTTP Action to be created within the Logic App Workflow. Changing this forces a new resource to be created.
     * > **NOTE:** This name must be unique across all Actions within the Logic App Workflow.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })
}

public object ActionCustomMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.logicapps.ActionCustom::class == javaResource::class

    override fun map(javaResource: Resource): ActionCustom = ActionCustom(
        javaResource as
            com.pulumi.azure.logicapps.ActionCustom,
    )
}

/**
 * @see [ActionCustom].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ActionCustom].
 */
public suspend fun actionCustom(
    name: String,
    block: suspend ActionCustomResourceBuilder.() -> Unit,
): ActionCustom {
    val builder = ActionCustomResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ActionCustom].
 * @param name The _unique_ name of the resulting resource.
 */
public fun actionCustom(name: String): ActionCustom {
    val builder = ActionCustomResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy