github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/api/handlers/compat/containers_unpause.go (about)

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