Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92e46cb

Browse files
authored
postgresql-track2 (Azure#18263)
* postgresql-track2 * update
1 parent 6144868 commit 92e46cb

File tree

77 files changed

+9287
-6380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+9287
-6380
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rush.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,11 @@
980980
"packageName": "@azure/arm-operationalinsights",
981981
"projectFolder": "sdk/operationalinsights/arm-operationalinsights",
982982
"versionPolicyName": "management"
983+
},
984+
{
985+
"packageName": "@azure/arm-postgresql",
986+
"projectFolder": "sdk/postgresql/arm-postgresql",
987+
"versionPolicyName": "management"
983988
}
984989
]
985990
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## 6.0.0-beta.1 (2021-10-19)
2+
3+
This is the first preview for the new version of the `@azure/arm-postgresql` package that follows the new [guidelines for TypeScript SDKs](https://azure.github.io/azure-sdk/typescript_introduction.html) for Azure services.
4+
5+
While this package remains auto generated, the SDK generator itself has undergone changes to comply with the above guidelines in order to generate packages that are idiomatic to the JavaScript/TypeScript ecosystem and consistent with other packages for Azure services. For more on this, please see [State of the Azure SDK 2021](https://devblogs.microsoft.com/azure-sdk/state-of-the-azure-sdk-2021/).
6+
7+
Please note that this version has breaking changes, all of which were made after careful consideration during the authoring of the guidelines and user studies.
8+
9+
**Noteworthy changes and features**
10+
- Authentication: The packages `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` are no longer supported. Use package [@azure/identity](https://www.npmjs.com/package/@azure/identity) instead. Select a credential from Azure Identity examples based on the authentication method of your choice.
11+
- Callbacks: Method overloads that used callbacks have been removed and the use of promises is encouraged instead.
12+
- List operations now return an iterable result that follows the `PagedAsyncIterableIterator` interface as opposed to the previous model where you had to make a new request using the link to the next page.
13+
- Long running operations i.e. the Lro related object returned by methods whose names started with `begin`, now uses `pollUntilDone` to check whether the request is finished, instead of `pollUntilFinished`. To get the final result, use the corresponding method that will have the suffix `AndWait`.
14+
- The SDK only supports ECMAScript 2015 (ES6) and beyond, all projects that referenced this SDK should be upgraded to use ES6.

sdk/postgresql/arm-postgresql/LICENSE.txt renamed to sdk/postgresql/arm-postgresql/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.
Lines changed: 65 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,94 @@
1-
## Azure PostgreSQLManagementClient SDK for JavaScript
1+
# Azure PostgreSQLManagement client library for JavaScript
22

3-
This package contains an isomorphic SDK for PostgreSQLManagementClient.
3+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure PostgreSQLManagement client.
4+
5+
The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model.
6+
7+
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql) |
8+
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-postgresql) |
9+
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-postgresql) |
10+
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
11+
12+
## Getting started
413

514
### Currently supported environments
615

716
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
8-
- Latest versions of Safari, Chrome, Edge, and Firefox.
17+
- Latest versions of Safari, Chrome, Edge and Firefox.
18+
19+
### Prerequisites
20+
21+
- An [Azure subscription][azure_sub].
922

10-
### How to Install
23+
### Install the `@azure/arm-postgresql` package
24+
25+
Install the Azure PostgreSQLManagement client library for JavaScript with `npm`:
1126

1227
```bash
1328
npm install @azure/arm-postgresql
1429
```
1530

16-
### How to use
31+
### Create and authenticate a `PostgreSQLManagementClient`
32+
33+
To create a client object to access the Azure PostgreSQLManagement API, you will need the `endpoint` of your Azure PostgreSQLManagement resource and a `credential`. The Azure PostgreSQLManagement client can use Azure Active Directory credentials to authenticate.
34+
You can find the endpoint for your Azure PostgreSQLManagement resource in the [Azure Portal][azure_portal].
1735

18-
#### nodejs - client creation and get servers as an example written in TypeScript.
36+
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
1937

20-
##### Install @azure/ms-rest-nodeauth
38+
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
2139

22-
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
2340
```bash
24-
npm install @azure/ms-rest-nodeauth@"^3.0.0"
41+
npm install @azure/identity
2542
```
2643

27-
##### Sample code
44+
You will also need to **register a new AAD application and grant access to Azure PostgreSQLManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
45+
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
46+
47+
For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
2848

