Skip to content

Commit 158b83f

Browse files
authored
Purview Share C# SDK V3 - Add new API List Share Resources (Azure#36981)
* WIP: Add new share sdk version * Get all existing tests ran * Add share resources client test * Sample tests passing in playback * All client test passing in playback * Fix share resource tests * Client tests information fixed * Fix samples information * Fix sample tests * Update readme * Fix generated code * Fix share resource client test errors * Update readme and changelog * Fix merge errors * Run script * Update snippets because of errors * Add missing references * Fix pipeline error * Fix small error * Add user invitation creation and tests and also update README * Update changelog * Fix snippet error * Remove unnecessary session records
1 parent 822b549 commit 158b83f

File tree

108 files changed

+14848
-8202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+14848
-8202
lines changed

sdk/purview/Azure.Analytics.Purview.Sharing/CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Release History
22

3-
## 1.0.0-beta.3 (Unreleased)
3+
## 1.0.0-beta.3 (2023-06-30)
44

55
### Features Added
66

7-
### Breaking Changes
7+
- Added the new share resource capability that allows listing resources associated with sent and received shares.
88

9-
### Bugs Fixed
9+
### Breaking Changes
1010

11-
### Other Changes
11+
- Removed skipToken as a parameter from all client list calls
12+
- Constructor for clients now takes in Uri object as oppose to a string parameter
1213

1314
## 1.0.0-beta.2 (2023-03-13)
1415

sdk/purview/Azure.Analytics.Purview.Sharing/README.md

Lines changed: 137 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
# Azure Purview Share client library for .NET
22

3-
Microsoft Purview Share is a fully managed cloud service.
3+
Microsoft Purview Data Sharing allows data to be shared in-place from Azure Data Lake Storage Gen2 and Azure Storage accounts, both within and across organizations.
44

