f-21: code: add vpc gestion in api
All checks were successful
Pre Release Workflow / set-release-target (push) Successful in 1s
Pre Release Workflow / build (agent, amd64, linux) (push) Successful in 1m33s
Pre Release Workflow / build (db, amd64, linux) (push) Successful in 1m30s
Pre Release Workflow / build (metacli, amd64, linux) (push) Successful in 1m30s
Pre Release Workflow / build (metadata, amd64, linux) (push) Successful in 1m31s
Pre Release Workflow / build (subnet, amd64, linux) (push) Successful in 1m31s
Pre Release Workflow / prerelease (push) Successful in 13s
Pre Release Workflow / build (dhcp, amd64, linux) (push) Successful in 1m28s
Pre Release Workflow / build (vpc, amd64, linux) (push) Successful in 1m30s
Pre Release Workflow / upload-scripts (run-dnsmasq-in-netns.sh) (push) Successful in 5s
All checks were successful
Pre Release Workflow / set-release-target (push) Successful in 1s
Pre Release Workflow / build (agent, amd64, linux) (push) Successful in 1m33s
Pre Release Workflow / build (db, amd64, linux) (push) Successful in 1m30s
Pre Release Workflow / build (metacli, amd64, linux) (push) Successful in 1m30s
Pre Release Workflow / build (metadata, amd64, linux) (push) Successful in 1m31s
Pre Release Workflow / build (subnet, amd64, linux) (push) Successful in 1m31s
Pre Release Workflow / prerelease (push) Successful in 13s
Pre Release Workflow / build (dhcp, amd64, linux) (push) Successful in 1m28s
Pre Release Workflow / build (vpc, amd64, linux) (push) Successful in 1m30s
Pre Release Workflow / upload-scripts (run-dnsmasq-in-netns.sh) (push) Successful in 5s
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
3955fb2112
commit
6dd21a465d
2 changed files with 26 additions and 7 deletions
|
|
@ -2,7 +2,11 @@ package agentapi
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"git.g3e.fr/syonad/two/internal/vpc"
|
||||
"git.g3e.fr/syonad/two/pkg/db/kv"
|
||||
)
|
||||
|
||||
func (s *Server) VpcsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -17,7 +21,7 @@ func (s *Server) VpcsHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Server) listVpcs(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *Server) listVpcs(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode([]VPC{})
|
||||
}
|
||||
|
|
@ -35,10 +39,11 @@ func (s *Server) postVpc(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
s.queue.Submit(func() {
|
||||
createVpc(req.Name)
|
||||
kv.AddInDB(s.db, "vpc/"+req.Name+"/state", "creating")
|
||||
if err := vpc.CreateVPC(s.db, req.Name); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
})
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
json.NewEncoder(w).Encode(VPC{Name: req.Name, State: "creating"})
|
||||
}
|
||||
|
||||
func createVpc(name string) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue