aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java12
2 files changed, 18 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
index 74009f6965..64c558f291 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
@@ -45,6 +45,12 @@ public interface TogglzFeatures {
@PUT
+ @Path("/state/{state}")
+ @ApiOperation(value = "Update feature toggle state for all features")
+ Response setAllFeatures(@PathParam("state") boolean state);
+
+
+ @PUT
@Path("/{featureName}/state/{state}")
@ApiOperation(value = "Update feature toggle state")
Response setFeatureState(@PathParam("featureName") String featureName, @PathParam("state") boolean state);
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
index 657c42833f..d62dd4add1 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
@@ -45,6 +45,18 @@ public class TogglzFeaturesImpl implements TogglzFeatures {
}
@Override
+ public Response setAllFeatures(boolean active) {
+ FeatureSetDto featureSetDto = new FeatureSetDto();
+ new MapToggleableFeatureToDto().doMapping(Arrays.asList(ToggleableFeature.values()), featureSetDto);
+ featureSetDto.getFeatures().forEach(featureDto -> {
+ Feature feature = new NamedFeature(featureDto.getName());
+ FeatureState featureState = new FeatureState(feature,active);
+ FeatureContext.getFeatureManager().setFeatureState(featureState);
+ });
+ return Response.ok().build();
+ }
+
+ @Override
public Response setFeatureState(String featureName, boolean active) {
Feature feature = new NamedFeature(featureName);
FeatureState featureState = new FeatureState(feature,active);