mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
42 lines
1.6 KiB
JavaScript
42 lines
1.6 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 { PostgreSQLManagementClient } = require("@azure/arm-postgresql");
|
|
const { DefaultAzureCredential } = require("@azure/identity");
|
|
|
|
/**
|
|
* This sample demonstrates how to Creates or updates an existing virtual network rule.
|
|
*
|
|
* @summary Creates or updates an existing virtual network rule.
|
|
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json
|
|
*/
|
|
async function createOrUpdateAVirtualNetworkRule() {
|
|
const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
|
|
const resourceGroupName = "TestGroup";
|
|
const serverName = "vnet-test-svr";
|
|
const virtualNetworkRuleName = "vnet-firewall-rule";
|
|
const parameters = {
|
|
ignoreMissingVnetServiceEndpoint: false,
|
|
virtualNetworkSubnetId:
|
|
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet",
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new PostgreSQLManagementClient(credential, subscriptionId);
|
|
const result = await client.virtualNetworkRules.beginCreateOrUpdateAndWait(
|
|
resourceGroupName,
|
|
serverName,
|
|
virtualNetworkRuleName,
|
|
parameters
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
createOrUpdateAVirtualNetworkRule().catch(console.error);
|