github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/pkg/api/handlers/compat/containers_unpause.go (about)

     1  package compat
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/containers/libpod/libpod"
     7  	"github.com/containers/libpod/pkg/api/handlers/utils"
     8  )
     9  
    10  func UnpauseContainer(w http.ResponseWriter, r *http.Request) {
    11  	runtime := r.Context().Value("runtime").(*libpod.Runtime)
    12  
    13  	// /{version}/containers/(name)/unpause
    14  	name := utils.GetName(r)
    15  	con, err := runtime.LookupContainer(name)
    16  	if err != nil {
    17  		utils.ContainerNotFound(w, name, err)
    18  		return
    19  	}
    20  
    21  	if err := con.Unpause(); err != nil {
    22  		utils.InternalServerError(w, err)
    23  		return
    24  	}
    25  
    26  	// Success
    27  	utils.WriteResponse(w, http.StatusNoContent, "")
    28  }