@@ -1310,9 +1310,28 @@ public Optional<Variable> getOptionalVariable(Object groupIdOrPath, String key)
13101310 */
13111311 public Variable createVariable (Object groupIdOrPath , String key , String value , Boolean isProtected ) throws GitLabApiException {
13121312
1313+ return createVariable (groupIdOrPath , key , value , isProtected , false );
1314+ }
1315+
1316+ /**
1317+ * Create a new group variable.
1318+ *
1319+ * <pre><code>GitLab Endpoint: POST /groups/:id/variables</code></pre>
1320+ *
1321+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required
1322+ * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required
1323+ * @param value the value for the variable, required
1324+ * @param isProtected whether the variable is protected, optional
1325+ * @param masked whether the variable is masked, optional
1326+ * @return a Variable instance with the newly created variable
1327+ * @throws GitLabApiException if any exception occurs during execution
1328+ */
1329+ public Variable createVariable (Object groupIdOrPath , String key , String value , Boolean isProtected , Boolean masked ) throws GitLabApiException {
1330+
13131331 GitLabApiForm formData = new GitLabApiForm ()
13141332 .withParam ("key" , key , true )
13151333 .withParam ("value" , value , true )
1334+ .withParam ("masked" , masked )
13161335 .withParam ("protected" , isProtected );
13171336 Response response = post (Response .Status .CREATED , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "variables" );
13181337 return (response .readEntity (Variable .class ));
@@ -1332,8 +1351,27 @@ public Variable createVariable(Object groupIdOrPath, String key, String value, B
13321351 */
13331352 public Variable updateVariable (Object groupIdOrPath , String key , String value , Boolean isProtected ) throws GitLabApiException {
13341353
1354+ return updateVariable (groupIdOrPath , key , value , isProtected , false );
1355+ }
1356+
1357+ /**
1358+ * Update a group variable.
1359+ *
1360+ * <pre><code>GitLab Endpoint: PUT /groups/:id/variables/:key</code></pre>
1361+ *
1362+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required
1363+ * @param key the key of an existing variable, required
1364+ * @param value the value for the variable, required
1365+ * @param isProtected whether the variable is protected, optional
1366+ * @param masked whether the variable is masked, optional
1367+ * @return a Variable instance with the updated variable
1368+ * @throws GitLabApiException if any exception occurs during execution
1369+ */
1370+ public Variable updateVariable (Object groupIdOrPath , String key , String value , Boolean isProtected , Boolean masked ) throws GitLabApiException {
1371+
13351372 GitLabApiForm formData = new GitLabApiForm ()
13361373 .withParam ("value" , value , true )
1374+ .withParam ("masked" , masked )
13371375 .withParam ("protected" , isProtected );
13381376 Response response = putWithFormData (Response .Status .CREATED , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "variables" , key );
13391377 return (response .readEntity (Variable .class ));
0 commit comments