Skip to content

Commit

Permalink
- Bumped interfaces reference from 4.0.1 to 4.0.2
Browse files Browse the repository at this point in the history
- Completed renaming to Application.StorageAccountNumber
  • Loading branch information
Henning Normann committed Oct 28, 2024
1 parent d39a0e8 commit 965ae04
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Storage/Altinn.Platform.Storage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<PackageReference Include="Altinn.Common.AccessTokenClient" Version="3.0.8" />
<PackageReference Include="Altinn.Platform.Models" Version="1.6.1" />
<PackageReference Include="Altinn.Platform.Storage.Interface" Version="4.0.1" />
<PackageReference Include="Altinn.Platform.Storage.Interface" Version="4.0.2" />
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.2" />
<PackageReference Include="Azure.Identity" Version="1.13.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.7.0" />
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Controllers/CleanupController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public async Task<ActionResult> CleanupDataelements()
app = await applicationRepository.FindOne(instance.AppId, instance.Org);
}

if (!await blobRepository.DeleteBlob(dataElement.BlobStoragePath.Split('/')[0], dataElement.BlobStoragePath, app.StorageContainerNumber))
if (!await blobRepository.DeleteBlob(dataElement.BlobStoragePath.Split('/')[0], dataElement.BlobStoragePath, app.StorageAccountNumber))
{
_logger.LogError(
"CleanupController // CleanupDataelements // Blob not found for dataElement Id: {dataElement.Id} Blobstoragepath: {blobStoragePath}",
Expand Down Expand Up @@ -192,7 +192,7 @@ private async Task<int> CleanupInstancesInternal(List<Instance> instances, List<
try
{
Application app = await applicationRepository.FindOne(instance.AppId, instance.Org);
blobsNoException = await blobRepository.DeleteDataBlobs(instance, app.StorageContainerNumber);
blobsNoException = await blobRepository.DeleteDataBlobs(instance, app.StorageAccountNumber);

if (blobsNoException)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Storage/Controllers/ContentOnDemandController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task<ActionResult> GetSignatureAsHtml([FromRoute] string org, [From
await _blobRepository.ReadBlob(
$"{(_generalSettings.A2UseTtdAsServiceOwner ? "ttd" : instance.Org)}",
$"{instance.Org}/{app}/{instanceGuid}/data/{signatureElement.Id}",
application.StorageContainerNumber));
application.StorageAccountNumber));

return View("Signature", view);
}
Expand All @@ -106,7 +106,7 @@ public async Task<ActionResult> GetPaymentAsHtml([FromRoute] string org, [FromRo
await _blobRepository.ReadBlob(
$"{(_generalSettings.A2UseTtdAsServiceOwner ? "ttd" : instance.Org)}",
$"{instance.Org}/{app}/{instanceGuid}/data/{paymentElement.Id}",
application.StorageContainerNumber));
application.StorageAccountNumber));

return View("Payment", view);
}
Expand Down Expand Up @@ -234,7 +234,7 @@ private async Task<Stream> GetFormdataAsHtmlInternal(string org, string app, Gui

return _a2OndemandFormattingService.GetFormdataHtml(
xsls,
await _blobRepository.ReadBlob($"{(_generalSettings.A2UseTtdAsServiceOwner ? "ttd" : instance.Org)}", $"{instance.Org}/{app}/{instanceGuid}/data/{xmlElement.Id}", application.StorageContainerNumber),
await _blobRepository.ReadBlob($"{(_generalSettings.A2UseTtdAsServiceOwner ? "ttd" : instance.Org)}", $"{instance.Org}/{app}/{instanceGuid}/data/{xmlElement.Id}", application.StorageAccountNumber),
xmlElement.Created.ToString());
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/Storage/Controllers/DataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public async Task<ActionResult<DataElement>> Delete(int instanceOwnerPartyId, Gu
}

dataElement.LastChangedBy = User.GetUserOrOrgId();
return await DeleteImmediately(instance, dataElement, application.StorageContainerNumber);
return await DeleteImmediately(instance, dataElement, application.StorageAccountNumber);
}

