github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/pkg/api/server/register_events.go (about)

     1  package server
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/containers/libpod/pkg/api/handlers/compat"
     7  	"github.com/gorilla/mux"
     8  )
     9  
    10  func (s *APIServer) registerEventsHandlers(r *mux.Router) error {
    11  	// swagger:operation GET /events system getEvents
    12  	// ---
    13  	// tags:
    14  	//   - system (compat)
    15  	// summary: Get events
    16  	// description: Returns events filtered on query parameters
    17  	// produces:
    18  	// - application/json
    19  	// parameters:
    20  	// - name: since
    21  	//   type: string
    22  	//   in: query
    23  	//   description: start streaming events from this time
    24  	// - name: until
    25  	//   type: string
    26  	//   in: query
    27  	//   description: stop streaming events later than this
    28  	// - name: filters
    29  	//   type: string
    30  	//   in: query
    31  	//   description: JSON encoded map[string][]string of constraints
    32  	// responses:
    33  	//   200:
    34  	//     description: returns a string of json data describing an event
    35  	//   500:
    36  	//     "$ref": "#/responses/InternalError"
    37  	r.Handle(VersionedPath("/events"), s.APIHandler(compat.GetEvents)).Methods(http.MethodGet)
    38  	// Added non version path to URI to support docker non versioned paths
    39  	r.Handle("/events", s.APIHandler(compat.GetEvents)).Methods(http.MethodGet)
    40  	// swagger:operation GET /libpod/events system libpodGetEvents
    41  	// ---
    42  	// tags:
    43  	//   - system
    44  	// summary: Get events
    45  	// description: Returns events filtered on query parameters
    46  	// produces:
    47  	// - application/json
    48  	// parameters:
    49  	// - name: since
    50  	//   type: string
    51  	//   in: query
    52  	//   description: start streaming events from this time
    53  	// - name: until
    54  	//   type: string
    55  	//   in: query
    56  	//   description: stop streaming events later than this
    57  	// - name: filters
    58  	//   type: string
    59  	//   in: query
    60  	//   description: JSON encoded map[string][]string of constraints
    61  	// responses:
    62  	//   200:
    63  	//     description: returns a string of json data describing an event
    64  	//   500:
    65  	//     "$ref": "#/responses/InternalError"
    66  	r.Handle(VersionedPath("/libpod/events"), s.APIHandler(compat.GetEvents)).Methods(http.MethodGet)
    67  	return nil
    68  }