Skip to content

Commit ddd7fa8

Browse files
authored
Purview Scanning Rest Client (Azure#14918)
* Initial commit for PurviewScanning * Add samples * Add sanity test * Fix broken links * Fix links * remove broken link * Fix endpoint replacement * fix url * delete unused recording * Re-generate latest swagger * Add purview ci * Re-generate purview scanning * update readme * Fix broken links * Update samples * update test and broken link * Update Karma timeout * Address feedback * update pnpm and rebase * update package json
1 parent 5eff9b8 commit ddd7fa8

39 files changed

+9586
-5
lines changed

common/config/rush/pnpm-lock.yaml

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

dataplane.code-workspace

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@
236236
"name": "dev tool",
237237
"path": "common/tools/dev-tool"
238238
},
239+
{
240+
"name": "purview-scanning",
241+
"path": "sdk/purview/purview-scanning-rest"
242+
},
239243
{
240244
"name": "perfstress",
241245
"path": "sdk/test-utils/perfstress"

rush.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,11 @@
334334
},
335335
{
336336
"packageName": "@azure-rest/purview-catalog",
337-
"projectFolder": "sdk/purview/purview-catalog-rest",
337+
"projectFolder": "sdk/purview/purview-catalog-rest"
338+
},
339+
{
340+
"packageName": "@azure-rest/purview-scanning",
341+
"projectFolder": "sdk/purview/purview-scanning-rest",
338342
"versionPolicyName": "client"
339343
},
340344
{

sdk/purview/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ extends:
3030
Artifacts:
3131
- name: azure-rest-purview-catalog
3232
safeName: azurerestpurviewcatalog
33+
- name: azure-rest-purview-scanning
34+
safeName: azurerestpurviewscanning

sdk/purview/purview-catalog-rest/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
},
3434
"//metadata": {
3535
"constantPaths": [
36-
{
37-
"path": "src/constants.ts",
38-
"prefix": "SDK_VERSION"
39-
},
4036
{
4137
"path": "swagger/README.md",
4238
"prefix": "package-version"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"plugins": ["@azure/azure-sdk"],
3+
"extends": ["plugin:@azure/azure-sdk/azure-sdk-base"],
4+
"rules": {
5+
"@azure/azure-sdk/ts-modules-only-named": "warn"
6+
}
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (Unreleased)
4+
5+
- First release of package, see README.md for details.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Microsoft
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Azure Purview Scanning Rest-Level client library for JavaScript
2+
3+
Azure Purview Scanning is a fully managed cloud service whose users can scan your data into your data estate (also known as your **catalog**). Scanning is a process by which the catalog connects directly to a data source on a user-specified schedule.
4+
5+
- Scan your data into your catalog
6+
- Examine your data
7+
- Extract schemas from your data
8+
9+
**Please rely heavily on the [service's documentation][scanning_product_documentation] and our [Rest client docs][rest_client] to use this library**
10+
11+
[Source code][source_code] | [Package (NPM)][scanning_npm] | [API reference documentation][scanning_ref_docs]| [Product documentation][scanning_product_documentation]
12+
13+
## Getting started
14+
15+
### Currently supported environments
16+
17+
- Node.js version 14.x.x or higher
18+
19+
### Prerequisites
20+
21+
- You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package.
22+
23+
#### Create a Purview Resource
24+
25+
Follow [these][purview_resource] instructions to create your Purview resource
26+
27+
### Install the `@azure-rest/purview-scanning` package
28+
29+
Install the Azure Purview Scanning client library for JavaScript with `npm`:
30+
31+
```bash
32+
npm install @azure-rest/purview-scanning
33+
```
34+
35+
### Create and authenticate a `PurviewScanning`
36+
37+
To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
38+
provide an instance of the desired credential type obtained from the
39+
[@azure/identity][azure_identity_credentials] library.
40+
41+
To authenticate with AAD, you must first `npm` install [`@azure/identity`][azure_identity_npm] and
42+
[enable AAD authentication on your Purview resource][enable_aad]
43+
44+
After setup, you can choose which type of [credential][azure_identity_credentials] from `@azure/identity` to use.
45+
As an example, [DefaultAzureCredential][default_azure_credential]
46+
can be used to authenticate the client:
47+
48+
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
49+
AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
50+
51+
Use the returned token credential to authenticate the client:
52+
53+
```typescript
54+
import PurviewScanning from "@azure-rest/purview-scanning";
55+
import { DefaultAzureCredential } from "@azure/identity";
56+
const client = PurviewScanning(
57+
"https://<my-account-name>.scanning.purview.azure.com",
58+
new DefaultAzureCredential()
59+
);
60+
```
61+
62+
## Key concepts
63+
64+
### Rest Client
65+
66+
This client is one of our Rest clients. We highly recommend you read how to use a Rest client [here][rest_client].
67+
68+
## Examples
69+
70+
The following section shows you how to initialize and authenticate your client, then list all of your data sources.
71+
72+
- [List All Data Sources](#list-all-data-sources "List All Data Sources")
73+
74+
### List All Data Sources
75+
76+
```typescript
77+
import PurviewScanning from "@azure-rest/purview-scanning";
78+
import { DefaultAzureCredential } from "@azure/identity";
79+
80+
async function main() {
81+
console.log("== List dataSources ==");
82+
const client = PurviewScanning(
83+
"https://<my-account-name>.scanning.purview.azure.com",
84+
new DefaultAzureCredential()
85+
);
86+
87+
const dataSources = await client.path("/datasources").get();
88+
89+
if (dataSources.status !== "200") {
90+
throw dataSources.body.error;
91+
}
92+
93+
console.log(dataSources.body.value?.map((ds) => ds.name).join("\n"));
94+
}
95+
96+
main().catch(console.error);
97+
```
98+
99+
## Troubleshooting
100+
101+
### Logging
102+
103+
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`:
104+
105+
```javascript
106+
import { setLogLevel } from "@azure/logger";
107+
108+
setLogLevel("info");
109+
```
110+
111+
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/master/sdk/core/logger).
112+
113+
## Next steps
114+
115+
## Contributing
116+
117+
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code.
118+
119+
## Related projects
120+
121+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
122+
123+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fpurview%2Fpurview-scanning-rest%2FREADME.png)
124+
125+
<!-- LINKS -->
126+
127+
[scanning_product_documentation]: https://azure.microsoft.com/services/purview/
128+
[rest_client]: https://github.com/Azure/azure-sdk-for-js/blob/master/documentation/rest-clients.md
129+
[source_code]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/purview/purview-scanning-rest
130+
[scanning_npm]: https://www.npmjs.com/package/@azure-rest/purview-scanning
131+
[scanning_ref_docs]: https://azure.github.io/azure-sdk-for-js
132+
[azure_subscription]: https://azure.microsoft.com/free/
133+
[purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal
134+
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
135+
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#credentials
136+
[azure_identity_npm]: https://www.npmjs.com/package/@azure/identity
137+
[enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role
138+
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"mainEntryPointFilePath": "types/src/index.d.ts",
4+
"docModel": {
5+
"enabled": true
6+
},
7+
"apiReport": {
8+
"enabled": true,
9+
"reportFolder": "./review"
10+
},
11+
"dtsRollup": {
12+
"enabled": true,
13+
"untrimmedFilePath": "",
14+
"publicTrimmedFilePath": "./types/purview-scanning-rest.d.ts"
15+
},
16+
"messages": {
17+
"tsdocMessageReporting": {
18+
"default": {
19+
"logLevel": "none"
20+
}
21+
},
22+
"extractorMessageReporting": {
23+
"ae-missing-release-tag": {
24+
"logLevel": "none"
25+
},
26+
"ae-unresolved-link": {
27+
"logLevel": "none"
28+
}
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)