Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dataplane.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@
"name": "dev tool",
"path": "common/tools/dev-tool"
},
{
"name": "purview-scanning",
"path": "sdk/purview/purview-scanning-rest"
},
{
"name": "perfstress",
"path": "sdk/test-utils/perfstress"
Expand Down
6 changes: 5 additions & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@
},
{
"packageName": "@azure-rest/purview-catalog",
"projectFolder": "sdk/purview/purview-catalog-rest",
"projectFolder": "sdk/purview/purview-catalog-rest"
},
{
"packageName": "@azure-rest/purview-scanning",
"projectFolder": "sdk/purview/purview-scanning-rest",
"versionPolicyName": "client"
},
{
Expand Down
2 changes: 2 additions & 0 deletions sdk/purview/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ extends:
Artifacts:
- name: azure-rest-purview-catalog
safeName: azurerestpurviewcatalog
- name: azure-rest-purview-scanning
safeName: azurerestpurviewscanning
4 changes: 0 additions & 4 deletions sdk/purview/purview-catalog-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
},
"//metadata": {
"constantPaths": [
{
"path": "src/constants.ts",
"prefix": "SDK_VERSION"
},
{
"path": "swagger/README.md",
"prefix": "package-version"
Expand Down
7 changes: 7 additions & 0 deletions sdk/purview/purview-scanning-rest/.eslintrc.json
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"
}
}
5 changes: 5 additions & 0 deletions sdk/purview/purview-scanning-rest/CHANGELOG.md
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.
21 changes: 21 additions & 0 deletions sdk/purview/purview-scanning-rest/LICENSE
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.
138 changes: 138 additions & 0 deletions sdk/purview/purview-scanning-rest/README.md
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
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member Author

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


```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)

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fpurview%2Fpurview-scanning-rest%2FREADME.png)

<!-- 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
31 changes: 31 additions & 0 deletions sdk/purview/purview-scanning-rest/api-extractor.json
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"
}
}
}
}
Loading