1.0.0-beta.5 • Published 1 month ago

@azure-rest/purview-catalog v1.0.0-beta.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Azure Purview Catalog REST client library for JavaScript

Azure Purview Catalog is a fully managed cloud service whose users can discover the data sources they need and understand the data sources they find. At the same time, Data Catalog helps organizations get more value from their existing investments.

  • Search for data using technical or business terms
  • Browse associated technical, business, semantic, and operational metadata
  • Identify the sensitivity level of data.

Please rely heavily on the service's documentation and our REST client docs to use this library

Source code | Package (NPM) | API reference documentation| Product documentation

Getting started

Currently supported environments

  • Node.js version 14.x.x or higher

Prerequisites

Create a Purview Resource

Follow these instructions to create your Purview resource

Install the @azure-rest/purview-catalog package

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

npm install @azure-rest/purview-catalog

Create and authenticate a PurviewCatalog

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 PurviewCatalog from "@azure-rest/purview-catalog";
import { DefaultAzureCredential } from "@azure/identity";
const client = PurviewCatalog(
  "https://<my-account-name>.catalog.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 get all of your type-defs.

import PurviewCatalog from "@azure-rest/purview-catalog";
import { DefaultAzureCredential } from "@azure/identity";

async function main() {
  console.log("== List entity typedefs ==");
  const client = PurviewCatalog(endpoint, new DefaultAzureCredential());

  const dataSources = await client.path("/atlas/v2/types/typedefs").get();

  if (dataSources.status !== "200") {
    throw dataSources;
  }

  console.log(dataSources.body.entityDefs?.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.

Related projects

Impressions

1.0.0-beta.5

2 years ago

1.0.0-beta.4

2 years ago

1.0.0-beta.3

3 years ago

1.0.0-beta.2

3 years ago

1.0.0-beta.1

3 years ago