Skip to content

Commit

Permalink
LLC purview Account (#23334)
Browse files Browse the repository at this point in the history
* LLC purview Account

* use default credential

* resolve comments

* re-generate purveiw account to latest version

* update collection test

* update Readme

* update purview Account API

* record test case

* update recorded test case

* [Purview] Renames + Adopt "Clientlet" Design

- Make some very general client names a little more specific by
  prefixing them with `Purview`.

- Adopt "Clientlet" design, while we work on teaching the code
  generator how to do this.  There are a few changes here:

  - The list methods for Resource Rule Sets and Collections are
    promoted to the root account client.

  - The `collectionName` parameter is promoted to be a client
    parameter instead of an operation parameter.

  - The public constructors for the clientlet types are supressed.

  - `Get<ClientletName>Client()` methods are added to the root client.

* [Purview] Update Accounts README.md

* [Purview] Mark methods virtual

* [Purview] Run Export-API.ps1

Co-authored-by: Matt Ellis <matell@microsoft.com>
  • Loading branch information
chunyu3 and ellismg authored Aug 24, 2021
1 parent e17808f commit dc6d557
Show file tree
Hide file tree
Showing 35 changed files with 4,758 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{8052009B-2126-44A3-88CD-4F3B17894C64}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Stress", "..\..\..\common\Stress\Azure.Test.Stress\Azure.Test.Stress.csproj", "{0B991CA1-E570-4292-BABF-E011D9613C7B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj", "{0ED9C8A0-9A19-4750-8DD3-61D086288283}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Analytics.Purview.Account", "src\Azure.Analytics.Purview.Account.csproj", "{CF37FB99-8D78-473D-8333-AD560F057B75}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Analytics.Purview.Account.Tests", "tests\Azure.Analytics.Purview.Account.Tests.csproj", "{002A0F15-402B-473D-8842-5507462920BF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8052009B-2126-44A3-88CD-4F3B17894C64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8052009B-2126-44A3-88CD-4F3B17894C64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8052009B-2126-44A3-88CD-4F3B17894C64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8052009B-2126-44A3-88CD-4F3B17894C64}.Release|Any CPU.Build.0 = Release|Any CPU
{0B991CA1-E570-4292-BABF-E011D9613C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B991CA1-E570-4292-BABF-E011D9613C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B991CA1-E570-4292-BABF-E011D9613C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B991CA1-E570-4292-BABF-E011D9613C7B}.Release|Any CPU.Build.0 = Release|Any CPU
{0ED9C8A0-9A19-4750-8DD3-61D086288283}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0ED9C8A0-9A19-4750-8DD3-61D086288283}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0ED9C8A0-9A19-4750-8DD3-61D086288283}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0ED9C8A0-9A19-4750-8DD3-61D086288283}.Release|Any CPU.Build.0 = Release|Any CPU
{CF37FB99-8D78-473D-8333-AD560F057B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF37FB99-8D78-473D-8333-AD560F057B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF37FB99-8D78-473D-8333-AD560F057B75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF37FB99-8D78-473D-8333-AD560F057B75}.Release|Any CPU.Build.0 = Release|Any CPU
{002A0F15-402B-473D-8842-5507462920BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{002A0F15-402B-473D-8842-5507462920BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{002A0F15-402B-473D-8842-5507462920BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{002A0F15-402B-473D-8842-5507462920BF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions sdk/purview/Azure.Analytics.Purview.Account/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Release History

## 1.0.0-beta.1 (Unreleased)

### New Features

- Initial preview release of the Azure Purview Account client library for .NET

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Add any shared properties you want for the projects under this package directory that need to be set before the auto imported Directory.Build.props
-->
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" />
</Project>
114 changes: 114 additions & 0 deletions sdk/purview/Azure.Analytics.Purview.Account/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Azure Purview Account client library for .NET

Azure Purview Account is a fully 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 Account client library for .NET with [NuGet][client_nuget_package]:

```
dotnet add package Azure.Analysis.Purview.Account
```

### 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 `AccountClient`.

```C#
var credential = new DefaultAzureCredential();
var client = new PurviewAccountClient(new Url("https://<my-account-name>.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 COMMON BAR -->
[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/)
<!-- CLIENT COMMON BAR -->

## 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 Type Definitions

```C#
var credential = new DefaultAzureCredential();
var client = new PurviewAccountClient(new Uri("https://<my-account-name>.purview.azure.com"), credential);

var Response response = await client.GetAccountPropertiesAsync();
var responseDocument = JsonDocument.Parse(response.Content);
Console.WriteLine(responseDocument.RootElement.GetProperty("name"));
```

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

<!-- LINKS -->
[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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace Azure.Analytics.Purview.Account
{
public partial class PurviewAccountClient
{
protected PurviewAccountClient() { }
public PurviewAccountClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Account.PurviewAccountClientOptions options = null) { }
public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
public virtual Azure.Response GetAccessKeys(Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> GetAccessKeysAsync(Azure.RequestOptions options = null) { throw null; }
public virtual Azure.Response GetAccountProperties(Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> GetAccountPropertiesAsync(Azure.RequestOptions options = null) { throw null; }
public virtual Azure.Analytics.Purview.Account.PurviewCollection GetCollectionClient(string collectionName) { throw null; }
public virtual Azure.Response GetCollections(string skipToken = null, Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> GetCollectionsAsync(string skipToken = null, Azure.RequestOptions options = null) { throw null; }
public virtual Azure.Analytics.Purview.Account.PurviewResourceSetRule GetResourceSetRuleClient() { throw null; }
public virtual Azure.Response GetResourceSetRules(string skipToken = null, Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> GetResourceSetRulesAsync(string skipToken = null, Azure.RequestOptions options = null) { throw null; }
public virtual Azure.Response RegenerateAccessKey(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> 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<Azure.Response> UpdateAccountPropertiesAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; }
}
public partial class PurviewAccountClientOptions : Azure.Core.ClientOptions
{
public PurviewAccountClientOptions(Azure.Analytics.Purview.Account.PurviewAccountClientOptions.ServiceVersion version = Azure.Analytics.Purview.Account.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<Azure.Response> 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<Azure.Response> DeleteCollectionAsync(Azure.RequestOptions options = null) { throw null; }
public virtual Azure.Response GetCollection(Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> GetCollectionAsync(Azure.RequestOptions options = null) { throw null; }
public virtual Azure.Response GetCollectionPath(Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> GetCollectionPathAsync(Azure.RequestOptions options = null) { throw null; }
public virtual Azure.Response ListChildCollectionNames(string skipToken = null, Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> ListChildCollectionNamesAsync(string skipToken = null, Azure.RequestOptions options = null) { 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<Azure.Response> 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<Azure.Response> DeleteResourceSetRuleAsync(Azure.RequestOptions options = null) { throw null; }
public virtual Azure.Response GetResourceSetRule(Azure.RequestOptions options = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> GetResourceSetRuleAsync(Azure.RequestOptions options = null) { throw null; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>An SDK for interacting with the Azure Purview Account service</Description>
<AssemblyTitle>Azure Purview Account SDK</AssemblyTitle>
<Version>1.0.0-beta.1</Version>
<PackageTags>Azure Purview</PackageTags>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<NoWarn>$(NoWarn);CS0169</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Azure.Core.Experimental" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
<ItemGroup>
<Compile Include="$(AzureCoreSharedSources)ArrayBufferWriter.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureCoreSharedSources)ClientDiagnostics.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureCoreSharedSources)ContentTypeUtilities.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureCoreSharedSources)DiagnosticScope.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureCoreSharedSources)DiagnosticScopeFactory.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureCoreSharedSources)HttpMessageSanitizer.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureCoreSharedSources)TaskExtensions.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureCoreSharedSources)OperationHelpers.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureCoreSharedSources)AzureResourceProviderNamespaceAttribute.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -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.Account
{
[CodeGenClient("AccountsClient")]
public partial class PurviewAccountClient
{
/// <summary>
/// Gets a service client for interacting with a collection.
/// </summary>
/// <param name="collectionName">The name of the collection to use.</param>
/// <returns>A service client for interacting with a collection.</returns>
public virtual PurviewCollection GetCollectionClient(string collectionName)
{
if (string.IsNullOrEmpty(collectionName))
{
throw new ArgumentNullException(nameof(collectionName));
}

return new PurviewCollection(Pipeline, _tokenCredential, endpoint, collectionName, apiVersion, _clientDiagnostics);
}

/// <summary>
/// Gets a service client for interacting with a resource set rule.
/// </summary>
/// <returns>A service client for interacting with a resource set rule.</returns>
public virtual PurviewResourceSetRule GetResourceSetRuleClient()
{
return new PurviewResourceSetRule(Pipeline, _tokenCredential, endpoint, apiVersion, _clientDiagnostics);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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.Account
{
[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, string apiVersion, ClientDiagnostics clientDiagnostics)
{
Pipeline = pipeline;
_tokenCredential = tokenCredential;
this.endpoint = endpoint;
this.collectionName = collectionName;
this.apiVersion = apiVersion;
_clientDiagnostics = clientDiagnostics;
}
}
}
Loading

0 comments on commit dc6d557

Please sign in to comment.