Skip to content

Commit 6a89da0

Browse files
Add attributes to Group and GroupParams (#1073)
--------- Co-authored-by: Jeremie Bresson <jeremie.bresson@unblu.com>
1 parent ddb244e commit 6a89da0

File tree

4 files changed

+203
-76
lines changed

4 files changed

+203
-76
lines changed

src/main/java/org/gitlab4j/api/Constants.java

+68
Original file line numberDiff line numberDiff line change
@@ -1029,5 +1029,73 @@ public String toString() {
10291029
return (enumHelper.toString(this));
10301030
}
10311031
}
1032+
1033+
/**
1034+
* Constant to specify the project_creation_level for the group.
1035+
*/
1036+
public enum ProjectCreationLevel {
1037+
NOONE, DEVELOPER, MAINTAINER;
1038+
1039+
private static JacksonJsonEnumHelper<ProjectCreationLevel> enumHelper = new JacksonJsonEnumHelper<>(ProjectCreationLevel.class);
1040+
1041+
@JsonCreator
1042+
public static ProjectCreationLevel forValue(String value) {
1043+
return enumHelper.forValue(value);
1044+
}
1045+
1046+
@JsonValue
1047+
public String toValue() {
1048+
return (enumHelper.toString(this));
1049+
}
1050+
1051+
@Override
1052+
public String toString() {
1053+
return (enumHelper.toString(this));
1054+
}
1055+
}
1056+
1057+
/**
1058+
* Constant to specify the subgroup_creation_level for the group.
1059+
*/
1060+
public enum SubgroupCreationLevel {
1061+
OWNER, MAINTAINER;
1062+
1063+
private static JacksonJsonEnumHelper<SubgroupCreationLevel> enumHelper = new JacksonJsonEnumHelper<>(SubgroupCreationLevel.class);
1064+
1065+
@JsonCreator
1066+
public static SubgroupCreationLevel forValue(String value) {
1067+
return enumHelper.forValue(value);
1068+
}
1069+
1070+
@JsonValue
1071+
public String toValue() {
1072+
return (enumHelper.toString(this));
1073+
}
1074+
1075+
@Override
1076+
public String toString() {
1077+
return (enumHelper.toString(this));
1078+
}
1079+
}
1080+
1081+
public enum DefaultBranchProtectionLevel {
1082+
NOT_PROTECTED(0),
1083+
PARTIALLY_PROTECTED(1),
1084+
FULLY_PROTECTED(2),
1085+
PROTECTED_AGAINST_PUSHES(3),
1086+
FULL_PROTECTION_AFTER_INITIAL_PUSH(4);
1087+
1088+
@JsonValue
1089+
private final int value;
1090+
1091+
private DefaultBranchProtectionLevel(int value) {
1092+
this.value = value;
1093+
}
1094+
1095+
@Override
1096+
public String toString() {
1097+
return Integer.toString(value);
1098+
}
1099+
}
10321100
}
10331101

src/main/java/org/gitlab4j/api/models/Group.java

+74
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
package org.gitlab4j.api.models;
33

44
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
5+
6+
import org.gitlab4j.api.Constants.DefaultBranchProtectionLevel;
7+
import org.gitlab4j.api.Constants.ProjectCreationLevel;
8+
import org.gitlab4j.api.Constants.SubgroupCreationLevel;
59
import org.gitlab4j.api.utils.JacksonJson;
610

711
import java.util.Date;
@@ -63,6 +67,11 @@ public void setJobArtifactsSize(Long jobArtifactsSize) {
6367
private Date createdAt;
6468
private List<SharedGroup> sharedWithGroups;
6569
private String runnersToken;
70+
private Boolean preventSharingGroupsOutsideHierarchy;
71+
private Boolean preventForkingOutsideGroup;
72+
private ProjectCreationLevel projectCreationLevel;
73+
private SubgroupCreationLevel subgroupCreationLevel;
74+
private DefaultBranchProtectionLevel defaultBranchProtection;
6675

6776
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
6877
private Date markedForDeletionOn;
@@ -179,6 +188,46 @@ public void setRunnersToken(String runnersToken) {
179188
this.runnersToken = runnersToken;
180189
}
181190

191+
public Boolean getPreventSharingGroupsOutsideHierarchy() {
192+
return preventSharingGroupsOutsideHierarchy;
193+
}
194+
195+
public void setPreventSharingGroupsOutsideHierarchy(Boolean preventSharingGroupsOutsideHierarchy) {
196+
this.preventSharingGroupsOutsideHierarchy = preventSharingGroupsOutsideHierarchy;
197+
}
198+
199+
public Boolean getPreventForkingOutsideGroup() {
200+
return preventForkingOutsideGroup;
201+
}
202+
203+
public void setPreventForkingOutsideGroup(Boolean preventForkingOutsideGroup) {
204+
this.preventForkingOutsideGroup = preventForkingOutsideGroup;
205+
}
206+
207+
public ProjectCreationLevel getProjectCreationLevel() {
208+
return this.projectCreationLevel;
209+
}
210+
211+
public void setProjectCreationLevel(ProjectCreationLevel projectCreationLevel) {
212+
this.projectCreationLevel = projectCreationLevel;
213+
}
214+
215+
public SubgroupCreationLevel getSubgroupCreationLevel() {
216+
return this.subgroupCreationLevel;
217+
}
218+
219+
public void setSubgroupCreationLevel(SubgroupCreationLevel subgroupCreationLevel) {
220+
this.subgroupCreationLevel = subgroupCreationLevel;
221+
}
222+
223+
public DefaultBranchProtectionLevel getDefaultBranchProtection() {
224+
return this.defaultBranchProtection;
225+
}
226+
227+
public void setDefaultBranchProtection(DefaultBranchProtectionLevel defaultBranchProtection) {
228+
this.defaultBranchProtection = defaultBranchProtection;
229+
}
230+
182231
public Group withPath(String path) {
183232
this.path = path;
184233
return this;
@@ -229,6 +278,31 @@ public Group withSharedProjects(List<Project> sharedProjects) {
229278
return this;
230279
}
231280

281+
public Group withPreventSharingGroupsOutsideHierarchy(Boolean preventSharingGroupsOutsideHierarchy) {
282+
this.preventSharingGroupsOutsideHierarchy = preventSharingGroupsOutsideHierarchy;
283+
return this;
284+
}
285+
286+
public Group withPreventForkingOutsideGroup(Boolean preventForkingOutsideGroup) {
287+
this.preventForkingOutsideGroup = preventForkingOutsideGroup;
288+
return this;
289+
}
290+
291+
public Group withProjectCreationLevel(ProjectCreationLevel projectCreationLevel) {
292+
this.projectCreationLevel = projectCreationLevel;
293+
return this;
294+
}
295+
296+
public Group withSubgroupCreationLevel(SubgroupCreationLevel subgroupCreationLevel) {
297+
this.subgroupCreationLevel = subgroupCreationLevel;
298+
return this;
299+
}
300+
301+
public Group withDefaultBranchProtection(DefaultBranchProtectionLevel defaultBranchProtection) {
302+
this.defaultBranchProtection = defaultBranchProtection;
303+
return this;
304+
}
305+
232306
@Override
233307
public String toString() {
234308
return (JacksonJson.toJsonString(this));

0 commit comments

Comments
 (0)