Files
azure-sdk-for-js/sdk/postgresql/arm-postgresql/samples/v6/javascript/privateEndpointConnectionsCreateOrUpdateSample.js
2022-04-29 13:40:32 +08:00

43 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 Approve or reject a private endpoint connection with a given name.
*
* @summary Approve or reject a private endpoint connection with a given name.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json
*/
async function approveOrRejectAPrivateEndpointConnectionWithAGivenName() {
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const resourceGroupName = "Default";
const serverName = "test-svr";
const privateEndpointConnectionName = "private-endpoint-connection-name";
const parameters = {
privateLinkServiceConnectionState: {
description: "Approved by [email protected]",
status: "Approved",
},
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementClient(credential, subscriptionId);
const result = await client.privateEndpointConnections.beginCreateOrUpdateAndWait(
resourceGroupName,
serverName,
privateEndpointConnectionName,
parameters
);
console.log(result);
}
approveOrRejectAPrivateEndpointConnectionWithAGivenName().catch(console.error);