aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-alm-client
diff options
context:
space:
mode:
authorWojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com>2023-05-31 15:13:59 +0200
committersonartech <sonartech@sonarsource.com>2023-06-01 20:02:58 +0000
commit511971650ddb2fe1fa4e55e5ab85dea85993db42 (patch)
treed6184c430450782bbee9f74ae3931169a27d99a5 /server/sonar-alm-client
parent902bbef4744bfbc116f57bef25dec6f262895163 (diff)
downloadsonarqube-511971650ddb2fe1fa4e55e5ab85dea85993db42.tar.gz
sonarqube-511971650ddb2fe1fa4e55e5ab85dea85993db42.zip
SONAR-19337 Add endpoint to validate GitHub provisioning config. (#8414)
Diffstat (limited to 'server/sonar-alm-client')
-rw-r--r--server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubBinding.java92
1 files changed, 65 insertions, 27 deletions
diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubBinding.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubBinding.java
index 90b77f763de..bb569f0db86 100644
--- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubBinding.java
+++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubBinding.java
@@ -21,13 +21,41 @@ package org.sonar.alm.client.github;
import com.google.gson.annotations.SerializedName;
import java.util.List;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
import static org.sonar.alm.client.github.GithubApplicationClient.Repository;
public class GithubBinding {
private GithubBinding() {
- //nothing to do
+ // nothing to do
+ }
+
+ public static class GsonApp {
+
+ @SerializedName("installations_count")
+ private long installationsCount;
+
+ @SerializedName("permissions")
+ Permissions permissions;
+
+ public GsonApp(long installationsCount, Permissions permissions) {
+ this.installationsCount = installationsCount;
+ this.permissions = permissions;
+ }
+
+ public GsonApp() {
+ // http://stackoverflow.com/a/18645370/229031
+ }
+
+ public Permissions getPermissions() {
+ return permissions;
+ }
+
+ public long getInstallationsCount() {
+ return installationsCount;
+ }
}
public static class GsonInstallations {
@@ -82,32 +110,6 @@ public class GithubBinding {
return account;
}
- public static class Permissions {
- @SerializedName("checks")
- String checks;
- @SerializedName("members")
- String members;
-
- public Permissions(String checks, String members) {
- this.checks = checks;
- this.members = members;
- }
-
- public Permissions() {
- // even if empty constructor is not required for Gson, it is strongly
- // recommended:
- // http://stackoverflow.com/a/18645370/229031
- }
-
- public String getMembers() {
- return members;
- }
-
- public String getChecks() {
- return checks;
- }
- }
-
public static class GsonAccount {
@SerializedName("id")
long id;
@@ -132,6 +134,42 @@ public class GithubBinding {
}
}
+ public static class Permissions {
+ @SerializedName("checks")
+ String checks;
+ @SerializedName("members")
+ String members;
+ @SerializedName("emails")
+ String emails;
+
+ public Permissions(@Nullable String checks, @Nullable String members, @Nullable String emails) {
+ this.checks = checks;
+ this.members = members;
+ this.emails = emails;
+ }
+
+ public Permissions() {
+ // even if empty constructor is not required for Gson, it is strongly
+ // recommended:
+ // http://stackoverflow.com/a/18645370/229031
+ }
+
+ @CheckForNull
+ public String getMembers() {
+ return members;
+ }
+
+ @CheckForNull
+ public String getChecks() {
+ return checks;
+ }
+
+ @CheckForNull
+ public String getEmails() {
+ return emails;
+ }
+ }
+
public static class GsonRepositorySearch {
@SerializedName("total_count")
int totalCount;