summaryrefslogtreecommitdiff
path: root/lib/api/variables.rb
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-06-01 17:18:03 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-06-01 17:18:03 +0000
commit950db1bd6472813bb539b69a309402c4eb115122 (patch)
tree8a334eb48bcdd297ecd53c5152b82cc9dea112c3 /lib/api/variables.rb
parent7c17a4b32f39a1b0ac8c16dae27e7cc7d3bf3614 (diff)
parent7da88278c33d20d97cf0eabb76b3117219479d12 (diff)
downloadgitlab-ce-950db1bd6472813bb539b69a309402c4eb115122.tar.gz
Merge branch '24196-protected-variables' into 'master'
Implementation for protected variables Closes #24196 See merge request !11688
Diffstat (limited to 'lib/api/variables.rb')
-rw-r--r--lib/api/variables.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/api/variables.rb b/lib/api/variables.rb
index 5acde41551b..381c4ef50b0 100644
--- a/lib/api/variables.rb
+++ b/lib/api/variables.rb
@@ -42,6 +42,7 @@ module API
params do
requires :key, type: String, desc: 'The key of the variable'
requires :value, type: String, desc: 'The value of the variable'
+ optional :protected, type: String, desc: 'Whether the variable is protected'
end
post ':id/variables' do
variable = user_project.variables.create(declared(params, include_parent_namespaces: false).to_h)
@@ -59,13 +60,14 @@ module API
params do
optional :key, type: String, desc: 'The key of the variable'
optional :value, type: String, desc: 'The value of the variable'
+ optional :protected, type: String, desc: 'Whether the variable is protected'
end
put ':id/variables/:key' do
variable = user_project.variables.find_by(key: params[:key])
return not_found!('Variable') unless variable
- if variable.update(value: params[:value])
+ if variable.update(declared_params(include_missing: false).except(:key))
present variable, with: Entities::Variable
else
render_validation_error!(variable)