Documentation
¶
Index ¶
- Constants
- Variables
- func IsBadRequest(err error) bool
- func IsInternalServer(err error) bool
- func IsStatusError(err error) (int, bool)
- func IsStatusErrorWithCode(err error, code int) bool
- func ParseResponseError(r *goHttp.Response, body []byte) error
- type API
- type ErrorResponse
- type Info
- type NodeInfo
- type Request
- type StatusError
Constants ¶
View Source
const (
DefaultPort = 8929
)
Variables ¶
View Source
var ( // BadRequestError indicates invalid arguments. BadRequestError = StatusError{StatusCode: goHttp.StatusBadRequest, /* contains filtered or unexported fields */} // InternalServerError indicates an unspecified error inside the server, perhaps a bug. InternalServerError = StatusError{StatusCode: goHttp.StatusInternalServerError, /* contains filtered or unexported fields */} )
Functions ¶
func IsBadRequest ¶
IsBadRequest returns true if the given error is caused by a BadRequestError.
func IsInternalServer ¶
IsInternalServer returns true if the given error is caused by a InternalServerError.
func IsStatusError ¶
IsStatusError returns the status code and true if the given error is caused by a StatusError.
func IsStatusErrorWithCode ¶
IsStatusErrorWithCode returns true if the given error is caused by a StatusError with given code.
Types ¶
type API ¶
type API interface {
// GetNodeInfo fetches information from the current node.
GetNodeInfo(ctx context.Context) (NodeInfo, error)
// GetInfo fetches information from the filesystem containing
// the given local path on the current node.
GetInfo(ctx context.Context, localPath string) (Info, error)
// Prepare a volume at the given local path
Prepare(ctx context.Context, localPath string) error
// Remove a volume with the given local path
Remove(ctx context.Context, localPath string) error
}
API of the provisioner
type ErrorResponse ¶
type ErrorResponse struct {
Error string
}
type NodeInfo ¶
type NodeInfo struct {
NodeName string `json:"nodeName"`
}
NodeInfo holds information of a node.
type Request ¶
type Request struct {
LocalPath string `json:"localPath"`
}
Request body for API HTTP requests.
type StatusError ¶
type StatusError struct {
StatusCode int
// contains filtered or unexported fields
}
func (StatusError) Error ¶
func (e StatusError) Error() string
Click to show internal directories.
Click to hide internal directories.