azure-sdk-for-js/sdk/purview/purview-scanning-rest
Jeremy Meng a28e8f0795 [EngSys] move to vendored version of cross-env via dev-tool
***NO_CI***

- apply the transformation

- update samples' README
2024-11-02 00:48:06 +00:00
..
review [eslint-plugin] add rule "@typescript-eslint/consistent-type-imports": "warn" 2024-10-30 15:48:52 +00:00
samples/v1-beta [EngSys] move to vendored version of cross-env via dev-tool 2024-11-02 00:48:06 +00:00
samples-dev Regenerate RLC broken samples (#21098) 2022-03-29 20:16:04 -07:00
src [eslint-plugin] add rule "@typescript-eslint/consistent-type-imports": "warn" 2024-10-30 15:48:52 +00:00
swagger Update swagger input links to azure-rest-api-specs main branch (#28309) 2024-01-22 10:32:36 -08:00
test/public [eslint-plugin] add rule "@typescript-eslint/consistent-type-imports": "warn" 2024-10-30 15:48:52 +00:00
CHANGELOG.md Post release automated changes for purview releases (#18187) 2021-10-18 12:41:06 -07:00
LICENSE Purview Scanning Rest Client (#14918) 2021-05-10 15:27:46 -07:00
README.md Increment minimum supported node version to 16 2023-10-09 21:09:54 +00:00
api-extractor.json Purview Scanning Rest Client (#14918) 2021-05-10 15:27:46 -07:00
assets.json migrate rlc recording (#26430) 2023-07-11 15:52:20 +08:00
eslint.config.mjs Apply automated migration to eslint flat config 2024-08-22 11:43:19 -07:00
karma.conf.js [engsys] remove karma ie and edge launcher 2023-03-06 17:08:15 -05:00
package.json [EngSys] move to vendored version of cross-env via dev-tool 2024-11-02 00:48:06 +00:00
sample.env Purview Scanning Rest Client (#14918) 2021-05-10 15:27:46 -07:00
tsconfig.json [EngSys] remove tsconfig.package.json 2024-07-16 13:27:25 +00:00
tsdoc.json Purview Scanning Rest Client (#14918) 2021-05-10 15:27:46 -07:00

README.md

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 and our Rest client docs to use this library

Key links:

Getting started

Currently supported environments

Prerequisites

Create a Purview Resource

Follow these instructions to create your Purview resource

Install the @azure-rest/purview-scanning package

Install the Azure Purview Scanning client library for JavaScript with npm:

npm install @azure-rest/purview-scanning

Create and authenticate a PurviewScanning

To use an Azure Active Directory (AAD) token credential, provide an instance of the desired credential type obtained from the @azure/identity library.

To authenticate with AAD, you must first npm install @azure/identity and enable AAD authentication on your Purview resource

After setup, you can choose which type of credential from @azure/identity to use. As an example, DefaultAzureCredential 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:

import PurviewScanning from "@azure-rest/purview-scanning";
import { DefaultAzureCredential } from "@azure/identity";
const client = PurviewScanning(
  "https://<my-account-name>.scan.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.

Examples

The following section shows you how to initialize and authenticate your client, then list all of your data sources.

List All Data Sources

import PurviewScanning, { paginate, DataSource } from "@azure-rest/purview-scanning";
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { DefaultAzureCredential } from "@azure/identity";

async function main() {
  console.log("== List dataSources ==");
  const client = PurviewScanning(
    "https://<my-account-name>.scan.purview.azure.com",
    new DefaultAzureCredential()
  );

  const dataSources = await client.path("/datasources").get();
  if (dataSources.status !== "200") {
    throw dataSources.body.error;
  }
  const iter = paginate(client, dataSources)

  const items: DataSource[] = [];

  for await (const item of <PagedAsyncIterableIterator<DataSource, (DataSource)[], PageSettings>>iter) {
    items.push(item);
  }

  console.log(items?.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:

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.

Next steps

Contributing

If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.

Impressions