mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Configurations: 'specification/networkfunction/resource-manager/Microsoft.NetworkFunction/TrafficCollector/tspconfig.yaml', API Version: 2022-11-01, SDK Release Type: beta, and CommitSHA: '3e0c16b4e69111860b9cb246f0eb64bd67ae6db1' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6485336 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --------- Co-authored-by: Jiao Di (MSFT) <[email protected]>
29 lines
940 B
TypeScript
29 lines
940 B
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
import { AzureTrafficCollectorClient } from "@azure/arm-networkfunction";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
/**
|
|
* This sample demonstrates how to creates or updates a Azure Traffic Collector resource
|
|
*
|
|
* @summary creates or updates a Azure Traffic Collector resource
|
|
* x-ms-original-file: 2022-11-01/AzureTrafficCollectorCreate.json
|
|
*/
|
|
async function createATrafficCollector(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "subid";
|
|
const client = new AzureTrafficCollectorClient(credential, subscriptionId);
|
|
const result = await client.azureTrafficCollectors.createOrUpdate("rg1", "atc", {
|
|
location: "West US",
|
|
tags: { key1: "value1" },
|
|
});
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await createATrafficCollector();
|
|
}
|
|
|
|
main().catch(console.error);
|