rest

package
v17.10.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBackend

func AddBackend(w http.ResponseWriter, r *http.Request)

func AddGeneric

func AddGeneric(
	w http.ResponseWriter,
	r *http.Request,
	response addResponse,
	add func([]byte),
)

func AddStorageClass

func AddStorageClass(w http.ResponseWriter, r *http.Request)

func AddVolume

func AddVolume(w http.ResponseWriter, r *http.Request)

func DeleteBackend

func DeleteBackend(w http.ResponseWriter, r *http.Request)

DeleteBackend calls OfflineBackend in the orchestrator, as we currently do not allow for full deletion of backends due to the potential for race conditions and the additional bookkeeping that would be required.

func DeleteGeneric

func DeleteGeneric(
	w http.ResponseWriter, r *http.Request, d deleteFunc, varName string,
)

func DeleteStorageClass

func DeleteStorageClass(w http.ResponseWriter, r *http.Request)

func DeleteVolume

func DeleteVolume(w http.ResponseWriter, r *http.Request)

func GetBackend

func GetBackend(w http.ResponseWriter, r *http.Request)

func GetGeneric

func GetGeneric(w http.ResponseWriter,
	r *http.Request,
	varName string,
	response interface{},
	get func(string) int,
)

func GetGenericNoArg

func GetGenericNoArg(w http.ResponseWriter,
	r *http.Request,
	response interface{},
	get func() int,
)

func GetStorageClass

func GetStorageClass(w http.ResponseWriter, r *http.Request)

func GetVersion

func GetVersion(w http.ResponseWriter, r *http.Request)

func GetVolume

func GetVolume(w http.ResponseWriter, r *http.Request)

func ListBackends

func ListBackends(w http.ResponseWriter, r *http.Request)

func ListGeneric

func ListGeneric(
	w http.ResponseWriter,
	r *http.Request,
	response listResponse,
	lister func() []string,
)

func ListStorageClasses

func ListStorageClasses(w http.ResponseWriter, r *http.Request)

func ListVolumes

func ListVolumes(w http.ResponseWriter, r *http.Request)

func Logger

func Logger(inner http.Handler, name string) http.Handler

func NewRouter

func NewRouter() *mux.Router

Types

type APIServer

type APIServer struct {
	// contains filtered or unexported fields
}

func NewAPIServer

func NewAPIServer(p core.Orchestrator, address, port string) *APIServer

func (*APIServer) Activate

func (s *APIServer) Activate() error

func (*APIServer) Deactivate

func (s *APIServer) Deactivate() error

func (*APIServer) GetName

func (s *APIServer) GetName() string

func (*APIServer) Version

func (s *APIServer) Version() string

type AddBackendResponse

type AddBackendResponse struct {
	BackendID string `json:"backend"`
	Error     string `json:"error,omitempty"`
}

type AddStorageClassResponse

type AddStorageClassResponse struct {
	StorageClassID string `json:"storageClass"`
	Error          string `json:"error,omitempty"`
}

type AddVolumeResponse

type AddVolumeResponse struct {
	BackendID string `json:"backend"`
	Error     string `json:"error,omitempty"`
}

type DeleteResponse

type DeleteResponse struct {
	Error string `json:"error,omitempty"`
}

type FakeTridentClient

type FakeTridentClient struct {
	// contains filtered or unexported fields
}

func NewFakeTridentClient

func NewFakeTridentClient(failMatrix map[string]bool) *FakeTridentClient

func (*FakeTridentClient) AddStorageClass

func (client *FakeTridentClient) AddStorageClass(storageClassConfig *storage_class.Config) (*AddStorageClassResponse, error)

func (*FakeTridentClient) AddVolume

func (client *FakeTridentClient) AddVolume(volConfig *storage.VolumeConfig) (*AddVolumeResponse, error)

func (*FakeTridentClient) Configure

func (client *FakeTridentClient) Configure(ip string, port, timeout int) Interface

func (*FakeTridentClient) Delete

func (client *FakeTridentClient) Delete(endpoint string) (*http.Response, error)

func (*FakeTridentClient) DeleteVolume

func (client *FakeTridentClient) DeleteVolume(volName string) (*DeleteResponse, error)

func (*FakeTridentClient) Get

func (client *FakeTridentClient) Get(endpoint string) (*http.Response, error)

