34
34
import jenkins .model .Jenkins ;
35
35
import org .apache .commons .lang3 .StringUtils ;
36
36
import org .jenkinsci .plugins .plaincredentials .StringCredentials ;
37
+ import org .kohsuke .accmod .Restricted ;
38
+ import org .kohsuke .accmod .restrictions .Beta ;
37
39
38
40
/**
39
41
* The implementation represents an endpoint configuration to be used in
@@ -86,6 +88,15 @@ public interface BitbucketEndpoint extends Describable<BitbucketEndpoint> {
86
88
*/
87
89
boolean isManageHooks ();
88
90
91
+ /**
92
+ * Sets if Jenkins is supposed to auto-manage hooks for this end-point.
93
+ *
94
+ * @param manageHooks if Jenkins must auto-manage hooks registration.
95
+ * @param credentialsId credentialsId to use with rights to create or update web
96
+ * hook for Bitbucket repositories.
97
+ */
98
+ void setManageHooks (boolean manageHooks , @ CheckForNull String credentialsId );
99
+
89
100
/**
90
101
* Returns the {@link StandardUsernamePasswordCredentials#getId()} of the
91
102
* credentials to use for auto-management of hooks.
@@ -106,14 +117,30 @@ public interface BitbucketEndpoint extends Describable<BitbucketEndpoint> {
106
117
@ NonNull
107
118
String getEndpointJenkinsRootURL ();
108
119
120
+ /**
121
+ * Returns if the should or not verify incoming web hook payload from this
122
+ * endpoint.
123
+ *
124
+ * @apiNote This method is under development so could be moved to an interface
125
+ * dedicated to webhooks implementation
126
+ *
127
+ * @return the {@code true} if the web hook implementation configured for this
128
+ * endpoint should or not verify web hook payload that could be signed
129
+ * or crypted.
130
+ */
131
+ @ Restricted (Beta .class )
109
132
boolean isEnableHookSignature ();
110
133
111
134
/**
112
- * The {@link StringCredentials#getId()} of the credentials to use to verify
113
- * the signature of hooks.
135
+ * The {@link StringCredentials#getId()} of the credentials to use to verify the
136
+ * signature of hooks.
137
+ *
138
+ * @apiNote This method is under development so could be moved to an interface
139
+ * dedicated to webhooks implementation
114
140
*
115
141
* @return the configured credentials identifier to use
116
142
*/
143
+ @ Restricted (Beta .class )
117
144
@ CheckForNull
118
145
String getHookSignatureCredentialsId ();
119
146
@@ -133,10 +160,15 @@ default StandardCredentials credentials() {
133
160
}
134
161
135
162
/**
136
- * Looks up the {@link StringCredentials} to use to verify the signature of hooks.
163
+ * Looks up the {@link StringCredentials} to use to verify the signature of
164
+ * hooks.
165
+ *
166
+ * @apiNote This method is under development so could be moved to an interface
167
+ * dedicated to webhook provider
137
168
*
138
169
* @return the credentials or {@code null}.
139
170
*/
171
+ @ Restricted (Beta .class )
140
172
@ CheckForNull
141
173
default StringCredentials hookSignatureCredentials () {
142
174
String credentialsId = Util .fixEmptyAndTrim (getHookSignatureCredentialsId ());
0 commit comments