mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Configurations: 'specification/networkcloud/NetworkCloud.Management/tspconfig.yaml', API Version: 2026-05-01-preview, SDK Release Type: beta, and CommitSHA: '13d51ee484703ea6845668fbf4b9de13f41bf5c2' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6259530 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. **Release plan link:** https://azsdk-releaseplan-dashboard-hveph5aqhhcfhtgu.westus-01.azurewebsites.net/?releasePlan=2218 **Submitted by**: [email protected] ## Release Plan Details - Release Plan: https://azsdk-releaseplan-dashboard-hveph5aqhhcfhtgu.westus-01.azurewebsites.net/?releasePlan=2218 Spec pull request: https://github.com/Azure/azure-rest-api-specs/pull/42234 Spec API version: --------- Co-authored-by: kazrael2119 <[email protected]> Co-authored-by: nafizhaider32 <[email protected]>
75 lines
3.3 KiB
TypeScript
75 lines
3.3 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
import { NetworkCloud } from "@azure/arm-networkcloud";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
/**
|
|
* This sample demonstrates how to create a new cluster manager or update properties of the cluster manager if it exists.
|
|
*
|
|
* @summary create a new cluster manager or update properties of the cluster manager if it exists.
|
|
* x-ms-original-file: 2026-05-01-preview/ClusterManagers_Create.json
|
|
*/
|
|
async function createOrUpdateClusterManager(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "123e4567-e89b-12d3-a456-426655440000";
|
|
const client = new NetworkCloud(credential, subscriptionId);
|
|
const result = await client.clusterManagers.createOrUpdate(
|
|
"resourceGroupName",
|
|
"clusterManagerName",
|
|
{
|
|
identity: { type: "SystemAssigned" },
|
|
kind: "AzureLocal",
|
|
location: "location",
|
|
analyticsWorkspaceId:
|
|
"/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.OperationalInsights/workspaces/logAnalyticsWorkspaceName",
|
|
fabricControllerId:
|
|
"/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/fabricControllerName",
|
|
managedResourceGroupConfiguration: { location: "East US", name: "my-managed-rg" },
|
|
tags: { key1: "myvalue1", key2: "myvalue2" },
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to create a new cluster manager or update properties of the cluster manager if it exists.
|
|
*
|
|
* @summary create a new cluster manager or update properties of the cluster manager if it exists.
|
|
* x-ms-original-file: 2026-05-01-preview/ClusterManagers_Create_Uami.json
|
|
*/
|
|
async function createOrUpdateClusterManagerWithUserAssignedIdentity(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "123e4567-e89b-12d3-a456-426655440000";
|
|
const client = new NetworkCloud(credential, subscriptionId);
|
|
const result = await client.clusterManagers.createOrUpdate(
|
|
"resourceGroupName",
|
|
"clusterManagerName",
|
|
{
|
|
identity: {
|
|
type: "UserAssigned",
|
|
userAssignedIdentities: {
|
|
"/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/userIdentity1":
|
|
{},
|
|
},
|
|
},
|
|
kind: "AzureLocal",
|
|
location: "location",
|
|
analyticsWorkspaceId:
|
|
"/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.OperationalInsights/workspaces/logAnalyticsWorkspaceName",
|
|
fabricControllerId:
|
|
"/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/fabricControllerName",
|
|
managedResourceGroupConfiguration: { location: "East US", name: "my-managed-rg" },
|
|
tags: { key1: "myvalue1", key2: "myvalue2" },
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await createOrUpdateClusterManager();
|
|
await createOrUpdateClusterManagerWithUserAssignedIdentity();
|
|
}
|
|
|
|
main().catch(console.error);
|