* 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
This commit is contained in:
Jose Manuel Heredia Hidalgo 2021-05-10 15:27:46 -07:00 коммит произвёл GitHub
Родитель 5eff9b8980
Коммит ddd7fa8eea
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
39 изменённых файлов: 9586 добавлений и 5 удалений

Просмотреть файл

@ -60,6 +60,7 @@ dependencies:
'@rush-temp/perf-storage-file-datalake': file:projects/perf-storage-file-datalake.tgz
'@rush-temp/perf-storage-file-share': file:projects/perf-storage-file-share.tgz
'@rush-temp/purview-catalog': file:projects/purview-catalog.tgz
'@rush-temp/purview-scanning': file:projects/purview-scanning.tgz
'@rush-temp/quantum-jobs': file:projects/quantum-jobs.tgz
'@rush-temp/schema-registry': file:projects/schema-registry.tgz
'@rush-temp/schema-registry-avro': file:projects/schema-registry-avro.tgz
@ -10244,6 +10245,49 @@ packages:
integrity: sha512-yBPbajTzczwOowo3dWhgRF4ndHwCFqKbKLEgcCYCMrXuD+PyqP+P3s4kV6wnlr6Ii7gS+r+JNCLHnEEhw3hzHw==
tarball: file:projects/purview-catalog.tgz
version: 0.0.0
file:projects/purview-scanning.tgz:
dependencies:
'@azure/core-rest-pipeline': 1.0.3
'@azure/identity': 1.3.0
'@microsoft/api-extractor': 7.13.2
'@types/chai': 4.2.16
'@types/mocha': 7.0.2
'@types/node': 8.10.66
chai: 4.3.4
cross-env: 7.0.3
dotenv: 8.2.0
eslint: 7.23.0
karma: 6.3.2
karma-chrome-launcher: 3.1.0
karma-coverage: 2.0.3
karma-edge-launcher: 0.4.2_karma@6.3.2
karma-env-preprocessor: 0.1.1
karma-firefox-launcher: 1.3.0
karma-ie-launcher: 1.0.0_karma@6.3.2
karma-json-preprocessor: 0.3.3_karma@6.3.2
karma-json-to-file-reporter: 1.0.1
karma-junit-reporter: 2.0.1_karma@6.3.2
karma-mocha: 2.0.1
karma-mocha-reporter: 2.2.5_karma@6.3.2
karma-source-map-support: 1.4.0
karma-sourcemap-loader: 0.3.8
mkdirp: 1.0.4
mocha: 7.2.0
mocha-junit-reporter: 1.23.3_mocha@7.2.0
nyc: 14.1.1
prettier: 2.2.1
rimraf: 3.0.2
rollup: 1.32.1
source-map-support: 0.5.19
tslib: 2.2.0
typedoc: 0.15.2
typescript: 4.2.4
dev: false
name: '@rush-temp/purview-scanning'
resolution:
integrity: sha512-JEBy9NjgTRXYyfkInijwhFw2aFRYRmvUA+NNDzyZaaphUN0RPfnKoXv6PmuLofbyyxHNgieCRkDuXq2kMbPOKQ==
tarball: file:projects/purview-scanning.tgz
version: 0.0.0
file:projects/quantum-jobs.tgz:
dependencies:
'@azure/core-tracing': 1.0.0-preview.11
@ -11343,6 +11387,7 @@ specifiers:
'@rush-temp/perf-storage-file-datalake': file:./projects/perf-storage-file-datalake.tgz
'@rush-temp/perf-storage-file-share': file:./projects/perf-storage-file-share.tgz
'@rush-temp/purview-catalog': file:./projects/purview-catalog.tgz
'@rush-temp/purview-scanning': file:./projects/purview-scanning.tgz
'@rush-temp/quantum-jobs': file:./projects/quantum-jobs.tgz
'@rush-temp/schema-registry': file:./projects/schema-registry.tgz
'@rush-temp/schema-registry-avro': file:./projects/schema-registry-avro.tgz

Просмотреть файл

@ -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"

Просмотреть файл

@ -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"
},
{

Просмотреть файл

@ -30,3 +30,5 @@ extends:
Artifacts:
- name: azure-rest-purview-catalog
safeName: azurerestpurviewcatalog
- name: azure-rest-purview-scanning
safeName: azurerestpurviewscanning

Просмотреть файл

@ -33,10 +33,6 @@
},
"//metadata": {
"constantPaths": [
{
"path": "src/constants.ts",
"prefix": "SDK_VERSION"
},
{
"path": "swagger/README.md",
"prefix": "package-version"

Просмотреть файл

@ -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"
}
}

Просмотреть файл

@ -0,0 +1,5 @@
# Release History
## 1.0.0-beta.1 (Unreleased)
- First release of package, see README.md for details.

Просмотреть файл

@ -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.

Просмотреть файл

@ -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)
![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

Просмотреть файл

@ -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"
}
}
}
}

Просмотреть файл

@ -0,0 +1,143 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// https://github.com/karma-runner/karma-chrome-launcher
process.env.CHROME_BIN = require("puppeteer").executablePath();
require("dotenv").config();
const {
jsonRecordingFilterFunction,
isPlaybackMode,
isSoftRecordMode,
isRecordMode,
} = require("@azure/test-utils-recorder");
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["source-map-support", "mocha"],
plugins: [
"karma-mocha",
"karma-mocha-reporter",
"karma-chrome-launcher",
"karma-edge-launcher",
"karma-firefox-launcher",
"karma-ie-launcher",
"karma-env-preprocessor",
"karma-coverage",
"karma-sourcemap-loader",
"karma-junit-reporter",
"karma-json-to-file-reporter",
"karma-source-map-support",
"karma-json-preprocessor",
],
// list of files / patterns to load in the browser
files: [
"dist-test/index.browser.js",
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true },
].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []),
// list of files / patterns to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["sourcemap", "env"],
"recordings/browsers/**/*.json": ["json"],
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
// Preprocess source file to calculate code coverage, however this will make source file unreadable
// "dist-test/index.js": ["coverage"]
},
envPreprocessor: [
"TEST_MODE",
"ENDPOINT",
"AZURE_CLIENT_SECRET",
"AZURE_CLIENT_ID",
"AZURE_TENANT_ID",
],
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "junit", "json-to-file"],
coverageReporter: {
// specify a common output directory
dir: "coverage-browser/",
reporters: [
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" },
],
},
junitReporter: {
outputDir: "", // results will be saved as $outputDir/$browserName.xml
outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: "", // suite will become the package name attribute in xml testsuite element
useBrowserName: false, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {}, // key value pair of properties to add to the <properties> section of the report
},
jsonToFileReporter: {
filter: jsonRecordingFilterFunction,
outputPath: ".",
},
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// --no-sandbox allows our tests to run in Linux without having to change the system.
// --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex.
browsers: ["ChromeHeadlessNoSandbox"],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: ["--no-sandbox", "--disable-web-security"],
},
},
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: 1,
browserNoActivityTimeout: 60000000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserConsoleLogOptions: {
terminal: !isRecordMode(),
},
client: {
mocha: {
// change Karma's debug.html to the mocha web reporter
reporter: "html",
timeout: "600000",
},
},
});
};

Просмотреть файл

@ -0,0 +1,130 @@
{
"name": "@azure-rest/purview-scanning",
"sdk-type": "client",
"author": "Microsoft Corporation",
"description": "An isomorphic rest level client library for the Azure Purview Scanning service.",
"version": "1.0.0-beta.1",
"keywords": [
"node",
"azure",
"cloud",
"typescript",
"browser",
"isomorphic"
],
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist-esm/src/index.js",
"types": "./types/purview-scanning-rest.d.ts",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/purview/purview-scanning-rest/README.md",
"repository": "github:Azure/azure-sdk-for-js",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"files": [
"dist/",
"dist-esm/src/",
"types/purview-scanning-rest.d.ts",
"README.md",
"LICENSE"
],
"//metadata": {
"constantPaths": [
{
"path": "swagger/README.md",
"prefix": "package-version"
}
]
},
"engines": {
"node": ">=8.0.0"
},
"//sampleConfiguration": {
"productName": "Azure Purview Scanning rest",
"productSlugs": [
"azure"
],
"requiredResources": {
"Azure Cognitive Services instance": "https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account"
}
},
"browser": {
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
},
"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"regenerate": "autorest --typescript swagger/README.md && npm run format",
"build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
"build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
"build:samples": "echo Obsolete.",
"build:test": "tsc -p . && rollup -c 2>&1",
"build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local",
"build:debug": "tsc -p . && rollup -c 2>&1 && api-extractor run --local",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"execute:samples": "dev-tool samples run samples-dev",
"extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"integration-test:browser": "karma start --single-run",
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}*.spec.js\"",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts",
"pack": "npm pack 2>&1",
"prebuild": "npm run clean",
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
"test": "npm run clean && npm run build:test && npm run unit-test",
"unit-test:browser": "karma start --single-run",
"unit-test:node": "mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}*.spec.ts\"",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"docs": "typedoc --excludePrivate --excludeExternals --out ./dist/docs ./src"
},
"sideEffects": false,
"autoPublish": false,
"dependencies": {
"@azure/core-auth": "^1.3.0",
"@azure-rest/core-client": "1.0.0-beta.1",
"@azure/core-rest-pipeline": "^1.0.0",
"@azure/logger": "^1.0.0",
"tslib": "^2.0.0"
},
"devDependencies": {
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/identity": "^1.1.0",
"@azure/test-utils-recorder": "^1.0.0",
"@microsoft/api-extractor": "7.13.2",
"@types/chai": "^4.1.6",
"@types/mocha": "^7.0.2",
"@types/node": "^8.0.0",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"dotenv": "^8.2.0",
"eslint": "^7.15.0",
"karma-chrome-launcher": "^3.0.0",
"karma-coverage": "^2.0.0",
"karma-edge-launcher": "^0.4.2",
"karma-env-preprocessor": "^0.1.1",
"karma-firefox-launcher": "^1.1.0",
"karma-ie-launcher": "^1.0.0",
"karma-json-preprocessor": "^0.3.3",
"karma-json-to-file-reporter": "^1.0.1",
"karma-junit-reporter": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-mocha": "^2.0.1",
"karma-source-map-support": "~1.4.0",
"karma-sourcemap-loader": "^0.3.8",
"karma": "^6.2.0",
"mkdirp": "^1.0.4",
"mocha-junit-reporter": "^1.18.0",
"mocha": "^7.1.1",
"nyc": "^14.0.0",
"prettier": "2.2.1",
"rimraf": "^3.0.0",
"rollup": "^1.16.3",
"source-map-support": "^0.5.9",
"typedoc": "0.15.2",
"typescript": "~4.2.0"
}
}

Просмотреть файл

@ -0,0 +1,52 @@
{
"recordings": [
{
"method": "POST",
"url": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token",
"query": {},
"requestBody": "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fpurview.azure.net%2F.default",
"status": 200,
"response": "{\"token_type\":\"Bearer\",\"expires_in\":86399,\"ext_expires_in\":86399,\"access_token\":\"access_token\"}",
"responseHeaders": {
"cache-control": "no-store, no-cache",
"content-length": "1318",
"content-type": "application/json; charset=utf-8",
"date": "Sat, 17 Apr 2021 03:02:04 GMT",
"expires": "-1",
"nel": "{\"report_to\":\"network-errors\",\"max_age\":86400,\"success_fraction\":0.001,\"failure_fraction\":1.0}",
"p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"",
"pragma": "no-cache",
"referrer-policy": "strict-origin-when-cross-origin",
"report-to": "{\"group\":\"network-errors\",\"max_age\":86400,\"endpoints\":[{\"url\":\"https://identity.nel.measure.office.net/api/report?catId=GW+estsfd+san\"}]}",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"x-content-type-options": "nosniff",
"x-ms-ests-server": "2.1.11654.16 - WUS2 ProdSlices",
"x-ms-request-id": "44f468db-faed-48d7-995e-05f817e02f00"
}
},
{
"method": "GET",
"url": "https://endpoint/datasources",
"query": {
"api-version": "2018-12-01-preview"
},
"requestBody": null,
"status": 200,
"response": "{\"value\":[{\"properties\":{\"createdAt\":\"2021-04-01T19:18:25.6411232Z\",\"lastModifiedAt\":\"2021-04-01T19:18:25.6411233Z\",\"parentCollection\":null},\"kind\":\"Collection\",\"id\":\"datasources/Collection-vaR\",\"name\":\"Collection-vaR\"},{\"properties\":{\"endpoint\":\"https://joherediteststorage.blob.core.windows.net/\",\"resourceGroup\":\"joheredi-test\",\"subscriptionId\":\"faa080af-c1d8-40ad-9cce-e1a450ca5b57\",\"location\":\"westus\",\"resourceName\":\"joherediteststorage\",\"createdAt\":\"2021-04-01T19:19:37.3396977Z\",\"lastModifiedAt\":\"2021-04-01T19:19:37.3396984Z\",\"parentCollection\":{\"type\":\"DataSourceReference\",\"referenceName\":\"Collection-vaR\"}},\"kind\":\"AzureStorage\",\"id\":\"datasources/AzureBlob-BzV\",\"name\":\"AzureBlob-BzV\"}],\"count\":2}",
"responseHeaders": {
"content-length": "709",
"content-type": "application/json; charset=utf-8",
"date": "Sat, 17 Apr 2021 03:02:05 GMT",
"server": "Kestrel",
"status": "200",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"x-ms-correlation-request-id": "36683dfa-4a94-4628-b8d3-d34ade2fd6e4"
}
}
],
"uniqueTestInfo": {
"uniqueName": {},
"newDate": {}
},
"hash": "5fee9200fb758f2d6abdead4d3526b3e"
}

Просмотреть файл

@ -0,0 +1,56 @@
let nock = require('nock');
module.exports.hash = "31a597a6bd805db1de58bb96c6462334";
module.exports.testInfo = {"uniqueName":{},"newDate":{}}
nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true})
.post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fpurview.azure.net%2F.default")
.reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [
'Cache-Control',
'no-store, no-cache',
'Pragma',
'no-cache',
'Content-Length',
'1318',
'Content-Type',
'application/json; charset=utf-8',
'Expires',
'-1',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains',
'X-Content-Type-Options',
'nosniff',
'P3P',
'CP="DSP CUR OTPi IND OTRi ONL FIN"',
'x-ms-request-id',
'3f6440c3-579d-41ac-b501-7bab53261900',
'x-ms-ests-server',
'2.1.11654.13 - SCUS ProdSlices',
'Set-Cookie',
'fpc=AlLlW8l6GSxOvCTrFZhj29X__1r8AQAAAKlGDNgOAAAA; expires=Mon, 17-May-2021 03:02:02 GMT; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly',
'Set-Cookie',
'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly',
'Date',
'Sat, 17 Apr 2021 03:02:02 GMT'
]);
nock('https://endpoint', {"encodedQueryParams":true})
.get('/datasources')
.query(true)
.reply(200, {"value":[{"properties":{"createdAt":"2021-04-01T19:18:25.6411232Z","lastModifiedAt":"2021-04-01T19:18:25.6411233Z","parentCollection":null},"kind":"Collection","id":"datasources/Collection-vaR","name":"Collection-vaR"},{"properties":{"endpoint":"https://joherediteststorage.blob.core.windows.net/","resourceGroup":"joheredi-test","subscriptionId":"faa080af-c1d8-40ad-9cce-e1a450ca5b57","location":"westus","resourceName":"joherediteststorage","createdAt":"2021-04-01T19:19:37.3396977Z","lastModifiedAt":"2021-04-01T19:19:37.3396984Z","parentCollection":{"type":"DataSourceReference","referenceName":"Collection-vaR"}},"kind":"AzureStorage","id":"datasources/AzureBlob-BzV","name":"AzureBlob-BzV"}],"count":2}, [
'Date',
'Sat, 17 Apr 2021 03:02:02 GMT',
'Content-Type',
'application/json; charset=utf-8',
'Server',
'Kestrel',
'Content-Length',
'709',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains',
'x-ms-correlation-request-id',
'9e4bac9f-885b-43a0-9aeb-5fdd385646f9'
]);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,3 @@
import { makeConfig } from "@azure/dev-tool/shared-config/rollup";
export default makeConfig(require("./package.json"));

Просмотреть файл

@ -0,0 +1,7 @@
# Purview Scanning resource endpoint
ENDPOINT=
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This sample demonstrates how get a list of datasources
*
* @summary gets a list of datasources
* @azsdk-weight 40
*/
import PurviewScanning from "@azure-rest/purview-scanning";
import { DefaultAzureCredential } from "@azure/identity";
import dotenv from "dotenv";
dotenv.config();
const endpoint = process.env["ENDPOINT"] || "";
async function main() {
console.log("== List dataSources sample ==");
const client = PurviewScanning(endpoint, 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);

Просмотреть файл

@ -0,0 +1,63 @@
---
page_type: sample
languages:
- javascript
products:
- azure
urlFragment: purview-scanning-javascript
disableDocsMs: true
---
# Azure Purview Scanning rest client library samples for JavaScript
These sample programs show how to use the JavaScript client libraries for Azure Purview Scanning rest in some common scenarios.
| **File Name** | **Description** |
| ------------------------------------- | -------------------------- |
| [listDatasources.js][listdatasources] | gets a list of datasources |
## Prerequisites
The sample programs are compatible with Node.js >=12.0.0.
You need [an Azure subscription][freesub] and the following Azure resources to run these sample programs:
- [Azure Cognitive Services instance][createinstance_azurecognitiveservicesinstance]
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node listDatasources.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env ENDPOINT="<endpoint>" node listDatasources.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[listdatasources]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/purview/purview-scanning-rest/samples/v1/javascript/listDatasources.js
[apiref]: https://docs.microsoft.com/azure/purview/tutorial-scan-data
[freesub]: https://azure.microsoft.com/free/
[createinstance_azurecognitiveservicesinstance]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account
[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/purview/purview-scanning-rest/README.md

Просмотреть файл

@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This sample demonstrates how get a list of datasources
*
* @summary gets a list of datasources
*/
const PurviewScanning = require("@azure-rest/purview-scanning");
const { DefaultAzureCredential } = require("@azure/identity");
const dotenv = require("dotenv");
dotenv.config();
const endpoint = process.env["ENDPOINT"] || "";
async function main() {
console.log("== List dataSources sample ==");
const client = PurviewScanning(endpoint, 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);

Просмотреть файл

@ -0,0 +1,33 @@
{
"name": "azure-purview-scanning-samples-js",
"private": true,
"version": "1.0.0",
"description": "Azure Purview Scanning rest client library samples for JavaScript",
"engine": {
"node": ">=12.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/purview/purview-scanning-rest"
},
"keywords": [
"node",
"azure",
"cloud",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/purview/purview-scanning-rest",
"dependencies": {
"@azure-rest/purview-scanning": "next",
"dotenv": "latest",
"@azure/identity": "^1.1.0"
}
}

Просмотреть файл

@ -0,0 +1,7 @@
# Purview Scanning resource endpoint
ENDPOINT=
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,76 @@
---
page_type: sample
languages:
- typescript
products:
- azure
urlFragment: purview-scanning-typescript
disableDocsMs: true
---
# Azure Purview Scanning rest client library samples for TypeScript
These sample programs show how to use the TypeScript client libraries for Azure Purview Scanning rest in some common scenarios.
| **File Name** | **Description** |
| ------------------------------------- | -------------------------- |
| [listDatasources.ts][listdatasources] | gets a list of datasources |
## Prerequisites
The sample programs are compatible with Node.js >=12.0.0.
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] and the following Azure resources to run these sample programs:
- [Azure Cognitive Services instance][createinstance_azurecognitiveservicesinstance]
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/listDatasources.ts
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env ENDPOINT="<endpoint>" node dist/listDatasources.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[listdatasources]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/purview/purview-scanning-rest/samples/v1/typescript/src/listDatasources.ts
[apiref]: https://docs.microsoft.com/azure/purview/tutorial-scan-data
[freesub]: https://azure.microsoft.com/free/
[createinstance_azurecognitiveservicesinstance]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account
[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/purview/purview-scanning-rest/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

Просмотреть файл

@ -0,0 +1,41 @@
{
"name": "azure-purview-scanning-samples-ts",
"private": true,
"version": "1.0.0",
"description": "Azure Purview Scanning rest client library samples for TypeScript",
"engine": {
"node": ">=12.0.0"
},
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/purview/purview-scanning-rest"
},
"keywords": [
"node",
"azure",
"cloud",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/purview/purview-scanning-rest",
"dependencies": {
"@azure-rest/purview-scanning": "next",
"dotenv": "latest",
"@azure/identity": "^1.1.0"
},
"devDependencies": {
"typescript": "~4.2.0",
"rimraf": "latest"
}
}

Просмотреть файл

@ -0,0 +1,7 @@
# Purview Scanning resource endpoint
ENDPOINT=
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This sample demonstrates how get a list of datasources
*
* @summary gets a list of datasources
*/
import PurviewScanning from "@azure-rest/purview-scanning";
import { DefaultAzureCredential } from "@azure/identity";
import dotenv from "dotenv";
dotenv.config();
const endpoint = process.env["ENDPOINT"] || "";
async function main() {
console.log("== List dataSources sample ==");
const client = PurviewScanning(endpoint, 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);

Просмотреть файл

@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2018",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"alwaysStrict": true,
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src/**.ts"
]
}

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import PurviewScanning from "./purviewScanning";
export * from "./purviewScanning";
export * from "./models";
export * from "./parameters";
export * from "./responses";
export default PurviewScanning;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,140 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { RequestParameters } from "@azure-rest/core-client";
import {
AzureKeyVault,
ClassificationRule,
ClassificationAction,
DataSource,
Filter,
Scan,
ScanLevelType,
ScanRuleset,
DataSourceType,
Trigger,
} from "./models";
export type KeyVaultConnectionsGetParameters = RequestParameters;
export interface KeyVaultConnectionsCreateBodyParam {
body: AzureKeyVault;
}
export type KeyVaultConnectionsCreateParameters = RequestParameters &
KeyVaultConnectionsCreateBodyParam;
export type KeyVaultConnectionsDeleteParameters = RequestParameters;
export type KeyVaultConnectionsListAllParameters = RequestParameters;
export type ClassificationRulesGetParameters = RequestParameters;
export interface ClassificationRulesCreateOrUpdateBodyParam {
body?: ClassificationRule;
}
export type ClassificationRulesCreateOrUpdateParameters = RequestParameters &
ClassificationRulesCreateOrUpdateBodyParam;
export type ClassificationRulesDeleteParameters = RequestParameters;
export type ClassificationRulesListAllParameters = RequestParameters;
export type ClassificationRulesListVersionsByClassificationRuleNameParameters = RequestParameters;
export interface ClassificationRulesTagClassificationVersionQueryParamProperties {
action: ClassificationAction;
}
export interface ClassificationRulesTagClassificationVersionQueryParam {
queryParameters: ClassificationRulesTagClassificationVersionQueryParamProperties;
}
export type ClassificationRulesTagClassificationVersionParameters = RequestParameters &
ClassificationRulesTagClassificationVersionQueryParam;
export interface DataSourcesCreateOrUpdateBodyParam {
body?: DataSource;
}
export type DataSourcesCreateOrUpdateParameters = RequestParameters &
DataSourcesCreateOrUpdateBodyParam;
export type DataSourcesGetParameters = RequestParameters;
export type DataSourcesDeleteParameters = RequestParameters;
export type DataSourcesListAllParameters = RequestParameters;
export type FiltersGetParameters = RequestParameters;
export interface FiltersCreateOrUpdateBodyParam {
body?: Filter;
}
export type FiltersCreateOrUpdateParameters = RequestParameters & FiltersCreateOrUpdateBodyParam;
export interface ScansCreateOrUpdateBodyParam {
body: Scan;
}
export type ScansCreateOrUpdateParameters = RequestParameters & ScansCreateOrUpdateBodyParam;
export type ScansGetParameters = RequestParameters;
export type ScansDeleteParameters = RequestParameters;
export type ScansListByDataSourceParameters = RequestParameters;
export interface ScanResultRunScanQueryParamProperties {
scanLevel?: ScanLevelType;
}
export interface ScanResultRunScanQueryParam {
queryParameters?: ScanResultRunScanQueryParamProperties;
}
export type ScanResultRunScanParameters = RequestParameters & ScanResultRunScanQueryParam;
export type ScanResultCancelScanParameters = RequestParameters;
export type ScanResultListScanHistoryParameters = RequestParameters;
export type ScanRulesetsGetParameters = RequestParameters;
export interface ScanRulesetsCreateOrUpdateBodyParam {
body?: ScanRuleset;
}
export type ScanRulesetsCreateOrUpdateParameters = RequestParameters &
ScanRulesetsCreateOrUpdateBodyParam;
export type ScanRulesetsDeleteParameters = RequestParameters;
export type ScanRulesetsListAllParameters = RequestParameters;
export type SystemScanRulesetsListAllParameters = RequestParameters;
export type SystemScanRulesetsGetParameters = RequestParameters;
export interface SystemScanRulesetsGetByVersionQueryParamProperties {
dataSourceType?: DataSourceType;
}
export interface SystemScanRulesetsGetByVersionQueryParam {
queryParameters?: SystemScanRulesetsGetByVersionQueryParamProperties;
}
export type SystemScanRulesetsGetByVersionParameters = RequestParameters &
SystemScanRulesetsGetByVersionQueryParam;
export interface SystemScanRulesetsGetLatestQueryParamProperties {
dataSourceType?: DataSourceType;
}
export interface SystemScanRulesetsGetLatestQueryParam {
queryParameters?: SystemScanRulesetsGetLatestQueryParamProperties;
}
export type SystemScanRulesetsGetLatestParameters = RequestParameters &
SystemScanRulesetsGetLatestQueryParam;
export interface SystemScanRulesetsListVersionsByDataSourceQueryParamProperties {
dataSourceType?: DataSourceType;
}
export interface SystemScanRulesetsListVersionsByDataSourceQueryParam {
queryParameters?: SystemScanRulesetsListVersionsByDataSourceQueryParamProperties;
}
export type SystemScanRulesetsListVersionsByDataSourceParameters = RequestParameters &
SystemScanRulesetsListVersionsByDataSourceQueryParam;
export type TriggersGetTriggerParameters = RequestParameters;
export interface TriggersCreateTriggerBodyParam {
body: Trigger;
}
export type TriggersCreateTriggerParameters = RequestParameters & TriggersCreateTriggerBodyParam;
export type TriggersDeleteTriggerParameters = RequestParameters;

Просмотреть файл

@ -0,0 +1,488 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import {
KeyVaultConnectionsGetParameters,
KeyVaultConnectionsCreateParameters,
KeyVaultConnectionsDeleteParameters,
KeyVaultConnectionsListAllParameters,
ClassificationRulesGetParameters,
ClassificationRulesCreateOrUpdateParameters,
ClassificationRulesDeleteParameters,
ClassificationRulesListAllParameters,
ClassificationRulesListVersionsByClassificationRuleNameParameters,
ClassificationRulesTagClassificationVersionParameters,
DataSourcesCreateOrUpdateParameters,
DataSourcesGetParameters,
DataSourcesDeleteParameters,
DataSourcesListAllParameters,
FiltersGetParameters,
FiltersCreateOrUpdateParameters,
ScansCreateOrUpdateParameters,
ScansGetParameters,
ScansDeleteParameters,
ScansListByDataSourceParameters,
ScanResultRunScanParameters,
ScanResultCancelScanParameters,
ScanResultListScanHistoryParameters,
ScanRulesetsGetParameters,
ScanRulesetsCreateOrUpdateParameters,
ScanRulesetsDeleteParameters,
ScanRulesetsListAllParameters,
SystemScanRulesetsListAllParameters,
SystemScanRulesetsGetParameters,
SystemScanRulesetsGetByVersionParameters,
SystemScanRulesetsGetLatestParameters,
SystemScanRulesetsListVersionsByDataSourceParameters,
TriggersGetTriggerParameters,
TriggersCreateTriggerParameters,
TriggersDeleteTriggerParameters,
} from "./parameters";
import {
KeyVaultConnectionsGet200Response,
KeyVaultConnectionsGetdefaultResponse,
KeyVaultConnectionsCreate200Response,
KeyVaultConnectionsCreatedefaultResponse,
KeyVaultConnectionsDelete200Response,
KeyVaultConnectionsDelete204Response,
KeyVaultConnectionsDeletedefaultResponse,
KeyVaultConnectionsListAll200Response,
KeyVaultConnectionsListAlldefaultResponse,
ClassificationRulesGet200Response,
ClassificationRulesGetdefaultResponse,
ClassificationRulesCreateOrUpdate200Response,
ClassificationRulesCreateOrUpdate201Response,
ClassificationRulesCreateOrUpdatedefaultResponse,
ClassificationRulesDelete200Response,
ClassificationRulesDelete204Response,
ClassificationRulesDeletedefaultResponse,
ClassificationRulesListAll200Response,
ClassificationRulesListAlldefaultResponse,
ClassificationRulesListVersionsByClassificationRuleName200Response,
ClassificationRulesListVersionsByClassificationRuleNamedefaultResponse,
ClassificationRulesTagClassificationVersion202Response,
ClassificationRulesTagClassificationVersiondefaultResponse,
DataSourcesCreateOrUpdate200Response,
DataSourcesCreateOrUpdate201Response,
DataSourcesCreateOrUpdatedefaultResponse,
DataSourcesGet200Response,
DataSourcesGetdefaultResponse,
DataSourcesDelete200Response,
DataSourcesDelete204Response,
DataSourcesDeletedefaultResponse,
DataSourcesListAll200Response,
DataSourcesListAlldefaultResponse,
FiltersGet200Response,
FiltersGetdefaultResponse,
FiltersCreateOrUpdate200Response,
FiltersCreateOrUpdate201Response,
FiltersCreateOrUpdatedefaultResponse,
ScansCreateOrUpdate200Response,
ScansCreateOrUpdate201Response,
ScansCreateOrUpdatedefaultResponse,
ScansGet200Response,
ScansGetdefaultResponse,
ScansDelete200Response,
ScansDelete204Response,
ScansDeletedefaultResponse,
ScansListByDataSource200Response,
ScansListByDataSourcedefaultResponse,
ScanResultRunScan202Response,
ScanResultRunScandefaultResponse,
ScanResultCancelScan202Response,
ScanResultCancelScandefaultResponse,
ScanResultListScanHistory200Response,
ScanResultListScanHistorydefaultResponse,
ScanRulesetsGet200Response,
ScanRulesetsGetdefaultResponse,
ScanRulesetsCreateOrUpdate200Response,
ScanRulesetsCreateOrUpdate201Response,
ScanRulesetsCreateOrUpdatedefaultResponse,
ScanRulesetsDelete200Response,
ScanRulesetsDelete204Response,
ScanRulesetsDeletedefaultResponse,
ScanRulesetsListAll200Response,
ScanRulesetsListAlldefaultResponse,
SystemScanRulesetsListAll200Response,
SystemScanRulesetsListAlldefaultResponse,
SystemScanRulesetsGet200Response,
SystemScanRulesetsGetdefaultResponse,
SystemScanRulesetsGetByVersion200Response,
SystemScanRulesetsGetByVersiondefaultResponse,
SystemScanRulesetsGetLatest200Response,
SystemScanRulesetsGetLatestdefaultResponse,
SystemScanRulesetsListVersionsByDataSource200Response,
SystemScanRulesetsListVersionsByDataSourcedefaultResponse,
TriggersGetTrigger200Response,
TriggersGetTriggerdefaultResponse,
TriggersCreateTrigger200Response,
TriggersCreateTrigger201Response,
TriggersCreateTriggerdefaultResponse,
TriggersDeleteTrigger200Response,
TriggersDeleteTrigger204Response,
TriggersDeleteTriggerdefaultResponse,
} from "./responses";
import { getClient, ClientOptions, Client } from "@azure-rest/core-client";
import { TokenCredential } from "@azure/core-auth";
export interface KeyVaultConnectionsDelete {
/** Gets key vault information */
get(
options?: KeyVaultConnectionsGetParameters
): Promise<KeyVaultConnectionsGet200Response | KeyVaultConnectionsGetdefaultResponse>;
/** Creates an instance of a key vault connection */
put(
options: KeyVaultConnectionsCreateParameters
): Promise<KeyVaultConnectionsCreate200Response | KeyVaultConnectionsCreatedefaultResponse>;
/** Deletes the key vault connection associated with the account */
delete(
options?: KeyVaultConnectionsDeleteParameters
): Promise<
| KeyVaultConnectionsDelete200Response
| KeyVaultConnectionsDelete204Response
| KeyVaultConnectionsDeletedefaultResponse
>;
}
export interface KeyVaultConnectionsListAll {
/** List key vault connections in account */
get(
options?: KeyVaultConnectionsListAllParameters
): Promise<KeyVaultConnectionsListAll200Response | KeyVaultConnectionsListAlldefaultResponse>;
}
export interface ClassificationRulesDelete {
/** Get a classification rule */
get(
options?: ClassificationRulesGetParameters
): Promise<ClassificationRulesGet200Response | ClassificationRulesGetdefaultResponse>;
/** Creates or Updates a classification rule */
put(
options?: ClassificationRulesCreateOrUpdateParameters
): Promise<
| ClassificationRulesCreateOrUpdate200Response
| ClassificationRulesCreateOrUpdate201Response
| ClassificationRulesCreateOrUpdatedefaultResponse
>;
/** Deletes a classification rule */
delete(
options?: ClassificationRulesDeleteParameters
): Promise<
| ClassificationRulesDelete200Response
| ClassificationRulesDelete204Response
| ClassificationRulesDeletedefaultResponse
>;
}
export interface ClassificationRulesListAll {
/** List classification rules in Account */
get(
options?: ClassificationRulesListAllParameters
): Promise<ClassificationRulesListAll200Response | ClassificationRulesListAlldefaultResponse>;
}
export interface ClassificationRulesListVersionsByClassificationRuleName {
/** Lists the rule versions of a classification rule */
get(
options?: ClassificationRulesListVersionsByClassificationRuleNameParameters
): Promise<
| ClassificationRulesListVersionsByClassificationRuleName200Response
| ClassificationRulesListVersionsByClassificationRuleNamedefaultResponse
>;
}
export interface ClassificationRulesTagClassificationVersion {
/** Sets Classification Action on a specific classification rule version. */
post(
options?: ClassificationRulesTagClassificationVersionParameters
): Promise<
| ClassificationRulesTagClassificationVersion202Response
| ClassificationRulesTagClassificationVersiondefaultResponse
>;
}
export interface DataSourcesDelete {
/** Creates or Updates a data source */
put(
options?: DataSourcesCreateOrUpdateParameters
): Promise<
| DataSourcesCreateOrUpdate200Response
| DataSourcesCreateOrUpdate201Response
| DataSourcesCreateOrUpdatedefaultResponse
>;
/** Get a data source */
get(
options?: DataSourcesGetParameters
): Promise<DataSourcesGet200Response | DataSourcesGetdefaultResponse>;
/** Deletes a data source */
delete(
options?: DataSourcesDeleteParameters
): Promise<
DataSourcesDelete200Response | DataSourcesDelete204Response | DataSourcesDeletedefaultResponse
>;
}
export interface DataSourcesListAll {
/** List data sources in Data catalog */
get(
options?: DataSourcesListAllParameters
): Promise<DataSourcesListAll200Response | DataSourcesListAlldefaultResponse>;
}
export interface FiltersCreateOrUpdate {
/** Get a filter */
get(options?: FiltersGetParameters): Promise<FiltersGet200Response | FiltersGetdefaultResponse>;
/** Creates or updates a filter */
put(
options?: FiltersCreateOrUpdateParameters
): Promise<
| FiltersCreateOrUpdate200Response
| FiltersCreateOrUpdate201Response
| FiltersCreateOrUpdatedefaultResponse
>;
}
export interface ScansDelete {
/** Creates an instance of a scan */
put(
options: ScansCreateOrUpdateParameters
): Promise<
| ScansCreateOrUpdate200Response
| ScansCreateOrUpdate201Response
| ScansCreateOrUpdatedefaultResponse
>;
/** Gets a scan information */
get(options?: ScansGetParameters): Promise<ScansGet200Response | ScansGetdefaultResponse>;
/** Deletes the scan associated with the data source */
delete(
options?: ScansDeleteParameters
): Promise<ScansDelete200Response | ScansDelete204Response | ScansDeletedefaultResponse>;
}
export interface ScansListByDataSource {
/** List scans in data source */
get(
options?: ScansListByDataSourceParameters
): Promise<ScansListByDataSource200Response | ScansListByDataSourcedefaultResponse>;
}
export interface ScanResultRunScan {
/** Runs the scan */
put(
options?: ScanResultRunScanParameters
): Promise<ScanResultRunScan202Response | ScanResultRunScandefaultResponse>;
}
export interface ScanResultCancelScan {
/** Cancels a scan */
post(
options?: ScanResultCancelScanParameters
): Promise<ScanResultCancelScan202Response | ScanResultCancelScandefaultResponse>;
}
export interface ScanResultListScanHistory {
/** Lists the scan history of a scan */
get(
options?: ScanResultListScanHistoryParameters
): Promise<ScanResultListScanHistory200Response | ScanResultListScanHistorydefaultResponse>;
}
export interface ScanRulesetsDelete {
/** Get a scan ruleset */
get(
options?: ScanRulesetsGetParameters
): Promise<ScanRulesetsGet200Response | ScanRulesetsGetdefaultResponse>;
/** Creates or Updates a scan ruleset */
put(
options?: ScanRulesetsCreateOrUpdateParameters
): Promise<
| ScanRulesetsCreateOrUpdate200Response
| ScanRulesetsCreateOrUpdate201Response
| ScanRulesetsCreateOrUpdatedefaultResponse
>;
/** Deletes a scan ruleset */
delete(
options?: ScanRulesetsDeleteParameters
): Promise<
| ScanRulesetsDelete200Response
| ScanRulesetsDelete204Response
| ScanRulesetsDeletedefaultResponse
>;
}
export interface ScanRulesetsListAll {
/** List scan rulesets in Data catalog */
get(
options?: ScanRulesetsListAllParameters
): Promise<ScanRulesetsListAll200Response | ScanRulesetsListAlldefaultResponse>;
}
export interface SystemScanRulesetsListAll {
/** List all system scan rulesets for an account */
get(
options?: SystemScanRulesetsListAllParameters
): Promise<SystemScanRulesetsListAll200Response | SystemScanRulesetsListAlldefaultResponse>;
}
export interface SystemScanRulesetsGet {
/** Get a system scan ruleset for a data source */
get(
options?: SystemScanRulesetsGetParameters
): Promise<SystemScanRulesetsGet200Response | SystemScanRulesetsGetdefaultResponse>;
}
export interface SystemScanRulesetsGetByVersion {
/** Get a scan ruleset by version */
get(
options?: SystemScanRulesetsGetByVersionParameters
): Promise<
SystemScanRulesetsGetByVersion200Response | SystemScanRulesetsGetByVersiondefaultResponse
>;
}
export interface SystemScanRulesetsGetLatest {
/** Get the latest version of a system scan ruleset */
get(
options?: SystemScanRulesetsGetLatestParameters
): Promise<SystemScanRulesetsGetLatest200Response | SystemScanRulesetsGetLatestdefaultResponse>;
}
export interface SystemScanRulesetsListVersionsByDataSource {
/** List system scan ruleset versions in Data catalog */
get(
options?: SystemScanRulesetsListVersionsByDataSourceParameters
): Promise<
| SystemScanRulesetsListVersionsByDataSource200Response
| SystemScanRulesetsListVersionsByDataSourcedefaultResponse
>;
}
export interface TriggersDeleteTrigger {
/** Gets trigger information */
get(
options?: TriggersGetTriggerParameters
): Promise<TriggersGetTrigger200Response | TriggersGetTriggerdefaultResponse>;
/** Creates an instance of a trigger */
put(
options: TriggersCreateTriggerParameters
): Promise<
| TriggersCreateTrigger200Response
| TriggersCreateTrigger201Response
| TriggersCreateTriggerdefaultResponse
>;
/** Deletes the trigger associated with the scan */
delete(
options?: TriggersDeleteTriggerParameters
): Promise<
| TriggersDeleteTrigger200Response
| TriggersDeleteTrigger204Response
| TriggersDeleteTriggerdefaultResponse
>;
}
export interface Routes {
/** Resource for '/azureKeyVaults/\{keyVaultName\}' has methods for the following verbs: get, put, delete */
(path: "/azureKeyVaults/{keyVaultName}", keyVaultName: string): KeyVaultConnectionsDelete;
/** Resource for '/azureKeyVaults' has methods for the following verbs: get */
(path: "/azureKeyVaults"): KeyVaultConnectionsListAll;
/** Resource for '/classificationrules/\{classificationRuleName\}' has methods for the following verbs: get, put, delete */
(
path: "/classificationrules/{classificationRuleName}",
classificationRuleName: string
): ClassificationRulesDelete;
/** Resource for '/classificationrules' has methods for the following verbs: get */
(path: "/classificationrules"): ClassificationRulesListAll;
/** Resource for '/classificationrules/\{classificationRuleName\}/versions' has methods for the following verbs: get */
(
path: "/classificationrules/{classificationRuleName}/versions",
classificationRuleName: string
): ClassificationRulesListVersionsByClassificationRuleName;
/** Resource for '/classificationrules/\{classificationRuleName\}/versions/\{classificationRuleVersion\}/:tag' has methods for the following verbs: post */
(
path: "/classificationrules/{classificationRuleName}/versions/{classificationRuleVersion}/:tag",
classificationRuleName: string,
classificationRuleVersion: string
): ClassificationRulesTagClassificationVersion;
/** Resource for '/datasources/\{dataSourceName\}' has methods for the following verbs: put, get, delete */
(path: "/datasources/{dataSourceName}", dataSourceName: string): DataSourcesDelete;
/** Resource for '/datasources' has methods for the following verbs: get */
(path: "/datasources"): DataSourcesListAll;
/** Resource for '/datasources/\{dataSourceName\}/scans/\{scanName\}/filters/custom' has methods for the following verbs: get, put */
(
path: "/datasources/{dataSourceName}/scans/{scanName}/filters/custom",
dataSourceName: string,
scanName: string
): FiltersCreateOrUpdate;
/** Resource for '/datasources/\{dataSourceName\}/scans/\{scanName\}' has methods for the following verbs: put, get, delete */
(
path: "/datasources/{dataSourceName}/scans/{scanName}",
dataSourceName: string,
scanName: string
): ScansDelete;
/** Resource for '/datasources/\{dataSourceName\}/scans' has methods for the following verbs: get */
(path: "/datasources/{dataSourceName}/scans", dataSourceName: string): ScansListByDataSource;
/** Resource for '/datasources/\{dataSourceName\}/scans/\{scanName\}/runs/\{runId\}' has methods for the following verbs: put */
(
path: "/datasources/{dataSourceName}/scans/{scanName}/runs/{runId}",
dataSourceName: string,
scanName: string,
runId: string
): ScanResultRunScan;
/** Resource for '/datasources/\{dataSourceName\}/scans/\{scanName\}/runs/\{runId\}/:cancel' has methods for the following verbs: post */
(
path: "/datasources/{dataSourceName}/scans/{scanName}/runs/{runId}/:cancel",
dataSourceName: string,
scanName: string,
runId: string
): ScanResultCancelScan;
/** Resource for '/datasources/\{dataSourceName\}/scans/\{scanName\}/runs' has methods for the following verbs: get */
(
path: "/datasources/{dataSourceName}/scans/{scanName}/runs",
dataSourceName: string,
scanName: string
): ScanResultListScanHistory;
/** Resource for '/scanrulesets/\{scanRulesetName\}' has methods for the following verbs: get, put, delete */
(path: "/scanrulesets/{scanRulesetName}", scanRulesetName: string): ScanRulesetsDelete;
/** Resource for '/scanrulesets' has methods for the following verbs: get */
(path: "/scanrulesets"): ScanRulesetsListAll;
/** Resource for '/systemScanRulesets' has methods for the following verbs: get */
(path: "/systemScanRulesets"): SystemScanRulesetsListAll;
/** Resource for '/systemScanRulesets/datasources/\{dataSourceType\}' has methods for the following verbs: get */
(
path: "/systemScanRulesets/datasources/{dataSourceType}",
dataSourceType: string
): SystemScanRulesetsGet;
/** Resource for '/systemScanRulesets/versions/\{version\}' has methods for the following verbs: get */
(path: "/systemScanRulesets/versions/{version}", version: string): SystemScanRulesetsGetByVersion;
/** Resource for '/systemScanRulesets/versions/latest' has methods for the following verbs: get */
(path: "/systemScanRulesets/versions/latest"): SystemScanRulesetsGetLatest;
/** Resource for '/systemScanRulesets/versions' has methods for the following verbs: get */
(path: "/systemScanRulesets/versions"): SystemScanRulesetsListVersionsByDataSource;
/** Resource for '/datasources/\{dataSourceName\}/scans/\{scanName\}/triggers/default' has methods for the following verbs: get, put, delete */
(
path: "/datasources/{dataSourceName}/scans/{scanName}/triggers/default",
dataSourceName: string,
scanName: string
): TriggersDeleteTrigger;
}
export type PurviewScanningRestClient = Client & {
path: Routes;
};
export default function PurviewScanning(
Endpoint: string,
credentials: TokenCredential,
options: ClientOptions = {}
): PurviewScanningRestClient {
const baseUrl = options.baseUrl ?? `${Endpoint}`;
options.apiVersion = options.apiVersion ?? "2018-12-01-preview";
options = {
...options,
credentials: {
scopes: ["https://purview.azure.net/.default"],
},
};
return getClient(baseUrl, credentials, options) as PurviewScanningRestClient;
}

Просмотреть файл

@ -0,0 +1,511 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import {
AzureKeyVault,
ErrorResponseModel,
AzureKeyVaultList,
ClassificationRule,
ClassificationRuleList,
OperationResponse,
DataSource,
DataSourceList,
Filter,
Scan,
ScanList,
ScanHistoryList,
ScanRuleset,
ScanRulesetList,
SystemScanRulesetList,
SystemScanRuleset,
Trigger,
} from "./models";
import { HttpResponse } from "@azure-rest/core-client";
/** Gets key vault information */
export interface KeyVaultConnectionsGet200Response extends HttpResponse {
status: "200";
body: AzureKeyVault;
}
/** Gets key vault information */
export interface KeyVaultConnectionsGetdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Creates an instance of a key vault connection */
export interface KeyVaultConnectionsCreate200Response extends HttpResponse {
status: "200";
body: AzureKeyVault;
}
/** Creates an instance of a key vault connection */
export interface KeyVaultConnectionsCreatedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Deletes the key vault connection associated with the account */
export interface KeyVaultConnectionsDelete200Response extends HttpResponse {
status: "200";
body: AzureKeyVault;
}
/** Deletes the key vault connection associated with the account */
export interface KeyVaultConnectionsDelete204Response extends HttpResponse {
status: "204";
}
/** Deletes the key vault connection associated with the account */
export interface KeyVaultConnectionsDeletedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** List key vault connections in account */
export interface KeyVaultConnectionsListAll200Response extends HttpResponse {
status: "200";
body: AzureKeyVaultList;
}
/** List key vault connections in account */
export interface KeyVaultConnectionsListAlldefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Get a classification rule */
export interface ClassificationRulesGet200Response extends HttpResponse {
status: "200";
body: ClassificationRule;
}
/** Get a classification rule */
export interface ClassificationRulesGetdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Creates or Updates a classification rule */
export interface ClassificationRulesCreateOrUpdate200Response extends HttpResponse {
status: "200";
body: ClassificationRule;
}
/** Creates or Updates a classification rule */
export interface ClassificationRulesCreateOrUpdate201Response extends HttpResponse {
status: "201";
body: ClassificationRule;
}
/** Creates or Updates a classification rule */
export interface ClassificationRulesCreateOrUpdatedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Deletes a classification rule */
export interface ClassificationRulesDelete200Response extends HttpResponse {
status: "200";
body: ClassificationRule;
}
/** Deletes a classification rule */
export interface ClassificationRulesDelete204Response extends HttpResponse {
status: "204";
}
/** Deletes a classification rule */
export interface ClassificationRulesDeletedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** List classification rules in Account */
export interface ClassificationRulesListAll200Response extends HttpResponse {
status: "200";
body: ClassificationRuleList;
}
/** List classification rules in Account */
export interface ClassificationRulesListAlldefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Lists the rule versions of a classification rule */
export interface ClassificationRulesListVersionsByClassificationRuleName200Response
extends HttpResponse {
status: "200";
body: ClassificationRuleList;
}
/** Lists the rule versions of a classification rule */
export interface ClassificationRulesListVersionsByClassificationRuleNamedefaultResponse
extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Sets Classification Action on a specific classification rule version. */
export interface ClassificationRulesTagClassificationVersion202Response extends HttpResponse {
status: "202";
body: OperationResponse;
}
/** Sets Classification Action on a specific classification rule version. */
export interface ClassificationRulesTagClassificationVersiondefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Creates or Updates a data source */
export interface DataSourcesCreateOrUpdate200Response extends HttpResponse {
status: "200";
body: DataSource;
}
/** Creates or Updates a data source */
export interface DataSourcesCreateOrUpdate201Response extends HttpResponse {
status: "201";
body: DataSource;
}
/** Creates or Updates a data source */
export interface DataSourcesCreateOrUpdatedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Get a data source */
export interface DataSourcesGet200Response extends HttpResponse {
status: "200";
body: DataSource;
}
/** Get a data source */
export interface DataSourcesGetdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Deletes a data source */
export interface DataSourcesDelete200Response extends HttpResponse {
status: "200";
body: DataSource;
}
/** Deletes a data source */
export interface DataSourcesDelete204Response extends HttpResponse {
status: "204";
}
/** Deletes a data source */
export interface DataSourcesDeletedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** List data sources in Data catalog */
export interface DataSourcesListAll200Response extends HttpResponse {
status: "200";
body: DataSourceList;
}
/** List data sources in Data catalog */
export interface DataSourcesListAlldefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Get a filter */
export interface FiltersGet200Response extends HttpResponse {
status: "200";
body: Filter;
}
/** Get a filter */
export interface FiltersGetdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Creates or updates a filter */
export interface FiltersCreateOrUpdate200Response extends HttpResponse {
status: "200";
body: Filter;
}
/** Creates or updates a filter */
export interface FiltersCreateOrUpdate201Response extends HttpResponse {
status: "201";
body: Filter;
}
/** Creates or updates a filter */
export interface FiltersCreateOrUpdatedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Creates an instance of a scan */
export interface ScansCreateOrUpdate200Response extends HttpResponse {
status: "200";
body: Scan;
}
/** Creates an instance of a scan */
export interface ScansCreateOrUpdate201Response extends HttpResponse {
status: "201";
body: Scan;
}
/** Creates an instance of a scan */
export interface ScansCreateOrUpdatedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Gets a scan information */
export interface ScansGet200Response extends HttpResponse {
status: "200";
body: Scan;
}
/** Gets a scan information */
export interface ScansGetdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Deletes the scan associated with the data source */
export interface ScansDelete200Response extends HttpResponse {
status: "200";
body: Scan;
}
/** Deletes the scan associated with the data source */
export interface ScansDelete204Response extends HttpResponse {
status: "204";
}
/** Deletes the scan associated with the data source */
export interface ScansDeletedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** List scans in data source */
export interface ScansListByDataSource200Response extends HttpResponse {
status: "200";
body: ScanList;
}
/** List scans in data source */
export interface ScansListByDataSourcedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Runs the scan */
export interface ScanResultRunScan202Response extends HttpResponse {
status: "202";
body: OperationResponse;
}
/** Runs the scan */
export interface ScanResultRunScandefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Cancels a scan */
export interface ScanResultCancelScan202Response extends HttpResponse {
status: "202";
body: OperationResponse;
}
/** Cancels a scan */
export interface ScanResultCancelScandefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Lists the scan history of a scan */
export interface ScanResultListScanHistory200Response extends HttpResponse {
status: "200";
body: ScanHistoryList;
}
/** Lists the scan history of a scan */
export interface ScanResultListScanHistorydefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Get a scan ruleset */
export interface ScanRulesetsGet200Response extends HttpResponse {
status: "200";
body: ScanRuleset;
}
/** Get a scan ruleset */
export interface ScanRulesetsGetdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Creates or Updates a scan ruleset */
export interface ScanRulesetsCreateOrUpdate200Response extends HttpResponse {
status: "200";
body: ScanRuleset;
}
/** Creates or Updates a scan ruleset */
export interface ScanRulesetsCreateOrUpdate201Response extends HttpResponse {
status: "201";
body: ScanRuleset;
}
/** Creates or Updates a scan ruleset */
export interface ScanRulesetsCreateOrUpdatedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Deletes a scan ruleset */
export interface ScanRulesetsDelete200Response extends HttpResponse {
status: "200";
body: ScanRuleset;
}
/** Deletes a scan ruleset */
export interface ScanRulesetsDelete204Response extends HttpResponse {
status: "204";
}
/** Deletes a scan ruleset */
export interface ScanRulesetsDeletedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** List scan rulesets in Data catalog */
export interface ScanRulesetsListAll200Response extends HttpResponse {
status: "200";
body: ScanRulesetList;
}
/** List scan rulesets in Data catalog */
export interface ScanRulesetsListAlldefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** List all system scan rulesets for an account */
export interface SystemScanRulesetsListAll200Response extends HttpResponse {
status: "200";
body: SystemScanRulesetList;
}
/** List all system scan rulesets for an account */
export interface SystemScanRulesetsListAlldefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Get a system scan ruleset for a data source */
export interface SystemScanRulesetsGet200Response extends HttpResponse {
status: "200";
body: SystemScanRuleset;
}
/** Get a system scan ruleset for a data source */
export interface SystemScanRulesetsGetdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Get a scan ruleset by version */
export interface SystemScanRulesetsGetByVersion200Response extends HttpResponse {
status: "200";
body: SystemScanRuleset;
}
/** Get a scan ruleset by version */
export interface SystemScanRulesetsGetByVersiondefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Get the latest version of a system scan ruleset */
export interface SystemScanRulesetsGetLatest200Response extends HttpResponse {
status: "200";
body: SystemScanRuleset;
}
/** Get the latest version of a system scan ruleset */
export interface SystemScanRulesetsGetLatestdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** List system scan ruleset versions in Data catalog */
export interface SystemScanRulesetsListVersionsByDataSource200Response extends HttpResponse {
status: "200";
body: SystemScanRulesetList;
}
/** List system scan ruleset versions in Data catalog */
export interface SystemScanRulesetsListVersionsByDataSourcedefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Gets trigger information */
export interface TriggersGetTrigger200Response extends HttpResponse {
status: "200";
body: Trigger;
}
/** Gets trigger information */
export interface TriggersGetTriggerdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Creates an instance of a trigger */
export interface TriggersCreateTrigger200Response extends HttpResponse {
status: "200";
body: Trigger;
}
/** Creates an instance of a trigger */
export interface TriggersCreateTrigger201Response extends HttpResponse {
status: "201";
body: Trigger;
}
/** Creates an instance of a trigger */
export interface TriggersCreateTriggerdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}
/** Deletes the trigger associated with the scan */
export interface TriggersDeleteTrigger200Response extends HttpResponse {
status: "200";
body: Trigger;
}
/** Deletes the trigger associated with the scan */
export interface TriggersDeleteTrigger204Response extends HttpResponse {
status: "204";
}
/** Deletes the trigger associated with the scan */
export interface TriggersDeleteTriggerdefaultResponse extends HttpResponse {
status: "500";
body: ErrorResponseModel;
}

Просмотреть файл

@ -0,0 +1,24 @@
# Azure Purview Scanning TypeScript Protocol Layer
> see https://aka.ms/autorest
## Configuration
```yaml
package-name: "@azure-rest/purview-scanning"
title: PurviewScanning
description: Purview Scanning Client
generate-metadata: false
license-header: MICROSOFT_MIT_NO_VERSION
output-folder: ../
source-code-folder-path: ./src
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/purview/data-plane/Azure.Analytics.Purview.Scanning/preview/2018-12-01-preview/scanningService.json
package-version: 1.0.0-beta.1
rest-level-client: true
add-credentials: true
credential-scopes: "https://purview.azure.net/.default"
use-extension:
"@autorest/typescript": "https://aka.ms/azsdk/typescript/rlc"
modelerfour:
lenient-model-deduplication: true
```

Просмотреть файл

@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { PurviewScanningRestClient } from "../../src";
import { Recorder } from "@azure/test-utils-recorder";
import { assert } from "chai";
import { createClient, createRecorder } from "./utils/recordedClient";
import { Context } from "mocha";
describe("List data sources", () => {
let recorder: Recorder;
let client: PurviewScanningRestClient;
beforeEach(function (this: Context) {
recorder = createRecorder(this);
client = createClient();
});
afterEach(async function () {
await recorder.stop();
});
it("should list all available data sources", async () => {
const result = await client.path("/datasources").get();
if (result.status !== "200") {
assert.fail(`GET "/datasources" failed with ${result.status}`);
}
assert.isDefined(result.body.value?.length);
});
});

Просмотреть файл

@ -0,0 +1,2 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

Просмотреть файл

@ -0,0 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import * as dotenv from "dotenv";
dotenv.config();

Просмотреть файл

@ -0,0 +1,55 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/// <reference lib="esnext.asynciterable" />
import { Context } from "mocha";
import { env, Recorder, record, RecorderEnvironmentSetup } from "@azure/test-utils-recorder";
import PurviewScanning, { PurviewScanningRestClient } from "../../../src";
import { ClientSecretCredential } from "@azure/identity";
import "./env";
import { ClientOptions } from "@azure-rest/core-client";
const replaceableVariables: { [k: string]: string } = {
ENDPOINT: "https://endpoint",
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
};
export const environmentSetup: RecorderEnvironmentSetup = {
replaceableVariables,
customizationsOnRecordings: [
(recording: string): string =>
recording.replace(/"access_token"\s?:\s?"[^"]*"/g, `"access_token":"access_token"`),
// If we put ENDPOINT in replaceableVariables above, it will not capture
// the endpoint string used with nock, which will be expanded to
// https://<endpoint>:443/ and therefore will not match, so we have to do
// this instead.
(recording: string): string => {
const replaced = recording.replace("endpoint:443", "endpoint");
return replaced;
},
],
queryParametersToSkip: [],
};
export function createClient(options?: ClientOptions): PurviewScanningRestClient {
const credential = new ClientSecretCredential(
env.AZURE_TENANT_ID,
env.AZURE_CLIENT_ID,
env.AZURE_CLIENT_SECRET
);
return PurviewScanning(env.ENDPOINT, credential, options);
}
/**
* creates the recorder and reads the environment variables from the `.env` file.
* Should be called first in the test suite to make sure environment variables are
* read before they are being used.
*/
export function createRecorder(context: Context): Recorder {
return record(context, environmentSetup);
}

Просмотреть файл

@ -0,0 +1,11 @@
{
"extends": "../../../tsconfig.package",
"compilerOptions": {
"outDir": "./dist-esm",
"declarationDir": "./types",
"paths": {
"@azure-rest/purview-scanning": ["./src/index"]
}
},
"include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts"]
}

Просмотреть файл

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"extends": ["../../../tsdoc.json"]
}