@@ -102,9 +102,27 @@ public Optional<Environment> getOptionalEnvironment(Object projectIdOrPath, Long
102
102
* @param externalUrl the place to link to for this environment
103
103
* @return the created Environment instance
104
104
* @throws GitLabApiException if any exception occurs
105
+ * @deprecated use {@link #createEnvironment(Object, String, String, String)} instead
105
106
*/
107
+ @ Deprecated
106
108
public Environment createEnvironment (Object projectIdOrPath , String name , String externalUrl ) throws GitLabApiException {
107
- GitLabApiForm formData = new GitLabApiForm ().withParam ("name" , name , true ).withParam ("external_url" , externalUrl );
109
+ return createEnvironment (projectIdOrPath , name , externalUrl , null );
110
+ }
111
+
112
+ /**
113
+ * Create a new environment with the given name, external_url and tier.
114
+ *
115
+ * <pre><code>GitLab Endpoint:POST /projects/:id/environments</code></pre>
116
+ *
117
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
118
+ * @param name the name of the environment
119
+ * @param externalUrl the place to link to for this environment
120
+ * @param tier the tier of the environment
121
+ * @return the created Environment instance
122
+ * @throws GitLabApiException if any exception occurs
123
+ */
124
+ public Environment createEnvironment (Object projectIdOrPath , String name , String externalUrl , String tier ) throws GitLabApiException {
125
+ GitLabApiForm formData = new GitLabApiForm ().withParam ("name" , name , true ).withParam ("external_url" , externalUrl ).withParam ("tier" , tier );
108
126
Response response = post (Response .Status .CREATED , formData ,
109
127
"projects" , getProjectIdOrPath (projectIdOrPath ), "environments" );
110
128
return (response .readEntity (Environment .class ));
@@ -121,9 +139,28 @@ public Environment createEnvironment(Object projectIdOrPath, String name, String
121
139
* @param externalUrl the place to link to for this environment
122
140
* @return the created Environment instance
123
141
* @throws GitLabApiException if any exception occurs
142
+ * @deprecated use {@link #updateEnvironment(Object, Long, String, String, String)} instead
124
143
*/
144
+ @ Deprecated
125
145
public Environment updateEnvironment (Object projectIdOrPath , Long environmentId , String name , String externalUrl ) throws GitLabApiException {
126
- GitLabApiForm formData = new GitLabApiForm ().withParam ("name" , name ).withParam ("external_url" , externalUrl );
146
+ return updateEnvironment (projectIdOrPath , environmentId , name , externalUrl , null );
147
+ }
148
+
149
+ /**
150
+ * Update an existing environment.
151
+ *
152
+ * <pre><code>GitLab Endpoint:POST /projects/:id/environments</code></pre>
153
+ *
154
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
155
+ * @param environmentId the ID of the environment to update
156
+ * @param name the name of the environment
157
+ * @param externalUrl the place to link to for this environment
158
+ * @param tier the tier of the environment
159
+ * @return the created Environment instance
160
+ * @throws GitLabApiException if any exception occurs
161
+ */
162
+ public Environment updateEnvironment (Object projectIdOrPath , Long environmentId , String name , String externalUrl , String tier ) throws GitLabApiException {
163
+ GitLabApiForm formData = new GitLabApiForm ().withParam ("name" , name ).withParam ("external_url" , externalUrl ).withParam ("tier" , tier );
127
164
Response response = putWithFormData (Response .Status .OK , formData , formData ,
128
165
"projects" , getProjectIdOrPath (projectIdOrPath ), "environments" , environmentId );
129
166
return (response .readEntity (Environment .class ));
@@ -175,4 +212,4 @@ public Environment createEnvironment(Object projectIdOrPath, Long environmentId)
175
212
"projects" , getProjectIdOrPath (projectIdOrPath ), "environments" , environmentId , "stop" );
176
213
return (response .readEntity (Environment .class ));
177
214
}
178
- }
215
+ }
0 commit comments