29-
While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
30-
```typescript
31-
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
49+
```javascript
3250
const { PostgreSQLManagementClient } = require("@azure/arm-postgresql");
33-
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
34-
35-
msRestNodeAuth.interactiveLogin().then((creds) => {
36-
const client = new PostgreSQLManagementClient(creds, subscriptionId);
37-
const resourceGroupName = "testresourceGroupName";
38-
const serverName = "testserverName";
39-
client.servers.get(resourceGroupName, serverName).then((result) => {
40-
console.log("The result is:");
41-
console.log(result);
42-
});
43-
}).catch((err) => {
44-
console.error(err);
45-
});
51+
const { DefaultAzureCredential } = require("@azure/identity");
52+
const subscriptionId = "00000000-0000-0000-0000-000000000000";
53+
const client = new PostgreSQLManagementClient(new DefaultAzureCredential(), subscriptionId);
4654
```
4755

48-
#### browser - Authentication, client creation and get servers as an example written in JavaScript.
56+
## Key concepts
4957

50-
##### Install @azure/ms-rest-browserauth
58+
### PostgreSQLManagementClient
5159

52-
```bash
53-
npm install @azure/ms-rest-browserauth
54-
```
60+
`PostgreSQLManagementClient` is the primary interface for developers using the Azure PostgreSQLManagement client library. Explore the methods on this client object to understand the different features of the Azure PostgreSQLManagement service that you can access.
5561

56-
##### Sample code
57-
58-
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
59-
60-
- index.html
61-
```html
62-
<!DOCTYPE html>
63-
<html lang="en">
64-
<head>
65-
<title>@azure/arm-postgresql sample</title>
66-
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
67-
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
68-
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
69-
<script src="node_modules/@azure/arm-postgresql/dist/arm-postgresql.js"></script>
70-
<script type="text/javascript">
71-
const subscriptionId = "<Subscription_Id>";
72-
const authManager = new msAuth.AuthManager({
73-
clientId: "<client id for your Azure AD app>",
74-
tenant: "<optional tenant for your organization>"
75-
});
76-
authManager.finalizeLogin().then((res) => {
77-
if (!res.isLoggedIn) {
78-
// may cause redirects
79-
authManager.login();
80-
}
81-
const client = new Azure.ArmPostgresql.PostgreSQLManagementClient(res.creds, subscriptionId);
82-
const resourceGroupName = "testresourceGroupName";
83-
const serverName = "testserverName";
84-
client.servers.get(resourceGroupName, serverName).then((result) => {
85-
console.log("The result is:");
86-
console.log(result);
87-
}).catch((err) => {
88-
console.log("An error occurred:");
89-
console.error(err);
90-
});
91-
});
92-
</script>
93-
</head>
94-
<body></body>
95-
</html>
62+
## Troubleshooting
63+
64+
### Logging
65+
66+
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
67+
68+
```javascript
69+
const { setLogLevel } = require("@azure/logger");
70+
setLogLevel("info");
9671
```
9772

73+
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
74+
75+
## Next steps
76+
77+
Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library.
78+
79+
## Contributing
80+
81+
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
82+
9883
## Related projects
9984

100-
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
85+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
86+
87+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fpostgresql%2Farm-postgresql%2FREADME.png)
10188

102-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/postgresql/arm-postgresql/README.png)
89+
[azure_cli]: https://docs.microsoft.com/cli/azure
90+
[azure_sub]: https://azure.microsoft.com/free/
91+
[azure_sub]: https://azure.microsoft.com/free/
92+
[azure_portal]: https://portal.azure.com
93+
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
94+
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"commit": "01c6e5b81b5a52b433fabfa56801f5a87b942067",
3+
"readme": "specification/postgresql/resource-manager/readme.md",
4+
"autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/postgresql/resource-manager/readme.md --tag=package-2020-01-01 --use=@autorest/[email protected]",
5+
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
6+
"tag": "package-2020-01-01",
7+
"use": "@autorest/[email protected]"
8+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
4+
"docModel": { "enabled": true },
5+
"apiReport": { "enabled": true, "reportFolder": "./review" },
6+
"dtsRollup": {
7+
"enabled": true,
8+
"untrimmedFilePath": "",
9+
"publicTrimmedFilePath": "./types/arm-postgresql.d.ts"
10+
},
11+
"messages": {
12+
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
13+
"extractorMessageReporting": {
14+
"ae-missing-release-tag": { "logLevel": "none" },
15+
"ae-unresolved-link": { "logLevel": "none" }
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)