/// <summary>
Expand Down Expand Up @@ -199,7 +199,7 @@ public async Task<ActionResult> Get(int instanceOwnerPartyId, Guid instanceGuid,

if (string.Equals(dataElement.BlobStoragePath, storageFileName))
{
Stream dataStream = await _blobRepository.ReadBlob(instance.Org, storageFileName, app.StorageContainerNumber);
Stream dataStream = await _blobRepository.ReadBlob(instance.Org, storageFileName, app.StorageAccountNumber);

if (dataStream == null)
{
Expand Down Expand Up @@ -312,11 +312,11 @@ public async Task<ActionResult<DataElement>> CreateAndUploadData(
}

newData.Filename = HttpUtility.UrlDecode(newData.Filename);
(long length, DateTimeOffset blobTimestamp) = await _blobRepository.WriteBlob(instance.Org, theStream, newData.BlobStoragePath, appInfo.StorageContainerNumber);
(long length, DateTimeOffset blobTimestamp) = await _blobRepository.WriteBlob(instance.Org, theStream, newData.BlobStoragePath, appInfo.StorageAccountNumber);

if (length == 0L)
{
await _blobRepository.DeleteBlob(instance.Org, newData.BlobStoragePath, appInfo.StorageContainerNumber);
await _blobRepository.DeleteBlob(instance.Org, newData.BlobStoragePath, appInfo.StorageAccountNumber);
return BadRequest("Empty stream provided. Cannot persist data.");
}

Expand All @@ -330,7 +330,7 @@ public async Task<ActionResult<DataElement>> CreateAndUploadData(
DataElement dataElement = await _dataRepository.Create(newData, instanceInternalId);
dataElement.SetPlatformSelfLinks(_storageBaseAndHost, instanceOwnerPartyId);

await _dataService.StartFileScan(instance, dataTypeDefinition, dataElement, blobTimestamp, appInfo.StorageContainerNumber, CancellationToken.None);
await _dataService.StartFileScan(instance, dataTypeDefinition, dataElement, blobTimestamp, appInfo.StorageAccountNumber, CancellationToken.None);

await _instanceEventService.DispatchEvent(InstanceEventType.Created, instance, dataElement);

Expand Down Expand Up @@ -418,7 +418,7 @@ public async Task<ActionResult<DataElement>> OverwriteData(

DateTime changedTime = DateTime.UtcNow;

(long blobSize, DateTimeOffset blobTimestamp) = await _blobRepository.WriteBlob(instance.Org, theStream, blobStoragePathName, appInfo.StorageContainerNumber);
(long blobSize, DateTimeOffset blobTimestamp) = await _blobRepository.WriteBlob(instance.Org, theStream, blobStoragePathName, appInfo.StorageAccountNumber);

var updatedProperties = new Dictionary<string, object>()
{
Expand Down Expand Up @@ -446,7 +446,7 @@ public async Task<ActionResult<DataElement>> OverwriteData(

updatedElement.SetPlatformSelfLinks(_storageBaseAndHost, instanceOwnerPartyId);

await _dataService.StartFileScan(instance, dataTypeDefinition, dataElement, blobTimestamp, appInfo.StorageContainerNumber, CancellationToken.None);
await _dataService.StartFileScan(instance, dataTypeDefinition, dataElement, blobTimestamp, appInfo.StorageAccountNumber, CancellationToken.None);

await _instanceEventService.DispatchEvent(InstanceEventType.Saved, instance, updatedElement);

Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Controllers/MigrationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public async Task<ActionResult<DataElement>> CreateDataElement(
$"{(_generalSettings.A2UseTtdAsServiceOwner ? "ttd" : instance.Org)}",
theStream,
dataElement.BlobStoragePath,
app.StorageContainerNumber);
app.StorageAccountNumber);
}
else
{
Expand Down Expand Up @@ -489,7 +489,7 @@ private async Task<bool> CleanupOldMigrationInternal(string instanceId)
}

instance.Id = instanceId;
await _blobRepository.DeleteDataBlobs(instance, app.StorageContainerNumber);
await _blobRepository.DeleteDataBlobs(instance, app.StorageAccountNumber);
await _dataRepository.DeleteForInstance(instanceId);
await _instanceEventRepository.DeleteAllInstanceEvents(instanceId);
await _instanceRepository.Delete(instance);
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Models/FileScanRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class FileScanRequest
public string Org { get; set; }

/// <summary>
/// Gets or sets an optional container number for when the application owner have more than one storage container
/// Gets or sets an optional account number for when the application owner have more than one storage account
/// </summary>
public int? StorageContainerNumber { get; set; }
public int? StorageAccountNumber { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Storage/Services/DataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task StartFileScan(Instance instance, DataType dataType, DataElemen
BlobStoragePath = dataElement.BlobStoragePath,
Filename = dataElement.Filename,
Org = instance.Org,
StorageContainerNumber = storageAccountNumber
StorageAccountNumber = storageAccountNumber
};

string serialisedRequest = JsonSerializer.Serialize(
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Services/InstanceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public InstanceService(IInstanceRepository instanceRepository, IDataService data

foreach (SignRequest.DataElementSignature dataElementSignature in signRequest.DataElementSignatures)
{
(string base64Sha256Hash, serviceError) = await _dataService.GenerateSha256Hash(instance.Org, instanceGuid, Guid.Parse(dataElementSignature.DataElementId), app.StorageContainerNumber);
(string base64Sha256Hash, serviceError) = await _dataService.GenerateSha256Hash(instance.Org, instanceGuid, Guid.Parse(dataElementSignature.DataElementId), app.StorageAccountNumber);
if (string.IsNullOrEmpty(base64Sha256Hash))
{
return (false, serviceError);
Expand Down Expand Up @@ -83,7 +83,7 @@ public InstanceService(IInstanceRepository instanceRepository, IDataService data

using (MemoryStream fileStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(signDocument, Formatting.Indented))))
{
await _dataService.UploadDataAndCreateDataElement(instance.Org, fileStream, dataElement, instanceInternalId, app.StorageContainerNumber);
await _dataService.UploadDataAndCreateDataElement(instance.Org, fileStream, dataElement, instanceInternalId, app.StorageAccountNumber);
}

await _instanceEventService.DispatchEvent(InstanceEventType.Signed, instance);
Expand Down

0 comments on commit 965ae04

Please sign in to comment.