@@ -2626,7 +2626,7 @@ public Optional<Variable> getOptionalVariable(Object projectIdOrPath, String key
26262626 * @throws GitLabApiException if any exception occurs during execution
26272627 */
26282628 public Variable createVariable (Object projectIdOrPath , String key , String value , Boolean isProtected ) throws GitLabApiException {
2629- return (createVariable (projectIdOrPath , key , value , isProtected , null ));
2629+ return (createVariable (projectIdOrPath , key , value , isProtected , ( String ) null ));
26302630 }
26312631
26322632 /**
@@ -2645,11 +2645,51 @@ public Variable createVariable(Object projectIdOrPath, String key, String value,
26452645 * @throws GitLabApiException if any exception occurs during execution
26462646 */
26472647 public Variable createVariable (Object projectIdOrPath , String key , String value , Boolean isProtected , String environmentScope ) throws GitLabApiException {
2648+ return createVariable (projectIdOrPath , key , value , isProtected , null , environmentScope );
2649+ }
2650+
2651+ /**
2652+ * Create a new project variable.
2653+ *
2654+ * <p>NOTE: Setting the environmentScope is only available on GitLab EE.</p>
2655+ *
2656+ * <pre><code>GitLab Endpoint: POST /projects/:id/variables</code></pre>
2657+ *
2658+ * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
2659+ * @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
2660+ * @param value the value for the variable, required
2661+ * @param isProtected whether the variable is protected, optional
2662+ * @param isMasked whether the variable is masked, optional
2663+ * @return a Variable instance with the newly created variable
2664+ * @throws GitLabApiException if any exception occurs during execution
2665+ */
2666+ public Variable createVariable (Object projectIdOrPath , String key , String value , Boolean isProtected , Boolean isMasked ) throws GitLabApiException {
2667+ return createVariable (projectIdOrPath , key , value , isProtected , isMasked , null );
2668+ }
2669+
2670+ /**
2671+ * Create a new project variable.
2672+ *
2673+ * <p>NOTE: Setting the environmentScope is only available on GitLab EE.</p>
2674+ *
2675+ * <pre><code>GitLab Endpoint: POST /projects/:id/variables</code></pre>
2676+ *
2677+ * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
2678+ * @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
2679+ * @param value the value for the variable, required
2680+ * @param isProtected whether the variable is protected, optional
2681+ * @param isMasked whether the variable is masked, optional
2682+ * @param environmentScope the environment_scope of the variable, optional
2683+ * @return a Variable instance with the newly created variable
2684+ * @throws GitLabApiException if any exception occurs during execution
2685+ */
2686+ public Variable createVariable (Object projectIdOrPath , String key , String value , Boolean isProtected , Boolean isMasked , String environmentScope ) throws GitLabApiException {
26482687
26492688 GitLabApiForm formData = new GitLabApiForm ()
26502689 .withParam ("key" , key , true )
26512690 .withParam ("value" , value , true )
26522691 .withParam ("protected" , isProtected )
2692+ .withParam ("masked" , isMasked )
26532693 .withParam ("environment_scope" , environmentScope );
26542694 Response response = post (Response .Status .CREATED , formData , "projects" , getProjectIdOrPath (projectIdOrPath ), "variables" );
26552695 return (response .readEntity (Variable .class ));
@@ -2668,7 +2708,7 @@ public Variable createVariable(Object projectIdOrPath, String key, String value,
26682708 * @throws GitLabApiException if any exception occurs during execution
26692709 */
26702710 public Variable updateVariable (Object projectIdOrPath , String key , String value , Boolean isProtected ) throws GitLabApiException {
2671- return (updateVariable (projectIdOrPath , key , value , isProtected , null ));
2711+ return (updateVariable (projectIdOrPath , key , value , isProtected , ( String ) null ));
26722712 }
26732713
26742714 /**
@@ -2687,10 +2727,50 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value,
26872727 * @throws GitLabApiException if any exception occurs during execution
26882728 */
26892729 public Variable updateVariable (Object projectIdOrPath , String key , String value , Boolean isProtected , String environmentScope ) throws GitLabApiException {
2730+ return updateVariable (projectIdOrPath , key , value , isProtected , null , environmentScope );
2731+ }
2732+
2733+ /**
2734+ * Update a project variable.
2735+ *
2736+ * <p>NOTE: Updating the environmentScope is only available on GitLab EE.</p>
2737+ *
2738+ * <pre><code>GitLab Endpoint: PUT /projects/:id/variables/:key</code></pre>
2739+ *
2740+ * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
2741+ * @param key the key of an existing variable, required
2742+ * @param value the value for the variable, required
2743+ * @param isProtected whether the variable is protected, optional
2744+ * @param isMasked whether the variable is masked, optional
2745+ * @return a Variable instance with the updated variable
2746+ * @throws GitLabApiException if any exception occurs during execution
2747+ */
2748+ public Variable updateVariable (Object projectIdOrPath , String key , String value , Boolean isProtected , Boolean isMasked ) throws GitLabApiException {
2749+ return updateVariable (projectIdOrPath , key , value , isProtected , isMasked , null );
2750+ }
2751+
2752+ /**
2753+ * Update a project variable.
2754+ *
2755+ * <p>NOTE: Updating the environmentScope is only available on GitLab EE.</p>
2756+ *
2757+ * <pre><code>GitLab Endpoint: PUT /projects/:id/variables/:key</code></pre>
2758+ *
2759+ * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
2760+ * @param key the key of an existing variable, required
2761+ * @param value the value for the variable, required
2762+ * @param isProtected whether the variable is protected, optional
2763+ * @param isMasked whether the variable is masked, optional
2764+ * @param environmentScope the environment_scope of the variable, optional.
2765+ * @return a Variable instance with the updated variable
2766+ * @throws GitLabApiException if any exception occurs during execution
2767+ */
2768+ public Variable updateVariable (Object projectIdOrPath , String key , String value , Boolean isProtected , Boolean isMasked , String environmentScope ) throws GitLabApiException {
26902769
26912770 GitLabApiForm formData = new GitLabApiForm ()
26922771 .withParam ("value" , value , true )
26932772 .withParam ("protected" , isProtected )
2773+ .withParam ("masked" , isMasked )
26942774 .withParam ("environment_scope" , environmentScope );
26952775 Response response = putWithFormData (Response .Status .OK , formData , "projects" , getProjectIdOrPath (projectIdOrPath ), "variables" , key );
26962776 return (response .readEntity (Variable .class ));
0 commit comments