public RequestBootstrapModule(IConfiguration config, IRootPathProvider pathProvider, ILogFactory log, IBootstrapController bootstrap) { this._pathProvider = pathProvider; this._cfg = config; this._logger = log.NewScope <RequestBootstrapModule>("RequestBootstrapModule"); //this._sess = sess; this._controller = bootstrap; this.Get[UrlPrefixBootstrap + "/new", true] = async(x, ct) => { NewBootstrapRequest req = new NewBootstrapRequest() { }; NewBootstrapReqResponse ret = await _controller.CreateNewBootstrapRequestAsync(req); return(this.Response.AsJson(ret)); }; this.Get[UrlPrefixBootstrap + "/get/{requestId}", true] = async(x, ct) => { GetBootstrapRequest req = new GetBootstrapRequest() { RequestId = x.requestId }; GetBootstrapReqResponse ret = await _controller.GetBootstrapRequestAsync(req); return(this.Response.AsJson(ret)); }; }
public async Task <NewBootstrapReqResponse> CreateNewBootstrapRequestAsync(NewBootstrapRequest req) { // Do some prevalidation based on the request // Create new request ID, defaults // Save to DB // Trigger authentication request? var ret = new NewBootstrapReqResponse(); var reqItem = new SecureBootstrap.Data.BootstrapRequest() { RequestId = System.Guid.NewGuid(), ClusterName = req.ClusterName, NodeName = req.NodeName, MachineId = req.MachineId, }; var obj = this.db.PutRequest(reqItem); return(ret); }