5-
**Please rely heavily on the [service's documentation][share_product_documentation] and our [protocol client docs][protocol_client_quickstart] to use this library**
5+
Data providers may use Microsoft Purview Data Sharing to share their data directly with other users and partners (known as data consumers) without data duplication, while centrally managing their sharing activities from within Microsoft Purview.
6+
7+
For data consumers, Microsoft Purview Data Sharing provides near real-time access to data shared with them by a provider.
8+
9+
Key capabilities delivered by Microsoft Purview Data Sharing include:
10+
- Share data within the organization or with partners and customers outside of the organization (within the same Azure tenant or across different Azure tenants).
11+
- Share data from ADLS Gen2 or Blob storage in-place without data duplication.
12+
- Share data with multiple recipients.
13+
- Access shared data in near real time.
14+
- Manage sharing relationships and keep track of who the data is shared with/from, for each ADLSGen2 or Blob Storage account.
15+
- Terminate share access at any time.
16+
- Flexible experience through Microsoft Purview governance portal or via REST APIs.
17+
18+
**Please visit the following resources to learn more about this product.**
619

720
[Source code][source_code] | [Package (NuGet)][client_nuget_package] | [Product documentation][share_product_documentation]
821

@@ -28,19 +41,11 @@ This example demonstrates using [DefaultAzureCredential][default_cred_ref] to au
2841

2942
Once you have chosen and configured your credential, you can create instances of the `SentSharesClient`.
3043

31-
```C# Snippet:SentSharesClientSample_CreateSentSharesClient
32-
var credential = new DefaultAzureCredential();
33-
var endPoint = "https://my-account-name.purview.azure.com/share";
34-
var sentShareClient = new SentSharesClient(endPoint, credential);
35-
```
44+
## Key concepts
3645

37-
```C# Snippet:ReceivedSharesClientSample_CreateReceivedSharesClient
38-
var credential = new DefaultAzureCredential();
39-
var endPoint = "https://my-account-name.purview.azure.com/share";
40-
var receivedSharesClient = new ReceivedSharesClient(endPoint, credential);
41-
```
46+
__Data Provider:__ A data provider is the individual who creates a share by selecting a data source, choosing which files and folders to share, and who to share them with. Microsoft Purview then sends an invitation to each data consumer.
4247

43-
## Key concepts
48+
__Data Consumer:__ A data consumer is the individual who accepts the invitation by specifying a target storage account in their own Azure subscription that they'll use to access the shared data.
4449

4550
### Protocol Methods
4651

@@ -62,15 +67,24 @@ We guarantee that all client instance methods are thread-safe and independent of
6267
[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/)
6368
<!-- CLIENT COMMON BAR -->
6469

65-
## Examples
70+
##Examples
71+
72+
### Data Provider Examples
73+
74+
The following code examples demonstrate how data providers can use the Microsoft Azure Java SDK for Purview Sharing to manage their sharing activity.
6675

67-
The following section shows you how to initialize and authenticate your client and share data.
76+
#### Create a Sent Share Client
77+
```C# Snippet:SentSharesClientSample_CreateSentSharesClient
78+
var credential = new DefaultAzureCredential();
79+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
80+
var sentShareClient = new SentSharesClient(endPoint, credential);
81+
```
6882

69-
### Create a sent share
83+
#### Create a Sent Share
7084

7185
```C# Snippet:SentSharesClientSample_CreateSentShare
7286
var credential = new DefaultAzureCredential();
73-
var endPoint = "https://my-account-name.purview.azure.com/share";
87+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
7488
var sentShareClient = new SentSharesClient(endPoint, credential);
7589

7690
var data = new
@@ -107,31 +121,59 @@ var data = new
107121
Operation<BinaryData> createResponse = await sentShareClient.CreateOrReplaceSentShareAsync(WaitUntil.Completed, "sentShareId", RequestContent.Create(data));
108122
```
109123

110-
### Get a sent share
124+
#### Get a Sent Share
125+
126+
After creating a sent share, data providers can retrieve it.
111127

112128
```C# Snippet:SentSharesClientSample_GetSentShare
113129
var credential = new DefaultAzureCredential();
114-
var endPoint = "https://my-account-name.purview.azure.com/share";
130+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
115131
var sentShareClient = new SentSharesClient(endPoint, credential);
116132

117133
Response response = await sentShareClient.GetSentShareAsync("sentShareId");
118134
```
119135

120-
### List sent shares
136+
#### List Sent Shares
137+
138+
Data providers can also retrieve a list of the sent shares they have created.
121139

122140
```C# Snippet:SentSharesClientSample_ListSentShares
123141
var credential = new DefaultAzureCredential();
124-
var endPoint = "https://my-account-name.purview.azure.com/share";
142+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
125143
var sentShareClient = new SentSharesClient(endPoint, credential);
126144

127145
List<BinaryData> response = await sentShareClient.GetAllSentSharesAsync("referenceName").ToEnumerableAsync();
128146
```
129147

130-
### Create a sent share invitation
148+
#### Create a Share Invitation to a User
149+
150+
After creating a sent share, the data provider can extend invitations to consumers who may then view the shared data. In this example, an invitation is extended to an individual by specifying their email address.
151+
152+
```C# Snippet:SentSharesClientSample_CreateSentShareUserInvitation
153+
var credential = new DefaultAzureCredential();
154+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
155+
var sentShareClient = new SentSharesClient(endPoint, credential);
156+
157+
var data = new
158+
{
159+
invitationKind = "User",
160+
properties = new
161+
{
162+
TargetEmail = "[email protected]",
163+
Notify = true,
164+
}
165+
};
166+
167+
Response response = await sentShareClient.CreateSentShareInvitationAsync("sentShareId", "sentShareInvitationId", RequestContent.Create(data));
168+
```
169+
170+
#### Create a Share Invitation to a Service
171+
172+
Data providers can also extend invitations to services or applications by specifying the tenant id and object id of the service. *The object id used for sending an invitation to a service must be the object id associated with the Enterprise Application (not the application registration)*.
131173

132174
```C# Snippet:SentSharesClientSample_CreateSentShareInvitation
133175
var credential = new DefaultAzureCredential();
134-
var endPoint = "https://my-account-name.purview.azure.com/share";
176+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
135177
var sentShareClient = new SentSharesClient(endPoint, credential);
136178

137179
var data = new
@@ -147,41 +189,84 @@ var data = new
147189
Response response = await sentShareClient.CreateSentShareInvitationAsync("sentShareId", "sentShareInvitationId", RequestContent.Create(data));
148190
```
149191

150-
### Get a sent share invitation
192+
#### Get a sent share invitation
193+
194+
After creating a sent share invitation, data providers can retrieve it.
151195

152196
```C# Snippet:SentSharesClientSample_GetSentShareInvitation
153197
var credential = new DefaultAzureCredential();
154-
var endPoint = "https://my-account-name.purview.azure.com/share";
198+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
155199
var sentShareClient = new SentSharesClient(endPoint, credential);
156200

157201
Response response = await sentShareClient.GetSentShareInvitationAsync("sentShareId", "sentShareInvitationId");
158202
```
159203

160-
### List sent share invitations
204+
#### List sent share invitations
205+
206+
Data providers can also retrieve a list of the sent share invitations they have created.
161207

162208
```C# Snippet:SentSharesClientSample_ListSentShareInvitations
163209
var credential = new DefaultAzureCredential();
164-
var endPoint = "https://my-account-name.purview.azure.com/share";
210+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
165211
var sentShareClient = new SentSharesClient(endPoint, credential);
166212

167213
List<BinaryData> sentShareInvitations = await sentShareClient.GetAllSentShareInvitationsAsync("sentShareId").ToEnumerableAsync();
168214
```
169215

170-
### List detached received shares
216+
#### Delete a sent share invitation
217+
218+
Data providers can also retrieve a list of the sent share invitations they have created.
219+
220+
```C# Snippet:SentSharesClientSample_DeleteSentShareInvitation
221+
var credential = new DefaultAzureCredential();
222+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
223+
var sentShareClient = new SentSharesClient(endPoint, credential);
224+
225+
Operation operation = await sentShareClient.DeleteSentShareInvitationAsync(WaitUntil.Completed, "sentShareId", "sentShareInvitationId");
226+
```
227+
228+
#### Delete a sent share
229+
230+
A sent share can be deleted by the data provider to stop sharing their data with all data consumers.
231+
232+
```C# Snippet:SentSharesClientSample_DeleteSentShare
233+
var credential = new DefaultAzureCredential();
234+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
235+
var sentShareClient = new SentSharesClient(endPoint, credential);
236+
237+
Operation operation = await sentShareClient.DeleteSentShareAsync(WaitUntil.Completed, "sentShareId");
238+
```
239+
240+
### Data Consumer Examples
241+
242+
The following code examples demonstrate how data consumers can use the Microsoft Azure Java SDK for Purview Sharing to manage their sharing activity.
243+
244+
#### Create a Receive Share Client
245+
```C# Snippet:ReceivedSharesClientSample_CreateReceivedSharesClient
246+
var credential = new DefaultAzureCredential();
247+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
248+
var receivedSharesClient = new ReceivedSharesClient(endPoint, credential);
249+
```
250+
251+
#### List detached received shares
252+
253+
To begin viewing data shared with them, a data consumer must first retrieve a list of detached received shares. Within this list, they can identify a detached received share to attach.
171254

172255
```C# Snippet:ReceivedSharesClientSample_ListDetachedReceivedShares
173256
var credential = new DefaultAzureCredential();
174-
var endPoint = "https://my-account-name.purview.azure.com/share";
257+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
175258
var receivedSharesClient = new ReceivedSharesClient(endPoint, credential);
176259

177260
List<BinaryData> createResponse = await receivedSharesClient.GetAllDetachedReceivedSharesAsync().ToEnumerableAsync();
178261
```
179262

180-
### Create a received share
263+
#### Attach a received share
264+
265+
Once the data consumer has identified a received share, they can attach the received share to a location where they can access the shared data. If the received share is already attached, the shared data will be made accessible at the new location specified.
181266

182267
```C# Snippet:ReceivedSharesClientSample_CreateReceivedShare
183268
var credential = new DefaultAzureCredential();
184-
var endPoint = "https://my-account-name.purview.azure.com/share";
269+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
185270
var receivedSharesClient = new ReceivedSharesClient(endPoint, credential);
186271

187272
var data = new
@@ -212,56 +297,59 @@ var data = new
212297
Operation<BinaryData> createResponse = await receivedSharesClient.CreateOrReplaceReceivedShareAsync(WaitUntil.Completed, "receivedShareId", RequestContent.Create(data));
213298
```
214299

215-
### Get a received share
300+
#### Get a received share
301+
302+
A data consumer can retrieve an individual received share.
216303

217304
```C# Snippet:ReceivedSharesClientSample_GetReceivedShare
218305
var credential = new DefaultAzureCredential();
219-
var endPoint = "https://my-account-name.purview.azure.com/share";
306+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
220307
var receivedSharesClient = new ReceivedSharesClient(endPoint, credential);
221308

222309
Response operation = await receivedSharesClient.GetReceivedShareAsync("receivedShareId");
223310
```
224311

225-
### List attached received shares
312+
#### List attached received shares
313+
314+
Data consumers can also retrieve a list of their attached received shares.
226315

227316
```C# Snippet:ReceivedSharesClientSample_ListAttachedReceivedShares
228317
var credential = new DefaultAzureCredential();
229-
var endPoint = "https://my-account-name.purview.azure.com/share";
318+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
230319
var receivedSharesClient = new ReceivedSharesClient(endPoint, credential);
231320

232321
List<BinaryData> createResponse = await receivedSharesClient.GetAllAttachedReceivedSharesAsync("referenceName").ToEnumerableAsync();
233322
```
234323

235-
### Delete a received share
324+
#### Delete a received share
325+
326+
Data consumers can also retrieve a list of their attached received shares.
236327

237328
```C# Snippet:ReceivedSharesClientSample_DeleteReceivedShare
238329
var credential = new DefaultAzureCredential();
239-
var endPoint = "https://my-account-name.purview.azure.com/share";
330+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
240331
var receivedSharesClient = new ReceivedSharesClient(endPoint, credential);
241332

242333
Operation operation = await receivedSharesClient.DeleteReceivedShareAsync(WaitUntil.Completed, "receivedShareId");
243334
```
244335

245-
### Delete a sent share invitation
336+
### Share Resouce Examples
246337

247-
```C# Snippet:SentSharesClientSample_DeleteSentShareInvitation
248-
var credential = new DefaultAzureCredential();
249-
var endPoint = "https://my-account-name.purview.azure.com/share";
250-
var sentShareClient = new SentSharesClient(endPoint, credential);
338+
The following code examples demonstrate how to use the Microsoft Azure Java SDK for Purview Sharing to view share resources. A share resource is the underlying resource from which a provider shares data or the destination where a consumer attaches data shared with them.
251339

252-
Operation operation = await sentShareClient.DeleteSentShareInvitationAsync(WaitUntil.Completed, "sentShareId", "sentShareInvitationId");
253-
```
340+
#### List share resources
254341

255-
### Delete a sent share
342+
A list of share resources can be retrieved to view all resources within an account where sharing activities have taken place.
256343

257-
```C# Snippet:SentSharesClientSample_DeleteSentShare
344+
```C# Snippet:ShareResourcesClientExample_ListShareResources
258345
var credential = new DefaultAzureCredential();
259-
var endPoint = "https://my-account-name.purview.azure.com/share";
260-
var sentShareClient = new SentSharesClient(endPoint, credential);
346+
var endPoint = new Uri("https://my-account-name.purview.azure.com/share");
347+
var shareResourcesClient = new ShareResourcesClient(endPoint, credential);
261348

262-
Operation operation = await sentShareClient.DeleteSentShareAsync(WaitUntil.Completed, "sentShareId");
349+
List<BinaryData> createResponse = await shareResourcesClient.GetAllShareResourcesAsync().ToEnumerableAsync();
263350
```
264351

352+
265353
## Troubleshooting
266354

267355
### Setting up console logging

0 commit comments

Comments
 (0)