-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package handlers | ||
|
||
import ( | ||
"github.com/deis/workflow-manager-api/pkg/swagger/restapi/operations" | ||
"github.com/go-swagger/go-swagger/httpkit/middleware" | ||
) | ||
|
||
// Ping is the handler for the ping endpoint | ||
func Ping() middleware.Responder { | ||
return operations.NewPingOK() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package operations | ||
|
||
// This file was generated by the swagger tool. | ||
// Editing this file might prove futile when you re-run the generate command | ||
|
||
import ( | ||
"net/http" | ||
|
||
middleware "github.com/go-swagger/go-swagger/httpkit/middleware" | ||
) | ||
|
||
// PingHandlerFunc turns a function with the right signature into a ping handler | ||
type PingHandlerFunc func() middleware.Responder | ||
|
||
// Handle executing the request and returning a response | ||
func (fn PingHandlerFunc) Handle() middleware.Responder { | ||
return fn() | ||
} | ||
|
||
// PingHandler interface for that can handle valid ping params | ||
type PingHandler interface { | ||
Handle() middleware.Responder | ||
} | ||
|
||
// NewPing creates a new http.Handler for the ping operation | ||
func NewPing(ctx *middleware.Context, handler PingHandler) *Ping { | ||
return &Ping{Context: ctx, Handler: handler} | ||
} | ||
|
||
/*Ping swagger:route GET /ping ping | ||
ping the versions API server | ||
*/ | ||
type Ping struct { | ||
Context *middleware.Context | ||
Handler PingHandler | ||
} | ||
|
||
func (o *Ping) ServeHTTP(rw http.ResponseWriter, r *http.Request) { | ||
route, _ := o.Context.RouteInfo(r) | ||
|
||
if err := o.Context.BindValidRequest(r, route, nil); err != nil { // bind params | ||
o.Context.Respond(rw, r, route.Produces, route, err) | ||
return | ||
} | ||
|
||
res := o.Handler.Handle() // actually handle the request | ||
|
||
o.Context.Respond(rw, r, route.Produces, route, res) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package operations | ||
|
||
// This file was generated by the swagger tool. | ||
// Editing this file might prove futile when you re-run the swagger generate command | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/go-swagger/go-swagger/httpkit" | ||
) | ||
|
||
/*PingOK server ping success | ||
swagger:response pingOK | ||
*/ | ||
type PingOK struct { | ||
} | ||
|
||
// NewPingOK creates PingOK with default headers values | ||
func NewPingOK() *PingOK { | ||
return &PingOK{} | ||
} | ||
|
||
// WriteResponse to the client | ||
func (o *PingOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) { | ||
|
||
rw.WriteHeader(200) | ||
} | ||
|
||
/*PingDefault unexpected error | ||
swagger:response pingDefault | ||
*/ | ||
type PingDefault struct { | ||
_statusCode int | ||
} | ||
|
||
// NewPingDefault creates PingDefault with default headers values | ||
func NewPingDefault(code int) *PingDefault { | ||
if code <= 0 { | ||
code = 500 | ||
} | ||
|
||
return &PingDefault{ | ||
_statusCode: code, | ||
} | ||
} | ||
|
||
// WithStatusCode adds the status to the ping default response | ||
func (o *PingDefault) WithStatusCode(code int) *PingDefault { | ||
o._statusCode = code | ||
return o | ||
} | ||
|
||
// SetStatusCode sets the status to the ping default response | ||
func (o *PingDefault) SetStatusCode(code int) { | ||
o._statusCode = code | ||
} | ||
|
||
// WriteResponse to the client | ||
func (o *PingDefault) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) { | ||
|
||
rw.WriteHeader(o._statusCode) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters