f-21: code: ajout d'un system de worker
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
e1f7676093
commit
8637c33bd8
8 changed files with 87 additions and 14 deletions
|
|
@ -6,7 +6,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
func VpcByNameHandler(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *Server) VpcByNameHandler(w http.ResponseWriter, r *http.Request) {
|
||||
name := strings.TrimPrefix(r.URL.Path, "/vpcs/")
|
||||
if name == "" {
|
||||
http.NotFound(w, r)
|
||||
|
|
@ -18,8 +18,13 @@ func VpcByNameHandler(w http.ResponseWriter, r *http.Request) {
|
|||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(map[string]string{"name": name})
|
||||
case http.MethodDelete:
|
||||
s.queue.Submit(func() {
|
||||
deleteVpc(name)
|
||||
})
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
default:
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
}
|
||||
}
|
||||
|
||||
func deleteVpc(name string) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue