azure-sdk-for-js/sdk/devcenter/arm-devcenter/samples-dev/catalogsSyncSample.ts

45 строки
1.3 KiB
TypeScript

/*
* 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.
import { DevCenterClient } from "@azure/arm-devcenter";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Syncs templates for a template source.
*
* @summary Syncs templates for a template source.
* x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_Sync.json
*/
async function catalogsSync() {
const subscriptionId =
process.env["DEVCENTER_SUBSCRIPTION_ID"] ||
"0ac520ee-14c0-480f-b6c9-0a90c58ffff";
const resourceGroupName = process.env["DEVCENTER_RESOURCE_GROUP"] || "rg1";
const devCenterName = "Contoso";
const catalogName = "CentralCatalog";
const credential = new DefaultAzureCredential();
const client = new DevCenterClient(credential, subscriptionId);
const result = await client.catalogs.beginSyncAndWait(
resourceGroupName,
devCenterName,
catalogName,
);
console.log(result);
}
async function main() {
catalogsSync();
}
main().catch(console.error);