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

com.pulumi.azure.automation.kotlin.JobSchedule.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.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.automation.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
import kotlin.collections.Map

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

    public var args: JobScheduleArgs = JobScheduleArgs()

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

/**
 * Links an Automation Runbook and Schedule.
 * ## Example Usage
 * This is an example of just the Job Schedule.
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.automation.JobSchedule("example", {
 *     resourceGroupName: "tf-rgr-automation",
 *     automationAccountName: "tf-automation-account",
 *     scheduleName: "hour",
 *     runbookName: "Get-VirtualMachine",
 *     parameters: {
 *         resourcegroup: "tf-rgr-vm",
 *         vmname: "TF-VM-01",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.automation.JobSchedule("example",
 *     resource_group_name="tf-rgr-automation",
 *     automation_account_name="tf-automation-account",
 *     schedule_name="hour",
 *     runbook_name="Get-VirtualMachine",
 *     parameters={
 *         "resourcegroup": "tf-rgr-vm",
 *         "vmname": "TF-VM-01",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Automation.JobSchedule("example", new()
 *     {
 *         ResourceGroupName = "tf-rgr-automation",
 *         AutomationAccountName = "tf-automation-account",
 *         ScheduleName = "hour",
 *         RunbookName = "Get-VirtualMachine",
 *         Parameters =
 *         {
 *             { "resourcegroup", "tf-rgr-vm" },
 *             { "vmname", "TF-VM-01" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/automation"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := automation.NewJobSchedule(ctx, "example", &automation.JobScheduleArgs{
 * 			ResourceGroupName:     pulumi.String("tf-rgr-automation"),
 * 			AutomationAccountName: pulumi.String("tf-automation-account"),
 * 			ScheduleName:          pulumi.String("hour"),
 * 			RunbookName:           pulumi.String("Get-VirtualMachine"),
 * 			Parameters: pulumi.StringMap{
 * 				"resourcegroup": pulumi.String("tf-rgr-vm"),
 * 				"vmname":        pulumi.String("TF-VM-01"),
 * 			},
 * 		})
 * 		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.automation.JobSchedule;
 * import com.pulumi.azure.automation.JobScheduleArgs;
 * 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 JobSchedule("example", JobScheduleArgs.builder()
 *             .resourceGroupName("tf-rgr-automation")
 *             .automationAccountName("tf-automation-account")
 *             .scheduleName("hour")
 *             .runbookName("Get-VirtualMachine")
 *             .parameters(Map.ofEntries(
 *                 Map.entry("resourcegroup", "tf-rgr-vm"),
 *                 Map.entry("vmname", "TF-VM-01")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:automation:JobSchedule
 *     properties:
 *       resourceGroupName: tf-rgr-automation
 *       automationAccountName: tf-automation-account
 *       scheduleName: hour
 *       runbookName: Get-VirtualMachine
 *       parameters:
 *         resourcegroup: tf-rgr-vm
 *         vmname: TF-VM-01
 * ```
 * 
 * ## Import
 * Automation Job Schedules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:automation/jobSchedule:JobSchedule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/jobSchedules/10000000-1001-1001-1001-000000000001
 * ```
 */
public class JobSchedule internal constructor(
    override val javaResource: com.pulumi.azure.automation.JobSchedule,
) : KotlinCustomResource(javaResource, JobScheduleMapper) {
    /**
     * The name of the Automation Account in which the Job Schedule is created. Changing this forces a new resource to be created.
     */
    public val automationAccountName: Output
        get() = javaResource.automationAccountName().applyValue({ args0 -> args0 })

    /**
     * (Optional) The UUID identifying the Automation Job Schedule.
     */
    public val jobScheduleId: Output
        get() = javaResource.jobScheduleId().applyValue({ args0 -> args0 })

    /**
     * A map of key/value pairs corresponding to the arguments that can be passed to the Runbook. Changing this forces a new resource to be created.
     * > **NOTE:** The parameter keys/names must strictly be in lowercase, even if this is not the case in the runbook. This is due to a limitation in Azure Automation where the parameter names are normalized. The values specified don't have this limitation.
     */
    public val parameters: Output>?
        get() = javaResource.parameters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The name of the resource group in which the Job Schedule is created. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * Name of a Hybrid Worker Group the Runbook will be executed on. Changing this forces a new resource to be created.
     */
    public val runOn: Output?
        get() = javaResource.runOn().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of a Runbook to link to a Schedule. It needs to be in the same Automation Account as the Schedule and Job Schedule. Changing this forces a new resource to be created.
     */
    public val runbookName: Output
        get() = javaResource.runbookName().applyValue({ args0 -> args0 })

    /**
     * The name of the Schedule. Changing this forces a new resource to be created.
     */
    public val scheduleName: Output
        get() = javaResource.scheduleName().applyValue({ args0 -> args0 })
}

public object JobScheduleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.automation.JobSchedule::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy