-
Notifications
You must be signed in to change notification settings - Fork 173
/
ReleaseWebHookHelper.java
54 lines (47 loc) · 1.7 KB
/
ReleaseWebHookHelper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package hudson.plugins.tfs.rm;
import hudson.plugins.tfs.JenkinsEventNotifier;
import hudson.plugins.tfs.TeamPluginGlobalConfig;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
/**
*
* @author Kalyan
*/
public final class ReleaseWebHookHelper {
private ReleaseWebHookHelper() {
}
/**
* Gets the release webHook configuration from global config.
* @return list of release webHook
*/
public static List<ReleaseWebHook> getReleaseWebHookConfigurations() {
final TeamPluginGlobalConfig config = TeamPluginGlobalConfig.get();
if (config == null) {
throw new InternalError("Cannot load TFS global configuration");
}
return config.getReleaseWebHookConfigurations();
}
/**
* Saves the release webHooks with the global config.
* @param releaseWebHooks
*/
public static void saveReleaseWebHookConfigurations(final List<ReleaseWebHook> releaseWebHooks) {
final TeamPluginGlobalConfig config = TeamPluginGlobalConfig.get();
if (config == null) {
throw new InternalError("Cannot load TFS global configuration");
}
config.setReleaseWebHookConfigurations(releaseWebHooks);
config.save();
}
/**
* Gets the payload signature for the given event payload.
* @param secret
* @param payload
* @return
*/
public static String getPayloadSignature(final String secret, final String payload) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
return JenkinsEventNotifier.getPayloadSignature(secret, payload);
}
}