func (*FakeTridentClient) GetBackend

func (client *FakeTridentClient) GetBackend(backendID string) (*GetBackendResponse, error)

func (*FakeTridentClient) GetVolume

func (client *FakeTridentClient) GetVolume(volName string) (*GetVolumeResponse, error)

func (*FakeTridentClient) ListBackends

func (client *FakeTridentClient) ListBackends() (*ListBackendsResponse, error)

func (*FakeTridentClient) Post

func (client *FakeTridentClient) Post(endpoint string, body io.Reader) (*http.Response, error)

func (*FakeTridentClient) PostBackend

func (client *FakeTridentClient) PostBackend(backendFile string) (*AddBackendResponse, error)

type GetBackendResponse

type GetBackendResponse struct {
	Backend *storage.StorageBackendExternal `json:"backend"`
	Error   string                          `json:"error,omitempty"`
}

type GetStorageClassResponse

type GetStorageClassResponse struct {
	StorageClass *storage_class.StorageClassExternal `json:"storageClass"`
	Error        string                              `json:"error,omitempty"`
}

type GetVersionResponse

type GetVersionResponse struct {
	Version string `json:"version"`
	Error   string `json:"error,omitempty"`
}

type GetVolumeResponse

type GetVolumeResponse struct {
	Volume *storage.VolumeExternal `json:"volume"`
	Error  string                  `json:"error,omitempty"`
}

type Interface

type Interface interface {
	RESTInterface
	Configure(ip string, port, timeout int) Interface
	GetBackend(backendID string) (*GetBackendResponse, error)
	PostBackend(backendFile string) (*AddBackendResponse, error)
	ListBackends() (*ListBackendsResponse, error)
	AddStorageClass(storageClassConfig *storage_class.Config) (*AddStorageClassResponse, error)
	GetVolume(volName string) (*GetVolumeResponse, error)
	AddVolume(volConfig *storage.VolumeConfig) (*AddVolumeResponse, error)
	DeleteVolume(volName string) (*DeleteResponse, error)
}

type ListBackendsResponse

type ListBackendsResponse struct {
	Backends []string `json:"backends"`
	Error    string   `json:"error,omitempty"`
}

type ListStorageClassesResponse

type ListStorageClassesResponse struct {
	StorageClasses []string `json:"storageClasses"`
	Error          string   `json:"error,omitempty"`
}

type ListVolumesResponse

type ListVolumesResponse struct {
	Volumes []string `json:"volumes"`
	Error   string   `json:"error,omitempty"`
}

type RESTInterface

type RESTInterface interface {
	Get(endpoint string) (*http.Response, error)
	Post(endpoint string, body io.Reader) (*http.Response, error)
	Delete(endpoint string) (*http.Response, error)
}

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

type Routes

type Routes []Route

type TridentClient

type TridentClient struct {
	// contains filtered or unexported fields
}

func NewTridentClient

func NewTridentClient(ip string, port, timeout int) *TridentClient

func (*TridentClient) AddStorageClass

func (client *TridentClient) AddStorageClass(storageClassConfig *storage_class.Config) (*AddStorageClassResponse, error)

func (*TridentClient) AddVolume

func (client *TridentClient) AddVolume(volConfig *storage.VolumeConfig) (*AddVolumeResponse, error)

func (*TridentClient) Configure

func (client *TridentClient) Configure(ip string, port, timeout int) Interface

func (*TridentClient) Delete

func (client *TridentClient) Delete(endpoint string) (*http.Response, error)

func (*TridentClient) DeleteVolume

func (client *TridentClient) DeleteVolume(volName string) (*DeleteResponse, error)

func (*TridentClient) Get

func (client *TridentClient) Get(endpoint string) (*http.Response, error)

func (*TridentClient) GetBackend

func (client *TridentClient) GetBackend(backendID string) (*GetBackendResponse, error)

func (*TridentClient) GetVolume

func (client *TridentClient) GetVolume(volName string) (*GetVolumeResponse, error)

func (*TridentClient) ListBackends

func (client *TridentClient) ListBackends() (*ListBackendsResponse, error)

func (*TridentClient) Post

func (client *TridentClient) Post(endpoint string, body io.Reader) (*http.Response, error)

func (*TridentClient) PostBackend

func (client *TridentClient) PostBackend(backendFile string) (*AddBackendResponse, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL