Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
dd64a3b7
Commit
dd64a3b7
authored
Sep 24, 2020
by
Jason Goodman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move feature flag api entities to core
Part of moving feature flags to core
parent
d4628f0c
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
123 additions
and
135 deletions
+123
-135
ee/lib/api/feature_flag_scopes.rb
ee/lib/api/feature_flag_scopes.rb
+11
-11
ee/lib/api/feature_flags.rb
ee/lib/api/feature_flags.rb
+8
-8
ee/lib/api/feature_flags_user_lists.rb
ee/lib/api/feature_flags_user_lists.rb
+8
-8
ee/lib/ee/api/entities/feature_flag.rb
ee/lib/ee/api/entities/feature_flag.rb
+0
-18
ee/lib/ee/api/entities/feature_flag/detailed_legacy_scope.rb
ee/lib/ee/api/entities/feature_flag/detailed_legacy_scope.rb
+0
-13
ee/lib/ee/api/entities/feature_flag/legacy_scope.rb
ee/lib/ee/api/entities/feature_flag/legacy_scope.rb
+0
-18
ee/lib/ee/api/entities/feature_flag/scope.rb
ee/lib/ee/api/entities/feature_flag/scope.rb
+0
-14
ee/lib/ee/api/entities/feature_flag/strategy.rb
ee/lib/ee/api/entities/feature_flag/strategy.rb
+0
-16
ee/lib/ee/api/entities/feature_flag/user_list.rb
ee/lib/ee/api/entities/feature_flag/user_list.rb
+0
-29
lib/api/entities/feature_flag.rb
lib/api/entities/feature_flag.rb
+16
-0
lib/api/entities/feature_flag/detailed_legacy_scope.rb
lib/api/entities/feature_flag/detailed_legacy_scope.rb
+11
-0
lib/api/entities/feature_flag/legacy_scope.rb
lib/api/entities/feature_flag/legacy_scope.rb
+16
-0
lib/api/entities/feature_flag/scope.rb
lib/api/entities/feature_flag/scope.rb
+12
-0
lib/api/entities/feature_flag/strategy.rb
lib/api/entities/feature_flag/strategy.rb
+14
-0
lib/api/entities/feature_flag/user_list.rb
lib/api/entities/feature_flag/user_list.rb
+27
-0
No files found.
ee/lib/api/feature_flag_scopes.rb
View file @
dd64a3b7
...
...
@@ -18,13 +18,13 @@ module API
resource
:feature_flag_scopes
do
desc
'Get all effective feature flags under the environment'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
::
DetailedLegacyScope
success
::
API
::
Entities
::
FeatureFlag
::
DetailedLegacyScope
end
params
do
requires
:environment
,
type:
String
,
desc:
'The environment name'
end
get
do
present
scopes_for_environment
,
with:
EE
::
API
::
Entities
::
FeatureFlag
::
DetailedLegacyScope
present
scopes_for_environment
,
with:
::
API
::
Entities
::
FeatureFlag
::
DetailedLegacyScope
end
end
...
...
@@ -35,18 +35,18 @@ module API
resource
:scopes
do
desc
'Get all scopes of a feature flag'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
success
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
end
params
do
use
:pagination
end
get
do
present
paginate
(
feature_flag
.
scopes
),
with:
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
present
paginate
(
feature_flag
.
scopes
),
with:
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
end
desc
'Create a scope of a feature flag'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
success
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
end
params
do
requires
:environment_scope
,
type:
String
,
desc:
'The environment scope of the scope'
...
...
@@ -61,7 +61,7 @@ module API
.
execute
(
feature_flag
)
if
result
[
:status
]
==
:success
present
scope
,
with:
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
present
scope
,
with:
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
else
render_api_error!
(
result
[
:message
],
result
[
:http_status
])
end
...
...
@@ -73,15 +73,15 @@ module API
resource
':environment_scope'
,
requirements:
ENVIRONMENT_SCOPE_ENDPOINT_REQUIREMENTS
do
desc
'Get a scope of a feature flag'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
success
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
end
get
do
present
scope
,
with:
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
present
scope
,
with:
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
end
desc
'Update a scope of a feature flag'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
success
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
end
params
do
optional
:active
,
type:
Boolean
,
desc:
'Whether the scope is active'
...
...
@@ -100,7 +100,7 @@ module API
updated_scope
=
result
[
:feature_flag
].
scopes
.
find
{
|
scope
|
scope
.
environment_scope
==
params
[
:environment_scope
]
}
present
updated_scope
,
with:
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
present
updated_scope
,
with:
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
else
render_api_error!
(
result
[
:message
],
result
[
:http_status
])
end
...
...
@@ -108,7 +108,7 @@ module API
desc
'Delete a scope from a feature flag'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
success
::
API
::
Entities
::
FeatureFlag
::
LegacyScope
end
delete
do
authorize_update_feature_flag!
...
...
ee/lib/api/feature_flags.rb
View file @
dd64a3b7
...
...
@@ -18,7 +18,7 @@ module API
resource
:feature_flags
do
desc
'Get all feature flags of a project'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
success
::
API
::
Entities
::
FeatureFlag
end
params
do
optional
:scope
,
type:
String
,
desc:
'The scope of feature flags'
,
...
...
@@ -35,7 +35,7 @@ module API
desc
'Create a new feature flag'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
success
::
API
::
Entities
::
FeatureFlag
end
params
do
requires
:name
,
type:
String
,
desc:
'The name of feature flag'
...
...
@@ -86,7 +86,7 @@ module API
resource
'feature_flags/:feature_flag_name'
,
requirements:
FEATURE_FLAG_ENDPOINT_REQUIREMENTS
do
desc
'Get a feature flag of a project'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
success
::
API
::
Entities
::
FeatureFlag
end
get
do
authorize_read_feature_flag!
...
...
@@ -96,7 +96,7 @@ module API
desc
'Enable a strategy for a feature flag on an environment'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
success
::
API
::
Entities
::
FeatureFlag
end
params
do
requires
:environment_scope
,
type:
String
,
desc:
'The environment scope of the feature flag'
...
...
@@ -119,7 +119,7 @@ module API
desc
'Disable a strategy for a feature flag on an environment'
do
detail
'This feature is going to be introduced in GitLab 12.5 if `feature_flag_api` feature flag is removed'
success
EE
::
API
::
Entities
::
FeatureFlag
success
::
API
::
Entities
::
FeatureFlag
end
params
do
requires
:environment_scope
,
type:
String
,
desc:
'The environment scope of the feature flag'
...
...
@@ -142,7 +142,7 @@ module API
desc
'Update a feature flag'
do
detail
'This feature will be introduced in GitLab 13.1 if feature_flags_new_version feature flag is removed'
success
EE
::
API
::
Entities
::
FeatureFlag
success
::
API
::
Entities
::
FeatureFlag
end
params
do
optional
:name
,
type:
String
,
desc:
'The name of the feature flag'
...
...
@@ -185,7 +185,7 @@ module API
desc
'Delete a feature flag'
do
detail
'This feature was introduced in GitLab 12.5'
success
EE
::
API
::
Entities
::
FeatureFlag
success
::
API
::
Entities
::
FeatureFlag
end
delete
do
authorize_destroy_feature_flag!
...
...
@@ -226,7 +226,7 @@ module API
def
present_entity
(
result
)
present
result
,
with:
EE
::
API
::
Entities
::
FeatureFlag
,
with:
::
API
::
Entities
::
FeatureFlag
,
feature_flags_new_version_enabled:
feature_flags_new_version_enabled?
end
...
...
ee/lib/api/feature_flags_user_lists.rb
View file @
dd64a3b7
...
...
@@ -19,19 +19,19 @@ module API
resource
:feature_flags_user_lists
do
desc
'Get all feature flags user lists of a project'
do
detail
'This feature was introduced in GitLab 12.10'
success
EE
::
API
::
Entities
::
FeatureFlag
::
UserList
success
::
API
::
Entities
::
FeatureFlag
::
UserList
end
params
do
use
:pagination
end
get
do
present
paginate
(
user_project
.
operations_feature_flags_user_lists
),
with:
EE
::
API
::
Entities
::
FeatureFlag
::
UserList
with:
::
API
::
Entities
::
FeatureFlag
::
UserList
end
desc
'Create a feature flags user list for a project'
do
detail
'This feature was introduced in GitLab 12.10'
success
EE
::
API
::
Entities
::
FeatureFlag
::
UserList
success
::
API
::
Entities
::
FeatureFlag
::
UserList
end
params
do
requires
:name
,
type:
String
,
desc:
'The name of the list'
...
...
@@ -41,7 +41,7 @@ module API
list
=
user_project
.
operations_feature_flags_user_lists
.
create
(
declared_params
)
if
list
.
save
present
list
,
with:
EE
::
API
::
Entities
::
FeatureFlag
::
UserList
present
list
,
with:
::
API
::
Entities
::
FeatureFlag
::
UserList
else
render_api_error!
(
list
.
errors
.
full_messages
,
:bad_request
)
end
...
...
@@ -54,16 +54,16 @@ module API
resource
'feature_flags_user_lists/:iid'
do
desc
'Get a single feature flag user list belonging to a project'
do
detail
'This feature was introduced in GitLab 12.10'
success
EE
::
API
::
Entities
::
FeatureFlag
::
UserList
success
::
API
::
Entities
::
FeatureFlag
::
UserList
end
get
do
present
user_project
.
operations_feature_flags_user_lists
.
find_by_iid!
(
params
[
:iid
]),
with:
EE
::
API
::
Entities
::
FeatureFlag
::
UserList
with:
::
API
::
Entities
::
FeatureFlag
::
UserList
end
desc
'Update a feature flag user list'
do
detail
'This feature was introduced in GitLab 12.10'
success
EE
::
API
::
Entities
::
FeatureFlag
::
UserList
success
::
API
::
Entities
::
FeatureFlag
::
UserList
end
params
do
optional
:name
,
type:
String
,
desc:
'The name of the list'
...
...
@@ -73,7 +73,7 @@ module API
list
=
user_project
.
operations_feature_flags_user_lists
.
find_by_iid!
(
params
[
:iid
])
if
list
.
update
(
declared_params
(
include_missing:
false
))
present
list
,
with:
EE
::
API
::
Entities
::
FeatureFlag
::
UserList
present
list
,
with:
::
API
::
Entities
::
FeatureFlag
::
UserList
else
render_api_error!
(
list
.
errors
.
full_messages
,
:bad_request
)
end
...
...
ee/lib/ee/api/entities/feature_flag.rb
deleted
100644 → 0
View file @
d4628f0c
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
expose
:name
expose
:description
expose
:active
expose
:version
,
if: :feature_flags_new_version_enabled
expose
:created_at
expose
:updated_at
expose
:scopes
,
using:
FeatureFlag
::
LegacyScope
expose
:strategies
,
using:
FeatureFlag
::
Strategy
,
if: :feature_flags_new_version_enabled
end
end
end
end
ee/lib/ee/api/entities/feature_flag/detailed_legacy_scope.rb
deleted
100644 → 0
View file @
d4628f0c
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
DetailedLegacyScope
<
LegacyScope
expose
:name
end
end
end
end
end
ee/lib/ee/api/entities/feature_flag/legacy_scope.rb
deleted
100644 → 0
View file @
d4628f0c
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
LegacyScope
<
Grape
::
Entity
expose
:id
expose
:active
expose
:environment_scope
expose
:strategies
expose
:created_at
expose
:updated_at
end
end
end
end
end
ee/lib/ee/api/entities/feature_flag/scope.rb
deleted
100644 → 0
View file @
d4628f0c
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
Scope
<
Grape
::
Entity
expose
:id
expose
:environment_scope
end
end
end
end
end
ee/lib/ee/api/entities/feature_flag/strategy.rb
deleted
100644 → 0
View file @
d4628f0c
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
Strategy
<
Grape
::
Entity
expose
:id
expose
:name
expose
:parameters
expose
:scopes
,
using:
FeatureFlag
::
Scope
end
end
end
end
end
ee/lib/ee/api/entities/feature_flag/user_list.rb
deleted
100644 → 0
View file @
d4628f0c
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
UserList
<
Grape
::
Entity
include
RequestAwareEntity
expose
:id
expose
:iid
expose
:project_id
expose
:created_at
expose
:updated_at
expose
:name
expose
:user_xids
expose
:path
do
|
list
|
project_feature_flags_user_list_path
(
list
.
project
,
list
)
end
expose
:edit_path
do
|
list
|
edit_project_feature_flags_user_list_path
(
list
.
project
,
list
)
end
end
end
end
end
end
lib/api/entities/feature_flag.rb
0 → 100644
View file @
dd64a3b7
# frozen_string_literal: true
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
expose
:name
expose
:description
expose
:active
expose
:version
,
if: :feature_flags_new_version_enabled
expose
:created_at
expose
:updated_at
expose
:scopes
,
using:
FeatureFlag
::
LegacyScope
expose
:strategies
,
using:
FeatureFlag
::
Strategy
,
if: :feature_flags_new_version_enabled
end
end
end
lib/api/entities/feature_flag/detailed_legacy_scope.rb
0 → 100644
View file @
dd64a3b7
# frozen_string_literal: true
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
DetailedLegacyScope
<
LegacyScope
expose
:name
end
end
end
end
lib/api/entities/feature_flag/legacy_scope.rb
0 → 100644
View file @
dd64a3b7
# frozen_string_literal: true
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
LegacyScope
<
Grape
::
Entity
expose
:id
expose
:active
expose
:environment_scope
expose
:strategies
expose
:created_at
expose
:updated_at
end
end
end
end
lib/api/entities/feature_flag/scope.rb
0 → 100644
View file @
dd64a3b7
# frozen_string_literal: true
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
Scope
<
Grape
::
Entity
expose
:id
expose
:environment_scope
end
end
end
end
lib/api/entities/feature_flag/strategy.rb
0 → 100644
View file @
dd64a3b7
# frozen_string_literal: true
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
Strategy
<
Grape
::
Entity
expose
:id
expose
:name
expose
:parameters
expose
:scopes
,
using:
FeatureFlag
::
Scope
end
end
end
end
lib/api/entities/feature_flag/user_list.rb
0 → 100644
View file @
dd64a3b7
# frozen_string_literal: true
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
UserList
<
Grape
::
Entity
include
RequestAwareEntity
expose
:id
expose
:iid
expose
:project_id
expose
:created_at
expose
:updated_at
expose
:name
expose
:user_xids
expose
:path
do
|
list
|
project_feature_flags_user_list_path
(
list
.
project
,
list
)
end
expose
:edit_path
do
|
list
|
edit_project_feature_flags_user_list_path
(
list
.
project
,
list
)
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment