Skip to content

Support Read and Delete operations in Feature Flag Scope API

Shinya Maeda requested to merge introduce-feature-flag-scope-api into master

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:

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

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

Merge request reports