summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-common-lib/src/main/java
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2022-03-10 11:55:04 +0000
committerfranciscovila <javier.paradela.vila@est.tech>2022-03-29 12:47:29 +0100
commitf772969ac32331ce847e8193059cd39dd362c7a6 (patch)
tree9e4986f2abb174b085f7a83f84bbdf3288e3869b /openecomp-be/lib/openecomp-common-lib/src/main/java
parent28e7f0f13e3d7b75750a449c9bda6c0d4a1986ce (diff)
Restrict deletion of archived VSPs if used in VF
Verify if a VSP is used in a VF in SDC-BE before proceeding with the deletion of a VSP Issue-ID: SDC-3894 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: I7c8bdd55516a51cf8693cfdb8c109a7c20e7ea84
Diffstat (limited to 'openecomp-be/lib/openecomp-common-lib/src/main/java')
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java10
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/CatalogRestClientException.java36
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java6
3 files changed, 51 insertions, 1 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java
index 92ace445da..fb15b54a2e 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java
@@ -125,6 +125,16 @@ public class CommonConfigurationManager {
}
/**
+ * This method can be used to access any yaml whole section configuration.
+ *
+ * @param yamlSection The yaml section that must be accessed
+ * @return map of entries configured for the specified section
+ */
+ public Map<String, Object> getConfigValue(String yamlSection) {
+ return this.configuration.get(yamlSection);
+ }
+
+ /**
* This method can be used to access a specific configuration parameter in the configuration in the yamlSection predefined in the constructor.
*
* @param name The name of the config
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/CatalogRestClientException.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/CatalogRestClientException.java
new file mode 100644
index 0000000000..c929d272c3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/CatalogRestClientException.java
@@ -0,0 +1,36 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ *
+ *
+ */
+
+package org.openecomp.sdc.common.errors;
+
+public class CatalogRestClientException extends RuntimeException {
+
+ public CatalogRestClientException() {
+ }
+
+ public CatalogRestClientException(final String message) {
+ super(message);
+ }
+
+ public CatalogRestClientException(final String message, final Throwable e) {
+ super(message, e);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
index 32cc143b24..65906bd3d2 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
@@ -96,9 +96,13 @@ public enum Messages {
SUB_ENTITY_NOT_FOUND("Incorrect sub entity details provided."),
FAILED_TO_SYNC("Non existing version cannot be synced."),
FAILED_TO_PUBLISH_OUT_OF_SYNC("Publish is not allowed since the version status is Out of sync"),
- DELETE_VSP_ERROR("VSP has been certified and cannot be deleted."),
+ DELETE_VSP_ERROR("Certified VSP must be archived before it can be deleted."),
+ DELETE_VSP_ERROR_USED_BY_VF("VSP cannot be deleted as it is used by VF %s. The VSP will only be available for deletion if VF %s is deleted."),
+ DELETE_VSP_UNEXPECTED_ERROR_USED_BY_VF("An error occurred while retrieving the usage of VSP %s through the rest endpoint %s"),
DELETE_VSP_FROM_STORAGE_ERROR("Failed to delete VSP '%s' from Storage"),
DELETE_VLM_ERROR("VLM has been certified and cannot be deleted."),
+ DELETE_VSP_ARCHIVED_ERROR("VSP has not been archived and cannot be deleted."),
+ CONFIG_ERROR("Configuration could not be loaded."),
ZIP_SHOULD_NOT_CONTAIN_FOLDERS("Zip file should not contain folders"),
VES_ZIP_SHOULD_CONTAIN_YML_ONLY("Wrong VES EVENT Artifact was uploaded - all files contained in Artifact must be YAML files"
+ " (using .yaml/.yml extensions)"),