Skip to content

Commit f5699cb

Browse files
committed
Add DeleteIfExistsAsync and CreateAsync container APIs (#6812)
Progress on #6766
1 parent 04b8a6a commit f5699cb

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/NuGetGallery.Core/Services/CloudBlobContainerWrapper.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
34
using System.Threading.Tasks;
45
using Microsoft.WindowsAzure.Storage.Blob;
56

@@ -37,5 +38,15 @@ public Task<bool> ExistsAsync()
3738
{
3839
return _blobContainer.ExistsAsync();
3940
}
41+
42+
public async Task<bool> DeleteIfExistsAsync()
43+
{
44+
return await _blobContainer.DeleteIfExistsAsync();
45+
}
46+
47+
public async Task CreateAsync()
48+
{
49+
await _blobContainer.CreateAsync();
50+
}
4051
}
4152
}

src/NuGetGallery.Core/Services/ICloudBlobContainer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
34
using System.Threading.Tasks;
45
using Microsoft.WindowsAzure.Storage.Blob;
56

@@ -11,5 +12,7 @@ public interface ICloudBlobContainer
1112
Task SetPermissionsAsync(BlobContainerPermissions permissions);
1213
ISimpleCloudBlob GetBlobReference(string blobAddressUri);
1314
Task<bool> ExistsAsync();
15+
Task<bool> DeleteIfExistsAsync();
16+
Task CreateAsync();
1417
}
1518
}

0 commit comments

Comments
 (0)