|
28 | 28 | import java.io.UnsupportedEncodingException;
|
29 | 29 | import java.net.URLEncoder;
|
30 | 30 | import java.util.Date;
|
| 31 | +import java.util.HashMap; |
31 | 32 | import java.util.List;
|
32 | 33 | import java.util.Map;
|
33 | 34 | import java.util.Objects;
|
@@ -1128,7 +1129,60 @@ public Project createProject(Project project, String importUrl) throws GitLabApi
|
1128 | 1129 | .withParam("suggestion_commit_message", project.getSuggestionCommitMessage())
|
1129 | 1130 | .withParam("remove_source_branch_after_merge", project.getRemoveSourceBranchAfterMerge())
|
1130 | 1131 | .withParam("auto_devops_enabled", project.getAutoDevopsEnabled())
|
1131 |
| - .withParam("squash_option", project.getSquashOption()); |
| 1132 | + .withParam("squash_option", project.getSquashOption()) |
| 1133 | + .withParam("use_custom_template", project.getUseCustomTemplate()) |
| 1134 | + .withParam( |
| 1135 | + "external_authorization_classification_label", |
| 1136 | + project.getExternalAuthorizationClassificationLabel()) |
| 1137 | + .withParam("group_runners_enabled", project.getGroupRunnersEnabled()) |
| 1138 | + .withParam("show_default_award_emojis", project.getShowDefaultAwardEmojis()) |
| 1139 | + .withParam( |
| 1140 | + "warn_about_potentially_unwanted_characters", |
| 1141 | + project.getWarnAboutPotentiallyUnwantedCharacters()) |
| 1142 | + .withParam("mirror_trigger_builds", project.getMirrorTriggerBuilds()) |
| 1143 | + .withParam("auto_cancel_pending_pipelines", project.getAutoCancelPendingPipelines()) |
| 1144 | + .withParam("repository_object_format", project.getRepositoryObjectFormat()) |
| 1145 | + .withParam( |
| 1146 | + "only_allow_merge_if_all_status_checks_passed", |
| 1147 | + project.getOnlyAllowMergeIfAllStatusChecksPassed()) |
| 1148 | + .withParam("group_with_project_templates_id", project.getGroupWithProjectTemplatesId()) |
| 1149 | + .withParam("public_builds", project.getPublicBuilds()) |
| 1150 | + .withParam("build_timeout", project.getBuildTimeout()) |
| 1151 | + .withParam("template_name", project.getTemplateName()) |
| 1152 | + .withParam("emails_enabled", project.getEmailsEnabled()) |
| 1153 | + .withParam("mirror", project.getMirror()) |
| 1154 | + .withParam("analytics_access_level", project.getAnalyticsAccessLevel()) |
| 1155 | + .withParam("builds_access_level", project.getBuildsAccessLevel()) |
| 1156 | + .withParam("container_registry_access_level", project.getContainerRegistryAccessLevel()) |
| 1157 | + .withParam("environments_access_level", project.getEnvironmentsAccessLevel()) |
| 1158 | + .withParam("feature_flags_access_level", project.getFeatureFlagsAccessLevel()) |
| 1159 | + .withParam("forking_access_level", project.getForkingAccessLevel()) |
| 1160 | + .withParam("infrastructure_access_level", project.getInfrastructureAccessLevel()) |
| 1161 | + .withParam("issues_access_level", project.getIssuesAccessLevel()) |
| 1162 | + .withParam("merge_requests_access_level", project.getMergeRequestsAccessLevel()) |
| 1163 | + .withParam("model_experiments_access_level", project.getModelExperimentsAccessLevel()) |
| 1164 | + .withParam("model_registry_access_level", project.getModelRegistryAccessLevel()) |
| 1165 | + .withParam("monitor_access_level", project.getMonitorAccessLevel()) |
| 1166 | + .withParam("pages_access_level", project.getPagesAccessLevel()) |
| 1167 | + .withParam("releases_access_level", project.getReleasesAccessLevel()) |
| 1168 | + .withParam("repository_access_level", project.getRepositoryAccessLevel()) |
| 1169 | + .withParam("requirements_access_level", project.getRequirementsAccessLevel()) |
| 1170 | + .withParam("security_and_compliance_access_level", project.getSecurityAndComplianceAccessLevel()) |
| 1171 | + .withParam("snippets_access_level", project.getSnippetsAccessLevel()) |
| 1172 | + .withParam("wiki_access_level", project.getWikiAccessLevel()); |
| 1173 | + |
| 1174 | + if (project.getContainerExpirationPolicy() != null) { |
| 1175 | + Map<String, Object> attributes = new HashMap<>(); |
| 1176 | + attributes.put("cadence", project.getContainerExpirationPolicy().getCadence()); |
| 1177 | + attributes.put("enabled", project.getContainerExpirationPolicy().getEnabled()); |
| 1178 | + attributes.put("keep_n", project.getContainerExpirationPolicy().getKeepN()); |
| 1179 | + attributes.put("older_than", project.getContainerExpirationPolicy().getOlderThan()); |
| 1180 | + attributes.put("name_regex", project.getContainerExpirationPolicy().getNameRegex()); |
| 1181 | + attributes.put( |
| 1182 | + "name_regex_keep", project.getContainerExpirationPolicy().getNameRegexKeep()); |
| 1183 | + |
| 1184 | + formData.withParam("container_expiration_policy_attributes", attributes, false); |
| 1185 | + } |
1132 | 1186 |
|
1133 | 1187 | Namespace namespace = project.getNamespace();
|
1134 | 1188 | if (namespace != null && namespace.getId() != null) {
|
@@ -1490,7 +1544,60 @@ public Project updateProject(Project project) throws GitLabApiException {
|
1490 | 1544 | .withParam("merge_method", project.getMergeMethod())
|
1491 | 1545 | .withParam("suggestion_commit_message", project.getSuggestionCommitMessage())
|
1492 | 1546 | .withParam("remove_source_branch_after_merge", project.getRemoveSourceBranchAfterMerge())
|
1493 |
| - .withParam("squash_option", project.getSquashOption()); |
| 1547 | + .withParam("squash_option", project.getSquashOption()) |
| 1548 | + .withParam("use_custom_template", project.getUseCustomTemplate()) |
| 1549 | + .withParam( |
| 1550 | + "external_authorization_classification_label", |
| 1551 | + project.getExternalAuthorizationClassificationLabel()) |
| 1552 | + .withParam("group_runners_enabled", project.getGroupRunnersEnabled()) |
| 1553 | + .withParam("show_default_award_emojis", project.getShowDefaultAwardEmojis()) |
| 1554 | + .withParam( |
| 1555 | + "warn_about_potentially_unwanted_characters", |
| 1556 | + project.getWarnAboutPotentiallyUnwantedCharacters()) |
| 1557 | + .withParam("mirror_trigger_builds", project.getMirrorTriggerBuilds()) |
| 1558 | + .withParam("auto_cancel_pending_pipelines", project.getAutoCancelPendingPipelines()) |
| 1559 | + .withParam("repository_object_format", project.getRepositoryObjectFormat()) |
| 1560 | + .withParam( |
| 1561 | + "only_allow_merge_if_all_status_checks_passed", |
| 1562 | + project.getOnlyAllowMergeIfAllStatusChecksPassed()) |
| 1563 | + .withParam("group_with_project_templates_id", project.getGroupWithProjectTemplatesId()) |
| 1564 | + .withParam("public_builds", project.getPublicBuilds()) |
| 1565 | + .withParam("build_timeout", project.getBuildTimeout()) |
| 1566 | + .withParam("template_name", project.getTemplateName()) |
| 1567 | + .withParam("emails_enabled", project.getEmailsEnabled()) |
| 1568 | + .withParam("mirror", project.getMirror()) |
| 1569 | + .withParam("analytics_access_level", project.getAnalyticsAccessLevel()) |
| 1570 | + .withParam("builds_access_level", project.getBuildsAccessLevel()) |
| 1571 | + .withParam("container_registry_access_level", project.getContainerRegistryAccessLevel()) |
| 1572 | + .withParam("environments_access_level", project.getEnvironmentsAccessLevel()) |
| 1573 | + .withParam("feature_flags_access_level", project.getFeatureFlagsAccessLevel()) |
| 1574 | + .withParam("forking_access_level", project.getForkingAccessLevel()) |
| 1575 | + .withParam("infrastructure_access_level", project.getInfrastructureAccessLevel()) |
| 1576 | + .withParam("issues_access_level", project.getIssuesAccessLevel()) |
| 1577 | + .withParam("merge_requests_access_level", project.getMergeRequestsAccessLevel()) |
| 1578 | + .withParam("model_experiments_access_level", project.getModelExperimentsAccessLevel()) |
| 1579 | + .withParam("model_registry_access_level", project.getModelRegistryAccessLevel()) |
| 1580 | + .withParam("monitor_access_level", project.getMonitorAccessLevel()) |
| 1581 | + .withParam("pages_access_level", project.getPagesAccessLevel()) |
| 1582 | + .withParam("releases_access_level", project.getReleasesAccessLevel()) |
| 1583 | + .withParam("repository_access_level", project.getRepositoryAccessLevel()) |
| 1584 | + .withParam("requirements_access_level", project.getRequirementsAccessLevel()) |
| 1585 | + .withParam("security_and_compliance_access_level", project.getSecurityAndComplianceAccessLevel()) |
| 1586 | + .withParam("snippets_access_level", project.getSnippetsAccessLevel()) |
| 1587 | + .withParam("wiki_access_level", project.getWikiAccessLevel()); |
| 1588 | + |
| 1589 | + if (project.getContainerExpirationPolicy() != null) { |
| 1590 | + Map<String, Object> attributes = new HashMap<>(); |
| 1591 | + attributes.put("cadence", project.getContainerExpirationPolicy().getCadence()); |
| 1592 | + attributes.put("enabled", project.getContainerExpirationPolicy().getEnabled()); |
| 1593 | + attributes.put("keep_n", project.getContainerExpirationPolicy().getKeepN()); |
| 1594 | + attributes.put("older_than", project.getContainerExpirationPolicy().getOlderThan()); |
| 1595 | + attributes.put("name_regex", project.getContainerExpirationPolicy().getNameRegex()); |
| 1596 | + attributes.put( |
| 1597 | + "name_regex_keep", project.getContainerExpirationPolicy().getNameRegexKeep()); |
| 1598 | + |
| 1599 | + formData.withParam("container_expiration_policy_attributes", attributes, false); |
| 1600 | + } |
1494 | 1601 |
|
1495 | 1602 | if (isApiVersion(ApiVersion.V3)) {
|
1496 | 1603 | formData.withParam("visibility_level", project.getVisibilityLevel());
|
|
0 commit comments