Skip to content

Commit

Permalink
Added info logging when saving
Browse files Browse the repository at this point in the history
  • Loading branch information
basiliskus committed Dec 5, 2023
1 parent 8a1155b commit 837c36d
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import gov.hhs.cdc.trustedintermediary.context.ApplicationContext;
import gov.hhs.cdc.trustedintermediary.etor.metadata.PartnerMetadata;
import gov.hhs.cdc.trustedintermediary.etor.metadata.PartnerMetadataStorage;
import gov.hhs.cdc.trustedintermediary.wrappers.Logger;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import javax.inject.Inject;

/** Implements the {@link PartnerMetadataStorage} using files stored in an Azure Storage Account. */
public class AzureStorageAccountPartnerMetadataStorage implements PartnerMetadataStorage {
Expand All @@ -27,6 +29,8 @@ public class AzureStorageAccountPartnerMetadataStorage implements PartnerMetadat
private static final AzureStorageAccountPartnerMetadataStorage INSTANCE =
new AzureStorageAccountPartnerMetadataStorage();

@Inject Logger logger;

private AzureStorageAccountPartnerMetadataStorage() {}

public static AzureStorageAccountPartnerMetadataStorage getInstance() {
Expand All @@ -45,5 +49,14 @@ public void saveMetadata(final PartnerMetadata metadata) {
ByteArrayInputStream inputStream =
new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8));
blobClient.upload(inputStream, content.length(), true);
logger.logInfo(
"Saved metadata for "
+ metadata.uniqueId()
+ " to "
+ METADATA_CONTAINER_NAME
+ " container in "
+ STORAGE_ACCOUNT_BLOB_ENDPOINT
+ " Azure storage account"
+ blobClient.getBlobUrl());
}
}

0 comments on commit 837c36d

Please sign in to comment.