Support Enable/Disable operations in Feature Flag API
What does this MR do?
This MR introduces the following endpoints:
POST /api/:version/projects/:id/feature_flags/enable(.:format) - Enable a strategy for a feature flag on an environment
POST /api/:version/projects/:id/feature_flags/disable(.:format) - Disable a strategy for a feature flag on an environment
This enable/disable is a very convenient endpoint to enable specific strategy/environment-scope on a feature flag, because
- User doesn't need to know if the feature flag exits on server side. The server side automagically handles the request for create or update.
- They simply append/remove strategy from the
strategies
. This works as strategies are evaluated asOR
. This approach is much more extensible than updating existing strategy that each strategy has a different parameter formats. This is also considered as Flipper-like approach. - Thus, by using this endpoint, users do not need to execute endpoints for multiple times. e.g. Get FF list => Update Scope.
These endpoints are mainly used in FF dogfooding, but of course can be used in the other ordinary cases.
Feature flag
This feature is built behind the feature flag - feature_flag_api
Related:
- FF CRD APIs !18198 (merged)
- FF enable/disable APIs !18368 (merged)
- FF scope APIs !18200 (merged)
- Issue: #9566 (closed)
TODO:
-
ee/app/finders/feature_flags_finder.rb -
ee/app/services/feature_flags/enable_service.rb -
ee/app/services/feature_flags/disable_service.rb
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation created/updated or follow-up review issue created => #9566 (closed)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda