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

com.pulumi.azurenative.devtestlab.kotlin.GlobalSchedule.kt Maven / Gradle / Ivy

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

package com.pulumi.azurenative.devtestlab.kotlin

import com.pulumi.azurenative.devtestlab.kotlin.outputs.DayDetailsResponse
import com.pulumi.azurenative.devtestlab.kotlin.outputs.HourDetailsResponse
import com.pulumi.azurenative.devtestlab.kotlin.outputs.NotificationSettingsResponse
import com.pulumi.azurenative.devtestlab.kotlin.outputs.WeekDetailsResponse
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
import com.pulumi.azurenative.devtestlab.kotlin.outputs.DayDetailsResponse.Companion.toKotlin as dayDetailsResponseToKotlin
import com.pulumi.azurenative.devtestlab.kotlin.outputs.HourDetailsResponse.Companion.toKotlin as hourDetailsResponseToKotlin
import com.pulumi.azurenative.devtestlab.kotlin.outputs.NotificationSettingsResponse.Companion.toKotlin as notificationSettingsResponseToKotlin
import com.pulumi.azurenative.devtestlab.kotlin.outputs.WeekDetailsResponse.Companion.toKotlin as weekDetailsResponseToKotlin

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

    public var args: GlobalScheduleArgs = GlobalScheduleArgs()

    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 GlobalScheduleArgsBuilder.() -> Unit) {
        val builder = GlobalScheduleArgsBuilder()
        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(): GlobalSchedule {
        val builtJavaResource =
            com.pulumi.azurenative.devtestlab.GlobalSchedule(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return GlobalSchedule(builtJavaResource)
    }
}

/**
 * A schedule.
 * Azure REST API version: 2018-09-15. Prior API version in Azure Native 1.x: 2018-09-15.
 * Other available API versions: 2016-05-15.
 * ## Example Usage
 * ### GlobalSchedules_CreateOrUpdate
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var globalSchedule = new AzureNative.DevTestLab.GlobalSchedule("globalSchedule", new()
 *     {
 *         Name = "labvmautostart",
 *         ResourceGroupName = "resourceGroupName",
 *         Status = AzureNative.DevTestLab.EnableStatus.Enabled,
 *         TaskType = "LabVmsStartupTask",
 *         TimeZoneId = "Hawaiian Standard Time",
 *         WeeklyRecurrence = new AzureNative.DevTestLab.Inputs.WeekDetailsArgs
 *         {
 *             Time = "0700",
 *             Weekdays = new[]
 *             {
 *                 "Monday",
 *                 "Tuesday",
 *                 "Wednesday",
 *                 "Thursday",
 *                 "Friday",
 *                 "Saturday",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	devtestlab "github.com/pulumi/pulumi-azure-native-sdk/devtestlab/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := devtestlab.NewGlobalSchedule(ctx, "globalSchedule", &devtestlab.GlobalScheduleArgs{
 * 			Name:              pulumi.String("labvmautostart"),
 * 			ResourceGroupName: pulumi.String("resourceGroupName"),
 * 			Status:            pulumi.String(devtestlab.EnableStatusEnabled),
 * 			TaskType:          pulumi.String("LabVmsStartupTask"),
 * 			TimeZoneId:        pulumi.String("Hawaiian Standard Time"),
 * 			WeeklyRecurrence: &devtestlab.WeekDetailsArgs{
 * 				Time: pulumi.String("0700"),
 * 				Weekdays: pulumi.StringArray{
 * 					pulumi.String("Monday"),
 * 					pulumi.String("Tuesday"),
 * 					pulumi.String("Wednesday"),
 * 					pulumi.String("Thursday"),
 * 					pulumi.String("Friday"),
 * 					pulumi.String("Saturday"),
 * 				},
 * 			},
 * 		})
 * 		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.azurenative.devtestlab.GlobalSchedule;
 * import com.pulumi.azurenative.devtestlab.GlobalScheduleArgs;
 * import com.pulumi.azurenative.devtestlab.inputs.WeekDetailsArgs;
 * 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 globalSchedule = new GlobalSchedule("globalSchedule", GlobalScheduleArgs.builder()
 *             .name("labvmautostart")
 *             .resourceGroupName("resourceGroupName")
 *             .status("Enabled")
 *             .taskType("LabVmsStartupTask")
 *             .timeZoneId("Hawaiian Standard Time")
 *             .weeklyRecurrence(WeekDetailsArgs.builder()
 *                 .time("0700")
 *                 .weekdays(
 *                     "Monday",
 *                     "Tuesday",
 *                     "Wednesday",
 *                     "Thursday",
 *                     "Friday",
 *                     "Saturday")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:devtestlab:GlobalSchedule LabVmAutoStart /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}
 * ```
 */
public class GlobalSchedule internal constructor(
    override val javaResource: com.pulumi.azurenative.devtestlab.GlobalSchedule,
) : KotlinCustomResource(javaResource, GlobalScheduleMapper) {
    /**
     * The creation date of the schedule.
     */
    public val createdDate: Output
        get() = javaResource.createdDate().applyValue({ args0 -> args0 })

    /**
     * If the schedule will occur once each day of the week, specify the daily recurrence.
     */
    public val dailyRecurrence: Output?
        get() = javaResource.dailyRecurrence().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> dayDetailsResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * If the schedule will occur multiple times a day, specify the hourly recurrence.
     */
    public val hourlyRecurrence: Output?
        get() = javaResource.hourlyRecurrence().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> hourDetailsResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The location of the resource.
     */
    public val location: Output?
        get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the resource.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Notification settings.
     */
    public val notificationSettings: Output?
        get() = javaResource.notificationSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> notificationSettingsResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The provisioning status of the resource.
     */
    public val provisioningState: Output
        get() = javaResource.provisioningState().applyValue({ args0 -> args0 })

    /**
     * The status of the schedule (i.e. Enabled, Disabled)
     */
    public val status: Output?
        get() = javaResource.status().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The tags of the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The resource ID to which the schedule belongs
     */
    public val targetResourceId: Output?
        get() = javaResource.targetResourceId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart).
     */
    public val taskType: Output?
        get() = javaResource.taskType().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in `IReadOnlyCollection TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds` (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md)
     */
    public val timeZoneId: Output?
        get() = javaResource.timeZoneId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The type of the resource.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * The unique immutable identifier of a resource (Guid).
     */
    public val uniqueIdentifier: Output
        get() = javaResource.uniqueIdentifier().applyValue({ args0 -> args0 })

    /**
     * If the schedule will occur only some days of the week, specify the weekly recurrence.
     */
    public val weeklyRecurrence: Output?
        get() = javaResource.weeklyRecurrence().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> weekDetailsResponseToKotlin(args0) })
            }).orElse(null)
        })
}

public object GlobalScheduleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.devtestlab.GlobalSchedule::class == javaResource::class

    override fun map(javaResource: Resource): GlobalSchedule = GlobalSchedule(
        javaResource as
            com.pulumi.azurenative.devtestlab.GlobalSchedule,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy