@@ -1310,9 +1310,28 @@ public Optional<Variable> getOptionalVariable(Object groupIdOrPath, String key)
1310
1310
*/
1311
1311
public Variable createVariable (Object groupIdOrPath , String key , String value , Boolean isProtected ) throws GitLabApiException {
1312
1312
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
+
1313
1331
GitLabApiForm formData = new GitLabApiForm ()
1314
1332
.withParam ("key" , key , true )
1315
1333
.withParam ("value" , value , true )
1334
+ .withParam ("masked" , masked )
1316
1335
.withParam ("protected" , isProtected );
1317
1336
Response response = post (Response .Status .CREATED , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "variables" );
1318
1337
return (response .readEntity (Variable .class ));
@@ -1332,8 +1351,27 @@ public Variable createVariable(Object groupIdOrPath, String key, String value, B
1332
1351
*/
1333
1352
public Variable updateVariable (Object groupIdOrPath , String key , String value , Boolean isProtected ) throws GitLabApiException {
1334
1353
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
+
1335
1372
GitLabApiForm formData = new GitLabApiForm ()
1336
1373
.withParam ("value" , value , true )
1374
+ .withParam ("masked" , masked )
1337
1375
.withParam ("protected" , isProtected );
1338
1376
Response response = putWithFormData (Response .Status .CREATED , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "variables" , key );
1339
1377
return (response .readEntity (Variable .class ));
0 commit comments