Skip to content

Commit 7c54b1b

Browse files
authored
Restored preview default Share Delete behavior (#15989)
1 parent 2c4d0e1 commit 7c54b1b

22 files changed

+483
-480
lines changed

sdk/storage/Azure.Storage.Files.Shares/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fixed bug where ShareDirectoryClient.Exists() and ShareFileClient.Exists() would thrown an exception when the directory or file's parent directory didn't exist.
55
- Added seekability to ShareFileClient.OpenRead().
66
- Renamed ShareClient.SetTier() -> ShareClient.SetProperties(). SetProperties() can be used to set both Share Tier and Share Quota.
7+
- Changed ShareDeleteOptions.IncludeSnapshots -> .ShareSnapshotsDeleteOption, and added option to also delete Share Snapshots that have been leased.
78

89
## 12.5.0-preview.1 (2020-09-30)
910
- Added support for service version 2020-02-10.

sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ public ShareClient(System.Uri shareUri, Azure.Storage.StorageSharedKeyCredential
2727
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.Shares.Models.PermissionInfo>> CreatePermissionAsync(string permission, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
2828
public virtual Azure.Response<Azure.Storage.Files.Shares.Models.ShareSnapshotInfo> CreateSnapshot(System.Collections.Generic.IDictionary<string, string> metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
2929
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.Shares.Models.ShareSnapshotInfo>> CreateSnapshotAsync(System.Collections.Generic.IDictionary<string, string> metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
30-
public virtual Azure.Response Delete(Azure.Storage.Files.Shares.Models.ShareDeleteOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
30+
public virtual Azure.Response Delete(Azure.Storage.Files.Shares.Models.ShareDeleteOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
3131
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
32-
public virtual Azure.Response Delete(bool includeSnapshots, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
33-
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteAsync(Azure.Storage.Files.Shares.Models.ShareDeleteOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
32+
public virtual Azure.Response Delete(bool includeSnapshots = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
33+
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteAsync(Azure.Storage.Files.Shares.Models.ShareDeleteOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
3434
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
35-
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteAsync(bool includeSnapshots, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
35+
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteAsync(bool includeSnapshots = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
3636
public virtual Azure.Response DeleteDirectory(string directoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
3737
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteDirectoryAsync(string directoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
38-
public virtual Azure.Response<bool> DeleteIfExists(Azure.Storage.Files.Shares.Models.ShareDeleteOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
38+
public virtual Azure.Response<bool> DeleteIfExists(Azure.Storage.Files.Shares.Models.ShareDeleteOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
3939
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
40-
public virtual Azure.Response<bool> DeleteIfExists(bool includeSnapshots, System.Threading.CancellationToken cancellationToken) { throw null; }
41-
public virtual System.Threading.Tasks.Task<Azure.Response<bool>> DeleteIfExistsAsync(Azure.Storage.Files.Shares.Models.ShareDeleteOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
40+
public virtual Azure.Response<bool> DeleteIfExists(bool includeSnapshots = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
41+
public virtual System.Threading.Tasks.Task<Azure.Response<bool>> DeleteIfExistsAsync(Azure.Storage.Files.Shares.Models.ShareDeleteOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
4242
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
43-
public virtual System.Threading.Tasks.Task<Azure.Response<bool>> DeleteIfExistsAsync(bool includeSnapshots, System.Threading.CancellationToken cancellationToken) { throw null; }
43+
public virtual System.Threading.Tasks.Task<Azure.Response<bool>> DeleteIfExistsAsync(bool includeSnapshots = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
4444
public virtual Azure.Response<bool> Exists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
4545
public virtual System.Threading.Tasks.Task<Azure.Response<bool>> ExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
4646
public virtual Azure.Response<System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.ShareSignedIdentifier>> GetAccessPolicy(Azure.Storage.Files.Shares.Models.ShareFileRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }

sdk/storage/Azure.Storage.Files.Shares/src/Models/ShareDeleteOptions.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,5 @@ public class ShareDeleteOptions
2323
/// on deleting the share.
2424
/// </summary>
2525
public ShareFileRequestConditions Conditions { get; set; }
26-
27-
/// <summary>
28-
/// Constructor.
29-
/// </summary>
30-
public ShareDeleteOptions()
31-
{
32-
ShareSnapshotsDeleteOption = Models.ShareSnapshotsDeleteOption.Include;
33-
}
3426
}
3527
}

sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ private async Task<Response<bool>> ExistsInternal(
905905
/// a failure occurs.
906906
/// </remarks>
907907
public virtual Response<bool> DeleteIfExists(
908-
ShareDeleteOptions options = default,
908+
ShareDeleteOptions options,
909909
CancellationToken cancellationToken = default) =>
910910
DeleteIfExistsInternal(
911911
includeSnapshots: default,
@@ -936,7 +936,7 @@ public virtual Response<bool> DeleteIfExists(
936936
/// a failure occurs.
937937
/// </remarks>
938938
public virtual async Task<Response<bool>> DeleteIfExistsAsync(
939-
ShareDeleteOptions options = default,
939+
ShareDeleteOptions options,
940940
CancellationToken cancellationToken = default) =>
941941
await DeleteIfExistsInternal(
942942
includeSnapshots: default,
@@ -971,8 +971,8 @@ await DeleteIfExistsInternal(
971971
#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
972972
public virtual Response<bool> DeleteIfExists(
973973
#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
974-
bool includeSnapshots,
975-
CancellationToken cancellationToken) =>
974+
bool includeSnapshots = true,
975+
CancellationToken cancellationToken = default) =>
976976
DeleteIfExistsInternal(
977977
includeSnapshots,
978978
shareSnapshotsDeleteOption: default,
@@ -1006,8 +1006,8 @@ public virtual Response<bool> DeleteIfExists(
10061006
#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
10071007
public virtual async Task<Response<bool>> DeleteIfExistsAsync(
10081008
#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
1009-
bool includeSnapshots,
1010-
CancellationToken cancellationToken) =>
1009+
bool includeSnapshots = true,
1010+
CancellationToken cancellationToken = default) =>
10111011
await DeleteIfExistsInternal(
10121012
includeSnapshots,
10131013
shareSnapshotsDeleteOption: default,
@@ -1238,7 +1238,7 @@ private async Task<Response<ShareSnapshotInfo>> CreateSnapshotInternal(
12381238
/// a failure occurs.
12391239
/// </remarks>
12401240
public virtual Response Delete(
1241-
ShareDeleteOptions options = default,
1241+
ShareDeleteOptions options,
12421242
CancellationToken cancellationToken = default) =>
12431243
DeleteInternal(
12441244
includeSnapshots: default,
@@ -1271,7 +1271,7 @@ public virtual Response Delete(
12711271
/// a failure occurs.
12721272
/// </remarks>
12731273
public virtual async Task<Response> DeleteAsync(
1274-
ShareDeleteOptions options = default,
1274+
ShareDeleteOptions options,
12751275
CancellationToken cancellationToken = default) =>
12761276
await DeleteInternal(
12771277
includeSnapshots: default,
@@ -1306,7 +1306,7 @@ await DeleteInternal(
13061306
/// </remarks>
13071307
[EditorBrowsable(EditorBrowsableState.Never)]
13081308
public virtual Response Delete(
1309-
bool includeSnapshots,
1309+
bool includeSnapshots = true,
13101310
CancellationToken cancellationToken = default) =>
13111311
DeleteInternal(
13121312
includeSnapshots,
@@ -1341,7 +1341,7 @@ public virtual Response Delete(
13411341
/// </remarks>
13421342
[EditorBrowsable(EditorBrowsableState.Never)]
13431343
public virtual async Task<Response> DeleteAsync(
1344-
bool includeSnapshots,
1344+
bool includeSnapshots = true,
13451345
CancellationToken cancellationToken = default) =>
13461346
await DeleteInternal(
13471347
includeSnapshots,

sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CreateIfNotExistsAsync_Exists.json

Lines changed: 24 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)