code: 409,
message: "Artifact type '%1' already exist.",
messageId: "SVC4163"
+ }
+
+ #---------SVC4164-----------------------------
+ # %1 - componentType
+ # %2 - component name
+ CANNOT_DELETE_SYSTEM_DEPLOYED_RESOURCES: {
+ code: 409,
+ message: "System deployed '%1' cannot be deleted '%2'",
+ messageId: "SVC4164"
}
\ No newline at end of file
return componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(resourceStatus.right().value()), "");
}
Resource resource = resourceStatus.left().value();
+ if (isComponentSystemDeployed(resource)) {
+ throw new ByActionStatusComponentException(ActionStatus.CANNOT_DELETE_SYSTEM_DEPLOYED_RESOURCES, ComponentTypeEnum.RESOURCE.getValue(),
+ resource.getName());
+ }
StorageOperationStatus result = StorageOperationStatus.OK;
lockComponent(resourceId, resource, "Mark resource to delete");
try {
}
}
+ private boolean isComponentSystemDeployed(Resource resource) {
+ return resource.getComponentMetadataDefinition().getMetadataDataDefinition().isNormative();
+ }
+
public ResponseFormat deleteResourceByNameAndVersion(String resourceName, String version, User user) {
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.NO_CONTENT);
validateUserExists(user);
//ArtifactType
ARTIFACT_TYPE_ALREADY_EXIST, FAILED_CREATE_ARTIFACTS_TYPES,
//TOSCA node types
- INVALID_NODE_TYPES_YAML
+ INVALID_NODE_TYPES_YAML,
+ //system deployed resources
+ CANNOT_DELETE_SYSTEM_DEPLOYED_RESOURCES
}