Virtual Machine Schedule
A schedule. Uses Azure REST API version 2018-09-15. In version 2.x of the Azure Native provider, it used API version 2018-09-15.
Example Usage
VirtualMachineSchedules_CreateOrUpdate
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var virtualMachineSchedule = new AzureNative.DevTestLab.VirtualMachineSchedule("virtualMachineSchedule", new()
{
DailyRecurrence = new AzureNative.DevTestLab.Inputs.DayDetailsArgs
{
Time = "1900",
},
HourlyRecurrence = new AzureNative.DevTestLab.Inputs.HourDetailsArgs
{
Minute = 30,
},
LabName = "{labName}",
Location = "{location}",
Name = "LabVmsShutdown",
NotificationSettings = new AzureNative.DevTestLab.Inputs.NotificationSettingsArgs
{
EmailRecipient = "{email}",
NotificationLocale = "EN",
Status = AzureNative.DevTestLab.EnableStatus.Enabled,
TimeInMinutes = 30,
WebhookUrl = "{webhookUrl}",
},
ResourceGroupName = "resourceGroupName",
Status = AzureNative.DevTestLab.EnableStatus.Enabled,
Tags =
{
{ "tagName1", "tagValue1" },
},
TargetResourceId = "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualMachines/{vmName}",
TaskType = "LabVmsShutdownTask",
TimeZoneId = "Pacific Standard Time",
VirtualMachineName = "{vmName}",
WeeklyRecurrence = new AzureNative.DevTestLab.Inputs.WeekDetailsArgs
{
Time = "1700",
Weekdays = new[]
{
"Friday",
"Saturday",
"Sunday",
},
},
});
});
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.NewVirtualMachineSchedule(ctx, "virtualMachineSchedule", &devtestlab.VirtualMachineScheduleArgs{
DailyRecurrence: &devtestlab.DayDetailsArgs{
Time: pulumi.String("1900"),
},
HourlyRecurrence: &devtestlab.HourDetailsArgs{
Minute: pulumi.Int(30),
},
LabName: pulumi.String("{labName}"),
Location: pulumi.String("{location}"),
Name: pulumi.String("LabVmsShutdown"),
NotificationSettings: &devtestlab.NotificationSettingsArgs{
EmailRecipient: pulumi.String("{email}"),
NotificationLocale: pulumi.String("EN"),
Status: pulumi.String(devtestlab.EnableStatusEnabled),
TimeInMinutes: pulumi.Int(30),
WebhookUrl: pulumi.String("{webhookUrl}"),
},
ResourceGroupName: pulumi.String("resourceGroupName"),
Status: pulumi.String(devtestlab.EnableStatusEnabled),
Tags: pulumi.StringMap{
"tagName1": pulumi.String("tagValue1"),
},
TargetResourceId: pulumi.String("/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualMachines/{vmName}"),
TaskType: pulumi.String("LabVmsShutdownTask"),
TimeZoneId: pulumi.String("Pacific Standard Time"),
VirtualMachineName: pulumi.String("{vmName}"),
WeeklyRecurrence: &devtestlab.WeekDetailsArgs{
Time: pulumi.String("1700"),
Weekdays: pulumi.StringArray{
pulumi.String("Friday"),
pulumi.String("Saturday"),
pulumi.String("Sunday"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.devtestlab.VirtualMachineSchedule;
import com.pulumi.azurenative.devtestlab.VirtualMachineScheduleArgs;
import com.pulumi.azurenative.devtestlab.inputs.DayDetailsArgs;
import com.pulumi.azurenative.devtestlab.inputs.HourDetailsArgs;
import com.pulumi.azurenative.devtestlab.inputs.NotificationSettingsArgs;
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 virtualMachineSchedule = new VirtualMachineSchedule("virtualMachineSchedule", VirtualMachineScheduleArgs.builder()
.dailyRecurrence(DayDetailsArgs.builder()
.time("1900")
.build())
.hourlyRecurrence(HourDetailsArgs.builder()
.minute(30)
.build())
.labName("{labName}")
.location("{location}")
.name("LabVmsShutdown")
.notificationSettings(NotificationSettingsArgs.builder()
.emailRecipient("{email}")
.notificationLocale("EN")
.status("Enabled")
.timeInMinutes(30)
.webhookUrl("{webhookUrl}")
.build())
.resourceGroupName("resourceGroupName")
.status("Enabled")
.tags(Map.of("tagName1", "tagValue1"))
.targetResourceId("/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualMachines/{vmName}")
.taskType("LabVmsShutdownTask")
.timeZoneId("Pacific Standard Time")
.virtualMachineName("{vmName}")
.weeklyRecurrence(WeekDetailsArgs.builder()
.time("1700")
.weekdays(
"Friday",
"Saturday",
"Sunday")
.build())
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:devtestlab:VirtualMachineSchedule LabVmsShutdown /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}
Properties
The Azure API version of the resource.
The creation date of the schedule.
If the schedule will occur once each day of the week, specify the daily recurrence.
If the schedule will occur multiple times a day, specify the hourly recurrence.
Notification settings.
The provisioning status of the resource.
The resource ID to which the schedule belongs
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<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds
(https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md)
The unique immutable identifier of a resource (Guid).
If the schedule will occur only some days of the week, specify the weekly recurrence.