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

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

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.logicapps.kotlin

import com.pulumi.azure.logicapps.kotlin.outputs.TriggerRecurrenceSchedule
import com.pulumi.azure.logicapps.kotlin.outputs.TriggerRecurrenceSchedule.Companion.toKotlin
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: TriggerRecurrenceArgs = TriggerRecurrenceArgs()

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

/**
 * Manages a Recurrence Trigger 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 exampleTriggerRecurrence = new azure.logicapps.TriggerRecurrence("example", {
 *     name: "run-every-day",
 *     logicAppId: exampleWorkflow.id,
 *     frequency: "Day",
 *     interval: 1,
 * });
 * ```
 * ```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_trigger_recurrence = azure.logicapps.TriggerRecurrence("example",
 *     name="run-every-day",
 *     logic_app_id=example_workflow.id,
 *     frequency="Day",
 *     interval=1)
 * ```
 * ```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 exampleTriggerRecurrence = new Azure.LogicApps.TriggerRecurrence("example", new()
 *     {
 *         Name = "run-every-day",
 *         LogicAppId = exampleWorkflow.Id,
 *         Frequency = "Day",
 *         Interval = 1,
 *     });
 * });
 * ```
 * ```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.NewTriggerRecurrence(ctx, "example", &logicapps.TriggerRecurrenceArgs{
 * 			Name:       pulumi.String("run-every-day"),
 * 			LogicAppId: exampleWorkflow.ID(),
 * 			Frequency:  pulumi.String("Day"),
 * 			Interval:   pulumi.Int(1),
 * 		})
 * 		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.TriggerRecurrence;
 * import com.pulumi.azure.logicapps.TriggerRecurrenceArgs;
 * 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 exampleTriggerRecurrence = new TriggerRecurrence("exampleTriggerRecurrence", TriggerRecurrenceArgs.builder()
 *             .name("run-every-day")
 *             .logicAppId(exampleWorkflow.id())
 *             .frequency("Day")
 *             .interval(1)
 *             .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}
 *   exampleTriggerRecurrence:
 *     type: azure:logicapps:TriggerRecurrence
 *     name: example
 *     properties:
 *       name: run-every-day
 *       logicAppId: ${exampleWorkflow.id}
 *       frequency: Day
 *       interval: 1
 * ```
 * 
 * ## Import
 * Logic App Recurrence Triggers can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:logicapps/triggerRecurrence:TriggerRecurrence daily /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Logic/workflows/workflow1/triggers/daily
 * ```
 */
public class TriggerRecurrence internal constructor(
    override val javaResource: com.pulumi.azure.logicapps.TriggerRecurrence,
) : KotlinCustomResource(javaResource, TriggerRecurrenceMapper) {
    /**
     * Specifies the Frequency at which this Trigger should be run. Possible values include `Month`, `Week`, `Day`, `Hour`, `Minute` and `Second`.
     */
    public val frequency: Output
        get() = javaResource.frequency().applyValue({ args0 -> args0 })

    /**
     * Specifies interval used for the Frequency, for example a value of `4` for `interval` and `hour` for `frequency` would run the Trigger every 4 hours.
     */
    public val interval: Output
        get() = javaResource.interval().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 Recurrence Triggers 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 Triggers within the Logic App Workflow.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A `schedule` block as specified below.
     */
    public val schedule: Output?
        get() = javaResource.schedule().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies the start date and time for this trigger in RFC3339 format: `2000-01-02T03:04:05Z`.
     */
    public val startTime: Output?
        get() = javaResource.startTime().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies the time zone for this trigger. Supported time zone options are listed [here](https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values)
     */
    public val timeZone: Output
        get() = javaResource.timeZone().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy