summaryrefslogtreecommitdiffstats
path: root/common-be/src/main
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-11-26 14:40:29 +0000
committerMichael Morris <michael.morris@est.tech>2021-11-29 14:36:12 +0000
commit6c32cbc7343bd56f62007451071c4b26c875382f (patch)
treefa3250eb24d518e5f15cb629bdb462b96be769c5 /common-be/src/main
parente9171113772c0c7dc3f7514ffd0660d1e0f8ef02 (diff)
Add VNFD to NSD when using S3 storage
Change-Id: I8eb810fadfe54b335647e71e21115514963b4be7 Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3792
Diffstat (limited to 'common-be/src/main')
-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();
}