mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
61 lines
2.1 KiB
JavaScript
61 lines
2.1 KiB
JavaScript
/*
|
|
* Copyright (c) Microsoft Corporation.
|
|
* Licensed under the MIT License.
|
|
*
|
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
*/
|
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
const { LoadTestClient } = require("@azure/arm-loadtesting");
|
|
const { DefaultAzureCredential } = require("@azure/identity");
|
|
require("dotenv").config();
|
|
|
|
/**
|
|
* This sample demonstrates how to Create or update LoadTest resource.
|
|
*
|
|
* @summary Create or update LoadTest resource.
|
|
* x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_CreateOrUpdate.json
|
|
*/
|
|
async function loadTestsCreateOrUpdate() {
|
|
const subscriptionId =
|
|
process.env["LOADTESTSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
|
|
const resourceGroupName = process.env["LOADTESTSERVICE_RESOURCE_GROUP"] || "dummyrg";
|
|
const loadTestName = "myLoadTest";
|
|
const loadTestResource = {
|
|
description: "This is new load test resource",
|
|
encryption: {
|
|
identity: {
|
|
type: "UserAssigned",
|
|
resourceId:
|
|
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1",
|
|
},
|
|
keyUrl: "https://dummy.vault.azure.net/keys/dummykey1",
|
|
},
|
|
identity: {
|
|
type: "SystemAssigned,UserAssigned",
|
|
userAssignedIdentities: {
|
|
"/subscriptions/00000000000000000000000000000000/resourceGroups/dummyrg/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1":
|
|
{},
|
|
},
|
|
},
|
|
location: "westus",
|
|
tags: { team: "Dev Exp" },
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new LoadTestClient(credential, subscriptionId);
|
|
const result = await client.loadTests.beginCreateOrUpdateAndWait(
|
|
resourceGroupName,
|
|
loadTestName,
|
|
loadTestResource
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main() {
|
|
loadTestsCreateOrUpdate();
|
|
}
|
|
|
|
main().catch(console.error);
|