Files

30 lines
997 B
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to lists all read replicas of a server.
*
* @summary lists all read replicas of a server.
* x-ms-original-file: 2026-04-01-preview/ReplicasListByServer.json
*/
async function listAllReadReplicasOfAServer(): Promise<void> {
const credential = new DefaultAzureCredential();
const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.replicas.listByServer("exampleresourcegroup", "exampleserver")) {
resArray.push(item);
}
console.log(resArray);
}
async function main(): Promise<void> {
await listAllReadReplicasOfAServer();
}
main().catch(console.error);