mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Create or replace an existing schedule.
|
|
*
|
|
* @summary Create or replace an existing schedule.
|
|
* x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_CreateOrUpdate.json
|
|
*/
|
|
|
|
import type { Schedule } from "@azure/arm-devtestlabs";
|
|
import { DevTestLabsClient } from "@azure/arm-devtestlabs";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
async function globalSchedulesCreateOrUpdate(): Promise<void> {
|
|
const subscriptionId = "{subscriptionId}";
|
|
const resourceGroupName = "resourceGroupName";
|
|
const name = "labvmautostart";
|
|
const schedule: Schedule = {
|
|
status: "Enabled",
|
|
taskType: "LabVmsStartupTask",
|
|
timeZoneId: "Hawaiian Standard Time",
|
|
weeklyRecurrence: {
|
|
time: "0700",
|
|
weekdays: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
},
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new DevTestLabsClient(credential, subscriptionId);
|
|
const result = await client.globalSchedules.createOrUpdate(resourceGroupName, name, schedule);
|
|
console.log(result);
|
|
}
|
|
|
|
globalSchedulesCreateOrUpdate().catch(console.error);
|