Skip to content

Commit

Permalink
Add DeleteIfExistsAsync and CreateAsync container APIs (#6812)
Browse files Browse the repository at this point in the history
Progress on #6766
  • Loading branch information
joelverhagen committed Jan 11, 2019
1 parent 04b8a6a commit f5699cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/NuGetGallery.Core/Services/CloudBlobContainerWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage.Blob;

Expand Down Expand Up @@ -37,5 +38,15 @@ public Task<bool> ExistsAsync()
{
return _blobContainer.ExistsAsync();
}

public async Task<bool> DeleteIfExistsAsync()
{
return await _blobContainer.DeleteIfExistsAsync();
}

public async Task CreateAsync()
{
await _blobContainer.CreateAsync();
}
}
}
3 changes: 3 additions & 0 deletions src/NuGetGallery.Core/Services/ICloudBlobContainer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage.Blob;

Expand All @@ -11,5 +12,7 @@ public interface ICloudBlobContainer
Task SetPermissionsAsync(BlobContainerPermissions permissions);
ISimpleCloudBlob GetBlobReference(string blobAddressUri);
Task<bool> ExistsAsync();
Task<bool> DeleteIfExistsAsync();
Task CreateAsync();
}
}

0 comments on commit f5699cb

Please sign in to comment.