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

com.pulumi.azure.automation.kotlin.WebhookArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.automation.kotlin

import com.pulumi.azure.automation.WebhookArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages an Automation Runbook's Webhook.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.automation.Account("example", {
 *     name: "account1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     skuName: "Basic",
 * });
 * const exampleRunBook = new azure.automation.RunBook("example", {
 *     name: "Get-AzureVMTutorial",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     automationAccountName: exampleAccount.name,
 *     logVerbose: true,
 *     logProgress: true,
 *     description: "This is an example runbook",
 *     runbookType: "PowerShellWorkflow",
 *     publishContentLink: {
 *         uri: "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
 *     },
 * });
 * const exampleWebhook = new azure.automation.Webhook("example", {
 *     name: "TestRunbook_webhook",
 *     resourceGroupName: example.name,
 *     automationAccountName: exampleAccount.name,
 *     expiryTime: "2021-12-31T00:00:00Z",
 *     enabled: true,
 *     runbookName: exampleRunBook.name,
 *     parameters: {
 *         input: "parameter",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_account = azure.automation.Account("example",
 *     name="account1",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku_name="Basic")
 * example_run_book = azure.automation.RunBook("example",
 *     name="Get-AzureVMTutorial",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     automation_account_name=example_account.name,
 *     log_verbose=True,
 *     log_progress=True,
 *     description="This is an example runbook",
 *     runbook_type="PowerShellWorkflow",
 *     publish_content_link={
 *         "uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
 *     })
 * example_webhook = azure.automation.Webhook("example",
 *     name="TestRunbook_webhook",
 *     resource_group_name=example.name,
 *     automation_account_name=example_account.name,
 *     expiry_time="2021-12-31T00:00:00Z",
 *     enabled=True,
 *     runbook_name=example_run_book.name,
 *     parameters={
 *         "input": "parameter",
 *     })
 * ```
 * ```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 = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Automation.Account("example", new()
 *     {
 *         Name = "account1",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         SkuName = "Basic",
 *     });
 *     var exampleRunBook = new Azure.Automation.RunBook("example", new()
 *     {
 *         Name = "Get-AzureVMTutorial",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AutomationAccountName = exampleAccount.Name,
 *         LogVerbose = true,
 *         LogProgress = true,
 *         Description = "This is an example runbook",
 *         RunbookType = "PowerShellWorkflow",
 *         PublishContentLink = new Azure.Automation.Inputs.RunBookPublishContentLinkArgs
 *         {
 *             Uri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
 *         },
 *     });
 *     var exampleWebhook = new Azure.Automation.Webhook("example", new()
 *     {
 *         Name = "TestRunbook_webhook",
 *         ResourceGroupName = example.Name,
 *         AutomationAccountName = exampleAccount.Name,
 *         ExpiryTime = "2021-12-31T00:00:00Z",
 *         Enabled = true,
 *         RunbookName = exampleRunBook.Name,
 *         Parameters =
 *         {
 *             { "input", "parameter" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/automation"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"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("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := automation.NewAccount(ctx, "example", &automation.AccountArgs{
 * 			Name:              pulumi.String("account1"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			SkuName:           pulumi.String("Basic"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleRunBook, err := automation.NewRunBook(ctx, "example", &automation.RunBookArgs{
 * 			Name:                  pulumi.String("Get-AzureVMTutorial"),
 * 			Location:              example.Location,
 * 			ResourceGroupName:     example.Name,
 * 			AutomationAccountName: exampleAccount.Name,
 * 			LogVerbose:            pulumi.Bool(true),
 * 			LogProgress:           pulumi.Bool(true),
 * 			Description:           pulumi.String("This is an example runbook"),
 * 			RunbookType:           pulumi.String("PowerShellWorkflow"),
 * 			PublishContentLink: &automation.RunBookPublishContentLinkArgs{
 * 				Uri: pulumi.String("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = automation.NewWebhook(ctx, "example", &automation.WebhookArgs{
 * 			Name:                  pulumi.String("TestRunbook_webhook"),
 * 			ResourceGroupName:     example.Name,
 * 			AutomationAccountName: exampleAccount.Name,
 * 			ExpiryTime:            pulumi.String("2021-12-31T00:00:00Z"),
 * 			Enabled:               pulumi.Bool(true),
 * 			RunbookName:           exampleRunBook.Name,
 * 			Parameters: pulumi.StringMap{
 * 				"input": pulumi.String("parameter"),
 * 			},
 * 		})
 * 		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.automation.Account;
 * import com.pulumi.azure.automation.AccountArgs;
 * import com.pulumi.azure.automation.RunBook;
 * import com.pulumi.azure.automation.RunBookArgs;
 * import com.pulumi.azure.automation.inputs.RunBookPublishContentLinkArgs;
 * import com.pulumi.azure.automation.Webhook;
 * import com.pulumi.azure.automation.WebhookArgs;
 * 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("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("account1")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .skuName("Basic")
 *             .build());
 *         var exampleRunBook = new RunBook("exampleRunBook", RunBookArgs.builder()
 *             .name("Get-AzureVMTutorial")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .automationAccountName(exampleAccount.name())
 *             .logVerbose("true")
 *             .logProgress("true")
 *             .description("This is an example runbook")
 *             .runbookType("PowerShellWorkflow")
 *             .publishContentLink(RunBookPublishContentLinkArgs.builder()
 *                 .uri("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1")
 *                 .build())
 *             .build());
 *         var exampleWebhook = new Webhook("exampleWebhook", WebhookArgs.builder()
 *             .name("TestRunbook_webhook")
 *             .resourceGroupName(example.name())
 *             .automationAccountName(exampleAccount.name())
 *             .expiryTime("2021-12-31T00:00:00Z")
 *             .enabled(true)
 *             .runbookName(exampleRunBook.name())
 *             .parameters(Map.of("input", "parameter"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:automation:Account
 *     name: example
 *     properties:
 *       name: account1
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       skuName: Basic
 *   exampleRunBook:
 *     type: azure:automation:RunBook
 *     name: example
 *     properties:
 *       name: Get-AzureVMTutorial
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       automationAccountName: ${exampleAccount.name}
 *       logVerbose: 'true'
 *       logProgress: 'true'
 *       description: This is an example runbook
 *       runbookType: PowerShellWorkflow
 *       publishContentLink:
 *         uri: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1
 *   exampleWebhook:
 *     type: azure:automation:Webhook
 *     name: example
 *     properties:
 *       name: TestRunbook_webhook
 *       resourceGroupName: ${example.name}
 *       automationAccountName: ${exampleAccount.name}
 *       expiryTime: 2021-12-31T00:00:00Z
 *       enabled: true
 *       runbookName: ${exampleRunBook.name}
 *       parameters:
 *         input: parameter
 * ```
 * 
 * ## Import
 * Automation Webhooks can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:automation/webhook:Webhook TestRunbook_webhook /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/webHooks/TestRunbook_webhook
 * ```
 * @property automationAccountName The name of the automation account in which the Webhook is created. Changing this forces a new resource to be created.
 * @property enabled Controls if Webhook is enabled. Defaults to `true`.
 * @property expiryTime Timestamp when the webhook expires. Changing this forces a new resource to be created.
 * @property name Specifies the name of the Webhook. Changing this forces a new resource to be created.
 * @property parameters Map of input parameters passed to runbook.
 * @property resourceGroupName The name of the resource group in which the Webhook is created. Changing this forces a new resource to be created.
 * @property runOnWorkerGroup Name of the hybrid worker group the Webhook job will run on.
 * @property runbookName Name of the Automation Runbook to execute by Webhook.
 * @property uri URI to initiate the webhook. Can be generated using [Generate URI API](https://docs.microsoft.com/rest/api/automation/webhook/generate-uri). By default, new URI is generated on each new resource creation. Changing this forces a new resource to be created.
 */
public data class WebhookArgs(
    public val automationAccountName: Output? = null,
    public val enabled: Output? = null,
    public val expiryTime: Output? = null,
    public val name: Output? = null,
    public val parameters: Output>? = null,
    public val resourceGroupName: Output? = null,
    public val runOnWorkerGroup: Output? = null,
    public val runbookName: Output? = null,
    public val uri: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.automation.WebhookArgs =
        com.pulumi.azure.automation.WebhookArgs.builder()
            .automationAccountName(automationAccountName?.applyValue({ args0 -> args0 }))
            .enabled(enabled?.applyValue({ args0 -> args0 }))
            .expiryTime(expiryTime?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .parameters(
                parameters?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .runOnWorkerGroup(runOnWorkerGroup?.applyValue({ args0 -> args0 }))
            .runbookName(runbookName?.applyValue({ args0 -> args0 }))
            .uri(uri?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [WebhookArgs].
 */
@PulumiTagMarker
public class WebhookArgsBuilder internal constructor() {
    private var automationAccountName: Output? = null

    private var enabled: Output? = null

    private var expiryTime: Output? = null

    private var name: Output? = null

    private var parameters: Output>? = null

    private var resourceGroupName: Output? = null

    private var runOnWorkerGroup: Output? = null

    private var runbookName: Output? = null

    private var uri: Output? = null

    /**
     * @param value The name of the automation account in which the Webhook is created. Changing this forces a new resource to be created.
     */
    @JvmName("dwjytlhvimchjtyl")
    public suspend fun automationAccountName(`value`: Output) {
        this.automationAccountName = value
    }

    /**
     * @param value Controls if Webhook is enabled. Defaults to `true`.
     */
    @JvmName("fdaffbbsoldcojjo")
    public suspend fun enabled(`value`: Output) {
        this.enabled = value
    }

    /**
     * @param value Timestamp when the webhook expires. Changing this forces a new resource to be created.
     */
    @JvmName("mqcxphxymdgepjqh")
    public suspend fun expiryTime(`value`: Output) {
        this.expiryTime = value
    }

    /**
     * @param value Specifies the name of the Webhook. Changing this forces a new resource to be created.
     */
    @JvmName("joruanjnhtluagdq")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Map of input parameters passed to runbook.
     */
    @JvmName("tknsrxpyeuhbvpof")
    public suspend fun parameters(`value`: Output>) {
        this.parameters = value
    }

    /**
     * @param value The name of the resource group in which the Webhook is created. Changing this forces a new resource to be created.
     */
    @JvmName("kxuwpuguwoyryvaw")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Name of the hybrid worker group the Webhook job will run on.
     */
    @JvmName("gcliykjvbxaouprc")
    public suspend fun runOnWorkerGroup(`value`: Output) {
        this.runOnWorkerGroup = value
    }

    /**
     * @param value Name of the Automation Runbook to execute by Webhook.
     */
    @JvmName("ckpatjbskadoqdfd")
    public suspend fun runbookName(`value`: Output) {
        this.runbookName = value
    }

    /**
     * @param value URI to initiate the webhook. Can be generated using [Generate URI API](https://docs.microsoft.com/rest/api/automation/webhook/generate-uri). By default, new URI is generated on each new resource creation. Changing this forces a new resource to be created.
     */
    @JvmName("augwytvoyfjgahgr")
    public suspend fun uri(`value`: Output) {
        this.uri = value
    }

    /**
     * @param value The name of the automation account in which the Webhook is created. Changing this forces a new resource to be created.
     */
    @JvmName("weipamtajwbqhxpb")
    public suspend fun automationAccountName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.automationAccountName = mapped
    }

    /**
     * @param value Controls if Webhook is enabled. Defaults to `true`.
     */
    @JvmName("jlmdkuaxabqeaivr")
    public suspend fun enabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.enabled = mapped
    }

    /**
     * @param value Timestamp when the webhook expires. Changing this forces a new resource to be created.
     */
    @JvmName("onmgnipurmkloeqy")
    public suspend fun expiryTime(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.expiryTime = mapped
    }

    /**
     * @param value Specifies the name of the Webhook. Changing this forces a new resource to be created.
     */
    @JvmName("fifkvemclysmedec")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Map of input parameters passed to runbook.
     */
    @JvmName("bmulusiebvkebwit")
    public suspend fun parameters(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.parameters = mapped
    }

    /**
     * @param values Map of input parameters passed to runbook.
     */
    @JvmName("uthsxawjmiqcemjn")
    public fun parameters(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.parameters = mapped
    }

    /**
     * @param value The name of the resource group in which the Webhook is created. Changing this forces a new resource to be created.
     */
    @JvmName("lctffnxldymieulq")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Name of the hybrid worker group the Webhook job will run on.
     */
    @JvmName("hlpjstnpvrgadqhx")
    public suspend fun runOnWorkerGroup(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.runOnWorkerGroup = mapped
    }

    /**
     * @param value Name of the Automation Runbook to execute by Webhook.
     */
    @JvmName("aqpfdpgjqqnbiolj")
    public suspend fun runbookName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.runbookName = mapped
    }

    /**
     * @param value URI to initiate the webhook. Can be generated using [Generate URI API](https://docs.microsoft.com/rest/api/automation/webhook/generate-uri). By default, new URI is generated on each new resource creation. Changing this forces a new resource to be created.
     */
    @JvmName("fwrmgshbsddlejlm")
    public suspend fun uri(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.uri = mapped
    }

    internal fun build(): WebhookArgs = WebhookArgs(
        automationAccountName = automationAccountName,
        enabled = enabled,
        expiryTime = expiryTime,
        name = name,
        parameters = parameters,
        resourceGroupName = resourceGroupName,
        runOnWorkerGroup = runOnWorkerGroup,
        runbookName = runbookName,
        uri = uri,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy