@azure-rest/purview-scanning 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Release History
2
2
 
3
+ ## 1.0.0-beta.2 (2021-09-30)
4
+
5
+ - refresh package with latest swagger and code generator.
6
+ - add paging helper support.
7
+
3
8
  ## 1.0.0-beta.1 (2021-05-11)
4
9
 
5
10
  - First release of package, see README.md for details.
package/README.md CHANGED
@@ -8,7 +8,12 @@ Azure Purview Scanning is a fully managed cloud service whose users can scan you
8
8
 
9
9
  **Please rely heavily on the [service's documentation][scanning_product_documentation] and our [Rest client docs][rest_client] to use this library**
10
10
 
11
- [Source code][source_code] | [Package (NPM)][scanning_npm] | [API reference documentation][scanning_ref_docs]| [Product documentation][scanning_product_documentation]
11
+ Key links:
12
+
13
+ - [Source code][source_code]
14
+ - [Package (NPM)][scanning_npm]
15
+ - [API reference documentation][scanning_ref_docs]
16
+ - [Product documentation][scanning_product_documentation]
12
17
 
13
18
  ## Getting started
14
19
 
@@ -54,7 +59,7 @@ Use the returned token credential to authenticate the client:
54
59
  import PurviewScanning from "@azure-rest/purview-scanning";
55
60
  import { DefaultAzureCredential } from "@azure/identity";
56
61
  const client = PurviewScanning(
57
- "https://<my-account-name>.scanning.purview.azure.com",
62
+ "https://<my-account-name>.scan.purview.azure.com",
58
63
  new DefaultAzureCredential()
59
64
  );
60
65
  ```
@@ -74,23 +79,30 @@ The following section shows you how to initialize and authenticate your client,
74
79
  ### List All Data Sources
75
80
 
76
81
  ```typescript
77
- import PurviewScanning from "@azure-rest/purview-scanning";
82
+ import PurviewScanning, { paginate, DataSource } from "@azure-rest/purview-scanning";
83
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
78
84
  import { DefaultAzureCredential } from "@azure/identity";
79
85
 
80
86
  async function main() {
81
87
  console.log("== List dataSources ==");
82
88
  const client = PurviewScanning(
83
- "https://<my-account-name>.scanning.purview.azure.com",
89
+ "https://<my-account-name>.scan.purview.azure.com",
84
90
  new DefaultAzureCredential()
85
91
  );
86
92
 
87
93
  const dataSources = await client.path("/datasources").get();
88
-
89
94
  if (dataSources.status !== "200") {
90
95
  throw dataSources.body.error;
91
96
  }
97
+ const iter = paginate(client, dataSources)
98
+
99
+ const items: DataSource[] = [];
100
+
101
+ for await (const item of <PagedAsyncIterableIterator<DataSource, (DataSource)[], PageSettings>>iter) {
102
+ items.push(item);
103
+ }
92
104
 
93
- console.log(dataSources.body.value?.map((ds) => ds.name).join("\n"));
105
+ console.log(items?.map((ds) => ds.name).join("\n"));
94
106
  }
95
107
 
96
108
  main().catch(console.error);
@@ -108,13 +120,13 @@ import { setLogLevel } from "@azure/logger";
108
120
  setLogLevel("info");
109
121
  ```
110
122
 
111
- 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).
123
+ 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/main/sdk/core/logger).
112
124
 
113
125
  ## Next steps
114
126
 
115
127
  ## Contributing
116
128
 
117
- 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.
129
+ If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
118
130
 
119
131
  ## Related projects
120
132
 
@@ -125,14 +137,14 @@ If you'd like to contribute to this library, please read the [contributing guide
125
137
  <!-- LINKS -->
126
138
 
127
139
  [scanning_product_documentation]: https://azure.microsoft.com/services/purview/
128
- [rest_client]: https://github.com/Azure/azure-sdk-for-js/blob/master/documentation/rest-clients.md
129
- [source_code]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/purview/purview-scanning-rest
140
+ [rest_client]: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md
141
+ [source_code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/purview/purview-scanning-rest
130
142
  [scanning_npm]: https://www.npmjs.com/package/@azure-rest/purview-scanning
131
143
  [scanning_ref_docs]: https://azure.github.io/azure-sdk-for-js
132
144
  [azure_subscription]: https://azure.microsoft.com/free/
133
145
  [purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal
134
146
  [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
135
- [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#credentials
147
+ [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials
136
148
  [azure_identity_npm]: https://www.npmjs.com/package/@azure/identity
137
149
  [enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role
138
- [default_azure_credential]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential
150
+ [default_azure_credential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
package/dist/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var coreClient = require('@azure-rest/core-client');
6
+ var corePaging = require('@azure/core-paging');
4
7
 
5
8
  // Copyright (c) Microsoft Corporation.
6
9
  function PurviewScanning(Endpoint, credentials, options = {}) {
@@ -13,7 +16,75 @@ function PurviewScanning(Endpoint, credentials, options = {}) {
13
16
  return coreClient.getClient(baseUrl, credentials, options);
14
17
  }
15
18
 
19
+ // Copyright (c) Microsoft Corporation.
20
+ /**
21
+ * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
22
+ * @param client - Client to use for sending the next page requests
23
+ * @param initialResponse - Initial response containing the nextLink and current page of elements
24
+ * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
25
+ * @returns - PagedAsyncIterableIterator to iterate the elements
26
+ */
27
+ function paginate(client, initialResponse, options = {}) {
28
+ let firstRun = true;
29
+ const itemName = "value";
30
+ const nextLinkName = "nextLink";
31
+ const { customGetPage } = options;
32
+ const pagedResult = {
33
+ firstPageLink: "",
34
+ getPage: typeof customGetPage === "function"
35
+ ? customGetPage
36
+ : async (pageLink) => {
37
+ const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
38
+ firstRun = false;
39
+ checkPagingRequest(result);
40
+ const nextLink = getNextLink(result.body, nextLinkName);
41
+ const values = getElements(result.body, itemName);
42
+ return {
43
+ page: values,
44
+ nextPageLink: nextLink,
45
+ };
46
+ },
47
+ };
48
+ return corePaging.getPagedAsyncIterator(pagedResult);
49
+ }
50
+ /**
51
+ * Gets for the value of nextLink in the body
52
+ */
53
+ function getNextLink(body, nextLinkName) {
54
+ if (!nextLinkName) {
55
+ return undefined;
56
+ }
57
+ const nextLink = body[nextLinkName];
58
+ if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
59
+ throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
60
+ }
61
+ return nextLink;
62
+ }
63
+ /**
64
+ * Gets the elements of the current request in the body.
65
+ */
66
+ function getElements(body, itemName) {
67
+ const value = body[itemName];
68
+ // value has to be an array according to the x-ms-pageable extension.
69
+ // The fact that this must be an array is used above to calculate the
70
+ // type of elements in the page in PaginateReturn
71
+ if (!Array.isArray(value)) {
72
+ throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
73
+ }
74
+ return value !== null && value !== void 0 ? value : [];
75
+ }
76
+ /**
77
+ * Checks if a request failed
78
+ */
79
+ function checkPagingRequest(response) {
80
+ const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
81
+ if (!Http2xxStatusCodes.includes(response.status)) {
82
+ throw coreClient.createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
83
+ }
84
+ }
85
+
16
86
  // Copyright (c) Microsoft Corporation.
17
87
 
18
- module.exports = PurviewScanning;
88
+ exports.default = PurviewScanning;
89
+ exports.paginate = paginate;
19
90
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/purviewScanning.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n KeyVaultConnectionsGetParameters,\n KeyVaultConnectionsCreateParameters,\n KeyVaultConnectionsDeleteParameters,\n KeyVaultConnectionsListAllParameters,\n ClassificationRulesGetParameters,\n ClassificationRulesCreateOrUpdateParameters,\n ClassificationRulesDeleteParameters,\n ClassificationRulesListAllParameters,\n ClassificationRulesListVersionsByClassificationRuleNameParameters,\n ClassificationRulesTagClassificationVersionParameters,\n DataSourcesCreateOrUpdateParameters,\n DataSourcesGetParameters,\n DataSourcesDeleteParameters,\n DataSourcesListAllParameters,\n FiltersGetParameters,\n FiltersCreateOrUpdateParameters,\n ScansCreateOrUpdateParameters,\n ScansGetParameters,\n ScansDeleteParameters,\n ScansListByDataSourceParameters,\n ScanResultRunScanParameters,\n ScanResultCancelScanParameters,\n ScanResultListScanHistoryParameters,\n ScanRulesetsGetParameters,\n ScanRulesetsCreateOrUpdateParameters,\n ScanRulesetsDeleteParameters,\n ScanRulesetsListAllParameters,\n SystemScanRulesetsListAllParameters,\n SystemScanRulesetsGetParameters,\n SystemScanRulesetsGetByVersionParameters,\n SystemScanRulesetsGetLatestParameters,\n SystemScanRulesetsListVersionsByDataSourceParameters,\n TriggersGetTriggerParameters,\n TriggersCreateTriggerParameters,\n TriggersDeleteTriggerParameters,\n} from \"./parameters\";\nimport {\n KeyVaultConnectionsGet200Response,\n KeyVaultConnectionsGetdefaultResponse,\n KeyVaultConnectionsCreate200Response,\n KeyVaultConnectionsCreatedefaultResponse,\n KeyVaultConnectionsDelete200Response,\n KeyVaultConnectionsDelete204Response,\n KeyVaultConnectionsDeletedefaultResponse,\n KeyVaultConnectionsListAll200Response,\n KeyVaultConnectionsListAlldefaultResponse,\n ClassificationRulesGet200Response,\n ClassificationRulesGetdefaultResponse,\n ClassificationRulesCreateOrUpdate200Response,\n ClassificationRulesCreateOrUpdate201Response,\n ClassificationRulesCreateOrUpdatedefaultResponse,\n ClassificationRulesDelete200Response,\n ClassificationRulesDelete204Response,\n ClassificationRulesDeletedefaultResponse,\n ClassificationRulesListAll200Response,\n ClassificationRulesListAlldefaultResponse,\n ClassificationRulesListVersionsByClassificationRuleName200Response,\n ClassificationRulesListVersionsByClassificationRuleNamedefaultResponse,\n ClassificationRulesTagClassificationVersion202Response,\n ClassificationRulesTagClassificationVersiondefaultResponse,\n DataSourcesCreateOrUpdate200Response,\n DataSourcesCreateOrUpdate201Response,\n DataSourcesCreateOrUpdatedefaultResponse,\n DataSourcesGet200Response,\n DataSourcesGetdefaultResponse,\n DataSourcesDelete200Response,\n DataSourcesDelete204Response,\n DataSourcesDeletedefaultResponse,\n DataSourcesListAll200Response,\n DataSourcesListAlldefaultResponse,\n FiltersGet200Response,\n FiltersGetdefaultResponse,\n FiltersCreateOrUpdate200Response,\n FiltersCreateOrUpdate201Response,\n FiltersCreateOrUpdatedefaultResponse,\n ScansCreateOrUpdate200Response,\n ScansCreateOrUpdate201Response,\n ScansCreateOrUpdatedefaultResponse,\n ScansGet200Response,\n ScansGetdefaultResponse,\n ScansDelete200Response,\n ScansDelete204Response,\n ScansDeletedefaultResponse,\n ScansListByDataSource200Response,\n ScansListByDataSourcedefaultResponse,\n ScanResultRunScan202Response,\n ScanResultRunScandefaultResponse,\n ScanResultCancelScan202Response,\n ScanResultCancelScandefaultResponse,\n ScanResultListScanHistory200Response,\n ScanResultListScanHistorydefaultResponse,\n ScanRulesetsGet200Response,\n ScanRulesetsGetdefaultResponse,\n ScanRulesetsCreateOrUpdate200Response,\n ScanRulesetsCreateOrUpdate201Response,\n ScanRulesetsCreateOrUpdatedefaultResponse,\n ScanRulesetsDelete200Response,\n ScanRulesetsDelete204Response,\n ScanRulesetsDeletedefaultResponse,\n ScanRulesetsListAll200Response,\n ScanRulesetsListAlldefaultResponse,\n SystemScanRulesetsListAll200Response,\n SystemScanRulesetsListAlldefaultResponse,\n SystemScanRulesetsGet200Response,\n SystemScanRulesetsGetdefaultResponse,\n SystemScanRulesetsGetByVersion200Response,\n SystemScanRulesetsGetByVersiondefaultResponse,\n SystemScanRulesetsGetLatest200Response,\n SystemScanRulesetsGetLatestdefaultResponse,\n SystemScanRulesetsListVersionsByDataSource200Response,\n SystemScanRulesetsListVersionsByDataSourcedefaultResponse,\n TriggersGetTrigger200Response,\n TriggersGetTriggerdefaultResponse,\n TriggersCreateTrigger200Response,\n TriggersCreateTrigger201Response,\n TriggersCreateTriggerdefaultResponse,\n TriggersDeleteTrigger200Response,\n TriggersDeleteTrigger204Response,\n TriggersDeleteTriggerdefaultResponse,\n} from \"./responses\";\nimport { getClient, ClientOptions, Client } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface KeyVaultConnectionsDelete {\n /** Gets key vault information */\n get(\n options?: KeyVaultConnectionsGetParameters\n ): Promise<KeyVaultConnectionsGet200Response | KeyVaultConnectionsGetdefaultResponse>;\n /** Creates an instance of a key vault connection */\n put(\n options: KeyVaultConnectionsCreateParameters\n ): Promise<KeyVaultConnectionsCreate200Response | KeyVaultConnectionsCreatedefaultResponse>;\n /** Deletes the key vault connection associated with the account */\n delete(\n options?: KeyVaultConnectionsDeleteParameters\n ): Promise<\n | KeyVaultConnectionsDelete200Response\n | KeyVaultConnectionsDelete204Response\n | KeyVaultConnectionsDeletedefaultResponse\n >;\n}\n\nexport interface KeyVaultConnectionsListAll {\n /** List key vault connections in account */\n get(\n options?: KeyVaultConnectionsListAllParameters\n ): Promise<KeyVaultConnectionsListAll200Response | KeyVaultConnectionsListAlldefaultResponse>;\n}\n\nexport interface ClassificationRulesDelete {\n /** Get a classification rule */\n get(\n options?: ClassificationRulesGetParameters\n ): Promise<ClassificationRulesGet200Response | ClassificationRulesGetdefaultResponse>;\n /** Creates or Updates a classification rule */\n put(\n options?: ClassificationRulesCreateOrUpdateParameters\n ): Promise<\n | ClassificationRulesCreateOrUpdate200Response\n | ClassificationRulesCreateOrUpdate201Response\n | ClassificationRulesCreateOrUpdatedefaultResponse\n >;\n /** Deletes a classification rule */\n delete(\n options?: ClassificationRulesDeleteParameters\n ): Promise<\n | ClassificationRulesDelete200Response\n | ClassificationRulesDelete204Response\n | ClassificationRulesDeletedefaultResponse\n >;\n}\n\nexport interface ClassificationRulesListAll {\n /** List classification rules in Account */\n get(\n options?: ClassificationRulesListAllParameters\n ): Promise<ClassificationRulesListAll200Response | ClassificationRulesListAlldefaultResponse>;\n}\n\nexport interface ClassificationRulesListVersionsByClassificationRuleName {\n /** Lists the rule versions of a classification rule */\n get(\n options?: ClassificationRulesListVersionsByClassificationRuleNameParameters\n ): Promise<\n | ClassificationRulesListVersionsByClassificationRuleName200Response\n | ClassificationRulesListVersionsByClassificationRuleNamedefaultResponse\n >;\n}\n\nexport interface ClassificationRulesTagClassificationVersion {\n /** Sets Classification Action on a specific classification rule version. */\n post(\n options?: ClassificationRulesTagClassificationVersionParameters\n ): Promise<\n | ClassificationRulesTagClassificationVersion202Response\n | ClassificationRulesTagClassificationVersiondefaultResponse\n >;\n}\n\nexport interface DataSourcesDelete {\n /** Creates or Updates a data source */\n put(\n options?: DataSourcesCreateOrUpdateParameters\n ): Promise<\n | DataSourcesCreateOrUpdate200Response\n | DataSourcesCreateOrUpdate201Response\n | DataSourcesCreateOrUpdatedefaultResponse\n >;\n /** Get a data source */\n get(\n options?: DataSourcesGetParameters\n ): Promise<DataSourcesGet200Response | DataSourcesGetdefaultResponse>;\n /** Deletes a data source */\n delete(\n options?: DataSourcesDeleteParameters\n ): Promise<\n DataSourcesDelete200Response | DataSourcesDelete204Response | DataSourcesDeletedefaultResponse\n >;\n}\n\nexport interface DataSourcesListAll {\n /** List data sources in Data catalog */\n get(\n options?: DataSourcesListAllParameters\n ): Promise<DataSourcesListAll200Response | DataSourcesListAlldefaultResponse>;\n}\n\nexport interface FiltersCreateOrUpdate {\n /** Get a filter */\n get(options?: FiltersGetParameters): Promise<FiltersGet200Response | FiltersGetdefaultResponse>;\n /** Creates or updates a filter */\n put(\n options?: FiltersCreateOrUpdateParameters\n ): Promise<\n | FiltersCreateOrUpdate200Response\n | FiltersCreateOrUpdate201Response\n | FiltersCreateOrUpdatedefaultResponse\n >;\n}\n\nexport interface ScansDelete {\n /** Creates an instance of a scan */\n put(\n options: ScansCreateOrUpdateParameters\n ): Promise<\n | ScansCreateOrUpdate200Response\n | ScansCreateOrUpdate201Response\n | ScansCreateOrUpdatedefaultResponse\n >;\n /** Gets a scan information */\n get(options?: ScansGetParameters): Promise<ScansGet200Response | ScansGetdefaultResponse>;\n /** Deletes the scan associated with the data source */\n delete(\n options?: ScansDeleteParameters\n ): Promise<ScansDelete200Response | ScansDelete204Response | ScansDeletedefaultResponse>;\n}\n\nexport interface ScansListByDataSource {\n /** List scans in data source */\n get(\n options?: ScansListByDataSourceParameters\n ): Promise<ScansListByDataSource200Response | ScansListByDataSourcedefaultResponse>;\n}\n\nexport interface ScanResultRunScan {\n /** Runs the scan */\n put(\n options?: ScanResultRunScanParameters\n ): Promise<ScanResultRunScan202Response | ScanResultRunScandefaultResponse>;\n}\n\nexport interface ScanResultCancelScan {\n /** Cancels a scan */\n post(\n options?: ScanResultCancelScanParameters\n ): Promise<ScanResultCancelScan202Response | ScanResultCancelScandefaultResponse>;\n}\n\nexport interface ScanResultListScanHistory {\n /** Lists the scan history of a scan */\n get(\n options?: ScanResultListScanHistoryParameters\n ): Promise<ScanResultListScanHistory200Response | ScanResultListScanHistorydefaultResponse>;\n}\n\nexport interface ScanRulesetsDelete {\n /** Get a scan ruleset */\n get(\n options?: ScanRulesetsGetParameters\n ): Promise<ScanRulesetsGet200Response | ScanRulesetsGetdefaultResponse>;\n /** Creates or Updates a scan ruleset */\n put(\n options?: ScanRulesetsCreateOrUpdateParameters\n ): Promise<\n | ScanRulesetsCreateOrUpdate200Response\n | ScanRulesetsCreateOrUpdate201Response\n | ScanRulesetsCreateOrUpdatedefaultResponse\n >;\n /** Deletes a scan ruleset */\n delete(\n options?: ScanRulesetsDeleteParameters\n ): Promise<\n | ScanRulesetsDelete200Response\n | ScanRulesetsDelete204Response\n | ScanRulesetsDeletedefaultResponse\n >;\n}\n\nexport interface ScanRulesetsListAll {\n /** List scan rulesets in Data catalog */\n get(\n options?: ScanRulesetsListAllParameters\n ): Promise<ScanRulesetsListAll200Response | ScanRulesetsListAlldefaultResponse>;\n}\n\nexport interface SystemScanRulesetsListAll {\n /** List all system scan rulesets for an account */\n get(\n options?: SystemScanRulesetsListAllParameters\n ): Promise<SystemScanRulesetsListAll200Response | SystemScanRulesetsListAlldefaultResponse>;\n}\n\nexport interface SystemScanRulesetsGet {\n /** Get a system scan ruleset for a data source */\n get(\n options?: SystemScanRulesetsGetParameters\n ): Promise<SystemScanRulesetsGet200Response | SystemScanRulesetsGetdefaultResponse>;\n}\n\nexport interface SystemScanRulesetsGetByVersion {\n /** Get a scan ruleset by version */\n get(\n options?: SystemScanRulesetsGetByVersionParameters\n ): Promise<\n SystemScanRulesetsGetByVersion200Response | SystemScanRulesetsGetByVersiondefaultResponse\n >;\n}\n\nexport interface SystemScanRulesetsGetLatest {\n /** Get the latest version of a system scan ruleset */\n get(\n options?: SystemScanRulesetsGetLatestParameters\n ): Promise<SystemScanRulesetsGetLatest200Response | SystemScanRulesetsGetLatestdefaultResponse>;\n}\n\nexport interface SystemScanRulesetsListVersionsByDataSource {\n /** List system scan ruleset versions in Data catalog */\n get(\n options?: SystemScanRulesetsListVersionsByDataSourceParameters\n ): Promise<\n | SystemScanRulesetsListVersionsByDataSource200Response\n | SystemScanRulesetsListVersionsByDataSourcedefaultResponse\n >;\n}\n\nexport interface TriggersDeleteTrigger {\n /** Gets trigger information */\n get(\n options?: TriggersGetTriggerParameters\n ): Promise<TriggersGetTrigger200Response | TriggersGetTriggerdefaultResponse>;\n /** Creates an instance of a trigger */\n put(\n options: TriggersCreateTriggerParameters\n ): Promise<\n | TriggersCreateTrigger200Response\n | TriggersCreateTrigger201Response\n | TriggersCreateTriggerdefaultResponse\n >;\n /** Deletes the trigger associated with the scan */\n delete(\n options?: TriggersDeleteTriggerParameters\n ): Promise<\n | TriggersDeleteTrigger200Response\n | TriggersDeleteTrigger204Response\n | TriggersDeleteTriggerdefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/azureKeyVaults/\\{keyVaultName\\}' has methods for the following verbs: get, put, delete */\n (path: \"/azureKeyVaults/{keyVaultName}\", keyVaultName: string): KeyVaultConnectionsDelete;\n /** Resource for '/azureKeyVaults' has methods for the following verbs: get */\n (path: \"/azureKeyVaults\"): KeyVaultConnectionsListAll;\n /** Resource for '/classificationrules/\\{classificationRuleName\\}' has methods for the following verbs: get, put, delete */\n (\n path: \"/classificationrules/{classificationRuleName}\",\n classificationRuleName: string\n ): ClassificationRulesDelete;\n /** Resource for '/classificationrules' has methods for the following verbs: get */\n (path: \"/classificationrules\"): ClassificationRulesListAll;\n /** Resource for '/classificationrules/\\{classificationRuleName\\}/versions' has methods for the following verbs: get */\n (\n path: \"/classificationrules/{classificationRuleName}/versions\",\n classificationRuleName: string\n ): ClassificationRulesListVersionsByClassificationRuleName;\n /** Resource for '/classificationrules/\\{classificationRuleName\\}/versions/\\{classificationRuleVersion\\}/:tag' has methods for the following verbs: post */\n (\n path: \"/classificationrules/{classificationRuleName}/versions/{classificationRuleVersion}/:tag\",\n classificationRuleName: string,\n classificationRuleVersion: string\n ): ClassificationRulesTagClassificationVersion;\n /** Resource for '/datasources/\\{dataSourceName\\}' has methods for the following verbs: put, get, delete */\n (path: \"/datasources/{dataSourceName}\", dataSourceName: string): DataSourcesDelete;\n /** Resource for '/datasources' has methods for the following verbs: get */\n (path: \"/datasources\"): DataSourcesListAll;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/filters/custom' has methods for the following verbs: get, put */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/filters/custom\",\n dataSourceName: string,\n scanName: string\n ): FiltersCreateOrUpdate;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}' has methods for the following verbs: put, get, delete */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}\",\n dataSourceName: string,\n scanName: string\n ): ScansDelete;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans' has methods for the following verbs: get */\n (path: \"/datasources/{dataSourceName}/scans\", dataSourceName: string): ScansListByDataSource;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/runs/\\{runId\\}' has methods for the following verbs: put */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/runs/{runId}\",\n dataSourceName: string,\n scanName: string,\n runId: string\n ): ScanResultRunScan;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/runs/\\{runId\\}/:cancel' has methods for the following verbs: post */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/runs/{runId}/:cancel\",\n dataSourceName: string,\n scanName: string,\n runId: string\n ): ScanResultCancelScan;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/runs' has methods for the following verbs: get */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/runs\",\n dataSourceName: string,\n scanName: string\n ): ScanResultListScanHistory;\n /** Resource for '/scanrulesets/\\{scanRulesetName\\}' has methods for the following verbs: get, put, delete */\n (path: \"/scanrulesets/{scanRulesetName}\", scanRulesetName: string): ScanRulesetsDelete;\n /** Resource for '/scanrulesets' has methods for the following verbs: get */\n (path: \"/scanrulesets\"): ScanRulesetsListAll;\n /** Resource for '/systemScanRulesets' has methods for the following verbs: get */\n (path: \"/systemScanRulesets\"): SystemScanRulesetsListAll;\n /** Resource for '/systemScanRulesets/datasources/\\{dataSourceType\\}' has methods for the following verbs: get */\n (\n path: \"/systemScanRulesets/datasources/{dataSourceType}\",\n dataSourceType: string\n ): SystemScanRulesetsGet;\n /** Resource for '/systemScanRulesets/versions/\\{version\\}' has methods for the following verbs: get */\n (path: \"/systemScanRulesets/versions/{version}\", version: string): SystemScanRulesetsGetByVersion;\n /** Resource for '/systemScanRulesets/versions/latest' has methods for the following verbs: get */\n (path: \"/systemScanRulesets/versions/latest\"): SystemScanRulesetsGetLatest;\n /** Resource for '/systemScanRulesets/versions' has methods for the following verbs: get */\n (path: \"/systemScanRulesets/versions\"): SystemScanRulesetsListVersionsByDataSource;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/triggers/default' has methods for the following verbs: get, put, delete */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/triggers/default\",\n dataSourceName: string,\n scanName: string\n ): TriggersDeleteTrigger;\n}\n\nexport type PurviewScanningRestClient = Client & {\n path: Routes;\n};\n\nexport default function PurviewScanning(\n Endpoint: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): PurviewScanningRestClient {\n const baseUrl = options.baseUrl ?? `${Endpoint}`;\n options.apiVersion = options.apiVersion ?? \"2018-12-01-preview\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://purview.azure.net/.default\"],\n },\n };\n\n return getClient(baseUrl, credentials, options) as PurviewScanningRestClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport PurviewScanning from \"./purviewScanning\";\n\nexport * from \"./purviewScanning\";\nexport * from \"./models\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\n\nexport default PurviewScanning;\n"],"names":["getClient"],"mappings":";;;;AAAA;SAwdwB,eAAe,CACrC,QAAgB,EAChB,WAA4B,EAC5B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,QAAQ,EAAE,CAAC;IACjD,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,oBAAoB,CAAC;IAChE,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,oCAAoC,CAAC;SAC/C,GACF,CAAC;IAEF,OAAOA,oBAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAA8B,CAAC;AAC/E;;ACveA,uCAAuC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/purviewScanning.ts","../src/paginateHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n KeyVaultConnectionsGetParameters,\n KeyVaultConnectionsCreateParameters,\n KeyVaultConnectionsDeleteParameters,\n KeyVaultConnectionsListAllParameters,\n ClassificationRulesGetParameters,\n ClassificationRulesCreateOrUpdateParameters,\n ClassificationRulesDeleteParameters,\n ClassificationRulesListAllParameters,\n ClassificationRulesListVersionsByClassificationRuleNameParameters,\n ClassificationRulesTagClassificationVersionParameters,\n DataSourcesCreateOrUpdateParameters,\n DataSourcesGetParameters,\n DataSourcesDeleteParameters,\n DataSourcesListAllParameters,\n FiltersGetParameters,\n FiltersCreateOrUpdateParameters,\n ScansCreateOrUpdateParameters,\n ScansGetParameters,\n ScansDeleteParameters,\n ScansListByDataSourceParameters,\n ScanResultRunScanParameters,\n ScanResultCancelScanParameters,\n ScanResultListScanHistoryParameters,\n ScanRulesetsGetParameters,\n ScanRulesetsCreateOrUpdateParameters,\n ScanRulesetsDeleteParameters,\n ScanRulesetsListAllParameters,\n SystemScanRulesetsListAllParameters,\n SystemScanRulesetsGetParameters,\n SystemScanRulesetsGetByVersionParameters,\n SystemScanRulesetsGetLatestParameters,\n SystemScanRulesetsListVersionsByDataSourceParameters,\n TriggersGetTriggerParameters,\n TriggersCreateTriggerParameters,\n TriggersDeleteTriggerParameters,\n} from \"./parameters\";\nimport {\n KeyVaultConnectionsGet200Response,\n KeyVaultConnectionsGetdefaultResponse,\n KeyVaultConnectionsCreate200Response,\n KeyVaultConnectionsCreatedefaultResponse,\n KeyVaultConnectionsDelete200Response,\n KeyVaultConnectionsDelete204Response,\n KeyVaultConnectionsDeletedefaultResponse,\n KeyVaultConnectionsListAll200Response,\n KeyVaultConnectionsListAlldefaultResponse,\n ClassificationRulesGet200Response,\n ClassificationRulesGetdefaultResponse,\n ClassificationRulesCreateOrUpdate200Response,\n ClassificationRulesCreateOrUpdate201Response,\n ClassificationRulesCreateOrUpdatedefaultResponse,\n ClassificationRulesDelete200Response,\n ClassificationRulesDelete204Response,\n ClassificationRulesDeletedefaultResponse,\n ClassificationRulesListAll200Response,\n ClassificationRulesListAlldefaultResponse,\n ClassificationRulesListVersionsByClassificationRuleName200Response,\n ClassificationRulesListVersionsByClassificationRuleNamedefaultResponse,\n ClassificationRulesTagClassificationVersion202Response,\n ClassificationRulesTagClassificationVersiondefaultResponse,\n DataSourcesCreateOrUpdate200Response,\n DataSourcesCreateOrUpdate201Response,\n DataSourcesCreateOrUpdatedefaultResponse,\n DataSourcesGet200Response,\n DataSourcesGetdefaultResponse,\n DataSourcesDelete200Response,\n DataSourcesDelete204Response,\n DataSourcesDeletedefaultResponse,\n DataSourcesListAll200Response,\n DataSourcesListAlldefaultResponse,\n FiltersGet200Response,\n FiltersGetdefaultResponse,\n FiltersCreateOrUpdate200Response,\n FiltersCreateOrUpdate201Response,\n FiltersCreateOrUpdatedefaultResponse,\n ScansCreateOrUpdate200Response,\n ScansCreateOrUpdate201Response,\n ScansCreateOrUpdatedefaultResponse,\n ScansGet200Response,\n ScansGetdefaultResponse,\n ScansDelete200Response,\n ScansDelete204Response,\n ScansDeletedefaultResponse,\n ScansListByDataSource200Response,\n ScansListByDataSourcedefaultResponse,\n ScanResultRunScan202Response,\n ScanResultRunScandefaultResponse,\n ScanResultCancelScan202Response,\n ScanResultCancelScandefaultResponse,\n ScanResultListScanHistory200Response,\n ScanResultListScanHistorydefaultResponse,\n ScanRulesetsGet200Response,\n ScanRulesetsGetdefaultResponse,\n ScanRulesetsCreateOrUpdate200Response,\n ScanRulesetsCreateOrUpdate201Response,\n ScanRulesetsCreateOrUpdatedefaultResponse,\n ScanRulesetsDelete200Response,\n ScanRulesetsDelete204Response,\n ScanRulesetsDeletedefaultResponse,\n ScanRulesetsListAll200Response,\n ScanRulesetsListAlldefaultResponse,\n SystemScanRulesetsListAll200Response,\n SystemScanRulesetsListAlldefaultResponse,\n SystemScanRulesetsGet200Response,\n SystemScanRulesetsGetdefaultResponse,\n SystemScanRulesetsGetByVersion200Response,\n SystemScanRulesetsGetByVersiondefaultResponse,\n SystemScanRulesetsGetLatest200Response,\n SystemScanRulesetsGetLatestdefaultResponse,\n SystemScanRulesetsListVersionsByDataSource200Response,\n SystemScanRulesetsListVersionsByDataSourcedefaultResponse,\n TriggersGetTrigger200Response,\n TriggersGetTriggerdefaultResponse,\n TriggersCreateTrigger200Response,\n TriggersCreateTrigger201Response,\n TriggersCreateTriggerdefaultResponse,\n TriggersDeleteTrigger200Response,\n TriggersDeleteTrigger204Response,\n TriggersDeleteTriggerdefaultResponse,\n} from \"./responses\";\nimport { getClient, ClientOptions, Client } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface KeyVaultConnectionsGet {\n /** Gets key vault information */\n get(\n options?: KeyVaultConnectionsGetParameters\n ): Promise<KeyVaultConnectionsGet200Response | KeyVaultConnectionsGetdefaultResponse>;\n /** Creates an instance of a key vault connection */\n put(\n options: KeyVaultConnectionsCreateParameters\n ): Promise<KeyVaultConnectionsCreate200Response | KeyVaultConnectionsCreatedefaultResponse>;\n /** Deletes the key vault connection associated with the account */\n delete(\n options?: KeyVaultConnectionsDeleteParameters\n ): Promise<\n | KeyVaultConnectionsDelete200Response\n | KeyVaultConnectionsDelete204Response\n | KeyVaultConnectionsDeletedefaultResponse\n >;\n}\n\nexport interface KeyVaultConnectionsListAll {\n /** List key vault connections in account */\n get(\n options?: KeyVaultConnectionsListAllParameters\n ): Promise<KeyVaultConnectionsListAll200Response | KeyVaultConnectionsListAlldefaultResponse>;\n}\n\nexport interface ClassificationRulesGet {\n /** Get a classification rule */\n get(\n options?: ClassificationRulesGetParameters\n ): Promise<ClassificationRulesGet200Response | ClassificationRulesGetdefaultResponse>;\n /** Creates or Updates a classification rule */\n put(\n options?: ClassificationRulesCreateOrUpdateParameters\n ): Promise<\n | ClassificationRulesCreateOrUpdate200Response\n | ClassificationRulesCreateOrUpdate201Response\n | ClassificationRulesCreateOrUpdatedefaultResponse\n >;\n /** Deletes a classification rule */\n delete(\n options?: ClassificationRulesDeleteParameters\n ): Promise<\n | ClassificationRulesDelete200Response\n | ClassificationRulesDelete204Response\n | ClassificationRulesDeletedefaultResponse\n >;\n}\n\nexport interface ClassificationRulesListAll {\n /** List classification rules in Account */\n get(\n options?: ClassificationRulesListAllParameters\n ): Promise<ClassificationRulesListAll200Response | ClassificationRulesListAlldefaultResponse>;\n}\n\nexport interface ClassificationRulesListVersionsByClassificationRuleName {\n /** Lists the rule versions of a classification rule */\n get(\n options?: ClassificationRulesListVersionsByClassificationRuleNameParameters\n ): Promise<\n | ClassificationRulesListVersionsByClassificationRuleName200Response\n | ClassificationRulesListVersionsByClassificationRuleNamedefaultResponse\n >;\n}\n\nexport interface ClassificationRulesTagClassificationVersion {\n /** Sets Classification Action on a specific classification rule version. */\n post(\n options: ClassificationRulesTagClassificationVersionParameters\n ): Promise<\n | ClassificationRulesTagClassificationVersion202Response\n | ClassificationRulesTagClassificationVersiondefaultResponse\n >;\n}\n\nexport interface DataSourcesCreateOrUpdate {\n /** Creates or Updates a data source */\n put(\n options?: DataSourcesCreateOrUpdateParameters\n ): Promise<\n | DataSourcesCreateOrUpdate200Response\n | DataSourcesCreateOrUpdate201Response\n | DataSourcesCreateOrUpdatedefaultResponse\n >;\n /** Get a data source */\n get(\n options?: DataSourcesGetParameters\n ): Promise<DataSourcesGet200Response | DataSourcesGetdefaultResponse>;\n /** Deletes a data source */\n delete(\n options?: DataSourcesDeleteParameters\n ): Promise<\n DataSourcesDelete200Response | DataSourcesDelete204Response | DataSourcesDeletedefaultResponse\n >;\n}\n\nexport interface DataSourcesListAll {\n /** List data sources in Data catalog */\n get(\n options?: DataSourcesListAllParameters\n ): Promise<DataSourcesListAll200Response | DataSourcesListAlldefaultResponse>;\n}\n\nexport interface FiltersGet {\n /** Get a filter */\n get(options?: FiltersGetParameters): Promise<FiltersGet200Response | FiltersGetdefaultResponse>;\n /** Creates or updates a filter */\n put(\n options?: FiltersCreateOrUpdateParameters\n ): Promise<\n | FiltersCreateOrUpdate200Response\n | FiltersCreateOrUpdate201Response\n | FiltersCreateOrUpdatedefaultResponse\n >;\n}\n\nexport interface ScansCreateOrUpdate {\n /** Creates an instance of a scan */\n put(\n options: ScansCreateOrUpdateParameters\n ): Promise<\n | ScansCreateOrUpdate200Response\n | ScansCreateOrUpdate201Response\n | ScansCreateOrUpdatedefaultResponse\n >;\n /** Gets a scan information */\n get(options?: ScansGetParameters): Promise<ScansGet200Response | ScansGetdefaultResponse>;\n /** Deletes the scan associated with the data source */\n delete(\n options?: ScansDeleteParameters\n ): Promise<ScansDelete200Response | ScansDelete204Response | ScansDeletedefaultResponse>;\n}\n\nexport interface ScansListByDataSource {\n /** List scans in data source */\n get(\n options?: ScansListByDataSourceParameters\n ): Promise<ScansListByDataSource200Response | ScansListByDataSourcedefaultResponse>;\n}\n\nexport interface ScanResultRunScan {\n /** Runs the scan */\n put(\n options?: ScanResultRunScanParameters\n ): Promise<ScanResultRunScan202Response | ScanResultRunScandefaultResponse>;\n}\n\nexport interface ScanResultCancelScan {\n /** Cancels a scan */\n post(\n options?: ScanResultCancelScanParameters\n ): Promise<ScanResultCancelScan202Response | ScanResultCancelScandefaultResponse>;\n}\n\nexport interface ScanResultListScanHistory {\n /** Lists the scan history of a scan */\n get(\n options?: ScanResultListScanHistoryParameters\n ): Promise<ScanResultListScanHistory200Response | ScanResultListScanHistorydefaultResponse>;\n}\n\nexport interface ScanRulesetsGet {\n /** Get a scan ruleset */\n get(\n options?: ScanRulesetsGetParameters\n ): Promise<ScanRulesetsGet200Response | ScanRulesetsGetdefaultResponse>;\n /** Creates or Updates a scan ruleset */\n put(\n options?: ScanRulesetsCreateOrUpdateParameters\n ): Promise<\n | ScanRulesetsCreateOrUpdate200Response\n | ScanRulesetsCreateOrUpdate201Response\n | ScanRulesetsCreateOrUpdatedefaultResponse\n >;\n /** Deletes a scan ruleset */\n delete(\n options?: ScanRulesetsDeleteParameters\n ): Promise<\n | ScanRulesetsDelete200Response\n | ScanRulesetsDelete204Response\n | ScanRulesetsDeletedefaultResponse\n >;\n}\n\nexport interface ScanRulesetsListAll {\n /** List scan rulesets in Data catalog */\n get(\n options?: ScanRulesetsListAllParameters\n ): Promise<ScanRulesetsListAll200Response | ScanRulesetsListAlldefaultResponse>;\n}\n\nexport interface SystemScanRulesetsListAll {\n /** List all system scan rulesets for an account */\n get(\n options?: SystemScanRulesetsListAllParameters\n ): Promise<SystemScanRulesetsListAll200Response | SystemScanRulesetsListAlldefaultResponse>;\n}\n\nexport interface SystemScanRulesetsGet {\n /** Get a system scan ruleset for a data source */\n get(\n options?: SystemScanRulesetsGetParameters\n ): Promise<SystemScanRulesetsGet200Response | SystemScanRulesetsGetdefaultResponse>;\n}\n\nexport interface SystemScanRulesetsGetByVersion {\n /** Get a scan ruleset by version */\n get(\n options?: SystemScanRulesetsGetByVersionParameters\n ): Promise<\n SystemScanRulesetsGetByVersion200Response | SystemScanRulesetsGetByVersiondefaultResponse\n >;\n}\n\nexport interface SystemScanRulesetsGetLatest {\n /** Get the latest version of a system scan ruleset */\n get(\n options?: SystemScanRulesetsGetLatestParameters\n ): Promise<SystemScanRulesetsGetLatest200Response | SystemScanRulesetsGetLatestdefaultResponse>;\n}\n\nexport interface SystemScanRulesetsListVersionsByDataSource {\n /** List system scan ruleset versions in Data catalog */\n get(\n options?: SystemScanRulesetsListVersionsByDataSourceParameters\n ): Promise<\n | SystemScanRulesetsListVersionsByDataSource200Response\n | SystemScanRulesetsListVersionsByDataSourcedefaultResponse\n >;\n}\n\nexport interface TriggersGetTrigger {\n /** Gets trigger information */\n get(\n options?: TriggersGetTriggerParameters\n ): Promise<TriggersGetTrigger200Response | TriggersGetTriggerdefaultResponse>;\n /** Creates an instance of a trigger */\n put(\n options: TriggersCreateTriggerParameters\n ): Promise<\n | TriggersCreateTrigger200Response\n | TriggersCreateTrigger201Response\n | TriggersCreateTriggerdefaultResponse\n >;\n /** Deletes the trigger associated with the scan */\n delete(\n options?: TriggersDeleteTriggerParameters\n ): Promise<\n | TriggersDeleteTrigger200Response\n | TriggersDeleteTrigger204Response\n | TriggersDeleteTriggerdefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/azureKeyVaults/\\{keyVaultName\\}' has methods for the following verbs: get, put, delete */\n (path: \"/azureKeyVaults/{keyVaultName}\", keyVaultName: string): KeyVaultConnectionsGet;\n /** Resource for '/azureKeyVaults' has methods for the following verbs: get */\n (path: \"/azureKeyVaults\"): KeyVaultConnectionsListAll;\n /** Resource for '/classificationrules/\\{classificationRuleName\\}' has methods for the following verbs: get, put, delete */\n (\n path: \"/classificationrules/{classificationRuleName}\",\n classificationRuleName: string\n ): ClassificationRulesGet;\n /** Resource for '/classificationrules' has methods for the following verbs: get */\n (path: \"/classificationrules\"): ClassificationRulesListAll;\n /** Resource for '/classificationrules/\\{classificationRuleName\\}/versions' has methods for the following verbs: get */\n (\n path: \"/classificationrules/{classificationRuleName}/versions\",\n classificationRuleName: string\n ): ClassificationRulesListVersionsByClassificationRuleName;\n /** Resource for '/classificationrules/\\{classificationRuleName\\}/versions/\\{classificationRuleVersion\\}/:tag' has methods for the following verbs: post */\n (\n path: \"/classificationrules/{classificationRuleName}/versions/{classificationRuleVersion}/:tag\",\n classificationRuleName: string,\n classificationRuleVersion: string\n ): ClassificationRulesTagClassificationVersion;\n /** Resource for '/datasources/\\{dataSourceName\\}' has methods for the following verbs: put, get, delete */\n (path: \"/datasources/{dataSourceName}\", dataSourceName: string): DataSourcesCreateOrUpdate;\n /** Resource for '/datasources' has methods for the following verbs: get */\n (path: \"/datasources\"): DataSourcesListAll;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/filters/custom' has methods for the following verbs: get, put */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/filters/custom\",\n dataSourceName: string,\n scanName: string\n ): FiltersGet;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}' has methods for the following verbs: put, get, delete */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}\",\n dataSourceName: string,\n scanName: string\n ): ScansCreateOrUpdate;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans' has methods for the following verbs: get */\n (path: \"/datasources/{dataSourceName}/scans\", dataSourceName: string): ScansListByDataSource;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/runs/\\{runId\\}' has methods for the following verbs: put */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/runs/{runId}\",\n dataSourceName: string,\n scanName: string,\n runId: string\n ): ScanResultRunScan;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/runs/\\{runId\\}/:cancel' has methods for the following verbs: post */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/runs/{runId}/:cancel\",\n dataSourceName: string,\n scanName: string,\n runId: string\n ): ScanResultCancelScan;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/runs' has methods for the following verbs: get */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/runs\",\n dataSourceName: string,\n scanName: string\n ): ScanResultListScanHistory;\n /** Resource for '/scanrulesets/\\{scanRulesetName\\}' has methods for the following verbs: get, put, delete */\n (path: \"/scanrulesets/{scanRulesetName}\", scanRulesetName: string): ScanRulesetsGet;\n /** Resource for '/scanrulesets' has methods for the following verbs: get */\n (path: \"/scanrulesets\"): ScanRulesetsListAll;\n /** Resource for '/systemScanRulesets' has methods for the following verbs: get */\n (path: \"/systemScanRulesets\"): SystemScanRulesetsListAll;\n /** Resource for '/systemScanRulesets/datasources/\\{dataSourceType\\}' has methods for the following verbs: get */\n (\n path: \"/systemScanRulesets/datasources/{dataSourceType}\",\n dataSourceType: string\n ): SystemScanRulesetsGet;\n /** Resource for '/systemScanRulesets/versions/\\{version\\}' has methods for the following verbs: get */\n (path: \"/systemScanRulesets/versions/{version}\", version: string): SystemScanRulesetsGetByVersion;\n /** Resource for '/systemScanRulesets/versions/latest' has methods for the following verbs: get */\n (path: \"/systemScanRulesets/versions/latest\"): SystemScanRulesetsGetLatest;\n /** Resource for '/systemScanRulesets/versions' has methods for the following verbs: get */\n (path: \"/systemScanRulesets/versions\"): SystemScanRulesetsListVersionsByDataSource;\n /** Resource for '/datasources/\\{dataSourceName\\}/scans/\\{scanName\\}/triggers/default' has methods for the following verbs: get, put, delete */\n (\n path: \"/datasources/{dataSourceName}/scans/{scanName}/triggers/default\",\n dataSourceName: string,\n scanName: string\n ): TriggersGetTrigger;\n}\n\nexport type PurviewScanningRestClient = Client & {\n path: Routes;\n};\n\nexport default function PurviewScanning(\n Endpoint: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): PurviewScanningRestClient {\n const baseUrl = options.baseUrl ?? `${Endpoint}`;\n options.apiVersion = options.apiVersion ?? \"2018-12-01-preview\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://purview.azure.net/.default\"],\n },\n };\n\n return getClient(baseUrl, credentials, options) as PurviewScanningRestClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {}\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport PurviewScanning from \"./purviewScanning\";\n\nexport * from \"./purviewScanning\";\nexport * from \"./models\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./paginateHelper\";\n\nexport default PurviewScanning;\n"],"names":["getClient","getPagedAsyncIterator","createRestError"],"mappings":";;;;;;;AAAA;SAwdwB,eAAe,CACrC,QAAgB,EAChB,WAA4B,EAC5B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,QAAQ,EAAE,CAAC;IACjD,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,oBAAoB,CAAC;IAChE,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,oCAAoC,CAAC;SAC/C,GACF,CAAC;IAEF,OAAOA,oBAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAA8B,CAAC;AAC/E;;ACveA;AACA,AA4CA;;;;;;;AAOA,SAAgB,QAAQ,CACtB,MAAc,EACd,eAA0B,EAC1B,UAAoC,EAAE;IAItC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,MAAM,QAAQ,GAAG,OAAO,CAAC;IACzB,MAAM,YAAY,GAAG,UAAU,CAAC;IAChC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,WAAW,GAA4B;QAC3C,aAAa,EAAE,EAAE;QACjB,OAAO,EACL,OAAO,aAAa,KAAK,UAAU;cAC/B,aAAa;cACb,OAAO,QAAgB;gBACrB,MAAM,MAAM,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;gBACvF,QAAQ,GAAG,KAAK,CAAC;gBACjB,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;gBACxD,MAAM,MAAM,GAAG,WAAW,CAAW,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC5D,OAAO;oBACL,IAAI,EAAE,MAAM;oBACZ,YAAY,EAAE,QAAQ;iBACvB,CAAC;aACH;KACR,CAAC;IAEF,OAAOC,gCAAqB,CAAC,WAAW,CAAC,CAAC;AAC5C,CAAC;AAED;;;AAGA,SAAS,WAAW,CAAC,IAAa,EAAE,YAAqB;IACvD,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,QAAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,kCAAkC,CAAC,CAAC;KAClF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;AAGA,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;;;;IAKjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;KACH;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;;AAGA,SAAS,kBAAkB,CAAC,QAA+B;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjD,MAAMC,0BAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;KACH;AACH,CAAC;;AClID,uCAAuC;;;;;"}
@@ -5,5 +5,6 @@ export * from "./purviewScanning";
5
5
  export * from "./models";
6
6
  export * from "./parameters";
7
7
  export * from "./responses";
8
+ export * from "./paginateHelper";
8
9
  export default PurviewScanning;
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,eAAe,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport PurviewScanning from \"./purviewScanning\";\n\nexport * from \"./purviewScanning\";\nexport * from \"./models\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\n\nexport default PurviewScanning;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AAEjC,eAAe,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport PurviewScanning from \"./purviewScanning\";\n\nexport * from \"./purviewScanning\";\nexport * from \"./models\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./paginateHelper\";\n\nexport default PurviewScanning;\n"]}