mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
41 lines
1.5 KiB
JavaScript
41 lines
1.5 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 a PostgreSQL Server key.
|
|
*
|
|
* @summary Creates or updates a PostgreSQL Server key.
|
|
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json
|
|
*/
|
|
async function createsOrUpdatesAPostgreSqlServerKey() {
|
|
const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
|
|
const serverName = "testserver";
|
|
const keyName = "someVault_someKey_01234567890123456789012345678901";
|
|
const resourceGroupName = "testrg";
|
|
const parameters = {
|
|
serverKeyType: "AzureKeyVault",
|
|
uri: "https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901",
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new PostgreSQLManagementClient(credential, subscriptionId);
|
|
const result = await client.serverKeys.beginCreateOrUpdateAndWait(
|
|
serverName,
|
|
keyName,
|
|
resourceGroupName,
|
|
parameters
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
createsOrUpdatesAPostgreSqlServerKey().catch(console.error);
|