From d661cc7fde3ea82fedd022c54d1a3bfb11642339 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Mon, 3 May 2021 16:40:02 -0700 Subject: [PATCH] [Purview] Design Refactor for Scanning (#20811) Based on feedback with the C# architects, we've made some changes to the class factoring here and renamed some methods. The goal was to try to reduce the number of clients we have and clean up some naming issues. --- ...alytics.Purview.Scanning.netstandard2.0.cs | 209 +++--- .../PurviewClassificationRuleClient.cs | 18 + .../Customizations/PurviewDataSourceClient.cs | 21 + .../src/Customizations/PurviewScanClient.cs | 19 + .../Customizations/PurviewScanningClient.cs | 14 + .../src/Generated/AzureKeyVaultsClient.cs | 195 ------ .../src/Generated/DataSourceClient.cs | 85 --- .../src/Generated/FiltersClient.cs | 141 ---- ....cs => PurviewClassificationRuleClient.cs} | 123 ++-- ...esClient.cs => PurviewDataSourceClient.cs} | 103 ++- .../src/Generated/PurviewScanClient.cs | 481 ++++++++++++++ .../Generated/PurviewScanningServiceClient.cs | 613 ++++++++++++++++++ ...=> PurviewScanningServiceClientOptions.cs} | 8 +- .../src/Generated/ScanRulesetsClient.cs | 195 ------ .../src/Generated/ScansClient.cs | 354 ---------- .../src/Generated/SystemScanRulesetsClient.cs | 238 ------- .../src/Generated/TriggersClient.cs | 182 ------ .../src/autorest.md | 102 ++- ...re.Analytics.Purview.Scanning.Tests.csproj | 2 +- 19 files changed, 1452 insertions(+), 1651 deletions(-) create mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewClassificationRuleClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewDataSourceClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanningClient.cs delete mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/AzureKeyVaultsClient.cs delete mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/DataSourceClient.cs delete mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/FiltersClient.cs rename sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/{ClassificationRulesClient.cs => PurviewClassificationRuleClient.cs} (56%) rename sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/{DataSourcesClient.cs => PurviewDataSourceClient.cs} (64%) create mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClient.cs rename sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/{ScanningClientOptions.cs => PurviewScanningServiceClientOptions.cs} (70%) delete mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScanRulesetsClient.cs delete mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScansClient.cs delete mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/SystemScanRulesetsClient.cs delete mode 100644 sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/TriggersClient.cs diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/api/Azure.Analytics.Purview.Scanning.netstandard2.0.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/api/Azure.Analytics.Purview.Scanning.netstandard2.0.cs index 85b12324a577..87c1faf463af 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/api/Azure.Analytics.Purview.Scanning.netstandard2.0.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/api/Azure.Analytics.Purview.Scanning.netstandard2.0.cs @@ -1,139 +1,112 @@ namespace Azure.Analytics.Purview.Scanning { - public partial class AzureKeyVaultsClient + public partial class PurviewClassificationRuleClient { - protected AzureKeyVaultsClient() { } - public AzureKeyVaultsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } + protected PurviewClassificationRuleClient() { } + public PurviewClassificationRuleClient(System.Uri endpoint, string classificationRuleName, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.PurviewScanningServiceClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CreateAzureKeyVault(string azureKeyVaultName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateAzureKeyVaultAsync(string azureKeyVaultName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteAzureKeyVault(string azureKeyVaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAzureKeyVaultAsync(string azureKeyVaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetAzureKeyVault(string azureKeyVaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetAzureKeyVaultAsync(string azureKeyVaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListByAccount(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListByAccountAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdate(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Delete(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetVersions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetVersionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response TagVersion(int classificationRuleVersion, string action, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task TagVersionAsync(int classificationRuleVersion, string action, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ClassificationRulesClient + public partial class PurviewDataSourceClient { - protected ClassificationRulesClient() { } - public ClassificationRulesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } + protected PurviewDataSourceClient() { } + public PurviewDataSourceClient(System.Uri endpoint, string dataSourceName, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.PurviewScanningServiceClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CreateOrUpdate(string classificationRuleName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string classificationRuleName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Delete(string classificationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(string classificationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string classificationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string classificationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListVersionsByClassificationRuleName(string classificationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListVersionsByClassificationRuleNameAsync(string classificationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response TagClassificationVersion(string classificationRuleName, int classificationRuleVersion, string action, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task TagClassificationVersionAsync(string classificationRuleName, int classificationRuleVersion, string action, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdate(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Delete(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetChildren(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetChildrenAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public Azure.Analytics.Purview.Scanning.PurviewScanClient GetScanClient(string scanName) { throw null; } + public virtual Azure.Response GetScans(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetScansAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class DataSourceClient + public partial class PurviewScanClient { - protected DataSourceClient() { } - public DataSourceClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } + protected PurviewScanClient() { } + public PurviewScanClient(System.Uri endpoint, string dataSourceName, string scanName, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.PurviewScanningServiceClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response ListUnparentedDataSourcesByAccount(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListUnparentedDataSourcesByAccountAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelScan(string runId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelScanAsync(string runId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdate(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateFilter(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateFilterAsync(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateTrigger(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateTriggerAsync(Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Delete(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteTrigger(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteTriggerAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetFilter(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetFilterAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRuns(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetRunsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTrigger(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetTriggerAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RunScan(string runId, string scanLevel = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task RunScanAsync(string runId, string scanLevel = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class DataSourcesClient + public partial class PurviewScanningServiceClient { - protected DataSourcesClient() { } - public DataSourcesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } + protected PurviewScanningServiceClient() { } + public PurviewScanningServiceClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.PurviewScanningServiceClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CreateOrUpdate(string dataSourceName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string dataSourceName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Delete(string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListByAccount(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListByAccountAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListChildrenByCollection(string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListChildrenByCollectionAsync(string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateKeyVaultReference(string azureKeyVaultName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateKeyVaultReferenceAsync(string azureKeyVaultName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateScanRuelset(string scanRulesetName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateScanRuelsetAsync(string scanRulesetName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteKeyVaultReference(string azureKeyVaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteKeyVaultReferenceAsync(string azureKeyVaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteScanRuleset(string scanRulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteScanRulesetAsync(string scanRulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public Azure.Analytics.Purview.Scanning.PurviewClassificationRuleClient GetClassificationRuleClient(string classificationRuleName) { throw null; } + public virtual Azure.Response GetClassificationRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetClassificationRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public Azure.Analytics.Purview.Scanning.PurviewDataSourceClient GetDataSourceClient(string dataSourceName) { throw null; } + public virtual Azure.Response GetDataSources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetDataSourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetKeyVaultReference(string azureKeyVaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetKeyVaultReferenceAsync(string azureKeyVaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetKeyVaultReferences(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetKeyVaultReferencesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetLatestSystemRulestes(string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetLatestSystemRulestesAsync(string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetScanRuleset(string scanRulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetScanRulesetAsync(string scanRulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetScanRulesets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetScanRulesetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSystemRulesets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetSystemRulesetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSystemRulesetsForDataSource(string dataSourceType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetSystemRulesetsForDataSourceAsync(string dataSourceType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSystemRulesetsForVersion(int version, string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetSystemRulesetsForVersionAsync(int version, string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSystemRulesetsVersions(string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetSystemRulesetsVersionsAsync(string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetUnparentedDataSources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetUnparentedDataSourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class FiltersClient + public partial class PurviewScanningServiceClientOptions : Azure.Core.ClientOptions { - protected FiltersClient() { } - public FiltersClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } - public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CreateOrUpdate(string dataSourceName, string scanName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string dataSourceName, string scanName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class ScanningClientOptions : Azure.Core.ClientOptions - { - public ScanningClientOptions(Azure.Analytics.Purview.Scanning.ScanningClientOptions.ServiceVersion version = Azure.Analytics.Purview.Scanning.ScanningClientOptions.ServiceVersion.V2018_12_01_preview) { } + public PurviewScanningServiceClientOptions(Azure.Analytics.Purview.Scanning.PurviewScanningServiceClientOptions.ServiceVersion version = Azure.Analytics.Purview.Scanning.PurviewScanningServiceClientOptions.ServiceVersion.V2018_12_01_preview) { } public enum ServiceVersion { V2018_12_01_preview = 1, } } - public partial class ScanRulesetsClient - { - protected ScanRulesetsClient() { } - public ScanRulesetsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } - public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CreateOrUpdate(string scanRulesetName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string scanRulesetName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Delete(string scanRulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(string scanRulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string scanRulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string scanRulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class ScansClient - { - protected ScansClient() { } - public ScansClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } - public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CancelScan(string dataSourceName, string scanName, string runId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CancelScanAsync(string dataSourceName, string scanName, string runId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CreateOrUpdate(string dataSourceName, string scanName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string dataSourceName, string scanName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Delete(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListByDataSource(string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListByDataSourceAsync(string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListScanHistory(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListScanHistoryAsync(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response RunScan(string dataSourceName, string scanName, string runId, string scanLevel = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task RunScanAsync(string dataSourceName, string scanName, string runId, string scanLevel = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class SystemScanRulesetsClient - { - protected SystemScanRulesetsClient() { } - public SystemScanRulesetsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } - public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response Get(string dataSourceType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string dataSourceType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetByVersion(int version, string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetByVersionAsync(int version, string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLatest(string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLatestAsync(string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListVersionsByDataSource(string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ListVersionsByDataSourceAsync(string dataSourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class TriggersClient - { - protected TriggersClient() { } - public TriggersClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.ScanningClientOptions options = null) { } - public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CreateTrigger(string dataSourceName, string scanName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateTriggerAsync(string dataSourceName, string scanName, Azure.Core.RequestContent requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteTrigger(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteTriggerAsync(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetTrigger(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetTriggerAsync(string dataSourceName, string scanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewClassificationRuleClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewClassificationRuleClient.cs new file mode 100644 index 000000000000..545376ffeb26 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewClassificationRuleClient.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Scanning +{ + public partial class PurviewClassificationRuleClient + { + internal PurviewClassificationRuleClient(Uri endpoint, string classificationRuleName, HttpPipeline pipeline, string apiVersion) { + this.endpoint = endpoint; + this.Pipeline = pipeline; + this.classificationRuleName = classificationRuleName; + this.apiVersion = apiVersion; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewDataSourceClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewDataSourceClient.cs new file mode 100644 index 000000000000..f6d4c30e1f24 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewDataSourceClient.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Scanning +{ + public partial class PurviewDataSourceClient + { + internal PurviewDataSourceClient(Uri endpoint, string dataSourceName, HttpPipeline pipeline, string apiVersion) { + this.endpoint = endpoint; + this.dataSourceName= dataSourceName; + this.Pipeline = pipeline; + this.apiVersion = apiVersion; + } + + /// + public PurviewScanClient GetScanClient(string scanName) => new PurviewScanClient(endpoint, dataSourceName, scanName, Pipeline, apiVersion); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanClient.cs new file mode 100644 index 000000000000..dec1361310a7 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanClient.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Scanning +{ + public partial class PurviewScanClient + { + internal PurviewScanClient(Uri endpoint, string dataSourceName, string scanName, HttpPipeline pipeline, string apiVersion) { + this.endpoint = endpoint; + this.dataSourceName= dataSourceName; + this.scanName = scanName; + this.Pipeline = pipeline; + this.apiVersion = apiVersion; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanningClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanningClient.cs new file mode 100644 index 000000000000..dd712080bdac --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanningClient.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Analytics.Purview.Scanning +{ + public partial class PurviewScanningServiceClient + { + /// + public PurviewDataSourceClient GetDataSourceClient(string dataSourceName) => new PurviewDataSourceClient(endpoint, dataSourceName, Pipeline, apiVersion); + + /// + public PurviewClassificationRuleClient GetClassificationRuleClient(string classificationRuleName) => new PurviewClassificationRuleClient(endpoint, classificationRuleName, Pipeline, apiVersion); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/AzureKeyVaultsClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/AzureKeyVaultsClient.cs deleted file mode 100644 index 32925eeb0ad9..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/AzureKeyVaultsClient.cs +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -#pragma warning disable AZC0007 - -namespace Azure.Analytics.Purview.Scanning -{ - /// The AzureKeyVaults service client. - public partial class AzureKeyVaultsClient - { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get; } - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; - private Uri endpoint; - private readonly string apiVersion; - - /// Initializes a new instance of AzureKeyVaultsClient for mocking. - protected AzureKeyVaultsClient() - { - } - - /// Initializes a new instance of AzureKeyVaultsClient. - /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public AzureKeyVaultsClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new ScanningClientOptions(); - Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Gets azureKeyVault information. - /// The String to use. - /// The cancellation token to use. - public virtual async Task GetAzureKeyVaultAsync(string azureKeyVaultName, CancellationToken cancellationToken = default) - { - Request req = CreateGetAzureKeyVaultRequest(azureKeyVaultName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Gets azureKeyVault information. - /// The String to use. - /// The cancellation token to use. - public virtual Response GetAzureKeyVault(string azureKeyVaultName, CancellationToken cancellationToken = default) - { - Request req = CreateGetAzureKeyVaultRequest(azureKeyVaultName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - private Request CreateGetAzureKeyVaultRequest(string azureKeyVaultName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/azureKeyVaults/", false); - uri.AppendPath(azureKeyVaultName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Creates an instance of a azureKeyVault. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual async Task CreateAzureKeyVaultAsync(string azureKeyVaultName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateAzureKeyVaultRequest(azureKeyVaultName, requestBody); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Creates an instance of a azureKeyVault. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual Response CreateAzureKeyVault(string azureKeyVaultName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateAzureKeyVaultRequest(azureKeyVaultName, requestBody); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The request body. - private Request CreateCreateAzureKeyVaultRequest(string azureKeyVaultName, RequestContent requestBody) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/azureKeyVaults/", false); - uri.AppendPath(azureKeyVaultName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = requestBody; - return request; - } - - /// Deletes the azureKeyVault associated with the account. - /// The String to use. - /// The cancellation token to use. - public virtual async Task DeleteAzureKeyVaultAsync(string azureKeyVaultName, CancellationToken cancellationToken = default) - { - Request req = CreateDeleteAzureKeyVaultRequest(azureKeyVaultName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Deletes the azureKeyVault associated with the account. - /// The String to use. - /// The cancellation token to use. - public virtual Response DeleteAzureKeyVault(string azureKeyVaultName, CancellationToken cancellationToken = default) - { - Request req = CreateDeleteAzureKeyVaultRequest(azureKeyVaultName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - private Request CreateDeleteAzureKeyVaultRequest(string azureKeyVaultName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/azureKeyVaults/", false); - uri.AppendPath(azureKeyVaultName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// List azureKeyVaults in account. - /// The cancellation token to use. - public virtual async Task ListByAccountAsync(CancellationToken cancellationToken = default) - { - Request req = CreateListByAccountRequest(); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// List azureKeyVaults in account. - /// The cancellation token to use. - public virtual Response ListByAccount(CancellationToken cancellationToken = default) - { - Request req = CreateListByAccountRequest(); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - private Request CreateListByAccountRequest() - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/azureKeyVaults", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - } -} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/DataSourceClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/DataSourceClient.cs deleted file mode 100644 index e650723a29db..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/DataSourceClient.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -#pragma warning disable AZC0007 - -namespace Azure.Analytics.Purview.Scanning -{ - /// The DataSource service client. - public partial class DataSourceClient - { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get; } - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; - private Uri endpoint; - private readonly string apiVersion; - - /// Initializes a new instance of DataSourceClient for mocking. - protected DataSourceClient() - { - } - - /// Initializes a new instance of DataSourceClient. - /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public DataSourceClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new ScanningClientOptions(); - Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Lists the data sources in the account that do not belong to any collection. - /// The cancellation token to use. - public virtual async Task ListUnparentedDataSourcesByAccountAsync(CancellationToken cancellationToken = default) - { - Request req = CreateListUnparentedDataSourcesByAccountRequest(); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Lists the data sources in the account that do not belong to any collection. - /// The cancellation token to use. - public virtual Response ListUnparentedDataSourcesByAccount(CancellationToken cancellationToken = default) - { - Request req = CreateListUnparentedDataSourcesByAccountRequest(); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - private Request CreateListUnparentedDataSourcesByAccountRequest() - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/listUnparentedDataSources", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - } -} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/FiltersClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/FiltersClient.cs deleted file mode 100644 index 8cde55568cc6..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/FiltersClient.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -#pragma warning disable AZC0007 - -namespace Azure.Analytics.Purview.Scanning -{ - /// The Filters service client. - public partial class FiltersClient - { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get; } - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; - private Uri endpoint; - private readonly string apiVersion; - - /// Initializes a new instance of FiltersClient for mocking. - protected FiltersClient() - { - } - - /// Initializes a new instance of FiltersClient. - /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public FiltersClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new ScanningClientOptions(); - Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Get a filter. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual async Task GetAsync(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateGetRequest(dataSourceName, scanName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Get a filter. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual Response Get(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateGetRequest(dataSourceName, scanName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - private Request CreateGetRequest(string dataSourceName, string scanName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/filters/custom", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Creates or updates a filter. - /// The String to use. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual async Task CreateOrUpdateAsync(string dataSourceName, string scanName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateOrUpdateRequest(dataSourceName, scanName, requestBody); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Creates or updates a filter. - /// The String to use. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual Response CreateOrUpdate(string dataSourceName, string scanName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateOrUpdateRequest(dataSourceName, scanName, requestBody); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - /// The request body. - private Request CreateCreateOrUpdateRequest(string dataSourceName, string scanName, RequestContent requestBody) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/filters/custom", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = requestBody; - return request; - } - } -} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ClassificationRulesClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewClassificationRuleClient.cs similarity index 56% rename from sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ClassificationRulesClient.cs rename to sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewClassificationRuleClient.cs index 613e7ba14fab..6fa6c1d7c0ce 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ClassificationRulesClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewClassificationRuleClient.cs @@ -16,62 +16,66 @@ namespace Azure.Analytics.Purview.Scanning { - /// The ClassificationRules service client. - public partial class ClassificationRulesClient + /// The PurviewClassificationRule service client. + public partial class PurviewClassificationRuleClient { /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline { get; } private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private Uri endpoint; + private string classificationRuleName; private readonly string apiVersion; - /// Initializes a new instance of ClassificationRulesClient for mocking. - protected ClassificationRulesClient() + /// Initializes a new instance of PurviewClassificationRuleClient for mocking. + protected PurviewClassificationRuleClient() { } - /// Initializes a new instance of ClassificationRulesClient. + /// Initializes a new instance of PurviewClassificationRuleClient. /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. + /// The String to use. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. - public ClassificationRulesClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) + public PurviewClassificationRuleClient(Uri endpoint, string classificationRuleName, TokenCredential credential, PurviewScanningServiceClientOptions options = null) { if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } + if (classificationRuleName == null) + { + throw new ArgumentNullException(nameof(classificationRuleName)); + } if (credential == null) { throw new ArgumentNullException(nameof(credential)); } - options ??= new ScanningClientOptions(); + options ??= new PurviewScanningServiceClientOptions(); Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); this.endpoint = endpoint; + this.classificationRuleName = classificationRuleName; apiVersion = options.Version; } /// Get a classification rule. - /// The String to use. /// The cancellation token to use. - public virtual async Task GetAsync(string classificationRuleName, CancellationToken cancellationToken = default) + public virtual async Task GetPropertiesAsync(CancellationToken cancellationToken = default) { - Request req = CreateGetRequest(classificationRuleName); + Request req = CreateGetPropertiesRequest(); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } /// Get a classification rule. - /// The String to use. /// The cancellation token to use. - public virtual Response Get(string classificationRuleName, CancellationToken cancellationToken = default) + public virtual Response GetProperties(CancellationToken cancellationToken = default) { - Request req = CreateGetRequest(classificationRuleName); + Request req = CreateGetPropertiesRequest(); return Pipeline.SendRequest(req, cancellationToken); } - /// Create Request for and operations. - /// The String to use. - private Request CreateGetRequest(string classificationRuleName) + /// Create Request for and operations. + private Request CreateGetPropertiesRequest() { var message = Pipeline.CreateMessage(); var request = message.Request; @@ -87,29 +91,26 @@ private Request CreateGetRequest(string classificationRuleName) } /// Creates or Updates a classification rule. - /// The String to use. /// The request body. /// The cancellation token to use. - public virtual async Task CreateOrUpdateAsync(string classificationRuleName, RequestContent requestBody, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(RequestContent requestBody, CancellationToken cancellationToken = default) { - Request req = CreateCreateOrUpdateRequest(classificationRuleName, requestBody); + Request req = CreateCreateOrUpdateRequest(requestBody); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } /// Creates or Updates a classification rule. - /// The String to use. /// The request body. /// The cancellation token to use. - public virtual Response CreateOrUpdate(string classificationRuleName, RequestContent requestBody, CancellationToken cancellationToken = default) + public virtual Response CreateOrUpdate(RequestContent requestBody, CancellationToken cancellationToken = default) { - Request req = CreateCreateOrUpdateRequest(classificationRuleName, requestBody); + Request req = CreateCreateOrUpdateRequest(requestBody); return Pipeline.SendRequest(req, cancellationToken); } /// Create Request for and operations. - /// The String to use. /// The request body. - private Request CreateCreateOrUpdateRequest(string classificationRuleName, RequestContent requestBody) + private Request CreateCreateOrUpdateRequest(RequestContent requestBody) { var message = Pipeline.CreateMessage(); var request = message.Request; @@ -127,26 +128,23 @@ private Request CreateCreateOrUpdateRequest(string classificationRuleName, Reque } /// Deletes a classification rule. - /// The String to use. /// The cancellation token to use. - public virtual async Task DeleteAsync(string classificationRuleName, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(CancellationToken cancellationToken = default) { - Request req = CreateDeleteRequest(classificationRuleName); + Request req = CreateDeleteRequest(); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } /// Deletes a classification rule. - /// The String to use. /// The cancellation token to use. - public virtual Response Delete(string classificationRuleName, CancellationToken cancellationToken = default) + public virtual Response Delete(CancellationToken cancellationToken = default) { - Request req = CreateDeleteRequest(classificationRuleName); + Request req = CreateDeleteRequest(); return Pipeline.SendRequest(req, cancellationToken); } /// Create Request for and operations. - /// The String to use. - private Request CreateDeleteRequest(string classificationRuleName) + private Request CreateDeleteRequest() { var message = Pipeline.CreateMessage(); var request = message.Request; @@ -161,58 +159,24 @@ private Request CreateDeleteRequest(string classificationRuleName) return request; } - /// List classification rules in Account. - /// The cancellation token to use. - public virtual async Task ListAllAsync(CancellationToken cancellationToken = default) - { - Request req = CreateListAllRequest(); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// List classification rules in Account. - /// The cancellation token to use. - public virtual Response ListAll(CancellationToken cancellationToken = default) - { - Request req = CreateListAllRequest(); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - private Request CreateListAllRequest() - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/classificationrules", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - /// Lists the rule versions of a classification rule. - /// The String to use. /// The cancellation token to use. - public virtual async Task ListVersionsByClassificationRuleNameAsync(string classificationRuleName, CancellationToken cancellationToken = default) + public virtual async Task GetVersionsAsync(CancellationToken cancellationToken = default) { - Request req = CreateListVersionsByClassificationRuleNameRequest(classificationRuleName); + Request req = CreateGetVersionsRequest(); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } /// Lists the rule versions of a classification rule. - /// The String to use. /// The cancellation token to use. - public virtual Response ListVersionsByClassificationRuleName(string classificationRuleName, CancellationToken cancellationToken = default) + public virtual Response GetVersions(CancellationToken cancellationToken = default) { - Request req = CreateListVersionsByClassificationRuleNameRequest(classificationRuleName); + Request req = CreateGetVersionsRequest(); return Pipeline.SendRequest(req, cancellationToken); } - /// Create Request for and operations. - /// The String to use. - private Request CreateListVersionsByClassificationRuleNameRequest(string classificationRuleName) + /// Create Request for and operations. + private Request CreateGetVersionsRequest() { var message = Pipeline.CreateMessage(); var request = message.Request; @@ -229,32 +193,29 @@ private Request CreateListVersionsByClassificationRuleNameRequest(string classif } /// Sets Classification Action on a specific classification rule version. - /// The String to use. /// The Integer to use. /// The ClassificationAction to use. /// The cancellation token to use. - public virtual async Task TagClassificationVersionAsync(string classificationRuleName, int classificationRuleVersion, string action, CancellationToken cancellationToken = default) + public virtual async Task TagVersionAsync(int classificationRuleVersion, string action, CancellationToken cancellationToken = default) { - Request req = CreateTagClassificationVersionRequest(classificationRuleName, classificationRuleVersion, action); + Request req = CreateTagVersionRequest(classificationRuleVersion, action); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } /// Sets Classification Action on a specific classification rule version. - /// The String to use. /// The Integer to use. /// The ClassificationAction to use. /// The cancellation token to use. - public virtual Response TagClassificationVersion(string classificationRuleName, int classificationRuleVersion, string action, CancellationToken cancellationToken = default) + public virtual Response TagVersion(int classificationRuleVersion, string action, CancellationToken cancellationToken = default) { - Request req = CreateTagClassificationVersionRequest(classificationRuleName, classificationRuleVersion, action); + Request req = CreateTagVersionRequest(classificationRuleVersion, action); return Pipeline.SendRequest(req, cancellationToken); } - /// Create Request for and operations. - /// The String to use. + /// Create Request for and operations. /// The Integer to use. /// The ClassificationAction to use. - private Request CreateTagClassificationVersionRequest(string classificationRuleName, int classificationRuleVersion, string action) + private Request CreateTagVersionRequest(int classificationRuleVersion, string action) { var message = Pipeline.CreateMessage(); var request = message.Request; diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/DataSourcesClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewDataSourceClient.cs similarity index 64% rename from sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/DataSourcesClient.cs rename to sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewDataSourceClient.cs index 2823d37e30d0..f02bc54bf439 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/DataSourcesClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewDataSourceClient.cs @@ -16,65 +16,69 @@ namespace Azure.Analytics.Purview.Scanning { - /// The DataSources service client. - public partial class DataSourcesClient + /// The PurviewDataSource service client. + public partial class PurviewDataSourceClient { /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline { get; } private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private Uri endpoint; + private string dataSourceName; private readonly string apiVersion; - /// Initializes a new instance of DataSourcesClient for mocking. - protected DataSourcesClient() + /// Initializes a new instance of PurviewDataSourceClient for mocking. + protected PurviewDataSourceClient() { } - /// Initializes a new instance of DataSourcesClient. + /// Initializes a new instance of PurviewDataSourceClient. /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. + /// The String to use. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. - public DataSourcesClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) + public PurviewDataSourceClient(Uri endpoint, string dataSourceName, TokenCredential credential, PurviewScanningServiceClientOptions options = null) { if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } + if (dataSourceName == null) + { + throw new ArgumentNullException(nameof(dataSourceName)); + } if (credential == null) { throw new ArgumentNullException(nameof(credential)); } - options ??= new ScanningClientOptions(); + options ??= new PurviewScanningServiceClientOptions(); Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); this.endpoint = endpoint; + this.dataSourceName = dataSourceName; apiVersion = options.Version; } /// Creates or Updates a data source. - /// The String to use. /// The request body. /// The cancellation token to use. - public virtual async Task CreateOrUpdateAsync(string dataSourceName, RequestContent requestBody, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(RequestContent requestBody, CancellationToken cancellationToken = default) { - Request req = CreateCreateOrUpdateRequest(dataSourceName, requestBody); + Request req = CreateCreateOrUpdateRequest(requestBody); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } /// Creates or Updates a data source. - /// The String to use. /// The request body. /// The cancellation token to use. - public virtual Response CreateOrUpdate(string dataSourceName, RequestContent requestBody, CancellationToken cancellationToken = default) + public virtual Response CreateOrUpdate(RequestContent requestBody, CancellationToken cancellationToken = default) { - Request req = CreateCreateOrUpdateRequest(dataSourceName, requestBody); + Request req = CreateCreateOrUpdateRequest(requestBody); return Pipeline.SendRequest(req, cancellationToken); } /// Create Request for and operations. - /// The String to use. /// The request body. - private Request CreateCreateOrUpdateRequest(string dataSourceName, RequestContent requestBody) + private Request CreateCreateOrUpdateRequest(RequestContent requestBody) { var message = Pipeline.CreateMessage(); var request = message.Request; @@ -92,26 +96,23 @@ private Request CreateCreateOrUpdateRequest(string dataSourceName, RequestConten } /// Get a data source. - /// The String to use. /// The cancellation token to use. - public virtual async Task GetAsync(string dataSourceName, CancellationToken cancellationToken = default) + public virtual async Task GetPropertiesAsync(CancellationToken cancellationToken = default) { - Request req = CreateGetRequest(dataSourceName); + Request req = CreateGetPropertiesRequest(); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } /// Get a data source. - /// The String to use. /// The cancellation token to use. - public virtual Response Get(string dataSourceName, CancellationToken cancellationToken = default) + public virtual Response GetProperties(CancellationToken cancellationToken = default) { - Request req = CreateGetRequest(dataSourceName); + Request req = CreateGetPropertiesRequest(); return Pipeline.SendRequest(req, cancellationToken); } - /// Create Request for and operations. - /// The String to use. - private Request CreateGetRequest(string dataSourceName) + /// Create Request for and operations. + private Request CreateGetPropertiesRequest() { var message = Pipeline.CreateMessage(); var request = message.Request; @@ -127,26 +128,23 @@ private Request CreateGetRequest(string dataSourceName) } /// Deletes a data source. - /// The String to use. /// The cancellation token to use. - public virtual async Task DeleteAsync(string dataSourceName, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(CancellationToken cancellationToken = default) { - Request req = CreateDeleteRequest(dataSourceName); + Request req = CreateDeleteRequest(); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } /// Deletes a data source. - /// The String to use. /// The cancellation token to use. - public virtual Response Delete(string dataSourceName, CancellationToken cancellationToken = default) + public virtual Response Delete(CancellationToken cancellationToken = default) { - Request req = CreateDeleteRequest(dataSourceName); + Request req = CreateDeleteRequest(); return Pipeline.SendRequest(req, cancellationToken); } /// Create Request for and operations. - /// The String to use. - private Request CreateDeleteRequest(string dataSourceName) + private Request CreateDeleteRequest() { var message = Pipeline.CreateMessage(); var request = message.Request; @@ -161,58 +159,57 @@ private Request CreateDeleteRequest(string dataSourceName) return request; } - /// List data sources in Data catalog. + /// Lists the children of the collection. /// The cancellation token to use. - public virtual async Task ListByAccountAsync(CancellationToken cancellationToken = default) + public virtual async Task GetChildrenAsync(CancellationToken cancellationToken = default) { - Request req = CreateListByAccountRequest(); + Request req = CreateGetChildrenRequest(); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } - /// List data sources in Data catalog. + /// Lists the children of the collection. /// The cancellation token to use. - public virtual Response ListByAccount(CancellationToken cancellationToken = default) + public virtual Response GetChildren(CancellationToken cancellationToken = default) { - Request req = CreateListByAccountRequest(); + Request req = CreateGetChildrenRequest(); return Pipeline.SendRequest(req, cancellationToken); } - /// Create Request for and operations. - private Request CreateListByAccountRequest() + /// Create Request for and operations. + private Request CreateGetChildrenRequest() { var message = Pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); - uri.AppendPath("/datasources", false); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/listChildren", false); uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return request; } - /// Lists the children of the collection. - /// The String to use. + /// List scans in data source. /// The cancellation token to use. - public virtual async Task ListChildrenByCollectionAsync(string dataSourceName, CancellationToken cancellationToken = default) + public virtual async Task GetScansAsync(CancellationToken cancellationToken = default) { - Request req = CreateListChildrenByCollectionRequest(dataSourceName); + Request req = CreateGetScansRequest(); return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); } - /// Lists the children of the collection. - /// The String to use. + /// List scans in data source. /// The cancellation token to use. - public virtual Response ListChildrenByCollection(string dataSourceName, CancellationToken cancellationToken = default) + public virtual Response GetScans(CancellationToken cancellationToken = default) { - Request req = CreateListChildrenByCollectionRequest(dataSourceName); + Request req = CreateGetScansRequest(); return Pipeline.SendRequest(req, cancellationToken); } - /// Create Request for and operations. - /// The String to use. - private Request CreateListChildrenByCollectionRequest(string dataSourceName) + /// Create Request for and operations. + private Request CreateGetScansRequest() { var message = Pipeline.CreateMessage(); var request = message.Request; @@ -221,7 +218,7 @@ private Request CreateListChildrenByCollectionRequest(string dataSourceName) uri.Reset(endpoint); uri.AppendPath("/datasources/", false); uri.AppendPath(dataSourceName, true); - uri.AppendPath("/listChildren", false); + uri.AppendPath("/scans", false); uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanClient.cs new file mode 100644 index 000000000000..03f6aaa670fe --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanClient.cs @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +#pragma warning disable AZC0007 + +namespace Azure.Analytics.Purview.Scanning +{ + /// The PurviewScan service client. + public partial class PurviewScanClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private Uri endpoint; + private string dataSourceName; + private string scanName; + private readonly string apiVersion; + + /// Initializes a new instance of PurviewScanClient for mocking. + protected PurviewScanClient() + { + } + + /// Initializes a new instance of PurviewScanClient. + /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. + /// The String to use. + /// The String to use. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public PurviewScanClient(Uri endpoint, string dataSourceName, string scanName, TokenCredential credential, PurviewScanningServiceClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (dataSourceName == null) + { + throw new ArgumentNullException(nameof(dataSourceName)); + } + if (scanName == null) + { + throw new ArgumentNullException(nameof(scanName)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new PurviewScanningServiceClientOptions(); + Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); + this.endpoint = endpoint; + this.dataSourceName = dataSourceName; + this.scanName = scanName; + apiVersion = options.Version; + } + + /// Get a filter. + /// The cancellation token to use. + public virtual async Task GetFilterAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetFilterRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Get a filter. + /// The cancellation token to use. + public virtual Response GetFilter(CancellationToken cancellationToken = default) + { + Request req = CreateGetFilterRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetFilterRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendPath("/filters/custom", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Creates or updates a filter. + /// The request body. + /// The cancellation token to use. + public virtual async Task CreateOrUpdateFilterAsync(RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateFilterRequest(requestBody); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Creates or updates a filter. + /// The request body. + /// The cancellation token to use. + public virtual Response CreateOrUpdateFilter(RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateFilterRequest(requestBody); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The request body. + private Request CreateCreateOrUpdateFilterRequest(RequestContent requestBody) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendPath("/filters/custom", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return request; + } + + /// Creates an instance of a scan. + /// The request body. + /// The cancellation token to use. + public virtual async Task CreateOrUpdateAsync(RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateRequest(requestBody); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Creates an instance of a scan. + /// The request body. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateRequest(requestBody); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The request body. + private Request CreateCreateOrUpdateRequest(RequestContent requestBody) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return request; + } + + /// Gets a scan information. + /// The cancellation token to use. + public virtual async Task GetPropertiesAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetPropertiesRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Gets a scan information. + /// The cancellation token to use. + public virtual Response GetProperties(CancellationToken cancellationToken = default) + { + Request req = CreateGetPropertiesRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetPropertiesRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Deletes the scan associated with the data source. + /// The cancellation token to use. + public virtual async Task DeleteAsync(CancellationToken cancellationToken = default) + { + Request req = CreateDeleteRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Deletes the scan associated with the data source. + /// The cancellation token to use. + public virtual Response Delete(CancellationToken cancellationToken = default) + { + Request req = CreateDeleteRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateDeleteRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Runs the scan. + /// The String to use. + /// The ScanLevelType to use. + /// The cancellation token to use. + public virtual async Task RunScanAsync(string runId, string scanLevel = null, CancellationToken cancellationToken = default) + { + Request req = CreateRunScanRequest(runId, scanLevel); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Runs the scan. + /// The String to use. + /// The ScanLevelType to use. + /// The cancellation token to use. + public virtual Response RunScan(string runId, string scanLevel = null, CancellationToken cancellationToken = default) + { + Request req = CreateRunScanRequest(runId, scanLevel); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The String to use. + /// The ScanLevelType to use. + private Request CreateRunScanRequest(string runId, string scanLevel = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + if (scanLevel != null) + { + uri.AppendQuery("scanLevel", scanLevel, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Cancels a scan. + /// The String to use. + /// The cancellation token to use. + public virtual async Task CancelScanAsync(string runId, CancellationToken cancellationToken = default) + { + Request req = CreateCancelScanRequest(runId); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Cancels a scan. + /// The String to use. + /// The cancellation token to use. + public virtual Response CancelScan(string runId, CancellationToken cancellationToken = default) + { + Request req = CreateCancelScanRequest(runId); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The String to use. + private Request CreateCancelScanRequest(string runId) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + uri.AppendPath("/:cancel", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Lists the scan history of a scan. + /// The cancellation token to use. + public virtual async Task GetRunsAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetRunsRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Lists the scan history of a scan. + /// The cancellation token to use. + public virtual Response GetRuns(CancellationToken cancellationToken = default) + { + Request req = CreateGetRunsRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetRunsRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendPath("/runs", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Gets trigger information. + /// The cancellation token to use. + public virtual async Task GetTriggerAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetTriggerRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Gets trigger information. + /// The cancellation token to use. + public virtual Response GetTrigger(CancellationToken cancellationToken = default) + { + Request req = CreateGetTriggerRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetTriggerRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendPath("/triggers/default", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Creates an instance of a trigger. + /// The request body. + /// The cancellation token to use. + public virtual async Task CreateOrUpdateTriggerAsync(RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateTriggerRequest(requestBody); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Creates an instance of a trigger. + /// The request body. + /// The cancellation token to use. + public virtual Response CreateOrUpdateTrigger(RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateTriggerRequest(requestBody); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The request body. + private Request CreateCreateOrUpdateTriggerRequest(RequestContent requestBody) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendPath("/triggers/default", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return request; + } + + /// Deletes the trigger associated with the scan. + /// The cancellation token to use. + public virtual async Task DeleteTriggerAsync(CancellationToken cancellationToken = default) + { + Request req = CreateDeleteTriggerRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Deletes the trigger associated with the scan. + /// The cancellation token to use. + public virtual Response DeleteTrigger(CancellationToken cancellationToken = default) + { + Request req = CreateDeleteTriggerRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateDeleteTriggerRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanName, true); + uri.AppendPath("/triggers/default", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClient.cs new file mode 100644 index 000000000000..81fc0b1fff7b --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClient.cs @@ -0,0 +1,613 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +#pragma warning disable AZC0007 + +namespace Azure.Analytics.Purview.Scanning +{ + /// The PurviewScanningService service client. + public partial class PurviewScanningServiceClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private Uri endpoint; + private readonly string apiVersion; + + /// Initializes a new instance of PurviewScanningServiceClient for mocking. + protected PurviewScanningServiceClient() + { + } + + /// Initializes a new instance of PurviewScanningServiceClient. + /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public PurviewScanningServiceClient(Uri endpoint, TokenCredential credential, PurviewScanningServiceClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new PurviewScanningServiceClientOptions(); + Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Gets azureKeyVault information. + /// The String to use. + /// The cancellation token to use. + public virtual async Task GetKeyVaultReferenceAsync(string azureKeyVaultName, CancellationToken cancellationToken = default) + { + Request req = CreateGetKeyVaultReferenceRequest(azureKeyVaultName); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Gets azureKeyVault information. + /// The String to use. + /// The cancellation token to use. + public virtual Response GetKeyVaultReference(string azureKeyVaultName, CancellationToken cancellationToken = default) + { + Request req = CreateGetKeyVaultReferenceRequest(azureKeyVaultName); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The String to use. + private Request CreateGetKeyVaultReferenceRequest(string azureKeyVaultName) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/azureKeyVaults/", false); + uri.AppendPath(azureKeyVaultName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Creates an instance of a azureKeyVault. + /// The String to use. + /// The request body. + /// The cancellation token to use. + public virtual async Task CreateOrUpdateKeyVaultReferenceAsync(string azureKeyVaultName, RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateKeyVaultReferenceRequest(azureKeyVaultName, requestBody); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Creates an instance of a azureKeyVault. + /// The String to use. + /// The request body. + /// The cancellation token to use. + public virtual Response CreateOrUpdateKeyVaultReference(string azureKeyVaultName, RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateKeyVaultReferenceRequest(azureKeyVaultName, requestBody); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The String to use. + /// The request body. + private Request CreateCreateOrUpdateKeyVaultReferenceRequest(string azureKeyVaultName, RequestContent requestBody) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/azureKeyVaults/", false); + uri.AppendPath(azureKeyVaultName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return request; + } + + /// Deletes the azureKeyVault associated with the account. + /// The String to use. + /// The cancellation token to use. + public virtual async Task DeleteKeyVaultReferenceAsync(string azureKeyVaultName, CancellationToken cancellationToken = default) + { + Request req = CreateDeleteKeyVaultReferenceRequest(azureKeyVaultName); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Deletes the azureKeyVault associated with the account. + /// The String to use. + /// The cancellation token to use. + public virtual Response DeleteKeyVaultReference(string azureKeyVaultName, CancellationToken cancellationToken = default) + { + Request req = CreateDeleteKeyVaultReferenceRequest(azureKeyVaultName); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The String to use. + private Request CreateDeleteKeyVaultReferenceRequest(string azureKeyVaultName) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/azureKeyVaults/", false); + uri.AppendPath(azureKeyVaultName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// List azureKeyVaults in account. + /// The cancellation token to use. + public virtual async Task GetKeyVaultReferencesAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetKeyVaultReferencesRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// List azureKeyVaults in account. + /// The cancellation token to use. + public virtual Response GetKeyVaultReferences(CancellationToken cancellationToken = default) + { + Request req = CreateGetKeyVaultReferencesRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetKeyVaultReferencesRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/azureKeyVaults", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// List classification rules in Account. + /// The cancellation token to use. + public virtual async Task GetClassificationRulesAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetClassificationRulesRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// List classification rules in Account. + /// The cancellation token to use. + public virtual Response GetClassificationRules(CancellationToken cancellationToken = default) + { + Request req = CreateGetClassificationRulesRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetClassificationRulesRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/classificationrules", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// List data sources in Data catalog. + /// The cancellation token to use. + public virtual async Task GetDataSourcesAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetDataSourcesRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// List data sources in Data catalog. + /// The cancellation token to use. + public virtual Response GetDataSources(CancellationToken cancellationToken = default) + { + Request req = CreateGetDataSourcesRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetDataSourcesRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/datasources", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Lists the data sources in the account that do not belong to any collection. + /// The cancellation token to use. + public virtual async Task GetUnparentedDataSourcesAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetUnparentedDataSourcesRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Lists the data sources in the account that do not belong to any collection. + /// The cancellation token to use. + public virtual Response GetUnparentedDataSources(CancellationToken cancellationToken = default) + { + Request req = CreateGetUnparentedDataSourcesRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetUnparentedDataSourcesRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/listUnparentedDataSources", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Get a scan ruleset. + /// The String to use. + /// The cancellation token to use. + public virtual async Task GetScanRulesetAsync(string scanRulesetName, CancellationToken cancellationToken = default) + { + Request req = CreateGetScanRulesetRequest(scanRulesetName); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Get a scan ruleset. + /// The String to use. + /// The cancellation token to use. + public virtual Response GetScanRuleset(string scanRulesetName, CancellationToken cancellationToken = default) + { + Request req = CreateGetScanRulesetRequest(scanRulesetName); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The String to use. + private Request CreateGetScanRulesetRequest(string scanRulesetName) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/scanrulesets/", false); + uri.AppendPath(scanRulesetName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Creates or Updates a scan ruleset. + /// The String to use. + /// The request body. + /// The cancellation token to use. + public virtual async Task CreateOrUpdateScanRuelsetAsync(string scanRulesetName, RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateScanRuelsetRequest(scanRulesetName, requestBody); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Creates or Updates a scan ruleset. + /// The String to use. + /// The request body. + /// The cancellation token to use. + public virtual Response CreateOrUpdateScanRuelset(string scanRulesetName, RequestContent requestBody, CancellationToken cancellationToken = default) + { + Request req = CreateCreateOrUpdateScanRuelsetRequest(scanRulesetName, requestBody); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The String to use. + /// The request body. + private Request CreateCreateOrUpdateScanRuelsetRequest(string scanRulesetName, RequestContent requestBody) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/scanrulesets/", false); + uri.AppendPath(scanRulesetName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return request; + } + + /// Deletes a scan ruleset. + /// The String to use. + /// The cancellation token to use. + public virtual async Task DeleteScanRulesetAsync(string scanRulesetName, CancellationToken cancellationToken = default) + { + Request req = CreateDeleteScanRulesetRequest(scanRulesetName); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Deletes a scan ruleset. + /// The String to use. + /// The cancellation token to use. + public virtual Response DeleteScanRuleset(string scanRulesetName, CancellationToken cancellationToken = default) + { + Request req = CreateDeleteScanRulesetRequest(scanRulesetName); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The String to use. + private Request CreateDeleteScanRulesetRequest(string scanRulesetName) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/scanrulesets/", false); + uri.AppendPath(scanRulesetName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// List scan rulesets in Data catalog. + /// The cancellation token to use. + public virtual async Task GetScanRulesetsAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetScanRulesetsRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// List scan rulesets in Data catalog. + /// The cancellation token to use. + public virtual Response GetScanRulesets(CancellationToken cancellationToken = default) + { + Request req = CreateGetScanRulesetsRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetScanRulesetsRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/scanrulesets", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// List all system scan rulesets for an account. + /// The cancellation token to use. + public virtual async Task GetSystemRulesetsAsync(CancellationToken cancellationToken = default) + { + Request req = CreateGetSystemRulesetsRequest(); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// List all system scan rulesets for an account. + /// The cancellation token to use. + public virtual Response GetSystemRulesets(CancellationToken cancellationToken = default) + { + Request req = CreateGetSystemRulesetsRequest(); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + private Request CreateGetSystemRulesetsRequest() + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/systemScanRulesets", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Get a system scan ruleset for a data source. + /// The DataSourceType to use. + /// The cancellation token to use. + public virtual async Task GetSystemRulesetsForDataSourceAsync(string dataSourceType, CancellationToken cancellationToken = default) + { + Request req = CreateGetSystemRulesetsForDataSourceRequest(dataSourceType); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Get a system scan ruleset for a data source. + /// The DataSourceType to use. + /// The cancellation token to use. + public virtual Response GetSystemRulesetsForDataSource(string dataSourceType, CancellationToken cancellationToken = default) + { + Request req = CreateGetSystemRulesetsForDataSourceRequest(dataSourceType); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The DataSourceType to use. + private Request CreateGetSystemRulesetsForDataSourceRequest(string dataSourceType) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/systemScanRulesets/datasources/", false); + uri.AppendPath(dataSourceType, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Get a scan ruleset by version. + /// The Integer to use. + /// The DataSourceType to use. + /// The cancellation token to use. + public virtual async Task GetSystemRulesetsForVersionAsync(int version, string dataSourceType = null, CancellationToken cancellationToken = default) + { + Request req = CreateGetSystemRulesetsForVersionRequest(version, dataSourceType); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Get a scan ruleset by version. + /// The Integer to use. + /// The DataSourceType to use. + /// The cancellation token to use. + public virtual Response GetSystemRulesetsForVersion(int version, string dataSourceType = null, CancellationToken cancellationToken = default) + { + Request req = CreateGetSystemRulesetsForVersionRequest(version, dataSourceType); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The Integer to use. + /// The DataSourceType to use. + private Request CreateGetSystemRulesetsForVersionRequest(int version, string dataSourceType = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/systemScanRulesets/versions/", false); + uri.AppendPath(version, true); + if (dataSourceType != null) + { + uri.AppendQuery("dataSourceType", dataSourceType, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// Get the latest version of a system scan ruleset. + /// The DataSourceType to use. + /// The cancellation token to use. + public virtual async Task GetLatestSystemRulestesAsync(string dataSourceType = null, CancellationToken cancellationToken = default) + { + Request req = CreateGetLatestSystemRulestesRequest(dataSourceType); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// Get the latest version of a system scan ruleset. + /// The DataSourceType to use. + /// The cancellation token to use. + public virtual Response GetLatestSystemRulestes(string dataSourceType = null, CancellationToken cancellationToken = default) + { + Request req = CreateGetLatestSystemRulestesRequest(dataSourceType); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The DataSourceType to use. + private Request CreateGetLatestSystemRulestesRequest(string dataSourceType = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/systemScanRulesets/versions/latest", false); + if (dataSourceType != null) + { + uri.AppendQuery("dataSourceType", dataSourceType, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + + /// List system scan ruleset versions in Data catalog. + /// The DataSourceType to use. + /// The cancellation token to use. + public virtual async Task GetSystemRulesetsVersionsAsync(string dataSourceType = null, CancellationToken cancellationToken = default) + { + Request req = CreateGetSystemRulesetsVersionsRequest(dataSourceType); + return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); + } + + /// List system scan ruleset versions in Data catalog. + /// The DataSourceType to use. + /// The cancellation token to use. + public virtual Response GetSystemRulesetsVersions(string dataSourceType = null, CancellationToken cancellationToken = default) + { + Request req = CreateGetSystemRulesetsVersionsRequest(dataSourceType); + return Pipeline.SendRequest(req, cancellationToken); + } + + /// Create Request for and operations. + /// The DataSourceType to use. + private Request CreateGetSystemRulesetsVersionsRequest(string dataSourceType = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/systemScanRulesets/versions", false); + if (dataSourceType != null) + { + uri.AppendQuery("dataSourceType", dataSourceType, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return request; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScanningClientOptions.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClientOptions.cs similarity index 70% rename from sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScanningClientOptions.cs rename to sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClientOptions.cs index a91b334fe890..2662eb386d85 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScanningClientOptions.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClientOptions.cs @@ -10,8 +10,8 @@ namespace Azure.Analytics.Purview.Scanning { - /// Client options for ScanningClient. - public partial class ScanningClientOptions : ClientOptions + /// Client options for PurviewScanningServiceClient. + public partial class PurviewScanningServiceClientOptions : ClientOptions { private const ServiceVersion LatestVersion = ServiceVersion.V2018_12_01_preview; @@ -24,8 +24,8 @@ public enum ServiceVersion internal string Version { get; } - /// Initializes new instance of ScanningClientOptions. - public ScanningClientOptions(ServiceVersion version = LatestVersion) + /// Initializes new instance of PurviewScanningServiceClientOptions. + public PurviewScanningServiceClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScanRulesetsClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScanRulesetsClient.cs deleted file mode 100644 index 03b386e933b7..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScanRulesetsClient.cs +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -#pragma warning disable AZC0007 - -namespace Azure.Analytics.Purview.Scanning -{ - /// The ScanRulesets service client. - public partial class ScanRulesetsClient - { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get; } - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; - private Uri endpoint; - private readonly string apiVersion; - - /// Initializes a new instance of ScanRulesetsClient for mocking. - protected ScanRulesetsClient() - { - } - - /// Initializes a new instance of ScanRulesetsClient. - /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public ScanRulesetsClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new ScanningClientOptions(); - Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Get a scan ruleset. - /// The String to use. - /// The cancellation token to use. - public virtual async Task GetAsync(string scanRulesetName, CancellationToken cancellationToken = default) - { - Request req = CreateGetRequest(scanRulesetName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Get a scan ruleset. - /// The String to use. - /// The cancellation token to use. - public virtual Response Get(string scanRulesetName, CancellationToken cancellationToken = default) - { - Request req = CreateGetRequest(scanRulesetName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - private Request CreateGetRequest(string scanRulesetName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scanrulesets/", false); - uri.AppendPath(scanRulesetName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Creates or Updates a scan ruleset. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual async Task CreateOrUpdateAsync(string scanRulesetName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateOrUpdateRequest(scanRulesetName, requestBody); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Creates or Updates a scan ruleset. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual Response CreateOrUpdate(string scanRulesetName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateOrUpdateRequest(scanRulesetName, requestBody); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The request body. - private Request CreateCreateOrUpdateRequest(string scanRulesetName, RequestContent requestBody) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scanrulesets/", false); - uri.AppendPath(scanRulesetName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = requestBody; - return request; - } - - /// Deletes a scan ruleset. - /// The String to use. - /// The cancellation token to use. - public virtual async Task DeleteAsync(string scanRulesetName, CancellationToken cancellationToken = default) - { - Request req = CreateDeleteRequest(scanRulesetName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Deletes a scan ruleset. - /// The String to use. - /// The cancellation token to use. - public virtual Response Delete(string scanRulesetName, CancellationToken cancellationToken = default) - { - Request req = CreateDeleteRequest(scanRulesetName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - private Request CreateDeleteRequest(string scanRulesetName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scanrulesets/", false); - uri.AppendPath(scanRulesetName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// List scan rulesets in Data catalog. - /// The cancellation token to use. - public virtual async Task ListAllAsync(CancellationToken cancellationToken = default) - { - Request req = CreateListAllRequest(); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// List scan rulesets in Data catalog. - /// The cancellation token to use. - public virtual Response ListAll(CancellationToken cancellationToken = default) - { - Request req = CreateListAllRequest(); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - private Request CreateListAllRequest() - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scanrulesets", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - } -} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScansClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScansClient.cs deleted file mode 100644 index 0b9fcc1151b1..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/ScansClient.cs +++ /dev/null @@ -1,354 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -#pragma warning disable AZC0007 - -namespace Azure.Analytics.Purview.Scanning -{ - /// The Scans service client. - public partial class ScansClient - { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get; } - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; - private Uri endpoint; - private readonly string apiVersion; - - /// Initializes a new instance of ScansClient for mocking. - protected ScansClient() - { - } - - /// Initializes a new instance of ScansClient. - /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public ScansClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new ScanningClientOptions(); - Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Creates an instance of a scan. - /// The String to use. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual async Task CreateOrUpdateAsync(string dataSourceName, string scanName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateOrUpdateRequest(dataSourceName, scanName, requestBody); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Creates an instance of a scan. - /// The String to use. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual Response CreateOrUpdate(string dataSourceName, string scanName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateOrUpdateRequest(dataSourceName, scanName, requestBody); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - /// The request body. - private Request CreateCreateOrUpdateRequest(string dataSourceName, string scanName, RequestContent requestBody) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = requestBody; - return request; - } - - /// Gets a scan information. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual async Task GetAsync(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateGetRequest(dataSourceName, scanName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Gets a scan information. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual Response Get(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateGetRequest(dataSourceName, scanName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - private Request CreateGetRequest(string dataSourceName, string scanName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Deletes the scan associated with the data source. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual async Task DeleteAsync(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateDeleteRequest(dataSourceName, scanName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Deletes the scan associated with the data source. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual Response Delete(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateDeleteRequest(dataSourceName, scanName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - private Request CreateDeleteRequest(string dataSourceName, string scanName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// List scans in data source. - /// The String to use. - /// The cancellation token to use. - public virtual async Task ListByDataSourceAsync(string dataSourceName, CancellationToken cancellationToken = default) - { - Request req = CreateListByDataSourceRequest(dataSourceName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// List scans in data source. - /// The String to use. - /// The cancellation token to use. - public virtual Response ListByDataSource(string dataSourceName, CancellationToken cancellationToken = default) - { - Request req = CreateListByDataSourceRequest(dataSourceName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - private Request CreateListByDataSourceRequest(string dataSourceName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Runs the scan. - /// The String to use. - /// The String to use. - /// The String to use. - /// The ScanLevelType to use. - /// The cancellation token to use. - public virtual async Task RunScanAsync(string dataSourceName, string scanName, string runId, string scanLevel = null, CancellationToken cancellationToken = default) - { - Request req = CreateRunScanRequest(dataSourceName, scanName, runId, scanLevel); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Runs the scan. - /// The String to use. - /// The String to use. - /// The String to use. - /// The ScanLevelType to use. - /// The cancellation token to use. - public virtual Response RunScan(string dataSourceName, string scanName, string runId, string scanLevel = null, CancellationToken cancellationToken = default) - { - Request req = CreateRunScanRequest(dataSourceName, scanName, runId, scanLevel); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - /// The String to use. - /// The ScanLevelType to use. - private Request CreateRunScanRequest(string dataSourceName, string scanName, string runId, string scanLevel = null) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - if (scanLevel != null) - { - uri.AppendQuery("scanLevel", scanLevel, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Cancels a scan. - /// The String to use. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual async Task CancelScanAsync(string dataSourceName, string scanName, string runId, CancellationToken cancellationToken = default) - { - Request req = CreateCancelScanRequest(dataSourceName, scanName, runId); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Cancels a scan. - /// The String to use. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual Response CancelScan(string dataSourceName, string scanName, string runId, CancellationToken cancellationToken = default) - { - Request req = CreateCancelScanRequest(dataSourceName, scanName, runId); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - /// The String to use. - private Request CreateCancelScanRequest(string dataSourceName, string scanName, string runId) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - uri.AppendPath("/:cancel", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Lists the scan history of a scan. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual async Task ListScanHistoryAsync(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateListScanHistoryRequest(dataSourceName, scanName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Lists the scan history of a scan. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual Response ListScanHistory(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateListScanHistoryRequest(dataSourceName, scanName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - private Request CreateListScanHistoryRequest(string dataSourceName, string scanName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/runs", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - } -} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/SystemScanRulesetsClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/SystemScanRulesetsClient.cs deleted file mode 100644 index c9eec7fe44b7..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/SystemScanRulesetsClient.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -#pragma warning disable AZC0007 - -namespace Azure.Analytics.Purview.Scanning -{ - /// The SystemScanRulesets service client. - public partial class SystemScanRulesetsClient - { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get; } - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; - private Uri endpoint; - private readonly string apiVersion; - - /// Initializes a new instance of SystemScanRulesetsClient for mocking. - protected SystemScanRulesetsClient() - { - } - - /// Initializes a new instance of SystemScanRulesetsClient. - /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public SystemScanRulesetsClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new ScanningClientOptions(); - Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// List all system scan rulesets for an account. - /// The cancellation token to use. - public virtual async Task ListAllAsync(CancellationToken cancellationToken = default) - { - Request req = CreateListAllRequest(); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// List all system scan rulesets for an account. - /// The cancellation token to use. - public virtual Response ListAll(CancellationToken cancellationToken = default) - { - Request req = CreateListAllRequest(); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - private Request CreateListAllRequest() - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Get a system scan ruleset for a data source. - /// The DataSourceType to use. - /// The cancellation token to use. - public virtual async Task GetAsync(string dataSourceType, CancellationToken cancellationToken = default) - { - Request req = CreateGetRequest(dataSourceType); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Get a system scan ruleset for a data source. - /// The DataSourceType to use. - /// The cancellation token to use. - public virtual Response Get(string dataSourceType, CancellationToken cancellationToken = default) - { - Request req = CreateGetRequest(dataSourceType); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The DataSourceType to use. - private Request CreateGetRequest(string dataSourceType) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets/datasources/", false); - uri.AppendPath(dataSourceType, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Get a scan ruleset by version. - /// The Integer to use. - /// The DataSourceType to use. - /// The cancellation token to use. - public virtual async Task GetByVersionAsync(int version, string dataSourceType = null, CancellationToken cancellationToken = default) - { - Request req = CreateGetByVersionRequest(version, dataSourceType); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Get a scan ruleset by version. - /// The Integer to use. - /// The DataSourceType to use. - /// The cancellation token to use. - public virtual Response GetByVersion(int version, string dataSourceType = null, CancellationToken cancellationToken = default) - { - Request req = CreateGetByVersionRequest(version, dataSourceType); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The Integer to use. - /// The DataSourceType to use. - private Request CreateGetByVersionRequest(int version, string dataSourceType = null) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets/versions/", false); - uri.AppendPath(version, true); - if (dataSourceType != null) - { - uri.AppendQuery("dataSourceType", dataSourceType, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Get the latest version of a system scan ruleset. - /// The DataSourceType to use. - /// The cancellation token to use. - public virtual async Task GetLatestAsync(string dataSourceType = null, CancellationToken cancellationToken = default) - { - Request req = CreateGetLatestRequest(dataSourceType); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Get the latest version of a system scan ruleset. - /// The DataSourceType to use. - /// The cancellation token to use. - public virtual Response GetLatest(string dataSourceType = null, CancellationToken cancellationToken = default) - { - Request req = CreateGetLatestRequest(dataSourceType); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The DataSourceType to use. - private Request CreateGetLatestRequest(string dataSourceType = null) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets/versions/latest", false); - if (dataSourceType != null) - { - uri.AppendQuery("dataSourceType", dataSourceType, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// List system scan ruleset versions in Data catalog. - /// The DataSourceType to use. - /// The cancellation token to use. - public virtual async Task ListVersionsByDataSourceAsync(string dataSourceType = null, CancellationToken cancellationToken = default) - { - Request req = CreateListVersionsByDataSourceRequest(dataSourceType); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// List system scan ruleset versions in Data catalog. - /// The DataSourceType to use. - /// The cancellation token to use. - public virtual Response ListVersionsByDataSource(string dataSourceType = null, CancellationToken cancellationToken = default) - { - Request req = CreateListVersionsByDataSourceRequest(dataSourceType); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The DataSourceType to use. - private Request CreateListVersionsByDataSourceRequest(string dataSourceType = null) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets/versions", false); - if (dataSourceType != null) - { - uri.AppendQuery("dataSourceType", dataSourceType, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - } -} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/TriggersClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/TriggersClient.cs deleted file mode 100644 index 1d443c45e3e4..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/TriggersClient.cs +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -#pragma warning disable AZC0007 - -namespace Azure.Analytics.Purview.Scanning -{ - /// The Triggers service client. - public partial class TriggersClient - { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get; } - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; - private Uri endpoint; - private readonly string apiVersion; - - /// Initializes a new instance of TriggersClient for mocking. - protected TriggersClient() - { - } - - /// Initializes a new instance of TriggersClient. - /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public TriggersClient(Uri endpoint, TokenCredential credential, ScanningClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new ScanningClientOptions(); - Pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes)); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Gets trigger information. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual async Task GetTriggerAsync(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateGetTriggerRequest(dataSourceName, scanName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Gets trigger information. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual Response GetTrigger(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateGetTriggerRequest(dataSourceName, scanName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - private Request CreateGetTriggerRequest(string dataSourceName, string scanName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/triggers/default", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - - /// Creates an instance of a trigger. - /// The String to use. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual async Task CreateTriggerAsync(string dataSourceName, string scanName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateTriggerRequest(dataSourceName, scanName, requestBody); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Creates an instance of a trigger. - /// The String to use. - /// The String to use. - /// The request body. - /// The cancellation token to use. - public virtual Response CreateTrigger(string dataSourceName, string scanName, RequestContent requestBody, CancellationToken cancellationToken = default) - { - Request req = CreateCreateTriggerRequest(dataSourceName, scanName, requestBody); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - /// The request body. - private Request CreateCreateTriggerRequest(string dataSourceName, string scanName, RequestContent requestBody) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/triggers/default", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = requestBody; - return request; - } - - /// Deletes the trigger associated with the scan. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual async Task DeleteTriggerAsync(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateDeleteTriggerRequest(dataSourceName, scanName); - return await Pipeline.SendRequestAsync(req, cancellationToken).ConfigureAwait(false); - } - - /// Deletes the trigger associated with the scan. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - public virtual Response DeleteTrigger(string dataSourceName, string scanName, CancellationToken cancellationToken = default) - { - Request req = CreateDeleteTriggerRequest(dataSourceName, scanName); - return Pipeline.SendRequest(req, cancellationToken); - } - - /// Create Request for and operations. - /// The String to use. - /// The String to use. - private Request CreateDeleteTriggerRequest(string dataSourceName, string scanName) - { - var message = Pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/triggers/default", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return request; - } - } -} diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/autorest.md b/sdk/purview/Azure.Analytics.Purview.Scanning/src/autorest.md index 36ff145b61c0..5b25f352e33a 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/autorest.md +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/autorest.md @@ -3,7 +3,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ```yaml -title: Scanning +title: PurviewScanningService input-file: https://github.com/Azure/azure-rest-api-specs/blob/8478d2280c54d0065ac6271e39321849c090c659/specification/purview/data-plane/Azure.Data.Purview.Scanning/preview/2018-12-01-preview/scanningService.json namespace: Azure.Analytics.Purview.Scanning low-level-client: true @@ -20,7 +20,101 @@ directive: - from: swagger-document where: $.parameters.Endpoint transform: > - if ($.format === undefined) { - $.format = "url"; - } + $.format = "url"; +``` + +# Promote Parameters to clients + +```yaml +directive: + - from: swagger-document + where: $.parameters + transform: > + $["dataSourceName"] = { + "in": "path", + "name": "dataSourceName", + "required": true, + "type": "string", + "x-ms-parameter-location": "client" + }; + $["scanName"] = { + "in": "path", + "name": "scanName", + "required": true, + "type": "string", + "x-ms-parameter-location": "client" + }; + $["classificationRuleName"] = { + "in": "path", + "name": "classificationRuleName", + "required": true, + "type": "string", + "x-ms-parameter-location": "client" + }; + + - from: swagger-document + where: $.paths..parameters[?(@.name=='dataSourceName')] + transform: > + $ = { "$ref": "#/parameters/dataSourceName" }; + + - from: swagger-document + where: $.paths..parameters[?(@.name=='scanName')] + transform: > + $ = { "$ref": "#/parameters/scanName" }; + + - from: swagger-document + where: $.paths..parameters[?(@.name=='classificationRuleName')] + transform: > + $ = { "$ref": "#/parameters/classificationRuleName" }; + +``` + +# Adopt Client Factoring + +```yaml +directive: + - from: swagger-document + where: $..[?(@.operationId !== undefined)] + transform: > + const mappingTable = { + "AzureKeyVaults_GetAzureKeyVault": "GetKeyVaultReference", + "AzureKeyVaults_CreateAzureKeyVault": "CreateOrUpdateKeyVaultReference", + "AzureKeyVaults_DeleteAzureKeyVault": "DeleteKeyVaultReference", + "AzureKeyVaults_ListByAccount": "GetKeyVaultReferences", + "ClassificationRules_Get": "PurviewClassificationRule_GetProperties", + "ClassificationRules_CreateOrUpdate": "PurviewClassificationRule_CreateOrUpdate", + "ClassificationRules_Delete": "PurviewClassificationRule_Delete", + "ClassificationRules_ListAll": "GetClassificationRules", + "ClassificationRules_ListVersionsByClassificationRuleName": "PurviewClassificationRule_GetVersions", + "ClassificationRules_TagClassificationVersion": "PurviewClassificationRule_TagVersion", + "DataSources_CreateOrUpdate": "PurviewDataSource_CreateOrUpdate", + "DataSources_Get": "PurviewDataSource_GetProperties", + "DataSources_Delete": "PurviewDataSource_Delete", + "DataSources_ListByAccount": "GetDataSources", + "DataSources_ListChildrenByCollection": "PurviewDataSource_GetChildren", + "DataSource_ListUnparentedDataSourcesByAccount": "GetUnparentedDataSources", + "Filters_Get": "PurviewScan_GetFilter", + "Filters_CreateOrUpdate": "PurviewScan_CreateOrUpdateFilter", + "Scans_CreateOrUpdate": "PurviewScan_CreateOrUpdate", + "Scans_Get": "PurviewScan_GetProperties", + "Scans_Delete": "PurviewScan_Delete", + "Scans_ListByDataSource": "PurviewDataSource_GetScans", + "Scans_RunScan": "PurviewScan_RunScan", + "Scans_CancelScan": "PurviewScan_CancelScan", + "Scans_ListScanHistory": "PurviewScan_GetRuns", + "ScanRulesets_Get": "GetScanRuleset", + "ScanRulesets_CreateOrUpdate": "CreateOrUpdateScanRuelset", + "ScanRulesets_Delete": "DeleteScanRuleset", + "ScanRulesets_ListAll": "GetScanRulesets", + "SystemScanRulesets_ListAll": "GetSystemRulesets", + "SystemScanRulesets_Get": "GetSystemRulesetsForDataSource", + "SystemScanRulesets_GetByVersion": "GetSystemRulesetsForVersion", + "SystemScanRulesets_GetLatest": "GetLatestSystemRulestes", + "SystemScanRulesets_ListVersionsByDataSource": "GetSystemRulesetsVersions", + "Triggers_GetTrigger": "PurviewScan_GetTrigger", + "Triggers_CreateTrigger": "PurviewScan_CreateOrUpdateTrigger", + "Triggers_DeleteTrigger": "PurviewScan_DeleteTrigger", + }; + + $.operationId = (mappingTable[$.operationId] ?? $.operationId); ``` \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/tests/Azure.Analytics.Purview.Scanning.Tests.csproj b/sdk/purview/Azure.Analytics.Purview.Scanning/tests/Azure.Analytics.Purview.Scanning.Tests.csproj index 160bf9a27214..8a496f63f7bd 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/tests/Azure.Analytics.Purview.Scanning.Tests.csproj +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/tests/Azure.Analytics.Purview.Scanning.Tests.csproj @@ -12,6 +12,6 @@ - +