summaryrefslogtreecommitdiff
path: root/pkg/api/server/register_healthcheck.go
blob: 4e2d4059a23d3afe4673e84ee6909f59115f8495 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package server

import (
	"net/http"

	"github.com/containers/podman/v4/pkg/api/handlers/libpod"
	"github.com/gorilla/mux"
)

func (s *APIServer) registerHealthCheckHandlers(r *mux.Router) error {
	// swagger:operation GET /libpod/containers/{name}/healthcheck libpod ContainerHealthcheckLibpod
	// ---
	// tags:
	//  - containers
	// summary: Run a container's healthcheck
	// description: Execute the defined healthcheck and return information about the results
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: the name or ID of the container
	// produces:
	// - application/json
	// responses:
	//   200:
	//     $ref: "#/responses/healthCheck"
	//   404:
	//     $ref: "#/responses/containerNotFound"
	//   409:
	//     description: container has no healthcheck or is not running
	//   500:
	//     $ref: '#/responses/internalError'
	r.Handle(VersionedPath("/libpod/containers/{name:.*}/healthcheck"), s.APIHandler(libpod.RunHealthCheck)).Methods(http.MethodGet)
	return nil
}