-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Purview Scanning Rest Client #14918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Purview Scanning Rest Client #14918
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
058120c
Initial commit for PurviewScanning
joheredi 535e7a4
Add samples
joheredi 453fc9f
Add sanity test
joheredi a25a897
Fix broken links
joheredi b1f36e3
Fix links
joheredi e7ba191
remove broken link
joheredi d659d2d
Fix endpoint replacement
joheredi dee359d
fix url
joheredi 2935803
delete unused recording
joheredi 624898d
Re-generate latest swagger
joheredi 0e27931
Add purview ci
joheredi da11346
Re-generate purview scanning
joheredi 05efc14
update readme
joheredi 58471d8
Fix broken links
joheredi af5bfa2
Update samples
joheredi 0f3c804
update test and broken link
joheredi f5db607
Update Karma timeout
joheredi 269254b
Address feedback
joheredi 8be2850
update pnpm and rebase
joheredi 3f09f61
update package json
joheredi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "plugins": ["@azure/azure-sdk"], | ||
| "extends": ["plugin:@azure/azure-sdk/azure-sdk-base"], | ||
| "rules": { | ||
| "@azure/azure-sdk/ts-modules-only-named": "warn" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Release History | ||
|
|
||
| ## 1.0.0-beta.1 (Unreleased) | ||
|
|
||
| - First release of package, see README.md for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| The MIT License (MIT) | ||
|
|
||
| Copyright (c) 2020 Microsoft | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # Azure Purview Scanning Rest-Level client library for JavaScript | ||
|
|
||
| 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. | ||
|
|
||
| - Scan your data into your catalog | ||
| - Examine your data | ||
| - Extract schemas from your data | ||
|
|
||
| **Please rely heavily on the [service's documentation][scanning_product_documentation] and our [Rest client docs][rest_client] to use this library** | ||
|
|
||
| [Source code][source_code] | [Package (NPM)][scanning_npm] | [API reference documentation][scanning_ref_docs]| [Product documentation][scanning_product_documentation] | ||
|
|
||
| ## Getting started | ||
|
|
||
| ### Currently supported environments | ||
|
|
||
| - Node.js version 14.x.x or higher | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package. | ||
|
|
||
| #### Create a Purview Resource | ||
|
|
||
| Follow [these][purview_resource] instructions to create your Purview resource | ||
|
|
||
| ### Install the `@azure-rest/purview-scanning` package | ||
|
|
||
| Install the Azure Purview Scanning client library for JavaScript with `npm`: | ||
|
|
||
| ```bash | ||
| npm install @azure-rest/purview-scanning | ||
| ``` | ||
|
|
||
| ### Create and authenticate a `PurviewScanning` | ||
|
|
||
| To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], | ||
| provide an instance of the desired credential type obtained from the | ||
| [@azure/identity][azure_identity_credentials] library. | ||
|
|
||
| To authenticate with AAD, you must first `npm` install [`@azure/identity`][azure_identity_npm] and | ||
| [enable AAD authentication on your Purview resource][enable_aad] | ||
|
|
||
| After setup, you can choose which type of [credential][azure_identity_credentials] from `@azure/identity` to use. | ||
| As an example, [DefaultAzureCredential][default_azure_credential] | ||
| can be used to authenticate the client: | ||
|
|
||
| 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 | ||
|
|
||
| Use the returned token credential to authenticate the client: | ||
|
|
||
| ```typescript | ||
| import PurviewScanning from "@azure-rest/purview-scanning"; | ||
| import { DefaultAzureCredential } from "@azure/identity"; | ||
| const client = PurviewScanning( | ||
| "https://<my-account-name>.scanning.purview.azure.com", | ||
| new DefaultAzureCredential() | ||
| ); | ||
| ``` | ||
|
|
||
| ## Key concepts | ||
|
|
||
| ### Rest Client | ||
|
|
||
| This client is one of our Rest clients. We highly recommend you read how to use a Rest client [here][rest_client]. | ||
|
|
||
| ## Examples | ||
|
|
||
| The following section shows you how to initialize and authenticate your client, then list all of your data sources. | ||
|
|
||
| - [List All Data Sources](#list-all-data-sources "List All Data Sources") | ||
|
|
||
| ### List All Data Sources | ||
|
|
||
| ```typescript | ||
| import PurviewScanning from "@azure-rest/purview-scanning"; | ||
| import { DefaultAzureCredential } from "@azure/identity"; | ||
|
|
||
| async function main() { | ||
| console.log("== List dataSources =="); | ||
| const client = PurviewScanning( | ||
| "https://<my-account-name>.scanning.purview.azure.com", | ||
| new DefaultAzureCredential() | ||
| ); | ||
|
|
||
| const dataSources = await client.path("/datasources").get(); | ||
|
|
||
| if (dataSources.status !== "200") { | ||
| throw dataSources.body.error; | ||
| } | ||
|
|
||
| console.log(dataSources.body.value?.map((ds) => ds.name).join("\n")); | ||
| } | ||
|
|
||
| main().catch(console.error); | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Logging | ||
|
|
||
| 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`: | ||
|
|
||
| ```javascript | ||
| import { setLogLevel } from "@azure/logger"; | ||
|
|
||
| setLogLevel("info"); | ||
| ``` | ||
|
|
||
| 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). | ||
|
|
||
| ## Next steps | ||
|
|
||
| ## Contributing | ||
|
|
||
| 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. | ||
|
|
||
| ## Related projects | ||
|
|
||
| - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) | ||
|
|
||
|  | ||
|
|
||
| <!-- LINKS --> | ||
|
|
||
| [scanning_product_documentation]: https://azure.microsoft.com/services/purview/ | ||
| [rest_client]: https://github.com/Azure/azure-sdk-for-js/blob/master/documentation/rest-clients.md | ||
| [source_code]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/purview/purview-scanning-rest | ||
| [scanning_npm]: https://www.npmjs.com/package/@azure-rest/purview-scanning | ||
| [scanning_ref_docs]: https://azure.github.io/azure-sdk-for-js | ||
| [azure_subscription]: https://azure.microsoft.com/free/ | ||
| [purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal | ||
| [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token | ||
| [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#credentials | ||
| [azure_identity_npm]: https://www.npmjs.com/package/@azure/identity | ||
| [enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role | ||
| [default_azure_credential]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
| "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
| "mainEntryPointFilePath": "types/src/index.d.ts", | ||
| "docModel": { | ||
| "enabled": true | ||
| }, | ||
| "apiReport": { | ||
| "enabled": true, | ||
| "reportFolder": "./review" | ||
| }, | ||
| "dtsRollup": { | ||
| "enabled": true, | ||
| "untrimmedFilePath": "", | ||
| "publicTrimmedFilePath": "./types/purview-scanning-rest.d.ts" | ||
| }, | ||
| "messages": { | ||
| "tsdocMessageReporting": { | ||
| "default": { | ||
| "logLevel": "none" | ||
| } | ||
| }, | ||
| "extractorMessageReporting": { | ||
| "ae-missing-release-tag": { | ||
| "logLevel": "none" | ||
| }, | ||
| "ae-unresolved-link": { | ||
| "logLevel": "none" | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like we need more hero scenarios than just listing, since I imagine you'd want to show scanning, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the service team will assist us with writing some sample additional samples