-
-
Save erikh/53c5b5d502d7f9f19932f20aa8803a61 to your computer and use it in GitHub Desktop.
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
package api | |
import ( | |
"net/http" | |
"github.com/contiv/volplugin/config" | |
"github.com/gorilla/mux" | |
) | |
// HTTP is a generic interface to HTTP calls. Used by the other interfaces. | |
type HTTP interface { | |
Router() *mux.Router | |
HTTPError(http.ResponseWriter, error) // note that it is expected that anything that calls this returns immediately afterwards. | |
} | |
// CRUDHandler is the request handler for CRUD operations. | |
type CRUDHandler interface { | |
Create(http.ResponseWriter, *http.Request) | |
Remove(http.ResponseWriter, *http.Request) | |
Get(http.ResponseWriter, *http.Request) | |
Path(http.ResponseWriter, *http.Request) | |
List(http.ResponseWriter, *http.Request) | |
} | |
// MountHandler is the request handler for Mount operations. | |
type MountHandler interface { | |
Mount(http.ResponseWriter, *http.Request) | |
Unmount(http.ResponseWriter, *http.Request) | |
} | |
// Volplugin is the interface that volplugin needs to provide to the clients | |
// (docker/k8s/mesos). | |
type Volplugin interface { | |
HTTP | |
ReadCreate(*http.Request) (config.Volume, error) | |
WriteCreate(config.Volume, http.ResponseWriter) error | |
WriteList([]string, http.ResponseWriter) error | |
ReadGet(*http.Request) (string, error) | |
WriteGet(config.Volume, http.ResponseWriter) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment