github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/bindings/containers/healthcheck.go (about) 1 package containers 2 3 import ( 4 "context" 5 "net/http" 6 7 "github.com/hanks177/podman/v4/libpod/define" 8 "github.com/hanks177/podman/v4/pkg/bindings" 9 ) 10 11 // RunHealthCheck executes the container's healthcheck and returns the health status of the 12 // container. 13 func RunHealthCheck(ctx context.Context, nameOrID string, options *HealthCheckOptions) (*define.HealthCheckResults, error) { 14 if options == nil { 15 options = new(HealthCheckOptions) 16 } 17 _ = options 18 conn, err := bindings.GetClient(ctx) 19 if err != nil { 20 return nil, err 21 } 22 var ( 23 status define.HealthCheckResults 24 ) 25 response, err := conn.DoRequest(ctx, nil, http.MethodGet, "/containers/%s/healthcheck", nil, nil, nameOrID) 26 if err != nil { 27 return nil, err 28 } 29 defer response.Body.Close() 30 31 return &status, response.Process(&status) 32 }