public BootstrapResponse bootstrap(Identity sender, BootstrapRequest request) {
String endpoint = request.getEndpointName();
final BootstrapSession session = this.sessionManager.begin(endpoint, sender);
if (!session.isAuthorized()) {
this.sessionManager.failed(session, UNAUTHORIZED, null);
return BootstrapResponse.badRequest("Unauthorized");
}
final BootstrapConfig cfg = store.getBootstrap(endpoint, sender);
if (cfg == null) {
LOG.debug("No bootstrap config for {}", endpoint);
this.sessionManager.failed(session, NO_BOOTSTRAP_CONFIG, null);
return BootstrapResponse.badRequest("no bootstrap config");
}
e.execute(new Runnable() {
@Override
public void run() {
sendDelete(session, cfg);
}
});
return BootstrapResponse.success();
}