Support Read and Delete operations in Feature Flag Scope API
What does this MR do?
This MR introduces the following endpoints:
GET /api/:version/projects/:id/feature_flag_scopes(.:format) - Get all effective feature flags under the environment
GET /api/:version/projects/:id/feature_flags/:name/scopes(.:format) - Get all scopes of a feature flag
GET /api/:version/projects/:id/feature_flags/:name/scopes/:environment_scope(.:format) - Get a scope of a feature flag
DELETE /api/:version/projects/:id/feature_flags/:name/scopes/:environment_scope(.:format) - Delete a scope from a feature flag
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
Sample payload
shinya@shinya-MS-7A34:~/workspace/thin-gdk/services/rails/src$ curl --header "Private-Token: mH2Nz_PT5zzjzj_ZN7hH" http://local.gitlab.test:8181/api/v4/projects/20/feature_flag_scopes?environment=prd
[
{
"id":3,
"active":true,
"environment_scope":"prd",
"strategies":[
{
"name":"gradualRolloutUserId",
"parameters":{
"groupId":"default",
"percentage":"90"
}
}
],
"created_at":"2019-10-29T06:48:28.786Z",
"updated_at":"2019-10-29T06:48:28.786Z",
"name":"test-2"
},
{
"id":1,
"active":true,
"environment_scope":"*",
"strategies":[
{
"name":"default",
"parameters":{
}
}
],
"created_at":"2019-10-29T06:48:07.109Z",
"updated_at":"2019-10-29T06:48:07.109Z",
"name":"test"
}
]
Related:
- FF CRD APIs !18198 (merged)
- FF enable/disable APIs !18368 (merged)
- FF scope APIs !18200 (merged)
- Issue: #9566 (closed)
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