This pull request updates the Node.js version requirement across multiple files and tools in the repository. The changes ensure compatibility with Node.js version 22 and its corresponding type definitions. Resolves #37945. ***NO_CI***
client library samples for JavaScript
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
| File Name | Description |
|---|---|
| checkNameAvailabilityExecuteSample.js | Check the availability of name for resource x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/CheckNameAvailability.json |
| configurationsCreateOrUpdateSample.js | Updates a configuration of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json |
| configurationsGetSample.js | Gets information about a configuration of server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json |
| configurationsListByServerSample.js | List all the configurations in a given server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationListByServer.json |
| databasesCreateOrUpdateSample.js | Creates a new database or updates an existing database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate.json |
| databasesDeleteSample.js | Deletes a database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete.json |
| databasesGetSample.js | Gets information about a database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json |
| databasesListByServerSample.js | List all the databases in a given server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseListByServer.json |
| firewallRulesCreateOrUpdateSample.js | Creates a new firewall rule or updates an existing firewall rule. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate.json |
| firewallRulesDeleteSample.js | Deletes a server firewall rule. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete.json |
| firewallRulesGetSample.js | Gets information about a server firewall rule. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json |
| firewallRulesListByServerSample.js | List all the firewall rules in a given server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleListByServer.json |
| locationBasedPerformanceTierListSample.js | List all the performance tiers at specified location in a given subscription. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json |
| logFilesListByServerSample.js | List all the log files in a given server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/LogFileListByServer.json |
| operationsListSample.js | Lists all of the available REST API operations. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/OperationList.json |
| privateEndpointConnectionsCreateOrUpdateSample.js | 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 |
| privateEndpointConnectionsDeleteSample.js | Deletes a private endpoint connection with a given name. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json |
| privateEndpointConnectionsGetSample.js | Gets a private endpoint connection. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json |
| privateEndpointConnectionsListByServerSample.js | Gets all private endpoint connections on a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json |
| privateEndpointConnectionsUpdateTagsSample.js | Updates private endpoint connection with the specified tags. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json |
| privateLinkResourcesGetSample.js | Gets a private link resource for PostgreSQL server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json |
| privateLinkResourcesListByServerSample.js | Gets the private link resources for PostgreSQL server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json |
| recoverableServersGetSample.js | Gets a recoverable PostgreSQL Server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/RecoverableServersGet.json |
| replicasListByServerSample.js | List all the replicas for a given server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ReplicasListByServer.json |
| serverAdministratorsCreateOrUpdateSample.js | Creates or update active directory administrator on an existing server. The update action will overwrite the existing administrator. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json |
| serverAdministratorsDeleteSample.js | Deletes server active directory administrator. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete.json |
| serverAdministratorsGetSample.js | Gets information about a AAD server administrator. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet.json |
| serverAdministratorsListSample.js | Returns a list of server Administrators. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminList.json |
| serverBasedPerformanceTierListSample.js | List all the performance tiers for a PostgreSQL server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json |
| serverKeysCreateOrUpdateSample.js | Creates or updates a PostgreSQL Server key. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json |
| serverKeysDeleteSample.js | Deletes the PostgreSQL Server key with the given name. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete.json |
| serverKeysGetSample.js | Gets a PostgreSQL Server key. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json |
| serverKeysListSample.js | Gets a list of Server keys. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json |
| serverParametersListUpdateConfigurationsSample.js | Update a list of configurations in a given server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json |
| serverSecurityAlertPoliciesCreateOrUpdateSample.js | Creates or updates a threat detection policy. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json |
| serverSecurityAlertPoliciesGetSample.js | Get a server's security alert policy. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json |
| serverSecurityAlertPoliciesListByServerSample.js | Get the server's threat detection policies. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json |
| serversCreateSample.js | Creates a new server, or will overwrite an existing server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json |
| serversDeleteSample.js | Deletes a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json |
| serversGetSample.js | Gets information about a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json |
| serversListByResourceGroupSample.js | List all the servers in a given resource group. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerListByResourceGroup.json |
| serversListSample.js | List all the servers in a given subscription. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json |
| serversRestartSample.js | Restarts a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json |
| serversUpdateSample.js | Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json |
| virtualNetworkRulesCreateOrUpdateSample.js | 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 |
| virtualNetworkRulesDeleteSample.js | Deletes the virtual network rule with the given name. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json |
| virtualNetworkRulesGetSample.js | Gets a virtual network rule. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json |
| virtualNetworkRulesListByServerSample.js | Gets a list of virtual network rules in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json |
Prerequisites
The sample programs are compatible with LTS versions of Node.js.
You need an Azure subscription to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the package README.
Setup
To run the samples using the published version of the package:
- Install the dependencies using
npm:
npm install
-
Edit the file
sample.env, adding the correct credentials to access the Azure service and run the samples. Then rename the file fromsample.envto just.env. The sample programs will read this file automatically. -
Run whichever samples you like (note that some samples may require additional setup, see the table above):
node checkNameAvailabilityExecuteSample.js
Alternatively, run a single sample with the correct environment variables set (setting up the .env file is not required if you do this), for example (cross-platform):
cross-env node checkNameAvailabilityExecuteSample.js
Next Steps
Take a look at our API Documentation for more information about the APIs that are available in the clients.