aboutsummaryrefslogtreecommitdiffstats
path: root/common-be
diff options
context:
space:
mode:
Diffstat (limited to 'common-be')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/csar/storage/MinIoStorageArtifactStorageManager.java28
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/csar/storage/NoneStorageManager.java10
2 files changed, 33 insertions, 5 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/csar/storage/MinIoStorageArtifactStorageManager.java b/common-be/src/main/java/org/openecomp/sdc/be/csar/storage/MinIoStorageArtifactStorageManager.java
index 0a48c2233c..850b4e1dda 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/csar/storage/MinIoStorageArtifactStorageManager.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/csar/storage/MinIoStorageArtifactStorageManager.java
@@ -108,6 +108,18 @@ public class MinIoStorageArtifactStorageManager implements ArtifactStorageManage
LOGGER.info("Bucket '{}' already exists.", vspId);
}
+ put(vspId, name, fileToUpload);
+
+ } catch (final Exception e) {
+ throw new ArtifactStorageException("Failed to upload artifact", e);
+ }
+
+ return new MinIoArtifactInfo(vspId, name);
+ }
+
+ @Override
+ public void put(final String vspId, final String name, final InputStream fileToUpload) {
+ try {
minioClient.putObject(
PutObjectArgs.builder()
.bucket(vspId)
@@ -115,12 +127,9 @@ public class MinIoStorageArtifactStorageManager implements ArtifactStorageManage
.stream(fileToUpload, fileToUpload.available(), -1)
.build()
);
-
} catch (final Exception e) {
throw new ArtifactStorageException("Failed to upload artifact", e);
}
-
- return new MinIoArtifactInfo(vspId, name);
}
@Override
@@ -132,9 +141,18 @@ public class MinIoStorageArtifactStorageManager implements ArtifactStorageManage
public InputStream get(final ArtifactInfo artifactInfo) {
final MinIoArtifactInfo minioObject = (MinIoArtifactInfo) artifactInfo;
try {
+ return get(minioObject.getBucket(), minioObject.getObjectName());
+ } catch (final Exception e) {
+ throw new ArtifactStorageException("Failed to get Object", e);
+ }
+ }
+
+ @Override
+ public InputStream get(final String bucketID, final String objectID) {
+ try {
return minioClient.getObject(GetObjectArgs.builder()
- .bucket(minioObject.getBucket())
- .object(minioObject.getObjectName())
+ .bucket(bucketID)
+ .object(objectID)
.build());
} catch (final Exception e) {
throw new ArtifactStorageException("Failed to get Object", e);
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/csar/storage/NoneStorageManager.java b/common-be/src/main/java/org/openecomp/sdc/be/csar/storage/NoneStorageManager.java
index 3fa22d41be..aec69d5bd7 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/csar/storage/NoneStorageManager.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/csar/storage/NoneStorageManager.java
@@ -37,6 +37,11 @@ public class NoneStorageManager implements ArtifactStorageManager {
}
@Override
+ public void put(final String vspId, final String versionId, final InputStream fileToUpload) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public ArtifactStorageConfig getStorageConfiguration() {
throw new UnsupportedOperationException();
}
@@ -47,6 +52,11 @@ public class NoneStorageManager implements ArtifactStorageManager {
}
@Override
+ public InputStream get(final String vspId, final String versionId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public void delete(final ArtifactInfo artifactInfo) {
throw new UnsupportedOperationException();
}