|
28 | 28 | import org.gitlab4j.api.models.LdapGroupLink;
|
29 | 29 | import org.gitlab4j.api.models.Member;
|
30 | 30 | import org.gitlab4j.api.models.Project;
|
| 31 | +import org.gitlab4j.api.models.SamlGroupLink; |
31 | 32 | import org.gitlab4j.api.models.Variable;
|
32 | 33 | import org.gitlab4j.api.models.Visibility;
|
33 | 34 | import org.gitlab4j.api.utils.ISO8601;
|
@@ -1183,9 +1184,9 @@ public void ldapSync(Object groupIdOrPath) throws GitLabApiException {
|
1183 | 1184 |
|
1184 | 1185 | /**
|
1185 | 1186 | * Get the list of LDAP group links.
|
1186 |
| - * |
| 1187 | + * |
1187 | 1188 | * <pre><code>GitLab Endpoint: GET /groups/:id/ldap_group_links</code></pre>
|
1188 |
| - * |
| 1189 | + * |
1189 | 1190 | * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
|
1190 | 1191 | * @return a list of LDAP group links
|
1191 | 1192 | * @throws GitLabApiException if any exception occurs
|
@@ -1275,6 +1276,74 @@ public void deleteLdapGroupLink(Object groupIdOrPath, String cn, String provider
|
1275 | 1276 | delete(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_group_links", provider, cn);
|
1276 | 1277 | }
|
1277 | 1278 |
|
| 1279 | + /** |
| 1280 | + * Get the list of SAML group links. |
| 1281 | + * |
| 1282 | + * <pre><code>GitLab Endpoint: GET /groups/:id/saml_group_links</code></pre> |
| 1283 | + * |
| 1284 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 1285 | + * @return a list of SAML group links |
| 1286 | + * @throws GitLabApiException if any exception occurs |
| 1287 | + */ |
| 1288 | + public List<SamlGroupLink> getSamlGroupLinks(Object groupIdOrPath) throws GitLabApiException { |
| 1289 | + Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "saml_group_links"); |
| 1290 | + return (response.readEntity(new GenericType<List<SamlGroupLink>>() {})); |
| 1291 | + } |
| 1292 | + |
| 1293 | + /** |
| 1294 | + * Adds an SAML group link. |
| 1295 | + * |
| 1296 | + * <pre><code>GitLab Endpoint: POST /groups/:id/saml_group_links</code></pre> |
| 1297 | + * |
| 1298 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 1299 | + * @param samlGroupName the name of the SAML group |
| 1300 | + * @param groupAccess the minimum access level for members of the SAML group |
| 1301 | + * @throws GitLabApiException if any exception occurs |
| 1302 | + */ |
| 1303 | + public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, AccessLevel groupAccess) throws GitLabApiException { |
| 1304 | + |
| 1305 | + if (groupAccess == null) { |
| 1306 | + throw new RuntimeException("groupAccess cannot be null or empty"); |
| 1307 | + } |
| 1308 | + |
| 1309 | + addSamlGroupLink(groupIdOrPath, samlGroupName, groupAccess.toValue()); |
| 1310 | + } |
| 1311 | + |
| 1312 | + /** |
| 1313 | + * Adds an SAML group link. |
| 1314 | + * |
| 1315 | + * <pre><code>GitLab Endpoint: POST /groups/:id/saml_group_links</code></pre> |
| 1316 | + * |
| 1317 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 1318 | + * @param samlGroupName the name of the SAML group |
| 1319 | + * @param groupAccess the minimum access level for members of the SAML group |
| 1320 | + * @throws GitLabApiException if any exception occurs |
| 1321 | + */ |
| 1322 | + public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, Integer groupAccess) throws GitLabApiException { |
| 1323 | + GitLabApiForm formData = new GitLabApiForm() |
| 1324 | + .withParam("saml_group_name", samlGroupName, true) |
| 1325 | + .withParam("access_level", groupAccess, true); |
| 1326 | + post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "saml_group_links"); |
| 1327 | + } |
| 1328 | + |
| 1329 | + /** |
| 1330 | + * Deletes an SAML group link. |
| 1331 | + * |
| 1332 | + * <pre><code>GitLab Endpoint: DELETE /groups/:id/saml_group_links/:cn</code></pre> |
| 1333 | + * |
| 1334 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 1335 | + * @param samlGroupName the name of the SAML group to delete |
| 1336 | + * @throws GitLabApiException if any exception occurs |
| 1337 | + */ |
| 1338 | + public void deleteSamlGroupLink(Object groupIdOrPath, String samlGroupName) throws GitLabApiException { |
| 1339 | + |
| 1340 | + if (samlGroupName == null || samlGroupName.trim().isEmpty()) { |
| 1341 | + throw new RuntimeException("samlGroupName cannot be null or empty"); |
| 1342 | + } |
| 1343 | + |
| 1344 | + delete(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "saml_group_links", samlGroupName); |
| 1345 | + } |
| 1346 | + |
1278 | 1347 | /**
|
1279 | 1348 | * Get list of a group’s variables.
|
1280 | 1349 | *
|
@@ -1961,7 +2030,7 @@ public void deleteCustomAttribute(final Object groupIdOrPath, final String key)
|
1961 | 2030 |
|
1962 | 2031 | delete(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "custom_attributes", key);
|
1963 | 2032 | }
|
1964 |
| - |
| 2033 | + |
1965 | 2034 | /**
|
1966 | 2035 | * Lists group iterations.
|
1967 | 2036 | *
|
|
0 commit comments