diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/Azure.Analytics.Purview.Administration.sln b/sdk/purview/Azure.Analytics.Purview.Administration/Azure.Analytics.Purview.Administration.sln new file mode 100644 index 000000000000..8254c498754a --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/Azure.Analytics.Purview.Administration.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31806.525 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Analytics.Purview.Administration", "src\Azure.Analytics.Purview.Administration.csproj", "{B0C276D1-2930-4887-B29A-D1A33E7009A2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Analytics.Purview.Administration.Tests", "tests\Azure.Analytics.Purview.Administration.Tests.csproj", "{8E9A77AC-792A-4432-8320-ACFD46730401}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Stress", "..\..\..\common\Stress\Azure.Test.Stress\Azure.Test.Stress.csproj", "{A4241C1F-A53D-474C-9E4E-075054407E74}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj", "{FA8BD3F1-8616-47B6-974C-7576CDF4717E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B6DFAA14-2473-4BC3-B66B-4421B51AE592} + EndGlobalSection +EndGlobal diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/CHANGELOG.md b/sdk/purview/Azure.Analytics.Purview.Administration/CHANGELOG.md new file mode 100644 index 000000000000..ebdb91fe55e4 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2021-10-19) + +### New Features + +- Initial preview release of the Azure Purview Administration client library for .NET +- Provides operations for Purview Account and MetadataPolicies services diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/Directory.Build.props b/sdk/purview/Azure.Analytics.Purview.Administration/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/README.md b/sdk/purview/Azure.Analytics.Purview.Administration/README.md new file mode 100644 index 000000000000..dd2a61de6c1a --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/README.md @@ -0,0 +1,131 @@ +# Azure Purview Administration client library for .NET + +Azure Purview Administration contains the Purview Account and Purview MetdataPolicy managed cloud service. + +**Please rely heavily on the [service's documentation][account_product_documentation] and our [protocol client docs][protocol_client_quickstart] to use this library** + +[Source code][source_code] | [Package (NuGet)][client_nuget_package] | [Product documentation][account_product_documentation] + +## Getting started + +### Install the package + +Install the Azure Purview Administration client library for .NET with [NuGet][client_nuget_package]: + +```dotnetcli +dotnet add package Azure.Analysis.Purview.Administration +``` + +### Prerequisites + +- You must have an [Azure subscription][azure_subscription] and a [Purview resource][purview_resource] to use this package. + +### Authenticate the client + +#### Using Azure Active Directory + +This document demonstrates using [DefaultAzureCredential][default_cred_ref] to authenticate via Azure Active Directory. However, any of the credentials offered by the [Azure.Identity][azure_identity] will be accepted. See the [Azure.Identity][azure_identity] documentation for more information about other credentials. + +Once you have chosen and configured your credential, you can create instances of the `PurviewAccountClient`, `PurviewMetadataPolicyClient` or `PurviewMetadataRolesClient`. + +```C# +var credential = new DefaultAzureCredential(); +var accountClient = new PurviewAccountClient(new Url("https://.purview.azure.com"), credential); +var policyClient = new PurviewMetadataPolicyClient(new Url("https://.purview.azure.com"), "myCollection", credential); +var roleClient = new PurviewMetadataRolesClient(new Url("https://.purview.azure.com"), credential); +``` + +## Key concepts + +### Protocol Methods + +Operations exposed by the Purview Account SDK for .NET use *protocol methods* to expose the underlying REST operations. You can learn more about how to use SDK Clients which use protocol methods in our [documentation][protocol_client_quickstart]. + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +The following section shows you how to initialize and authenticate your client, then get all of the type definitions in the catalog. + +### Get All Account Type Definitions + +```C# +var credential = new DefaultAzureCredential(); +var client = new PurviewAccountClient(new Uri("https://.purview.azure.com"), credential); + +var Response response = await client.GetAccountPropertiesAsync(); +var responseDocument = JsonDocument.Parse(response.Content); +Console.WriteLine(responseDocument.RootElement.GetProperty("name")); +``` + +### List All Roles + +```C# +var credential = new DefaultAzureCredential(); +var client = new PurviewMetadataRolesClient(new Uri("https://.purview.azure.com"), credential); + +AsyncPageable fetchResponse = client.GetMetadataRolesAsync(new()); +await foreach (BinaryData item in fetchResponse) +{ + JsonElement fetchBodyJson = JsonDocument.Parse(item).RootElement; + Console.WriteLine(fetchBodyJson.GetProperty("id")); +} +``` + +## Troubleshooting + +### Setting up console logging + +The simplest way to see the logs is to enable the console logging. +To create an Azure SDK log listener that outputs messages to console use AzureEventSourceListener.CreateConsoleLogger method. + +```C# +// Setup a listener to monitor logged events. +using AzureEventSourceListener listener = AzureEventSourceListener.CreateConsoleLogger(); +``` + +To learn more about other logging mechanisms see [here][azure_core_diagnostics]. + +## Next steps + +This client SDK exposes operations using *protocol methods*, you can learn more about how to use SDK Clients which use protocol methods in our [documentation][protocol_client_quickstart]. + +## Contributing + +See the [CONTRIBUTING.md][contributing] for details on building, testing, and contributing to this library. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla]. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments. + + +[source_code]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/purview/Azure.Analytics.Purview.Account/src +[client_nuget_package]: https://www.nuget.org/packages?q=Azure.Analytics.Purview.Account +[account_product_documentation]: https://azure.microsoft.com/services/purview/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity +[protocol_client_quickstart]: https://aka.ms/azsdk/net/protocol/quickstart +[default_cred_ref]: https://docs.microsoft.com/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet +[azure_subscription]: https://azure.microsoft.com/free/dotnet/ +[purview_resource]: https://docs.microsoft.com/azure/purview +[azure_core_diagnostics]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md +[cla]: https://cla.microsoft.com +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ +[coc_contact]: mailto:opencode@microsoft.com + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Fpurview%2FAzure.Analytics.Purview.Catalog%2FREADME.png) diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/api/Azure.Analytics.Purview.Administration.netstandard2.0.cs b/sdk/purview/Azure.Analytics.Purview.Administration/api/Azure.Analytics.Purview.Administration.netstandard2.0.cs new file mode 100644 index 000000000000..00b712412a60 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/api/Azure.Analytics.Purview.Administration.netstandard2.0.cs @@ -0,0 +1,85 @@ +namespace Azure.Analytics.Purview.Administration +{ + public partial class PurviewAccountClient + { + protected PurviewAccountClient() { } + public PurviewAccountClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Administration.PurviewAccountClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response GetAccessKeys(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAccessKeysAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetAccountProperties(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAccountPropertiesAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Analytics.Purview.Administration.PurviewCollection GetCollectionClient(string collectionName) { throw null; } + public virtual Azure.Pageable GetCollections(Azure.RequestOptions options, string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable GetCollectionsAsync(Azure.RequestOptions options, string skipToken = null) { throw null; } + public virtual Azure.Analytics.Purview.Administration.PurviewResourceSetRule GetResourceSetRuleClient() { throw null; } + public virtual Azure.Pageable GetResourceSetRules(Azure.RequestOptions options, string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable GetResourceSetRulesAsync(Azure.RequestOptions options, string skipToken = null) { throw null; } + public virtual Azure.Response RegenerateAccessKey(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task RegenerateAccessKeyAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response UpdateAccountProperties(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task UpdateAccountPropertiesAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + } + public partial class PurviewAccountClientOptions : Azure.Core.ClientOptions + { + public PurviewAccountClientOptions(Azure.Analytics.Purview.Administration.PurviewAccountClientOptions.ServiceVersion version = Azure.Analytics.Purview.Administration.PurviewAccountClientOptions.ServiceVersion.V2019_11_01_preview) { } + public enum ServiceVersion + { + V2019_11_01_preview = 1, + } + } + public partial class PurviewCollection + { + protected PurviewCollection() { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdateCollection(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateCollectionAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response DeleteCollection(Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteCollectionAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetCollection(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCollectionAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetCollectionPath(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCollectionPathAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable ListChildCollectionNames(Azure.RequestOptions options, string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListChildCollectionNamesAsync(Azure.RequestOptions options, string skipToken = null) { throw null; } + } + public partial class PurviewMetadataClientOptions : Azure.Core.ClientOptions + { + public PurviewMetadataClientOptions(Azure.Analytics.Purview.Administration.PurviewMetadataClientOptions.ServiceVersion version = Azure.Analytics.Purview.Administration.PurviewMetadataClientOptions.ServiceVersion.V2021_07_01) { } + public enum ServiceVersion + { + V2021_07_01 = 1, + } + } + public partial class PurviewMetadataPolicyClient + { + protected PurviewMetadataPolicyClient() { } + public PurviewMetadataPolicyClient(System.Uri endpoint, string collectionName, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Administration.PurviewMetadataClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Pageable GetMetadataPolicies(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetMetadataPoliciesAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetMetadataPolicy(string policyId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetMetadataPolicyAsync(string policyId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response UpdateMetadataPolicy(string policyId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task UpdateMetadataPolicyAsync(string policyId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + } + public partial class PurviewMetadataRolesClient + { + protected PurviewMetadataRolesClient() { } + public PurviewMetadataRolesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Administration.PurviewMetadataClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Pageable GetMetadataRoles(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetMetadataRolesAsync(Azure.RequestOptions options) { throw null; } + } + public partial class PurviewResourceSetRule + { + protected PurviewResourceSetRule() { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdateResourceSetRule(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateResourceSetRuleAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response DeleteResourceSetRule(Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteResourceSetRuleAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetResourceSetRule(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetResourceSetRuleAsync(Azure.RequestOptions options) { throw null; } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Azure.Analytics.Purview.Administration.csproj b/sdk/purview/Azure.Analytics.Purview.Administration/src/Azure.Analytics.Purview.Administration.csproj new file mode 100644 index 000000000000..331b18787532 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Azure.Analytics.Purview.Administration.csproj @@ -0,0 +1,31 @@ + + + An SDK for interacting with the Azure Purview Administration service + Azure Purview Administration SDK + 1.0.0-beta.1 + Azure Purview + $(RequiredTargetFrameworks) + $(NoWarn);CS0169 + $(DefineConstants);EXPERIMENTAL + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewAccountClient.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewAccountClient.cs new file mode 100644 index 000000000000..959dc4225ddb --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewAccountClient.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; + +namespace Azure.Analytics.Purview.Administration +{ + [CodeGenClient("AccountsClient")] + public partial class PurviewAccountClient + { + /// + /// Gets a service client for interacting with a collection. + /// + /// The name of the collection to use. + /// A service client for interacting with a collection. + public virtual PurviewCollection GetCollectionClient(string collectionName) + { + if (string.IsNullOrEmpty(collectionName)) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + return new PurviewCollection(Pipeline, _tokenCredential, _endpoint, collectionName, _clientDiagnostics); + } + + /// + /// Gets a service client for interacting with a resource set rule. + /// + /// A service client for interacting with a resource set rule. + public virtual PurviewResourceSetRule GetResourceSetRuleClient() + { + return new PurviewResourceSetRule(Pipeline, _tokenCredential, _endpoint, _clientDiagnostics); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewAccountClientOptions.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewAccountClientOptions.cs new file mode 100644 index 000000000000..a2b52ca13344 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewAccountClientOptions.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +[assembly:CodeGenSuppressType("PurviewAccountClientOptions")] + +namespace Azure.Analytics.Purview.Administration +{ + /// Client options for PurviewAccountClient. + [CodeGenClient("PurviewAdministrationClientOptions")] + public partial class PurviewAccountClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2019_11_01_preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2019-11-01-preview". + V2019_11_01_preview = 1, + } + + internal string Version { get; } + + /// Initializes new instance of PurviewAccountClientOptions. + public PurviewAccountClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2019_11_01_preview => "2019-11-01-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewCollection.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewCollection.cs new file mode 100644 index 000000000000..433b3da79ab3 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewCollection.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + [CodeGenClient("CollectionsClient")] + [CodeGenSuppress("PurviewCollection", new Type[] { typeof(Uri), typeof(string), typeof(TokenCredential), typeof(PurviewAccountClientOptions)})] + public partial class PurviewCollection + { + internal PurviewCollection(HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string collectionName, ClientDiagnostics clientDiagnostics) + { + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _collectionName = collectionName; + _clientDiagnostics = clientDiagnostics; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataClientOptions.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataClientOptions.cs new file mode 100644 index 000000000000..368a45eb927b --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataClientOptions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Analytics.Purview.Administration +{ + /// Client options for PurviewMetadataClient. + public partial class PurviewMetadataClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2021_07_01; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2021-07-01". + V2021_07_01 = 1, + } + + internal string Version { get; } + + /// Initializes new instance of PurviewMetadataClientOptions. + public PurviewMetadataClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2021_07_01 => "2021-07-01", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataPolicyClient.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataPolicyClient.cs new file mode 100644 index 000000000000..fe0553076156 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataPolicyClient.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + /// The PurviewMetadataPolicy service client. + [CodeGenClient("PurviewMetadataPolicyClient")] + [CodeGenSuppress("PurviewMetadataPolicyClient", new Type[] { typeof(Uri), typeof(string), typeof(TokenCredential), typeof(PurviewAccountClientOptions)})] + public partial class PurviewMetadataPolicyClient + { + /// Initializes a new instance of PurviewMetadataPolicyClient. + /// The endpoint of your Purview account. Example: https://{accountName}.purview.azure.com. + /// The String to use. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// , , or is null. + public PurviewMetadataPolicyClient(Uri endpoint, string collectionName, TokenCredential credential, PurviewMetadataClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new PurviewMetadataClientOptions(); + + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _collectionName = collectionName; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataRolesClient.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataRolesClient.cs new file mode 100644 index 000000000000..25fd22cd8531 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewMetadataRolesClient.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + /// The PurviewMetadataRoles service client. + [CodeGenClient("PurviewMetadataRolesClient")] + [CodeGenSuppress("PurviewMetadataRolesClient", new Type[] { typeof(Uri), typeof(TokenCredential), typeof(PurviewAccountClientOptions)})] + public partial class PurviewMetadataRolesClient + { + /// Initializes a new instance of PurviewMetadataRolesClient. + /// The endpoint of your Purview account. Example: https://{accountName}.purview.azure.com. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public PurviewMetadataRolesClient(Uri endpoint, TokenCredential credential, PurviewMetadataClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new PurviewMetadataClientOptions(); + + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewResourceSetRule.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewResourceSetRule.cs new file mode 100644 index 000000000000..3f8963e06063 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Customizations/PurviewResourceSetRule.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + [CodeGenClient("ResourceSetRulesClient")] + [CodeGenSuppress("PurviewResourceSetRule", typeof(Uri), typeof(TokenCredential), typeof(PurviewAccountClientOptions))] + public partial class PurviewResourceSetRule + { + internal PurviewResourceSetRule(HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, ClientDiagnostics clientDiagnostics) + { + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewAccountClient.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewAccountClient.cs new file mode 100644 index 000000000000..323345413536 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewAccountClient.cs @@ -0,0 +1,1261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + /// The PurviewAccount service client. + public partial class PurviewAccountClient + { + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + + private readonly HttpPipeline _pipeline; + private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } + + /// Initializes a new instance of PurviewAccountClient for mocking. + protected PurviewAccountClient() + { + } + + /// Initializes a new instance of PurviewAccountClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/account/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public PurviewAccountClient(Uri endpoint, TokenCredential credential, PurviewAccountClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new PurviewAccountClientOptions(); + + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + } + + /// Get an account. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// id: string, + /// identity: { + /// principalId: string, + /// tenantId: string, + /// type: "SystemAssigned" + /// }, + /// location: string, + /// name: string, + /// properties: { + /// cloudConnectors: { + /// awsExternalId: string + /// }, + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByObjectId: string, + /// endpoints: { + /// catalog: string, + /// guardian: string, + /// scan: string + /// }, + /// friendlyName: string, + /// managedResourceGroupName: string, + /// managedResources: { + /// eventHubNamespace: string, + /// resourceGroup: string, + /// storageAccount: string + /// }, + /// privateEndpointConnections: [ + /// { + /// id: string, + /// name: string, + /// properties: { + /// privateEndpoint: { + /// id: string + /// }, + /// privateLinkServiceConnectionState: { + /// actionsRequired: string, + /// description: string, + /// status: "Unknown" | "Pending" | "Approved" | "Rejected" | "Disconnected" + /// }, + /// provisioningState: string + /// }, + /// type: string + /// } + /// ], + /// provisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "SoftDeleting" | "SoftDeleted" | "Failed" | "Succeeded" | "Canceled", + /// publicNetworkAccess: "NotSpecified" | "Enabled" | "Disabled" + /// }, + /// sku: { + /// capacity: number, + /// name: "Standard" + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// }, + /// tags: Dictionary<string, string>, + /// type: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetAccountPropertiesAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetAccountProperties"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAccountPropertiesRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an account. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// id: string, + /// identity: { + /// principalId: string, + /// tenantId: string, + /// type: "SystemAssigned" + /// }, + /// location: string, + /// name: string, + /// properties: { + /// cloudConnectors: { + /// awsExternalId: string + /// }, + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByObjectId: string, + /// endpoints: { + /// catalog: string, + /// guardian: string, + /// scan: string + /// }, + /// friendlyName: string, + /// managedResourceGroupName: string, + /// managedResources: { + /// eventHubNamespace: string, + /// resourceGroup: string, + /// storageAccount: string + /// }, + /// privateEndpointConnections: [ + /// { + /// id: string, + /// name: string, + /// properties: { + /// privateEndpoint: { + /// id: string + /// }, + /// privateLinkServiceConnectionState: { + /// actionsRequired: string, + /// description: string, + /// status: "Unknown" | "Pending" | "Approved" | "Rejected" | "Disconnected" + /// }, + /// provisioningState: string + /// }, + /// type: string + /// } + /// ], + /// provisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "SoftDeleting" | "SoftDeleted" | "Failed" | "Succeeded" | "Canceled", + /// publicNetworkAccess: "NotSpecified" | "Enabled" | "Disabled" + /// }, + /// sku: { + /// capacity: number, + /// name: "Standard" + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// }, + /// tags: Dictionary<string, string>, + /// type: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response GetAccountProperties(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetAccountProperties"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAccountPropertiesRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates an account. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// friendlyName: string + /// } + /// + /// Schema for Response Body: + /// { + /// id: string, + /// identity: { + /// principalId: string, + /// tenantId: string, + /// type: "SystemAssigned" + /// }, + /// location: string, + /// name: string, + /// properties: { + /// cloudConnectors: { + /// awsExternalId: string + /// }, + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByObjectId: string, + /// endpoints: { + /// catalog: string, + /// guardian: string, + /// scan: string + /// }, + /// friendlyName: string, + /// managedResourceGroupName: string, + /// managedResources: { + /// eventHubNamespace: string, + /// resourceGroup: string, + /// storageAccount: string + /// }, + /// privateEndpointConnections: [ + /// { + /// id: string, + /// name: string, + /// properties: { + /// privateEndpoint: { + /// id: string + /// }, + /// privateLinkServiceConnectionState: { + /// actionsRequired: string, + /// description: string, + /// status: "Unknown" | "Pending" | "Approved" | "Rejected" | "Disconnected" + /// }, + /// provisioningState: string + /// }, + /// type: string + /// } + /// ], + /// provisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "SoftDeleting" | "SoftDeleted" | "Failed" | "Succeeded" | "Canceled", + /// publicNetworkAccess: "NotSpecified" | "Enabled" | "Disabled" + /// }, + /// sku: { + /// capacity: number, + /// name: "Standard" + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// }, + /// tags: Dictionary<string, string>, + /// type: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task UpdateAccountPropertiesAsync(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.UpdateAccountProperties"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateAccountPropertiesRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates an account. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// friendlyName: string + /// } + /// + /// Schema for Response Body: + /// { + /// id: string, + /// identity: { + /// principalId: string, + /// tenantId: string, + /// type: "SystemAssigned" + /// }, + /// location: string, + /// name: string, + /// properties: { + /// cloudConnectors: { + /// awsExternalId: string + /// }, + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByObjectId: string, + /// endpoints: { + /// catalog: string, + /// guardian: string, + /// scan: string + /// }, + /// friendlyName: string, + /// managedResourceGroupName: string, + /// managedResources: { + /// eventHubNamespace: string, + /// resourceGroup: string, + /// storageAccount: string + /// }, + /// privateEndpointConnections: [ + /// { + /// id: string, + /// name: string, + /// properties: { + /// privateEndpoint: { + /// id: string + /// }, + /// privateLinkServiceConnectionState: { + /// actionsRequired: string, + /// description: string, + /// status: "Unknown" | "Pending" | "Approved" | "Rejected" | "Disconnected" + /// }, + /// provisioningState: string + /// }, + /// type: string + /// } + /// ], + /// provisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "SoftDeleting" | "SoftDeleted" | "Failed" | "Succeeded" | "Canceled", + /// publicNetworkAccess: "NotSpecified" | "Enabled" | "Disabled" + /// }, + /// sku: { + /// capacity: number, + /// name: "Standard" + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// }, + /// tags: Dictionary<string, string>, + /// type: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response UpdateAccountProperties(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.UpdateAccountProperties"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateAccountPropertiesRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List the authorization keys associated with this account. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// atlasKafkaPrimaryEndpoint: string, + /// atlasKafkaSecondaryEndpoint: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetAccessKeysAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetAccessKeys"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAccessKeysRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List the authorization keys associated with this account. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// atlasKafkaPrimaryEndpoint: string, + /// atlasKafkaSecondaryEndpoint: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response GetAccessKeys(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetAccessKeys"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAccessKeysRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Regenerate the authorization keys associated with this data catalog. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// keyType: "PrimaryAtlasKafkaKey" | "SecondaryAtlasKafkaKey" + /// } + /// + /// Schema for Response Body: + /// { + /// atlasKafkaPrimaryEndpoint: string, + /// atlasKafkaSecondaryEndpoint: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task RegenerateAccessKeyAsync(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.RegenerateAccessKey"); + scope.Start(); + try + { + using HttpMessage message = CreateRegenerateAccessKeyRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Regenerate the authorization keys associated with this data catalog. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// keyType: "PrimaryAtlasKafkaKey" | "SecondaryAtlasKafkaKey" + /// } + /// + /// Schema for Response Body: + /// { + /// atlasKafkaPrimaryEndpoint: string, + /// atlasKafkaSecondaryEndpoint: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response RegenerateAccessKey(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.RegenerateAccessKey"); + scope.Start(); + try + { + using HttpMessage message = CreateRegenerateAccessKeyRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List the collections in the account. + /// The request options. + /// The String to use. + /// + /// Schema for Response Body: + /// { + /// count: number, + /// nextLink: string, + /// value: [ + /// { + /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", + /// description: string, + /// friendlyName: string, + /// name: string, + /// parentCollection: { + /// referenceName: string, + /// type: string + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// } + /// } + /// ] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable GetCollectionsAsync(RequestOptions options, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewAccountClient.GetCollections"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetCollectionsRequest(skipToken) + : CreateGetCollectionsNextPageRequest(nextLink, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// List the collections in the account. + /// The request options. + /// The String to use. + /// + /// Schema for Response Body: + /// { + /// count: number, + /// nextLink: string, + /// value: [ + /// { + /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", + /// description: string, + /// friendlyName: string, + /// name: string, + /// parentCollection: { + /// referenceName: string, + /// type: string + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// } + /// } + /// ] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable GetCollections(RequestOptions options, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewAccountClient.GetCollections"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetCollectionsRequest(skipToken) + : CreateGetCollectionsNextPageRequest(nextLink, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Get a resource set config service model. + /// The request options. + /// The String to use. + /// + /// Schema for Response Body: + /// { + /// count: number, + /// nextLink: string, + /// value: [ + /// { + /// advancedResourceSet: { + /// modifiedAt: string (ISO 8601 Format), + /// resourceSetProcessing: "Default" | "Advanced" + /// }, + /// name: string, + /// pathPatternConfig: { + /// acceptedPatterns: [ + /// { + /// createdBy: string, + /// filterType: "Pattern" | "Regex", + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// path: string + /// } + /// ], + /// complexReplacers: [ + /// { + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// typeName: string + /// } + /// ], + /// createdBy: string, + /// enableDefaultPatterns: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// normalizationRules: [ + /// { + /// description: string, + /// disabled: boolean, + /// dynamicReplacement: boolean, + /// entityTypes: [string], + /// lastUpdatedTimestamp: number, + /// name: string, + /// regex: { + /// maxDigits: number, + /// maxLetters: number, + /// minDashes: number, + /// minDigits: number, + /// minDigitsOrLetters: number, + /// minDots: number, + /// minHex: number, + /// minLetters: number, + /// minUnderscores: number, + /// options: number, + /// regexStr: string + /// }, + /// replaceWith: string, + /// version: number + /// } + /// ], + /// regexReplacers: [ + /// { + /// condition: string, + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// doNotReplaceRegex: FastRegex, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// regex: FastRegex, + /// replaceWith: string + /// } + /// ], + /// rejectedPatterns: [Filter], + /// scopedRules: [ + /// { + /// bindingUrl: string, + /// rules: [ + /// { + /// displayName: string, + /// isResourceSet: boolean, + /// lastUpdatedTimestamp: number, + /// name: string, + /// qualifiedName: string + /// } + /// ], + /// storeType: string + /// } + /// ], + /// version: number + /// } + /// } + /// ] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable GetResourceSetRulesAsync(RequestOptions options, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewAccountClient.GetResourceSetRules"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetResourceSetRulesRequest(skipToken) + : CreateGetResourceSetRulesNextPageRequest(nextLink, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Get a resource set config service model. + /// The request options. + /// The String to use. + /// + /// Schema for Response Body: + /// { + /// count: number, + /// nextLink: string, + /// value: [ + /// { + /// advancedResourceSet: { + /// modifiedAt: string (ISO 8601 Format), + /// resourceSetProcessing: "Default" | "Advanced" + /// }, + /// name: string, + /// pathPatternConfig: { + /// acceptedPatterns: [ + /// { + /// createdBy: string, + /// filterType: "Pattern" | "Regex", + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// path: string + /// } + /// ], + /// complexReplacers: [ + /// { + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// typeName: string + /// } + /// ], + /// createdBy: string, + /// enableDefaultPatterns: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// normalizationRules: [ + /// { + /// description: string, + /// disabled: boolean, + /// dynamicReplacement: boolean, + /// entityTypes: [string], + /// lastUpdatedTimestamp: number, + /// name: string, + /// regex: { + /// maxDigits: number, + /// maxLetters: number, + /// minDashes: number, + /// minDigits: number, + /// minDigitsOrLetters: number, + /// minDots: number, + /// minHex: number, + /// minLetters: number, + /// minUnderscores: number, + /// options: number, + /// regexStr: string + /// }, + /// replaceWith: string, + /// version: number + /// } + /// ], + /// regexReplacers: [ + /// { + /// condition: string, + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// doNotReplaceRegex: FastRegex, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// regex: FastRegex, + /// replaceWith: string + /// } + /// ], + /// rejectedPatterns: [Filter], + /// scopedRules: [ + /// { + /// bindingUrl: string, + /// rules: [ + /// { + /// displayName: string, + /// isResourceSet: boolean, + /// lastUpdatedTimestamp: number, + /// name: string, + /// qualifiedName: string + /// } + /// ], + /// storeType: string + /// } + /// ], + /// version: number + /// } + /// } + /// ] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable GetResourceSetRules(RequestOptions options, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewAccountClient.GetResourceSetRules"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetResourceSetRulesRequest(skipToken) + : CreateGetResourceSetRulesNextPageRequest(nextLink, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateGetAccountPropertiesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUpdateAccountPropertiesRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetAccessKeysRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/listkeys", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateRegenerateAccessKeyRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/regeneratekeys", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCollectionsRequest(string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetResourceSetRulesRequest(string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/resourceSetRuleConfigs", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCollectionsNextPageRequest(string nextLink, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetResourceSetRulesNextPageRequest(string nextLink, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewCollection.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewCollection.cs new file mode 100644 index 000000000000..65dcb7d29ad6 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewCollection.cs @@ -0,0 +1,731 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + /// The PurviewCollection service client. + public partial class PurviewCollection + { + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + + private readonly HttpPipeline _pipeline; + private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _collectionName; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } + + /// Initializes a new instance of PurviewCollection for mocking. + protected PurviewCollection() + { + } + + /// Get a collection. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", + /// description: string, + /// friendlyName: string, + /// name: string, + /// parentCollection: { + /// referenceName: string, + /// type: string + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetCollectionAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollection"); + scope.Start(); + try + { + using HttpMessage message = CreateGetCollectionRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a collection. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", + /// description: string, + /// friendlyName: string, + /// name: string, + /// parentCollection: { + /// referenceName: string, + /// type: string + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response GetCollection(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollection"); + scope.Start(); + try + { + using HttpMessage message = CreateGetCollectionRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a collection entity. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", + /// description: string, + /// friendlyName: string, + /// name: string, + /// parentCollection: { + /// referenceName: string, + /// type: string + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", + /// description: string, + /// friendlyName: string, + /// name: string, + /// parentCollection: { + /// referenceName: string, + /// type: string + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateCollectionAsync(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.CreateOrUpdateCollection"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateCollectionRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a collection entity. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", + /// description: string, + /// friendlyName: string, + /// name: string, + /// parentCollection: { + /// referenceName: string, + /// type: string + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", + /// description: string, + /// friendlyName: string, + /// name: string, + /// parentCollection: { + /// referenceName: string, + /// type: string + /// }, + /// systemData: { + /// createdAt: string (ISO 8601 Format), + /// createdBy: string, + /// createdByType: "User" | "Application" | "ManagedIdentity" | "Key", + /// lastModifiedAt: string (ISO 8601 Format), + /// lastModifiedBy: string, + /// lastModifiedByType: "User" | "Application" | "ManagedIdentity" | "Key" + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdateCollection(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.CreateOrUpdateCollection"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateCollectionRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a Collection entity. + /// The request options. + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task DeleteCollectionAsync(RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.DeleteCollection"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteCollectionRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a Collection entity. + /// The request options. + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response DeleteCollection(RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.DeleteCollection"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteCollectionRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the parent name and parent friendly name chains that represent the collection path. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// parentFriendlyNameChain: [string], + /// parentNameChain: [string] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetCollectionPathAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollectionPath"); + scope.Start(); + try + { + using HttpMessage message = CreateGetCollectionPathRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the parent name and parent friendly name chains that represent the collection path. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// parentFriendlyNameChain: [string], + /// parentNameChain: [string] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response GetCollectionPath(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollectionPath"); + scope.Start(); + try + { + using HttpMessage message = CreateGetCollectionPathRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the child collections names in the collection. + /// The request options. + /// The String to use. + /// + /// Schema for Response Body: + /// { + /// count: number, + /// nextLink: string, + /// value: [ + /// { + /// friendlyName: string, + /// name: string + /// } + /// ] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListChildCollectionNamesAsync(RequestOptions options, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewCollection.ListChildCollectionNames"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListChildCollectionNamesRequest(skipToken) + : CreateListChildCollectionNamesNextPageRequest(nextLink, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Lists the child collections names in the collection. + /// The request options. + /// The String to use. + /// + /// Schema for Response Body: + /// { + /// count: number, + /// nextLink: string, + /// value: [ + /// { + /// friendlyName: string, + /// name: string + /// } + /// ] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable ListChildCollectionNames(RequestOptions options, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewCollection.ListChildCollectionNames"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListChildCollectionNamesRequest(skipToken) + : CreateListChildCollectionNamesNextPageRequest(nextLink, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateGetCollectionRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, true); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateCollectionRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, true); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteCollectionRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, true); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListChildCollectionNamesRequest(string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, true); + uri.AppendPath("/getChildCollectionNames", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCollectionPathRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, true); + uri.AppendPath("/getCollectionPath", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListChildCollectionNamesNextPageRequest(string nextLink, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewMetadataPolicyClient.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewMetadataPolicyClient.cs new file mode 100644 index 000000000000..684c79dde370 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewMetadataPolicyClient.cs @@ -0,0 +1,579 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + /// The PurviewMetadataPolicy service client. + public partial class PurviewMetadataPolicyClient + { + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + + private readonly HttpPipeline _pipeline; + private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _collectionName; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } + + /// Initializes a new instance of PurviewMetadataPolicyClient for mocking. + protected PurviewMetadataPolicyClient() + { + } + + /// Updates a metadata policy. + /// Unique policy id. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// name: string, + /// id: string, + /// version: number, + /// properties: { + /// description: string, + /// decisionRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// effect: "Deny" | "Permit", + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// attributeRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// id: string, + /// name: string, + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// collection: { + /// type: string, + /// referenceName: string + /// }, + /// parentCollectionName: string + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// name: string, + /// id: string, + /// version: number, + /// properties: { + /// description: string, + /// decisionRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// effect: "Deny" | "Permit", + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// attributeRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// id: string, + /// name: string, + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// collection: { + /// type: string, + /// referenceName: string + /// }, + /// parentCollectionName: string + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModelAutoGenerated] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task UpdateMetadataPolicyAsync(string policyId, RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewMetadataPolicyClient.UpdateMetadataPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateMetadataPolicyRequest(policyId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a metadata policy. + /// Unique policy id. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// name: string, + /// id: string, + /// version: number, + /// properties: { + /// description: string, + /// decisionRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// effect: "Deny" | "Permit", + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// attributeRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// id: string, + /// name: string, + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// collection: { + /// type: string, + /// referenceName: string + /// }, + /// parentCollectionName: string + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// name: string, + /// id: string, + /// version: number, + /// properties: { + /// description: string, + /// decisionRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// effect: "Deny" | "Permit", + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// attributeRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// id: string, + /// name: string, + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// collection: { + /// type: string, + /// referenceName: string + /// }, + /// parentCollectionName: string + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModelAutoGenerated] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response UpdateMetadataPolicy(string policyId, RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewMetadataPolicyClient.UpdateMetadataPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateMetadataPolicyRequest(policyId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a metadata policy. + /// Id of an existing policy that needs to be fetched. + /// The request options. + /// is null. + /// + /// Schema for Response Body: + /// { + /// name: string, + /// id: string, + /// version: number, + /// properties: { + /// description: string, + /// decisionRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// effect: "Deny" | "Permit", + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// attributeRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// id: string, + /// name: string, + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// collection: { + /// type: string, + /// referenceName: string + /// }, + /// parentCollectionName: string + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModelAutoGenerated] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetMetadataPolicyAsync(string policyId, RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewMetadataPolicyClient.GetMetadataPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateGetMetadataPolicyRequest(policyId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a metadata policy. + /// Id of an existing policy that needs to be fetched. + /// The request options. + /// is null. + /// + /// Schema for Response Body: + /// { + /// name: string, + /// id: string, + /// version: number, + /// properties: { + /// description: string, + /// decisionRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// effect: "Deny" | "Permit", + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// attributeRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// id: string, + /// name: string, + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// collection: { + /// type: string, + /// referenceName: string + /// }, + /// parentCollectionName: string + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModelAutoGenerated] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response GetMetadataPolicy(string policyId, RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewMetadataPolicyClient.GetMetadataPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateGetMetadataPolicyRequest(policyId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List or Get metadata policies. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// values: [ + /// { + /// name: string, + /// id: string, + /// version: number, + /// properties: { + /// description: string, + /// decisionRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// effect: "Deny" | "Permit", + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// attributeRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// id: string, + /// name: string, + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// collection: { + /// type: string, + /// referenceName: string + /// }, + /// parentCollectionName: string + /// } + /// } + /// ], + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModelAutoGenerated] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable GetMetadataPoliciesAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewMetadataPolicyClient.GetMetadataPolicies"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetMetadataPoliciesRequest() + : CreateGetMetadataPoliciesNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// List or Get metadata policies. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// values: [ + /// { + /// name: string, + /// id: string, + /// version: number, + /// properties: { + /// description: string, + /// decisionRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// effect: "Deny" | "Permit", + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// attributeRules: [ + /// { + /// kind: "decisionrule" | "attributerule", + /// id: string, + /// name: string, + /// dnfCondition: [AttributeMatcher[]] + /// } + /// ], + /// collection: { + /// type: string, + /// referenceName: string + /// }, + /// parentCollectionName: string + /// } + /// } + /// ], + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModelAutoGenerated] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable GetMetadataPolicies(RequestOptions options) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewMetadataPolicyClient.GetMetadataPolicies"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetMetadataPoliciesRequest() + : CreateGetMetadataPoliciesNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateGetMetadataPoliciesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/policyStore", false); + uri.AppendPath("/metadataPolicies", false); + uri.AppendQuery("api-version", "2021-07-01", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUpdateMetadataPolicyRequest(string policyId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/policyStore", false); + uri.AppendPath("/metadataPolicies/", false); + uri.AppendPath(policyId, true); + uri.AppendQuery("api-version", "2021-07-01", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetMetadataPolicyRequest(string policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/policyStore", false); + uri.AppendPath("/metadataPolicies/", false); + uri.AppendPath(policyId, true); + uri.AppendQuery("api-version", "2021-07-01", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetMetadataPoliciesNextPageRequest(string nextLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/policyStore", false); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewMetadataRolesClient.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewMetadataRolesClient.cs new file mode 100644 index 000000000000..339f36267edf --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewMetadataRolesClient.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + /// The PurviewMetadataRoles service client. + public partial class PurviewMetadataRolesClient + { + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + + private readonly HttpPipeline _pipeline; + private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } + + /// Initializes a new instance of PurviewMetadataRolesClient for mocking. + protected PurviewMetadataRolesClient() + { + } + + /// Lists roles for Purview Account. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// values: [ + /// { + /// id: string, + /// name: string, + /// type: string, + /// properties: { + /// provisioningState: string, + /// roleType: string, + /// friendlyName: string, + /// description: string, + /// cnfCondition: [AttributeMatcher[]], + /// dnfCondition: [AttributeMatcher[]], + /// version: number + /// } + /// } + /// ], + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModelAutoGenerated] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable GetMetadataRolesAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewMetadataRolesClient.GetMetadataRoles"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetMetadataRolesRequest() + : CreateGetMetadataRolesNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Lists roles for Purview Account. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// values: [ + /// { + /// id: string, + /// name: string, + /// type: string, + /// properties: { + /// provisioningState: string, + /// roleType: string, + /// friendlyName: string, + /// description: string, + /// cnfCondition: [AttributeMatcher[]], + /// dnfCondition: [AttributeMatcher[]], + /// version: number + /// } + /// } + /// ], + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModelAutoGenerated] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable GetMetadataRoles(RequestOptions options) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewMetadataRolesClient.GetMetadataRoles"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetMetadataRolesRequest() + : CreateGetMetadataRolesNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateGetMetadataRolesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/policyStore", false); + uri.AppendPath("/metadataRoles", false); + uri.AppendQuery("api-version", "2021-07-01", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetMetadataRolesNextPageRequest(string nextLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/policyStore", false); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewResourceSetRule.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewResourceSetRule.cs new file mode 100644 index 000000000000..c22f85e38e2e --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/PurviewResourceSetRule.cs @@ -0,0 +1,917 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Administration +{ + /// The PurviewResourceSetRule service client. + public partial class PurviewResourceSetRule + { + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + + private readonly HttpPipeline _pipeline; + private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } + + /// Initializes a new instance of PurviewResourceSetRule for mocking. + protected PurviewResourceSetRule() + { + } + + /// Get a resource set config service model. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// advancedResourceSet: { + /// modifiedAt: string (ISO 8601 Format), + /// resourceSetProcessing: "Default" | "Advanced" + /// }, + /// name: string, + /// pathPatternConfig: { + /// acceptedPatterns: [ + /// { + /// createdBy: string, + /// filterType: "Pattern" | "Regex", + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// path: string + /// } + /// ], + /// complexReplacers: [ + /// { + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// typeName: string + /// } + /// ], + /// createdBy: string, + /// enableDefaultPatterns: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// normalizationRules: [ + /// { + /// description: string, + /// disabled: boolean, + /// dynamicReplacement: boolean, + /// entityTypes: [string], + /// lastUpdatedTimestamp: number, + /// name: string, + /// regex: { + /// maxDigits: number, + /// maxLetters: number, + /// minDashes: number, + /// minDigits: number, + /// minDigitsOrLetters: number, + /// minDots: number, + /// minHex: number, + /// minLetters: number, + /// minUnderscores: number, + /// options: number, + /// regexStr: string + /// }, + /// replaceWith: string, + /// version: number + /// } + /// ], + /// regexReplacers: [ + /// { + /// condition: string, + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// doNotReplaceRegex: FastRegex, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// regex: FastRegex, + /// replaceWith: string + /// } + /// ], + /// rejectedPatterns: [Filter], + /// scopedRules: [ + /// { + /// bindingUrl: string, + /// rules: [ + /// { + /// displayName: string, + /// isResourceSet: boolean, + /// lastUpdatedTimestamp: number, + /// name: string, + /// qualifiedName: string + /// } + /// ], + /// storeType: string + /// } + /// ], + /// version: number + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetResourceSetRuleAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.GetResourceSetRule"); + scope.Start(); + try + { + using HttpMessage message = CreateGetResourceSetRuleRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a resource set config service model. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// advancedResourceSet: { + /// modifiedAt: string (ISO 8601 Format), + /// resourceSetProcessing: "Default" | "Advanced" + /// }, + /// name: string, + /// pathPatternConfig: { + /// acceptedPatterns: [ + /// { + /// createdBy: string, + /// filterType: "Pattern" | "Regex", + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// path: string + /// } + /// ], + /// complexReplacers: [ + /// { + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// typeName: string + /// } + /// ], + /// createdBy: string, + /// enableDefaultPatterns: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// normalizationRules: [ + /// { + /// description: string, + /// disabled: boolean, + /// dynamicReplacement: boolean, + /// entityTypes: [string], + /// lastUpdatedTimestamp: number, + /// name: string, + /// regex: { + /// maxDigits: number, + /// maxLetters: number, + /// minDashes: number, + /// minDigits: number, + /// minDigitsOrLetters: number, + /// minDots: number, + /// minHex: number, + /// minLetters: number, + /// minUnderscores: number, + /// options: number, + /// regexStr: string + /// }, + /// replaceWith: string, + /// version: number + /// } + /// ], + /// regexReplacers: [ + /// { + /// condition: string, + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// doNotReplaceRegex: FastRegex, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// regex: FastRegex, + /// replaceWith: string + /// } + /// ], + /// rejectedPatterns: [Filter], + /// scopedRules: [ + /// { + /// bindingUrl: string, + /// rules: [ + /// { + /// displayName: string, + /// isResourceSet: boolean, + /// lastUpdatedTimestamp: number, + /// name: string, + /// qualifiedName: string + /// } + /// ], + /// storeType: string + /// } + /// ], + /// version: number + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response GetResourceSetRule(RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.GetResourceSetRule"); + scope.Start(); + try + { + using HttpMessage message = CreateGetResourceSetRuleRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an resource set config. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// advancedResourceSet: { + /// modifiedAt: string (ISO 8601 Format), + /// resourceSetProcessing: "Default" | "Advanced" + /// }, + /// name: string, + /// pathPatternConfig: { + /// acceptedPatterns: [ + /// { + /// createdBy: string, + /// filterType: "Pattern" | "Regex", + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string (required), + /// path: string (required) + /// } + /// ], + /// complexReplacers: [ + /// { + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// typeName: string + /// } + /// ], + /// createdBy: string (required), + /// enableDefaultPatterns: boolean (required), + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// normalizationRules: [ + /// { + /// description: string, + /// disabled: boolean, + /// dynamicReplacement: boolean, + /// entityTypes: [string], + /// lastUpdatedTimestamp: number, + /// name: string, + /// regex: { + /// maxDigits: number, + /// maxLetters: number, + /// minDashes: number, + /// minDigits: number, + /// minDigitsOrLetters: number, + /// minDots: number, + /// minHex: number, + /// minLetters: number, + /// minUnderscores: number, + /// options: number, + /// regexStr: string + /// }, + /// replaceWith: string, + /// version: number + /// } + /// ], + /// regexReplacers: [ + /// { + /// condition: string, + /// createdBy: string, + /// description: string, + /// disabled: boolean (required), + /// disableRecursiveReplacerApplication: boolean, + /// doNotReplaceRegex: FastRegex, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string (required), + /// regex: FastRegex, + /// replaceWith: string + /// } + /// ], + /// rejectedPatterns: [Filter], + /// scopedRules: [ + /// { + /// bindingUrl: string (required), + /// rules: [ + /// { + /// displayName: string, + /// isResourceSet: boolean, + /// lastUpdatedTimestamp: number, + /// name: string, + /// qualifiedName: string (required) + /// } + /// ], + /// storeType: string (required) + /// } + /// ], + /// version: number + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// advancedResourceSet: { + /// modifiedAt: string (ISO 8601 Format), + /// resourceSetProcessing: "Default" | "Advanced" + /// }, + /// name: string, + /// pathPatternConfig: { + /// acceptedPatterns: [ + /// { + /// createdBy: string, + /// filterType: "Pattern" | "Regex", + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// path: string + /// } + /// ], + /// complexReplacers: [ + /// { + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// typeName: string + /// } + /// ], + /// createdBy: string, + /// enableDefaultPatterns: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// normalizationRules: [ + /// { + /// description: string, + /// disabled: boolean, + /// dynamicReplacement: boolean, + /// entityTypes: [string], + /// lastUpdatedTimestamp: number, + /// name: string, + /// regex: { + /// maxDigits: number, + /// maxLetters: number, + /// minDashes: number, + /// minDigits: number, + /// minDigitsOrLetters: number, + /// minDots: number, + /// minHex: number, + /// minLetters: number, + /// minUnderscores: number, + /// options: number, + /// regexStr: string + /// }, + /// replaceWith: string, + /// version: number + /// } + /// ], + /// regexReplacers: [ + /// { + /// condition: string, + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// doNotReplaceRegex: FastRegex, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// regex: FastRegex, + /// replaceWith: string + /// } + /// ], + /// rejectedPatterns: [Filter], + /// scopedRules: [ + /// { + /// bindingUrl: string, + /// rules: [ + /// { + /// displayName: string, + /// isResourceSet: boolean, + /// lastUpdatedTimestamp: number, + /// name: string, + /// qualifiedName: string + /// } + /// ], + /// storeType: string + /// } + /// ], + /// version: number + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateResourceSetRuleAsync(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.CreateOrUpdateResourceSetRule"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateResourceSetRuleRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an resource set config. + /// The content to send as the body of the request. + /// The request options. + /// is null. + /// + /// Schema for Request Body: + /// { + /// advancedResourceSet: { + /// modifiedAt: string (ISO 8601 Format), + /// resourceSetProcessing: "Default" | "Advanced" + /// }, + /// name: string, + /// pathPatternConfig: { + /// acceptedPatterns: [ + /// { + /// createdBy: string, + /// filterType: "Pattern" | "Regex", + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string (required), + /// path: string (required) + /// } + /// ], + /// complexReplacers: [ + /// { + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// typeName: string + /// } + /// ], + /// createdBy: string (required), + /// enableDefaultPatterns: boolean (required), + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// normalizationRules: [ + /// { + /// description: string, + /// disabled: boolean, + /// dynamicReplacement: boolean, + /// entityTypes: [string], + /// lastUpdatedTimestamp: number, + /// name: string, + /// regex: { + /// maxDigits: number, + /// maxLetters: number, + /// minDashes: number, + /// minDigits: number, + /// minDigitsOrLetters: number, + /// minDots: number, + /// minHex: number, + /// minLetters: number, + /// minUnderscores: number, + /// options: number, + /// regexStr: string + /// }, + /// replaceWith: string, + /// version: number + /// } + /// ], + /// regexReplacers: [ + /// { + /// condition: string, + /// createdBy: string, + /// description: string, + /// disabled: boolean (required), + /// disableRecursiveReplacerApplication: boolean, + /// doNotReplaceRegex: FastRegex, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string (required), + /// regex: FastRegex, + /// replaceWith: string + /// } + /// ], + /// rejectedPatterns: [Filter], + /// scopedRules: [ + /// { + /// bindingUrl: string (required), + /// rules: [ + /// { + /// displayName: string, + /// isResourceSet: boolean, + /// lastUpdatedTimestamp: number, + /// name: string, + /// qualifiedName: string (required) + /// } + /// ], + /// storeType: string (required) + /// } + /// ], + /// version: number + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// advancedResourceSet: { + /// modifiedAt: string (ISO 8601 Format), + /// resourceSetProcessing: "Default" | "Advanced" + /// }, + /// name: string, + /// pathPatternConfig: { + /// acceptedPatterns: [ + /// { + /// createdBy: string, + /// filterType: "Pattern" | "Regex", + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// path: string + /// } + /// ], + /// complexReplacers: [ + /// { + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// typeName: string + /// } + /// ], + /// createdBy: string, + /// enableDefaultPatterns: boolean, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// normalizationRules: [ + /// { + /// description: string, + /// disabled: boolean, + /// dynamicReplacement: boolean, + /// entityTypes: [string], + /// lastUpdatedTimestamp: number, + /// name: string, + /// regex: { + /// maxDigits: number, + /// maxLetters: number, + /// minDashes: number, + /// minDigits: number, + /// minDigitsOrLetters: number, + /// minDots: number, + /// minHex: number, + /// minLetters: number, + /// minUnderscores: number, + /// options: number, + /// regexStr: string + /// }, + /// replaceWith: string, + /// version: number + /// } + /// ], + /// regexReplacers: [ + /// { + /// condition: string, + /// createdBy: string, + /// description: string, + /// disabled: boolean, + /// disableRecursiveReplacerApplication: boolean, + /// doNotReplaceRegex: FastRegex, + /// lastUpdatedTimestamp: number, + /// modifiedBy: string, + /// name: string, + /// regex: FastRegex, + /// replaceWith: string + /// } + /// ], + /// rejectedPatterns: [Filter], + /// scopedRules: [ + /// { + /// bindingUrl: string, + /// rules: [ + /// { + /// displayName: string, + /// isResourceSet: boolean, + /// lastUpdatedTimestamp: number, + /// name: string, + /// qualifiedName: string + /// } + /// ], + /// storeType: string + /// } + /// ], + /// version: number + /// } + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdateResourceSetRule(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.CreateOrUpdateResourceSetRule"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateResourceSetRuleRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a ResourceSetRuleConfig resource. + /// The request options. + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task DeleteResourceSetRuleAsync(RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.DeleteResourceSetRule"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteResourceSetRuleRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a ResourceSetRuleConfig resource. + /// The request options. + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// details: [ + /// { + /// code: string, + /// details: [ErrorModel], + /// message: string, + /// target: string + /// } + /// ], + /// message: string, + /// target: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response DeleteResourceSetRule(RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.DeleteResourceSetRule"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteResourceSetRuleRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetResourceSetRuleRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/resourceSetRuleConfigs/defaultResourceSetRuleConfig", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateResourceSetRuleRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/resourceSetRuleConfigs/defaultResourceSetRuleConfig", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteResourceSetRuleRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/resourceSetRuleConfigs/defaultResourceSetRuleConfig", false); + uri.AppendQuery("api-version", "2019-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 204 => false, + _ => true + }; + } + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/GlobalSuppressions.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/GlobalSuppressions.cs new file mode 100644 index 000000000000..f973107da2a5 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/GlobalSuppressions.cs @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Usage", "AZC0016:Invalid ServiceVersion member name.", Justification = "Generated code: https://github.com/Azure/autorest.csharp/issues/1524", Scope = "type", Target = "~T:Azure.Analytics.Purview.Administration.PurviewAccountClientOptions.ServiceVersion")] +[assembly: SuppressMessage("Usage", "AZC0016:Invalid ServiceVersion member name.", Justification = "Generated code: https://github.com/Azure/autorest.csharp/issues/1524", Scope = "type", Target = "~T:Azure.Analytics.Purview.Administration.PurviewAdministrationClientOptions.ServiceVersion")] diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/autorest.md b/sdk/purview/Azure.Analytics.Purview.Administration/src/autorest.md new file mode 100644 index 000000000000..1798ae5549c5 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/autorest.md @@ -0,0 +1,86 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +```yaml +title: PurviewAdministration +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/b2bddfe2e59b5b14e559e0433b6e6d057bcff95d/specification/purview/data-plane/Azure.Analytics.Purview.Account/preview/2019-11-01-preview/account.json + - https://github.com/Azure/azure-rest-api-specs/blob/1424fc4a1f82af852a626c6ab6d1d296b5fe4df1/specification/purview/data-plane/Azure.Analytics.Purview.MetadataPolicies/preview/2021-07-01/purviewMetadataPolicy.json +namespace: Azure.Analytics.Purview.Administration +low-level-client: true +modelerfour: + lenient-model-deduplication: true +security: AADToken +security-scopes: https://purview.azure.net/.default +``` + +# Model endpoint parameter as a url, not a string. + +```yaml +directive: + - from: swagger-document + where: $.parameters.endpoint + transform: > + if ($.format === undefined) { + $.format = "url"; + } + - from: swagger-document + where: $.parameters.Endpoint + transform: > + if ($.format === undefined) { + $.format = "url"; + } +``` + +# Promote collectionName to be a client parameter. + +```yaml +directive: + - from: swagger-document + where: $.parameters + transform: > + $["collectionName"] = { + "in": "path", + "name": "collectionName", + "required": true, + "type": "string", + "x-ms-parameter-location": "client" + }; + + - from: swagger-document + where: $.paths..parameters[?(@.name=='collectionName')] + transform: > + $ = { "$ref": "#/parameters/collectionName" }; +``` + +# Rename or reorganize methods + +```yaml +directive: + - from: swagger-document + where: $..[?(@.operationId !== undefined)] + transform: > + const mappingTable = { + "Collections_ListCollections": "Accounts_GetCollections", + "ResourceSetRules_ListResourceSetRules": "Accounts_GetResourceSetRules", + "MetadataRoles_List": "MetadataRoles_GetMetadataRoles", + "MetadataPolicy_ListAll": "MetadataPolicy_GetMetadataPolicies", + "MetadataPolicy_Get": "MetadataPolicy_GetMetadataPolicy", + "MetadataPolicy_Update": "MetadataPolicy_UpdateMetadataPolicy", + }; + + $.operationId = (mappingTable[$.operationId] ?? $.operationId); +``` + +# Add `Purview` To Metadata Clients + +```yaml +directive: + - from: swagger-document + where: $..[?(@.operationId !== undefined)] + transform: > + if ($.operationId.startsWith("Metadata")) { + $.operationId = "Purview" + $.operationId; + } +``` diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/properties/AssemblyInfo.cs b/sdk/purview/Azure.Analytics.Purview.Administration/src/properties/AssemblyInfo.cs new file mode 100644 index 000000000000..d824f6bb9834 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Purview")] diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/AccountsClientTest.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/AccountsClientTest.cs new file mode 100644 index 000000000000..3026f2e743cc --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/AccountsClientTest.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class AccountsClientTest : AccountsClientTestBase + { + public AccountsClientTest(bool isAsync) : base(isAsync) + { + } + + [RecordedTest] + public async Task GetTask() + { + PurviewAccountClient client = GetAccountClient(); + Response fetchResponse = await client.GetAccountPropertiesAsync(new()); + JsonElement fetchBodyJson = JsonDocument.Parse(GetContentFromResponse(fetchResponse)).RootElement; + Assert.AreEqual("dotnetLLCPurviewAccount", fetchBodyJson.GetProperty("name").GetString()); + } + + [RecordedTest] + public async Task UpdateTask() + { + var options = new PurviewAccountClientOptions(); + PurviewAccountClient client = GetAccountClient(); + var data = new JsonData(new Dictionary + { + ["friendlyName"] = "udpatedFriendlyName" + }); + Response updateRespons = await client.UpdateAccountPropertiesAsync(RequestContent.Create(data)); + JsonElement upateBodyJson = JsonDocument.Parse(GetContentFromResponse(updateRespons)).RootElement; + Assert.AreEqual("dotnetLLCPurviewAccount", upateBodyJson.GetProperty("name").GetString()); + Assert.AreEqual("udpatedFriendlyName", upateBodyJson.GetProperty("properties").GetProperty("friendlyName").GetString()); + } + + [RecordedTest] + public async Task RegenerateKeysTask() + { + var options = new PurviewAccountClientOptions(); + PurviewAccountClient client = GetAccountClient(); + var data = new + { + keyType = "PrimaryAtlasKafkaKey", + }; + Response genResponse = await client.RegenerateAccessKeyAsync(RequestContent.Create(data)); + JsonElement genKeyBodyJson = JsonDocument.Parse(GetContentFromResponse(genResponse)).RootElement; + Assert.AreEqual(genResponse.Status, 200); + } + + [RecordedTest] + public async Task ListKeysTask() + { + var options = new PurviewAccountClientOptions(); + PurviewAccountClient client = GetAccountClient(); + var data = new JsonData(new Dictionary + { + ["keyType"] = "PrimaryAtlasKafkaKey" + }); + Response genResponse = await client.RegenerateAccessKeyAsync(RequestContent.Create(data)); + JsonElement genKeyBodyJson = JsonDocument.Parse(GetContentFromResponse(genResponse)).RootElement; + Assert.AreEqual(genResponse.Status, 200); + Response listKeysResponse = await client.GetAccessKeysAsync(new()); + JsonElement listKeyBodyJson = JsonDocument.Parse(GetContentFromResponse(listKeysResponse)).RootElement; + Assert.AreEqual(listKeysResponse.Status, 200); + } + + private static BinaryData GetContentFromResponse(Response r) + { + // Workaround azure/azure-sdk-for-net#21048, which prevents .Content from working when dealing with responses + // from the playback system. + + MemoryStream ms = new MemoryStream(); + r.ContentStream.CopyTo(ms); + return new BinaryData(ms.ToArray()); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/AccountsClientTestBase.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/AccountsClientTestBase.cs new file mode 100644 index 000000000000..c43825af8a76 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/AccountsClientTestBase.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Net.Http; +using Azure.Core.Pipeline; +using Azure.Core.TestFramework; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class AccountsClientTestBase : RecordedTestBase + { + public AccountsClientTestBase(bool isAsync) : base(isAsync) + { + } + + public AccountsClientTestBase(bool isAsync, RecordedTestMode mode) : base(isAsync, mode) + { + } + + public PurviewAccountClient GetAccountClient() + { + var httpHandler = new HttpClientHandler(); + httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => + { + return true; + }; + var options = new PurviewAccountClientOptions { Transport = new HttpClientTransport(httpHandler) }; + var client = InstrumentClient( + new PurviewAccountClient(TestEnvironment.Endpoint, TestEnvironment.Credential, InstrumentClientOptions(options))); + return client; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/Azure.Analytics.Purview.Administration.Tests.csproj b/sdk/purview/Azure.Analytics.Purview.Administration/tests/Azure.Analytics.Purview.Administration.Tests.csproj new file mode 100644 index 000000000000..954dcd191d93 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/Azure.Analytics.Purview.Administration.Tests.csproj @@ -0,0 +1,17 @@ + + + $(RequiredTargetFrameworks) + + + + + + + + + + + + + + diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/CollectionsClientTest.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/CollectionsClientTest.cs new file mode 100644 index 000000000000..b429dc3e925e --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/CollectionsClientTest.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using NUnit.Framework; +using System.Text.Json; +using Azure.Core; +using System.IO; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class CollectionsClientTest: CollectionsClientTestBase + { + public CollectionsClientTest(bool isAsync) : base(isAsync) + { + } + + [RecordedTest] + public async Task CreateOrUpdateTask() + { + var options = new PurviewAccountClientOptions(); + var collectionName = "mysubCollection"; + PurviewCollection client = GetCollectionsClient(collectionName); + + var data = new + { + parentCollection = new + { + referenceName = "dotnetLLCPurviewAccount" + }, + }; + Response createResponse = await client.CreateOrUpdateCollectionAsync(RequestContent.Create(data), default); + + JsonElement createBodyJson = JsonDocument.Parse(GetContentFromResponse(createResponse)).RootElement; + Assert.AreEqual("mysubCollection", createBodyJson.GetProperty("name").GetString()); + while (true) + { + System.Threading.Thread.Sleep(1000); + Response getResponse = await client.GetCollectionAsync(new()); + JsonElement getBodyJson = JsonDocument.Parse(GetContentFromResponse(getResponse)).RootElement; + if (getBodyJson.GetProperty("collectionProvisioningState").GetString() == "Succeeded") + break; + } + Response delRespons = await client.DeleteCollectionAsync(default); + } + + [RecordedTest] + public async Task GetTask() + { + var options = new PurviewAccountClientOptions(); + var collectionName = "myCollection1"; + PurviewCollection client = GetCollectionsClient(collectionName); + + var data = new + { + parentCollection = new + { + referenceName = "dotnetLLCPurviewAccount" + }, + }; + Response createResponse = await client.CreateOrUpdateCollectionAsync(RequestContent.Create(data), default); + Response getResponse = await client.GetCollectionAsync(new()); + JsonElement getBodyJson = JsonDocument.Parse(GetContentFromResponse(getResponse)).RootElement; + Assert.AreEqual("myCollection1", getBodyJson.GetProperty("name").GetString()); + while (true) + { + System.Threading.Thread.Sleep(1000); + Response getRes = await client.GetCollectionAsync(new()); + JsonElement getJson = JsonDocument.Parse(GetContentFromResponse(getRes)).RootElement; + if (getJson.GetProperty("collectionProvisioningState").GetString() == "Succeeded") + break; + } + Response delRespons = await client.DeleteCollectionAsync(default); + } + private static BinaryData GetContentFromResponse(Response r) + { + // Workaround azure/azure-sdk-for-net#21048, which prevents .Content from working when dealing with responses + // from the playback system. + + MemoryStream ms = new MemoryStream(); + r.ContentStream.CopyTo(ms); + return new BinaryData(ms.ToArray()); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/CollectionsClientTestBase.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/CollectionsClientTestBase.cs new file mode 100644 index 000000000000..11eda594cbd6 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/CollectionsClientTestBase.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Azure.Core.Pipeline; +using Azure.Core.TestFramework; +using Azure.Identity; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class CollectionsClientTestBase: RecordedTestBase + { + public CollectionsClientTestBase(bool isAsync) : base(isAsync) + { + } + + public CollectionsClientTestBase(bool isAsync, RecordedTestMode mode) : base(isAsync, mode) + { + } + + public PurviewCollection GetCollectionsClient(string collectionName) + { + var httpHandler = new HttpClientHandler(); + httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => + { + return true; + }; + var options = new PurviewAccountClientOptions { Transport = new HttpClientTransport(httpHandler) }; + var client = InstrumentClient( + new PurviewAccountClient(TestEnvironment.Endpoint, TestEnvironment.Credential, InstrumentClientOptions(options)).GetCollectionClient(collectionName)); + return client; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataPolicyClientTest.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataPolicyClientTest.cs new file mode 100644 index 000000000000..a15d487b2fa0 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataPolicyClientTest.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using NUnit.Framework; +using System.Text.Json; +using System.IO; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class MetadataPolicyClientTest : MetadataPolicyClientTestBase + { + public MetadataPolicyClientTest(bool isAsync) : base(isAsync) + { + } + + [RecordedTest] + public async Task GetMetadataPolicy() + { + var client = GetMetadataPolicyClient("dotnetllcpurviewaccount"); + Response fetchResponse = await client.GetMetadataPolicyAsync("d04a7fad-ff6c-44f4-8fb4-0d007a8c01f8", new()); + JsonElement fetchBodyJson = JsonDocument.Parse(GetContentFromResponse(fetchResponse)).RootElement; + Assert.AreEqual("policy_dotnetLLCPurviewAccount", fetchBodyJson.GetProperty("name").GetString()); + Assert.GreaterOrEqual(fetchBodyJson.GetProperty("properties").GetProperty("attributeRules").GetArrayLength(),1); + } + + private static BinaryData GetContentFromResponse(Response r) + { + // Workaround azure/azure-sdk-for-net#21048, which prevents .Content from working when dealing with responses + // from the playback system. + + MemoryStream ms = new MemoryStream(); + r.ContentStream.CopyTo(ms); + return new BinaryData(ms.ToArray()); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataPolicyClientTestBase.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataPolicyClientTestBase.cs new file mode 100644 index 000000000000..1b756ea1b0cb --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataPolicyClientTestBase.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Net.Http; +using Azure.Core.Pipeline; +using Azure.Core.TestFramework; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class MetadataPolicyClientTestBase : RecordedTestBase + { + public MetadataPolicyClientTestBase(bool isAsync) : base(isAsync) + { + } + + public MetadataPolicyClientTestBase(bool isAsync, RecordedTestMode mode) : base(isAsync, mode) + { + } + public PurviewMetadataPolicyClient GetMetadataPolicyClient(string collectionName) + { + var httpHandler = new HttpClientHandler(); + httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => + { + return true; + }; + var options = new PurviewMetadataClientOptions { Transport = new HttpClientTransport(httpHandler) }; + var client = InstrumentClient( + new PurviewMetadataPolicyClient(TestEnvironment.Endpoint, collectionName, TestEnvironment.Credential, InstrumentClientOptions(options))); + return client; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataRolesClientTest.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataRolesClientTest.cs new file mode 100644 index 000000000000..2c644dc759ab --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataRolesClientTest.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using NUnit.Framework; +using System.Text.Json; +using System.IO; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class MetadataRolesClientTest : MetadataRolesClientTestBase + { + public MetadataRolesClientTest(bool isAsync) : base(isAsync) + { + } + + [RecordedTest] + public async Task List() + { + var client = GetMetadataPolicyClient(); + AsyncPageable fetchResponse = client.GetMetadataRolesAsync(new()); + await foreach (BinaryData item in fetchResponse) + { + JsonElement fetchBodyJson = JsonDocument.Parse(item).RootElement; + Assert.Equals(fetchBodyJson.GetProperty("id").ToString().StartsWith("purviewmetadatarole"), true); + } + } + + private static BinaryData GetContentFromResponse(Response r) + { + // Workaround azure/azure-sdk-for-net#21048, which prevents .Content from working when dealing with responses + // from the playback system. + + MemoryStream ms = new MemoryStream(); + r.ContentStream.CopyTo(ms); + return new BinaryData(ms.ToArray()); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataRolesClientTestBase.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataRolesClientTestBase.cs new file mode 100644 index 000000000000..f93b75bb0cfd --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataRolesClientTestBase.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Azure.Core.Pipeline; +using Azure.Core.TestFramework; +using Azure.Identity; +using Castle.DynamicProxy; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class MetadataRolesClientTestBase : RecordedTestBase + { + public MetadataRolesClientTestBase(bool isAsync) : base(isAsync) + { + } + + public MetadataRolesClientTestBase(bool isAsync, RecordedTestMode mode) : base(isAsync, mode) + { + } + public PurviewMetadataRolesClient GetMetadataPolicyClient() + { + var httpHandler = new HttpClientHandler(); + httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => + { + return true; + }; + var options = new PurviewMetadataClientOptions { Transport = new HttpClientTransport(httpHandler) }; + var client = InstrumentClient( + new PurviewMetadataRolesClient(TestEnvironment.Endpoint, TestEnvironment.Credential, InstrumentClientOptions(options))); + return client; + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/PurviewAccountTestEnvironment.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/PurviewAccountTestEnvironment.cs new file mode 100644 index 000000000000..b231666d4abf --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/PurviewAccountTestEnvironment.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Core.TestFramework; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class PurviewAccountTestEnvironment: TestEnvironment + { + public PurviewAccountTestEnvironment() + { + } + public Uri Endpoint => new(GetRecordedVariable("PURVIEW_ACCOUNT_URL")); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/PurviewCollectionTestEnvironment.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/PurviewCollectionTestEnvironment.cs new file mode 100644 index 000000000000..2236c697f1b0 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/PurviewCollectionTestEnvironment.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Core.TestFramework; + +namespace Azure.Analytics.Purview.Administration.Tests +{ + public class PurviewCollectionTestEnvironment: TestEnvironment + { + public PurviewCollectionTestEnvironment() + { + } + public Uri Endpoint => new(GetRecordedVariable("PURVIEW_ACCOUNT_URL")); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/GetTask.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/GetTask.json new file mode 100644 index 000000000000..ffd60cec98fd --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/GetTask.json @@ -0,0 +1,81 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-c05675d938ab7748a6b1432170b84ffc-37326752cecb244f-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "c8757ea39b6e31f5ad60da2ced4b3d6e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:44:11 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-account-status": "Succeeded", + "x-ms-correlation-request-id": "0c323717-ac91-432a-8ed9-b618cbeaef00" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "capacity": 1 + }, + "properties": { + "cloudConnectors": { + "awsExternalId": "62c6f480-34d4-48be-b22e-e686d0766e7e" + }, + "friendlyName": "udpatedFriendlyName", + "createdBy": "chunyu@microsoft.com", + "createdByObjectId": "3bbd551e-499a-4607-a978-be16a8e17789", + "createdAt": "2021-08-18T04:55:19.116601Z", + "endpoints": { + "catalog": "https://dotnetllcpurviewaccount.catalog.purview.azure.com", + "scan": "https://dotnetllcpurviewaccount.scan.purview.azure.com", + "guardian": "https://dotnetllcpurviewaccount.guardian.purview.azure.com" + }, + "provisioningState": "Succeeded", + "privateEndpointConnections": [], + "managedResources": { + "resourceGroup": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount", + "storageAccount": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount/providers/Microsoft.Storage/storageAccounts/scaneastus2abhgmpa", + "eventHubNamespace": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount/providers/Microsoft.EventHub/namespaces/Atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f" + }, + "publicNetworkAccess": "Enabled", + "managedResourceGroupName": "managed-rg-dotnetLLCPurviewAccount" + }, + "id": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/dotnetTest/providers/Microsoft.Purview/accounts/dotnetLLCPurviewAccount", + "name": "dotnetLLCPurviewAccount", + "type": "Microsoft.Purview/accounts", + "location": "eastus2", + "identity": { + "type": "SystemAssigned", + "principalId": "f977cbc9-abaa-4aba-9c27-17d3dd704ca4", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "tags": {}, + "systemData": { + "createdBy": "chunyu@microsoft.com", + "createdByType": "User", + "createdAt": "2021-08-18T04:55:19.116601Z", + "lastModifiedBy": "chunyu@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-18T04:55:19.116601Z" + } + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "575287349" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/GetTaskAsync.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/GetTaskAsync.json new file mode 100644 index 000000000000..e35d4dfed1a1 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/GetTaskAsync.json @@ -0,0 +1,81 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-55b643d326068f4a9555ddf1140f5184-51e26e2828c73245-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "89f528707a7c9ecec7fdbebcbe3385db", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:44:12 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-account-status": "Succeeded", + "x-ms-correlation-request-id": "48449a3d-5658-4753-b509-7a1708e0230d" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "capacity": 1 + }, + "properties": { + "cloudConnectors": { + "awsExternalId": "62c6f480-34d4-48be-b22e-e686d0766e7e" + }, + "friendlyName": "udpatedFriendlyName", + "createdBy": "chunyu@microsoft.com", + "createdByObjectId": "3bbd551e-499a-4607-a978-be16a8e17789", + "createdAt": "2021-08-18T04:55:19.116601Z", + "endpoints": { + "catalog": "https://dotnetllcpurviewaccount.catalog.purview.azure.com", + "scan": "https://dotnetllcpurviewaccount.scan.purview.azure.com", + "guardian": "https://dotnetllcpurviewaccount.guardian.purview.azure.com" + }, + "provisioningState": "Succeeded", + "privateEndpointConnections": [], + "managedResources": { + "resourceGroup": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount", + "storageAccount": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount/providers/Microsoft.Storage/storageAccounts/scaneastus2abhgmpa", + "eventHubNamespace": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount/providers/Microsoft.EventHub/namespaces/Atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f" + }, + "publicNetworkAccess": "Enabled", + "managedResourceGroupName": "managed-rg-dotnetLLCPurviewAccount" + }, + "id": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/dotnetTest/providers/Microsoft.Purview/accounts/dotnetLLCPurviewAccount", + "name": "dotnetLLCPurviewAccount", + "type": "Microsoft.Purview/accounts", + "location": "eastus2", + "identity": { + "type": "SystemAssigned", + "principalId": "f977cbc9-abaa-4aba-9c27-17d3dd704ca4", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "tags": {}, + "systemData": { + "createdBy": "chunyu@microsoft.com", + "createdByType": "User", + "createdAt": "2021-08-18T04:55:19.116601Z", + "lastModifiedBy": "chunyu@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-18T04:55:19.116601Z" + } + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "1856431416" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/ListKeysTask.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/ListKeysTask.json new file mode 100644 index 000000000000..7626460c4b97 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/ListKeysTask.json @@ -0,0 +1,70 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/regeneratekeys?api-version=2019-11-01-preview", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "34", + "Content-Type": "application/json", + "traceparent": "00-a1f98e7fecbac34fbb62c6427d2b6994-9e333a81e9510541-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "2a379a4c7df55797b8a6d19eb8f16ef9", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "keyType": "PrimaryAtlasKafkaKey" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:48:54 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "3ac84d65-0cfd-4623-a994-cb83c86b22db" + }, + "ResponseBody": { + "atlasKafkaPrimaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=Lp58m4PXPdjA\u002BOKwBT717op3fc/PXtVaPuONkWVVnh0=", + "atlasKafkaSecondaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=GcMVTNPGShESagjYw\u002B\u002BLGPPYfZ1h3Bj1IjL4tdejn9k=" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/listkeys?api-version=2019-11-01-preview", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-0888dfc11c3193468b7ddef7aab3184f-2aaaed5239d6af4c-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "8e4d4297872ade2f14f1c3a029763aff", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:48:54 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "974f914a-c4db-40aa-b27a-6396b74ee5b5" + }, + "ResponseBody": { + "atlasKafkaPrimaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=Lp58m4PXPdjA\u002BOKwBT717op3fc/PXtVaPuONkWVVnh0=", + "atlasKafkaSecondaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=GcMVTNPGShESagjYw\u002B\u002BLGPPYfZ1h3Bj1IjL4tdejn9k=" + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "216070101" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/ListKeysTaskAsync.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/ListKeysTaskAsync.json new file mode 100644 index 000000000000..520cd96f94c1 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/ListKeysTaskAsync.json @@ -0,0 +1,70 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/regeneratekeys?api-version=2019-11-01-preview", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "34", + "Content-Type": "application/json", + "traceparent": "00-12cbafaae379d44fb5220253dbafda01-3a9cd50adb1fe341-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "e418cff927889314631fd791c9d88a3b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "keyType": "PrimaryAtlasKafkaKey" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:49:02 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "7934f311-5518-4920-810d-8bb9c87723c7" + }, + "ResponseBody": { + "atlasKafkaPrimaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=xre3vpyXezr4nqC4kFt78PXtH2eq7VGZi\u002BJiXfcdU5U=", + "atlasKafkaSecondaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=GcMVTNPGShESagjYw\u002B\u002BLGPPYfZ1h3Bj1IjL4tdejn9k=" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/listkeys?api-version=2019-11-01-preview", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-8875fd2bd09f8e48aa50779edca524fb-4f0807fd79172247-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "0964116075190ed298f2d904c4ddb07a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:49:03 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "40594ffd-874b-4ec4-a3a1-d0bae7b808c9" + }, + "ResponseBody": { + "atlasKafkaPrimaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=xre3vpyXezr4nqC4kFt78PXtH2eq7VGZi\u002BJiXfcdU5U=", + "atlasKafkaSecondaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=GcMVTNPGShESagjYw\u002B\u002BLGPPYfZ1h3Bj1IjL4tdejn9k=" + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "483359474" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/RegenerateKeysTask.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/RegenerateKeysTask.json new file mode 100644 index 000000000000..e64921b4e40b --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/RegenerateKeysTask.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/regeneratekeys?api-version=2019-11-01-preview", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "34", + "Content-Type": "application/json", + "traceparent": "00-ed533dfe68370e479751d1f2e0e4650e-679dc872f169e14f-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "bd3893be470abba7360db0141e299c1f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "keyType": "PrimaryAtlasKafkaKey" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:47:59 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "7fafecf4-f119-40e0-bb2a-6b3d90347d47" + }, + "ResponseBody": { + "atlasKafkaPrimaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=DghPW/ZISiqsExfGFaEwwr2WiB2rjERWMzlhUAOCuPE=", + "atlasKafkaSecondaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=GcMVTNPGShESagjYw\u002B\u002BLGPPYfZ1h3Bj1IjL4tdejn9k=" + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "832744196" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/RegenerateKeysTaskAsync.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/RegenerateKeysTaskAsync.json new file mode 100644 index 000000000000..994c0614941d --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/RegenerateKeysTaskAsync.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/regeneratekeys?api-version=2019-11-01-preview", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "34", + "Content-Type": "application/json", + "traceparent": "00-c72dd4792b21ad4aa245706419cbbab6-d079e10ac057964c-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "c8eed6530673feb53528373d966ed705", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "keyType": "PrimaryAtlasKafkaKey" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:48:07 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "70160618-6264-48ea-a6c1-4c2649abc6c7" + }, + "ResponseBody": { + "atlasKafkaPrimaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=TmfpFZBHQcZuAbzxwF2c8XAGWw02mXS/GWMkZmlufLM=", + "atlasKafkaSecondaryEndpoint": "Endpoint=sb://atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=GcMVTNPGShESagjYw\u002B\u002BLGPPYfZ1h3Bj1IjL4tdejn9k=" + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "1601155618" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/UpdateTask.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/UpdateTask.json new file mode 100644 index 000000000000..c796cee53ec6 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/UpdateTask.json @@ -0,0 +1,84 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/?api-version=2019-11-01-preview", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "38", + "Content-Type": "application/json", + "traceparent": "00-bd34de1d60498947b2cac08efb36c881-aeb5b27ad611974c-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "8d605e757290c739af404ddc3deadce1", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "friendlyName": "udpatedFriendlyName" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:46:49 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "96577d55-bab4-4fe9-a395-d8806347ef52" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "capacity": 1 + }, + "properties": { + "cloudConnectors": { + "awsExternalId": "62c6f480-34d4-48be-b22e-e686d0766e7e" + }, + "friendlyName": "udpatedFriendlyName", + "createdBy": "chunyu@microsoft.com", + "createdByObjectId": "3bbd551e-499a-4607-a978-be16a8e17789", + "createdAt": "2021-08-18T04:55:19.116601Z", + "endpoints": { + "catalog": "https://dotnetllcpurviewaccount.catalog.purview.azure.com", + "scan": "https://dotnetllcpurviewaccount.scan.purview.azure.com", + "guardian": "https://dotnetllcpurviewaccount.guardian.purview.azure.com" + }, + "provisioningState": "Succeeded", + "privateEndpointConnections": [], + "managedResources": { + "resourceGroup": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount", + "storageAccount": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount/providers/Microsoft.Storage/storageAccounts/scaneastus2abhgmpa", + "eventHubNamespace": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount/providers/Microsoft.EventHub/namespaces/Atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f" + }, + "publicNetworkAccess": "Enabled", + "managedResourceGroupName": "managed-rg-dotnetLLCPurviewAccount" + }, + "id": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/dotnetTest/providers/Microsoft.Purview/accounts/dotnetLLCPurviewAccount", + "name": "dotnetLLCPurviewAccount", + "type": "Microsoft.Purview/accounts", + "location": "eastus2", + "identity": { + "type": "SystemAssigned", + "principalId": "f977cbc9-abaa-4aba-9c27-17d3dd704ca4", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "tags": {}, + "systemData": { + "createdBy": "chunyu@microsoft.com", + "createdByType": "User", + "createdAt": "2021-08-18T04:55:19.116601Z", + "lastModifiedBy": "chunyu@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-18T04:55:19.116601Z" + } + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "584858991" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/UpdateTaskAsync.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/UpdateTaskAsync.json new file mode 100644 index 000000000000..83ba9cf2b649 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/AccountsClientTest/UpdateTaskAsync.json @@ -0,0 +1,84 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/?api-version=2019-11-01-preview", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "38", + "Content-Type": "application/json", + "traceparent": "00-decdd8926c1736488e1f5bc9a7fef8be-5eece6306e1da14f-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "e837ec19be013504068f897cb02a8f42", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "friendlyName": "udpatedFriendlyName" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:46:51 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "ccb39200-f292-44a4-90d9-33450064de89" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "capacity": 1 + }, + "properties": { + "cloudConnectors": { + "awsExternalId": "62c6f480-34d4-48be-b22e-e686d0766e7e" + }, + "friendlyName": "udpatedFriendlyName", + "createdBy": "chunyu@microsoft.com", + "createdByObjectId": "3bbd551e-499a-4607-a978-be16a8e17789", + "createdAt": "2021-08-18T04:55:19.116601Z", + "endpoints": { + "catalog": "https://dotnetllcpurviewaccount.catalog.purview.azure.com", + "scan": "https://dotnetllcpurviewaccount.scan.purview.azure.com", + "guardian": "https://dotnetllcpurviewaccount.guardian.purview.azure.com" + }, + "provisioningState": "Succeeded", + "privateEndpointConnections": [], + "managedResources": { + "resourceGroup": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount", + "storageAccount": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount/providers/Microsoft.Storage/storageAccounts/scaneastus2abhgmpa", + "eventHubNamespace": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/managed-rg-dotnetLLCPurviewAccount/providers/Microsoft.EventHub/namespaces/Atlas-7fd51f91-de1e-4e8b-a5b6-da64dd299b9f" + }, + "publicNetworkAccess": "Enabled", + "managedResourceGroupName": "managed-rg-dotnetLLCPurviewAccount" + }, + "id": "/subscriptions/7fd08dcc-a653-4b0f-8f8c-4dac889fdda4/resourceGroups/dotnetTest/providers/Microsoft.Purview/accounts/dotnetLLCPurviewAccount", + "name": "dotnetLLCPurviewAccount", + "type": "Microsoft.Purview/accounts", + "location": "eastus2", + "identity": { + "type": "SystemAssigned", + "principalId": "f977cbc9-abaa-4aba-9c27-17d3dd704ca4", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "tags": {}, + "systemData": { + "createdBy": "chunyu@microsoft.com", + "createdByType": "User", + "createdAt": "2021-08-18T04:55:19.116601Z", + "lastModifiedBy": "chunyu@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-18T04:55:19.116601Z" + } + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "1739424517" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/CreateOrUpdateTask.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/CreateOrUpdateTask.json new file mode 100644 index 000000000000..3d1961c69fcb --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/CreateOrUpdateTask.json @@ -0,0 +1,122 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/mysubCollection?api-version=2019-11-01-preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "64", + "Content-Type": "application/json", + "traceparent": "00-97eb591a51b8844cae8cb94771a13755-4f84ead2d9199143-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "0f1449582f019d2f3b3e0f0a5e2776f5", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "parentCollection": { + "referenceName": "dotnetLLCPurviewAccount" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:52:44 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "24d3cac0-0f95-4df7-bba1-e4f4defa41c1" + }, + "ResponseBody": { + "name": "mysubCollection", + "friendlyName": "mysubCollection", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:52:44.6070545Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:52:44.6070546Z" + }, + "collectionProvisioningState": "Creating" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/mysubCollection?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-f17a935ab0274d4da6b75a5391aeb717-f0210132b07e434d-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "5563d20befd8259bd8b6dd9f99b204ce", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:52:46 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "c8fac965-e99a-41d0-96db-39ebfcda36e8" + }, + "ResponseBody": { + "name": "mysubCollection", + "friendlyName": "mysubCollection", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:52:44.6070545Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:52:44.6070546Z" + }, + "collectionProvisioningState": "Succeeded" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/mysubCollection?api-version=2019-11-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-2b26793566020743ab0928dd75f027a3-4cdaa5ae191c7244-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "a43b4e193246f70518e01733999be75a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Date": "Fri, 20 Aug 2021 06:52:47 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "04d75497-6a28-4522-ab17-27bee0c0fb43" + }, + "ResponseBody": [] + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "1677679430" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/CreateOrUpdateTaskAsync.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/CreateOrUpdateTaskAsync.json new file mode 100644 index 000000000000..261228900eeb --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/CreateOrUpdateTaskAsync.json @@ -0,0 +1,164 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/mysubCollection?api-version=2019-11-01-preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "64", + "Content-Type": "application/json", + "traceparent": "00-7a4a9c849f878a4d91a858420fafcfe4-0e03f345b9b6784d-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "3e2d17f8dacaf083b0bb9b4152b8046f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "parentCollection": { + "referenceName": "dotnetLLCPurviewAccount" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:52:49 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "d2647011-24bd-4a41-97b7-5f7072ebbf0d" + }, + "ResponseBody": { + "name": "mysubCollection", + "friendlyName": "mysubCollection", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:52:50.1553477Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:52:50.1553478Z" + }, + "collectionProvisioningState": "Creating" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/mysubCollection?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-9de4cfed016ff44e916d705a7307e1a6-e06945b9c4885340-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "c7704b8a22ad784c7533901ba51876dd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:52:51 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "9911e41b-b81c-4264-967e-e90a98f41d3e" + }, + "ResponseBody": { + "name": "mysubCollection", + "friendlyName": "mysubCollection", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:52:50.1553477Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:52:50.1553478Z" + }, + "collectionProvisioningState": "Creating" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/mysubCollection?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-f4d892d857526240b43f138c91b4d20f-2e128b84b869cc4e-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "d29e33a6a3ae50f75245339903b2c520", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:52:53 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "532dc21b-ab5a-4762-a422-5d692e9ca796" + }, + "ResponseBody": { + "name": "mysubCollection", + "friendlyName": "mysubCollection", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:52:50.1553477Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:52:50.1553478Z" + }, + "collectionProvisioningState": "Succeeded" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/mysubCollection?api-version=2019-11-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-7264da64c59aa742947a35692c238755-300736fe9d1d1945-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "df651eb5d750d6b9cbb5c99749684a97", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Date": "Fri, 20 Aug 2021 06:52:53 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "1a681f71-5b28-4f34-b8d0-fafbd7a1100f" + }, + "ResponseBody": [] + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "1001014761" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/GetTask.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/GetTask.json new file mode 100644 index 000000000000..78e848f47132 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/GetTask.json @@ -0,0 +1,164 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "64", + "Content-Type": "application/json", + "traceparent": "00-ced80a7cfe4a844284812604e0556928-e1b17f2111993946-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "63a979a1c271186cddcbb125a6acc6ec", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "parentCollection": { + "referenceName": "dotnetLLCPurviewAccount" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:53:39 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "5fff8fab-ae83-4ba1-8aaf-a2555c163082" + }, + "ResponseBody": { + "name": "myCollection1", + "friendlyName": "myCollection1", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:53:40.0137865Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:53:40.0137866Z" + }, + "collectionProvisioningState": "Creating" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-54a0191e72ba194cb38a5676a14aa96d-070ecb23e1dd2b4b-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "38b42ec54fbd0314bb61fb83eb2153d6", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:53:40 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "d8f51d22-bc59-46d8-bf2c-df9f475dec08" + }, + "ResponseBody": { + "name": "myCollection1", + "friendlyName": "myCollection1", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:53:40.0137865Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:53:40.0137866Z" + }, + "collectionProvisioningState": "Creating" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-81a3c007a300e346ba78ce77e10e9a6a-61e4df48eb3af742-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "25880ebebc805d23f214acbb981384e3", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:53:41 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "ee2acb10-4e2d-454c-ac40-228354aed7d2" + }, + "ResponseBody": { + "name": "myCollection1", + "friendlyName": "myCollection1", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:53:40.0137865Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:53:40.0137866Z" + }, + "collectionProvisioningState": "Succeeded" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-410a0382a474a74382fef1e7d4182b9d-fc6705ccb83db048-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "caff32f5dfb0511a65a6a80fc7e82cbc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Date": "Fri, 20 Aug 2021 06:53:42 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "3ccb1118-590b-46ef-9e16-2b9d0c02fdb1" + }, + "ResponseBody": [] + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "403042195" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/GetTaskAsync.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/GetTaskAsync.json new file mode 100644 index 000000000000..22d242d69c06 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/CollectionsClientTest/GetTaskAsync.json @@ -0,0 +1,206 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "64", + "Content-Type": "application/json", + "traceparent": "00-6beca710d3092f41adaef7a24e6ed17d-c433f7aef66a5e4f-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "4d4ea21d6612c4be0eee6b159a9fe963", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "parentCollection": { + "referenceName": "dotnetLLCPurviewAccount" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:53:44 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "0a0d2389-26c2-4ad1-912e-266be9dab06e" + }, + "ResponseBody": { + "name": "myCollection1", + "friendlyName": "myCollection1", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:53:45.4716995Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:53:45.4716996Z" + }, + "collectionProvisioningState": "Creating" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-68d2baddd6b72647bdd85c71ec7cc26a-6996f1d18d5b8447-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "a3e80296ecf8c12f0d88253b15cafc01", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:53:45 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "70dc53f6-c46d-4080-ad59-e77b6bea272b" + }, + "ResponseBody": { + "name": "myCollection1", + "friendlyName": "myCollection1", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:53:45.4716995Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:53:45.4716996Z" + }, + "collectionProvisioningState": "Creating" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-8d940852cde57f4a88081666b52a3ccf-5b49c9b061465547-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "c8f23197895472e25b95641bcf2edb13", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:53:46 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "64e201d9-b465-4536-8da4-11ec58c44300" + }, + "ResponseBody": { + "name": "myCollection1", + "friendlyName": "myCollection1", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:53:45.4716995Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:53:45.4716996Z" + }, + "collectionProvisioningState": "Creating" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-0e649de0d6deab408e9910a180e680e0-cef3031e9fd5ba4d-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "a0bc67917ddd30a0738c3f8a4183ae43", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 20 Aug 2021 06:53:48 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "14ff695a-8483-4d0f-927d-ab05b76f7a55" + }, + "ResponseBody": { + "name": "myCollection1", + "friendlyName": "myCollection1", + "parentCollection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + }, + "systemData": { + "createdBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "createdByType": "Application", + "createdAt": "2021-08-20T06:53:45.4716995Z", + "lastModifiedBy": "4faa32fd-963a-464d-b6bf-c12cf48c0317", + "lastModifiedByType": "Application", + "lastModifiedAt": "2021-08-20T06:53:45.4716996Z" + }, + "collectionProvisioningState": "Succeeded" + } + }, + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/collections/myCollection1?api-version=2019-11-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-975151e6a942244cb6eb72c5283f6539-0da9e056da563049-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Account/1.0.0-alpha.20210820.1", + "(.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )" + ], + "x-ms-client-request-id": "687d6af220ad0d0e207648628814f1df", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Date": "Fri, 20 Aug 2021 06:53:48 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "dd5ab0e9-60f4-4113-869b-48c3c1a14fbb" + }, + "ResponseBody": [] + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetLLCPurviewAccount.purview.azure.com", + "RandomSeed": "391599712" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataPolicyClientTest/GetMetadataPolicy.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataPolicyClientTest/GetMetadataPolicy.json new file mode 100644 index 000000000000..4a70f058c9a7 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataPolicyClientTest/GetMetadataPolicy.json @@ -0,0 +1,186 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/policyStore/metadataPolicies/d04a7fad-ff6c-44f4-8fb4-0d007a8c01f8?api-version=2021-07-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-ccd2104426343746b6c5f18bb25bd8c0-db104ef24cdaf74f-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Administration/1.0.0-alpha.20211018.1", + "(.NET Core 3.1.20; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "5bae5b2b12a54b48d19ba1106f4831f7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2021-07-01-preview, 2021-07-01", + "Content-Length": "3747", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 18 Oct 2021 07:10:31 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "17df28c2-54d4-41c0-8a8c-1d3e8c188ea1" + }, + "ResponseBody": { + "name": "policy_dotnetLLCPurviewAccount", + "id": "d04a7fad-ff6c-44f4-8fb4-0d007a8c01f8", + "version": 4, + "properties": { + "description": "", + "decisionRules": [ + { + "kind": "decisionrule", + "effect": "Permit", + "dnfCondition": [ + [ + { + "attributeName": "resource.purview.collection", + "attributeValueIncludes": "dotnetllcpurviewaccount" + }, + { + "fromRule": "permission:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "permission:dotnetllcpurviewaccount" + } + ] + ] + } + ], + "attributeRules": [ + { + "kind": "attributerule", + "id": "purviewmetadatarole_builtin_collection-administrator:dotnetllcpurviewaccount", + "name": "purviewmetadatarole_builtin_collection-administrator:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "attributeName": "principal.microsoft.id", + "attributeValueIncludedIn": [ + "9f78dd23-f3c4-450f-84af-d9bd0a224f0b", + "6d0fee93-2b74-46dd-a497-e74f724b6125" + ] + }, + { + "fromRule": "purviewmetadatarole_builtin_collection-administrator", + "attributeName": "derived.purview.role", + "attributeValueIncludes": "purviewmetadatarole_builtin_collection-administrator" + } + ] + ] + }, + { + "kind": "attributerule", + "id": "purviewmetadatarole_builtin_purview-reader:dotnetllcpurviewaccount", + "name": "purviewmetadatarole_builtin_purview-reader:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "attributeName": "principal.microsoft.id", + "attributeValueIncludedIn": [ + "9f78dd23-f3c4-450f-84af-d9bd0a224f0b", + "6d0fee93-2b74-46dd-a497-e74f724b6125" + ] + }, + { + "fromRule": "purviewmetadatarole_builtin_purview-reader", + "attributeName": "derived.purview.role", + "attributeValueIncludes": "purviewmetadatarole_builtin_purview-reader" + } + ] + ] + }, + { + "kind": "attributerule", + "id": "purviewmetadatarole_builtin_data-curator:dotnetllcpurviewaccount", + "name": "purviewmetadatarole_builtin_data-curator:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "attributeName": "principal.microsoft.id", + "attributeValueIncludedIn": [ + "9f78dd23-f3c4-450f-84af-d9bd0a224f0b", + "6d0fee93-2b74-46dd-a497-e74f724b6125" + ] + }, + { + "fromRule": "purviewmetadatarole_builtin_data-curator", + "attributeName": "derived.purview.role", + "attributeValueIncludes": "purviewmetadatarole_builtin_data-curator" + } + ] + ] + }, + { + "kind": "attributerule", + "id": "purviewmetadatarole_builtin_data-source-administrator:dotnetllcpurviewaccount", + "name": "purviewmetadatarole_builtin_data-source-administrator:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "attributeName": "principal.microsoft.id", + "attributeValueIncludedIn": [ + "9f78dd23-f3c4-450f-84af-d9bd0a224f0b", + "6d0fee93-2b74-46dd-a497-e74f724b6125" + ] + }, + { + "fromRule": "purviewmetadatarole_builtin_data-source-administrator", + "attributeName": "derived.purview.role", + "attributeValueIncludes": "purviewmetadatarole_builtin_data-source-administrator" + } + ] + ] + }, + { + "kind": "attributerule", + "id": "permission:dotnetllcpurviewaccount", + "name": "permission:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "fromRule": "purviewmetadatarole_builtin_collection-administrator:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "purviewmetadatarole_builtin_collection-administrator:dotnetllcpurviewaccount" + } + ], + [ + { + "fromRule": "purviewmetadatarole_builtin_purview-reader:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "purviewmetadatarole_builtin_purview-reader:dotnetllcpurviewaccount" + } + ], + [ + { + "fromRule": "purviewmetadatarole_builtin_data-curator:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "purviewmetadatarole_builtin_data-curator:dotnetllcpurviewaccount" + } + ], + [ + { + "fromRule": "purviewmetadatarole_builtin_data-source-administrator:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "purviewmetadatarole_builtin_data-source-administrator:dotnetllcpurviewaccount" + } + ] + ] + } + ], + "collection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + } + } + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetllcpurviewaccount.purview.azure.com/", + "RandomSeed": "1117275389" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataPolicyClientTest/GetMetadataPolicyAsync.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataPolicyClientTest/GetMetadataPolicyAsync.json new file mode 100644 index 000000000000..ad5e16fd59f1 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataPolicyClientTest/GetMetadataPolicyAsync.json @@ -0,0 +1,186 @@ +{ + "Entries": [ + { + "RequestUri": "https://dotnetllcpurviewaccount.purview.azure.com/policyStore/metadataPolicies/d04a7fad-ff6c-44f4-8fb4-0d007a8c01f8?api-version=2021-07-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-5a1aa981a0f75f46921c4203d16f422b-b955f5624c4c6340-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Administration/1.0.0-alpha.20211018.1", + "(.NET Core 3.1.20; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "cbd1f41cd34aa75238a552a06b993cc8", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2021-07-01-preview, 2021-07-01", + "Content-Length": "3747", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 18 Oct 2021 07:10:34 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "3c6fd014-6030-46a1-ac02-05001d6a9bf5" + }, + "ResponseBody": { + "name": "policy_dotnetLLCPurviewAccount", + "id": "d04a7fad-ff6c-44f4-8fb4-0d007a8c01f8", + "version": 4, + "properties": { + "description": "", + "decisionRules": [ + { + "kind": "decisionrule", + "effect": "Permit", + "dnfCondition": [ + [ + { + "attributeName": "resource.purview.collection", + "attributeValueIncludes": "dotnetllcpurviewaccount" + }, + { + "fromRule": "permission:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "permission:dotnetllcpurviewaccount" + } + ] + ] + } + ], + "attributeRules": [ + { + "kind": "attributerule", + "id": "purviewmetadatarole_builtin_collection-administrator:dotnetllcpurviewaccount", + "name": "purviewmetadatarole_builtin_collection-administrator:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "attributeName": "principal.microsoft.id", + "attributeValueIncludedIn": [ + "9f78dd23-f3c4-450f-84af-d9bd0a224f0b", + "6d0fee93-2b74-46dd-a497-e74f724b6125" + ] + }, + { + "fromRule": "purviewmetadatarole_builtin_collection-administrator", + "attributeName": "derived.purview.role", + "attributeValueIncludes": "purviewmetadatarole_builtin_collection-administrator" + } + ] + ] + }, + { + "kind": "attributerule", + "id": "purviewmetadatarole_builtin_purview-reader:dotnetllcpurviewaccount", + "name": "purviewmetadatarole_builtin_purview-reader:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "attributeName": "principal.microsoft.id", + "attributeValueIncludedIn": [ + "9f78dd23-f3c4-450f-84af-d9bd0a224f0b", + "6d0fee93-2b74-46dd-a497-e74f724b6125" + ] + }, + { + "fromRule": "purviewmetadatarole_builtin_purview-reader", + "attributeName": "derived.purview.role", + "attributeValueIncludes": "purviewmetadatarole_builtin_purview-reader" + } + ] + ] + }, + { + "kind": "attributerule", + "id": "purviewmetadatarole_builtin_data-curator:dotnetllcpurviewaccount", + "name": "purviewmetadatarole_builtin_data-curator:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "attributeName": "principal.microsoft.id", + "attributeValueIncludedIn": [ + "9f78dd23-f3c4-450f-84af-d9bd0a224f0b", + "6d0fee93-2b74-46dd-a497-e74f724b6125" + ] + }, + { + "fromRule": "purviewmetadatarole_builtin_data-curator", + "attributeName": "derived.purview.role", + "attributeValueIncludes": "purviewmetadatarole_builtin_data-curator" + } + ] + ] + }, + { + "kind": "attributerule", + "id": "purviewmetadatarole_builtin_data-source-administrator:dotnetllcpurviewaccount", + "name": "purviewmetadatarole_builtin_data-source-administrator:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "attributeName": "principal.microsoft.id", + "attributeValueIncludedIn": [ + "9f78dd23-f3c4-450f-84af-d9bd0a224f0b", + "6d0fee93-2b74-46dd-a497-e74f724b6125" + ] + }, + { + "fromRule": "purviewmetadatarole_builtin_data-source-administrator", + "attributeName": "derived.purview.role", + "attributeValueIncludes": "purviewmetadatarole_builtin_data-source-administrator" + } + ] + ] + }, + { + "kind": "attributerule", + "id": "permission:dotnetllcpurviewaccount", + "name": "permission:dotnetllcpurviewaccount", + "dnfCondition": [ + [ + { + "fromRule": "purviewmetadatarole_builtin_collection-administrator:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "purviewmetadatarole_builtin_collection-administrator:dotnetllcpurviewaccount" + } + ], + [ + { + "fromRule": "purviewmetadatarole_builtin_purview-reader:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "purviewmetadatarole_builtin_purview-reader:dotnetllcpurviewaccount" + } + ], + [ + { + "fromRule": "purviewmetadatarole_builtin_data-curator:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "purviewmetadatarole_builtin_data-curator:dotnetllcpurviewaccount" + } + ], + [ + { + "fromRule": "purviewmetadatarole_builtin_data-source-administrator:dotnetllcpurviewaccount", + "attributeName": "derived.purview.permission", + "attributeValueIncludes": "purviewmetadatarole_builtin_data-source-administrator:dotnetllcpurviewaccount" + } + ] + ] + } + ], + "collection": { + "type": "CollectionReference", + "referenceName": "dotnetllcpurviewaccount" + } + } + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://dotnetllcpurviewaccount.purview.azure.com/", + "RandomSeed": "1401571704" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataRolesClientTest/List.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataRolesClientTest/List.json new file mode 100644 index 000000000000..e0b202c09f0a --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataRolesClientTest/List.json @@ -0,0 +1,158 @@ +{ + "Entries": [ + { + "RequestUri": "https://feng-purview.purview.azure.com/policyStore/metadataRoles?api-version=2021-07-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-0934ff9eb63000428e3942d53521ed5a-2129a58604dc7141-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Administration/1.0.0-alpha.20211018.1", + "(.NET 5.0.11; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "e462278b7d3b3e7868ae2ecfa6df2566", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2021-01-01-preview, 2021-07-01-preview, 2021-07-01", + "Content-Length": "1982", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 18 Oct 2021 14:08:38 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "594af5d1-3316-4e7b-b0ec-b1b485fc0bd8" + }, + "ResponseBody": { + "values": [ + { + "id": "purviewmetadatarole_builtin_data-curator", + "name": "data-curator", + "type": "Microsoft.Purview/role", + "properties": { + "provisioningState": "Provisioned", + "roleType": "BuiltIn", + "friendlyName": "Data Curator", + "cnfCondition": [ + [ + { + "attributeName": "request.azure.dataAction", + "attributeValueIncludedIn": [ + "Microsoft.Purview/accounts/data/read", + "Microsoft.Purview/accounts/data/write", + "Microsoft.Purview/accounts/collection/read" + ] + } + ] + ], + "version": 1 + } + }, + { + "id": "purviewmetadatarole_builtin_data-source-administrator", + "name": "data-source-administrator", + "type": "Microsoft.Purview/role", + "properties": { + "provisioningState": "Provisioned", + "roleType": "BuiltIn", + "friendlyName": "Data Source Administrator", + "cnfCondition": [ + [ + { + "attributeName": "request.azure.dataAction", + "attributeValueIncludedIn": [ + "Microsoft.Purview/accounts/scan/read", + "Microsoft.Purview/accounts/scan/write", + "Microsoft.Purview/accounts/collection/read" + ] + } + ] + ], + "version": 1 + } + }, + { + "id": "purviewmetadatarole_builtin_collection-administrator", + "name": "collection-administrator", + "type": "Microsoft.Purview/role", + "properties": { + "provisioningState": "Provisioned", + "roleType": "BuiltIn", + "friendlyName": "Collection Administrator", + "cnfCondition": [ + [ + { + "attributeName": "request.azure.dataAction", + "attributeValueIncludedIn": [ + "Microsoft.Purview/accounts/collection/read", + "Microsoft.Purview/accounts/collection/write" + ] + } + ] + ], + "version": 1 + } + }, + { + "id": "purviewmetadatarole_builtin_purview-reader", + "name": "purview-reader", + "type": "Microsoft.Purview/role", + "properties": { + "provisioningState": "Provisioned", + "roleType": "BuiltIn", + "friendlyName": "Purview Reader", + "cnfCondition": [ + [ + { + "attributeName": "request.azure.dataAction", + "attributeValueIncludedIn": [ + "Microsoft.Purview/accounts/data/read", + "Microsoft.Purview/accounts/collection/read" + ] + } + ] + ], + "version": 1 + } + } + ], + "nextLink": "https://feng-purview.purview.azure.com/policyStore/metadataRoles?api-version=2021-07-01\u0026skipToken=%2BRID%3A~OCYSANC6p-wJCT0AAAAAAA%3D%3D%23RT%3A1%23TRC%3A5%23ISV%3A2%23IEO%3A65551%23QCF%3A4%23FPC%3AAgH09PQEAAmJBoA%3D" + } + }, + { + "RequestUri": "https://feng-purview.purview.azure.com/policyStore/metadataRoles?api-version=2021-07-01\u0026skipToken=%2BRID%3A~OCYSANC6p-wJCT0AAAAAAA%3D%3D%23RT%3A1%23TRC%3A5%23ISV%3A2%23IEO%3A65551%23QCF%3A4%23FPC%3AAgH09PQEAAmJBoA%3D", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-3afb14ba8cade6468cdead1e7e7ccb0d-7c32448e26ec894a-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Administration/1.0.0-alpha.20211018.1", + "(.NET 5.0.11; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "ead9bbabebb91959ae6e4dfa3c4b30dd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2021-01-01-preview, 2021-07-01-preview, 2021-07-01", + "Content-Length": "13", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 18 Oct 2021 14:08:39 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "66c25575-882b-4dfc-bce4-ec54341d1ead" + }, + "ResponseBody": { + "values": [] + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://feng-purview.purview.azure.com", + "RandomSeed": "1058512166" + } +} \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataRolesClientTest/ListAsync.json b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataRolesClientTest/ListAsync.json new file mode 100644 index 000000000000..21372ff19847 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/SessionRecords/MetadataRolesClientTest/ListAsync.json @@ -0,0 +1,158 @@ +{ + "Entries": [ + { + "RequestUri": "https://feng-purview.purview.azure.com/policyStore/metadataRoles?api-version=2021-07-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-90bed46460097546897a4cc77d2a56fe-ededb9d3210c014c-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Administration/1.0.0-alpha.20211018.1", + "(.NET 5.0.11; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "fdf78c5964de06debd7249d57c7504b6", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2021-01-01-preview, 2021-07-01-preview, 2021-07-01", + "Content-Length": "1982", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 18 Oct 2021 14:08:40 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "0c34d3fd-50a7-400a-9bd0-3f17493c4197" + }, + "ResponseBody": { + "values": [ + { + "id": "purviewmetadatarole_builtin_data-curator", + "name": "data-curator", + "type": "Microsoft.Purview/role", + "properties": { + "provisioningState": "Provisioned", + "roleType": "BuiltIn", + "friendlyName": "Data Curator", + "cnfCondition": [ + [ + { + "attributeName": "request.azure.dataAction", + "attributeValueIncludedIn": [ + "Microsoft.Purview/accounts/data/read", + "Microsoft.Purview/accounts/data/write", + "Microsoft.Purview/accounts/collection/read" + ] + } + ] + ], + "version": 1 + } + }, + { + "id": "purviewmetadatarole_builtin_data-source-administrator", + "name": "data-source-administrator", + "type": "Microsoft.Purview/role", + "properties": { + "provisioningState": "Provisioned", + "roleType": "BuiltIn", + "friendlyName": "Data Source Administrator", + "cnfCondition": [ + [ + { + "attributeName": "request.azure.dataAction", + "attributeValueIncludedIn": [ + "Microsoft.Purview/accounts/scan/read", + "Microsoft.Purview/accounts/scan/write", + "Microsoft.Purview/accounts/collection/read" + ] + } + ] + ], + "version": 1 + } + }, + { + "id": "purviewmetadatarole_builtin_collection-administrator", + "name": "collection-administrator", + "type": "Microsoft.Purview/role", + "properties": { + "provisioningState": "Provisioned", + "roleType": "BuiltIn", + "friendlyName": "Collection Administrator", + "cnfCondition": [ + [ + { + "attributeName": "request.azure.dataAction", + "attributeValueIncludedIn": [ + "Microsoft.Purview/accounts/collection/read", + "Microsoft.Purview/accounts/collection/write" + ] + } + ] + ], + "version": 1 + } + }, + { + "id": "purviewmetadatarole_builtin_purview-reader", + "name": "purview-reader", + "type": "Microsoft.Purview/role", + "properties": { + "provisioningState": "Provisioned", + "roleType": "BuiltIn", + "friendlyName": "Purview Reader", + "cnfCondition": [ + [ + { + "attributeName": "request.azure.dataAction", + "attributeValueIncludedIn": [ + "Microsoft.Purview/accounts/data/read", + "Microsoft.Purview/accounts/collection/read" + ] + } + ] + ], + "version": 1 + } + } + ], + "nextLink": "https://feng-purview.purview.azure.com/policyStore/metadataRoles?api-version=2021-07-01\u0026skipToken=%2BRID%3A~OCYSANC6p-wJCT0AAAAAAA%3D%3D%23RT%3A1%23TRC%3A5%23ISV%3A2%23IEO%3A65551%23QCF%3A4%23FPC%3AAgH09PQEAAmJBoA%3D" + } + }, + { + "RequestUri": "https://feng-purview.purview.azure.com/policyStore/metadataRoles?api-version=2021-07-01\u0026skipToken=%2BRID%3A~OCYSANC6p-wJCT0AAAAAAA%3D%3D%23RT%3A1%23TRC%3A5%23ISV%3A2%23IEO%3A65551%23QCF%3A4%23FPC%3AAgH09PQEAAmJBoA%3D", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-27d4c5de32968a4082356f7a007ed14f-bf951b71d837f840-00", + "User-Agent": [ + "azsdk-net-Analytics.Purview.Administration/1.0.0-alpha.20211018.1", + "(.NET 5.0.11; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "fbef42b3f8d5cae2e67d714a0f632f70", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2021-01-01-preview, 2021-07-01-preview, 2021-07-01", + "Content-Length": "13", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 18 Oct 2021 14:08:41 GMT", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-correlation-request-id": "0451593a-af62-4023-9c62-52a7aa758275" + }, + "ResponseBody": { + "values": [] + } + } + ], + "Variables": { + "PURVIEW_ACCOUNT_URL": "https://feng-purview.purview.azure.com", + "RandomSeed": "1099624609" + } +} \ No newline at end of file