Skip to content

Commit

Permalink
remove default value for memorystream when writing policies
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasisnes committed Aug 12, 2024
1 parent d1ba126 commit f0abf4b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IPolicyRepository
/// <param name="fileStream">File stream of the policy file to be written</param>
/// <param name="cancellationToken">cancellation token</param>
/// <returns>Azure response BlobContentInfo</returns>
Task<Response<BlobContentInfo>> WritePolicyAsync(Stream fileStream = null, CancellationToken cancellationToken = default);
Task<Response<BlobContentInfo>> WritePolicyAsync(Stream fileStream, CancellationToken cancellationToken = default);

/// <summary>
/// Writes a file stream to blobstorage to the specified path, including the conditional check that the provided blob lease id is valid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public interface ISingleRightsService
/// <param name="authenticatedUserId">The user id of the authenticated user performing the delegation</param>
/// <param name="authenticatedUserAuthlevel">The authentication level of the authenticated user performing the delegation</param>
/// <param name="delegation">The delegation</param>
/// <param name="cancellationToken">CancellationToken</param>
/// <returns>The result of the delegation</returns>
public Task<DelegationActionResult> DelegateRights(int authenticatedUserId, int authenticatedUserAuthlevel, DelegationLookup delegation, CancellationToken cancellationToken = default);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private async Task<bool> WriteDelegationPolicyInternal(string policyPath, List<R
if (!await policyClient.PolicyExistsAsync(cancellationToken))
{
// Create a new empty blob for lease locking
await policyClient.WritePolicyAsync(cancellationToken: cancellationToken);
await policyClient.WritePolicyAsync(new MemoryStream(), cancellationToken: cancellationToken);
}

string leaseId = await policyClient.TryAcquireBlobLease(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public async Task<string> TryAcquireBlobLease(CancellationToken cancellationToke
}

/// <inheritdoc/>
public async Task<Response<BlobContentInfo>> WritePolicyAsync(Stream fileStream = null, CancellationToken cancellationToken = default)
public async Task<Response<BlobContentInfo>> WritePolicyAsync(Stream fileStream, CancellationToken cancellationToken = default)
{
return await RoundTripper(async () => await Client.UploadAsync(fileStream ?? new MemoryStream(), true, cancellationToken));
}
Expand Down

0 comments on commit f0abf4b

Please sign in to comment.