diff options
Diffstat (limited to 'lib/api/variables.rb')
-rw-r--r-- | lib/api/variables.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/api/variables.rb b/lib/api/variables.rb index a1bb21b3a06..af1d7936556 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -7,6 +7,8 @@ module API before { authenticate! } before { authorize! :admin_build, user_project } + helpers Helpers::VariablesHelpers + helpers do def filter_variable_parameters(params) # This method exists so that EE can more easily filter out certain @@ -54,12 +56,11 @@ 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' + optional :protected, type: Boolean, desc: 'Whether the variable is protected' + optional :masked, type: Boolean, desc: 'Whether the variable is masked' optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var' - if Gitlab.ee? - optional :environment_scope, type: String, desc: 'The environment_scope of the variable' - end + use :optional_params_ee end post ':id/variables' do variable_params = declared_params(include_missing: false) @@ -80,12 +81,11 @@ 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' + optional :protected, type: Boolean, desc: 'Whether the variable is protected' + optional :masked, type: Boolean, desc: 'Whether the variable is masked' optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file' - if Gitlab.ee? - optional :environment_scope, type: String, desc: 'The environment_scope of the variable' - end + use :optional_params_ee end # rubocop: disable CodeReuse/ActiveRecord put ':id/variables/:key' do |