provisioner

package
v0.0.0-...-d3ccc4f Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort = 8929
)

Variables

View Source
var (

	// BadRequestError indicates invalid arguments.
	BadRequestError = StatusError{StatusCode: http.StatusBadRequest, /* contains filtered or unexported fields */}
	// InternalServerError indicates an unspecified error inside the server, perhaps a bug.
	InternalServerError = StatusError{StatusCode: http.StatusInternalServerError, /* contains filtered or unexported fields */}
)

Functions

func IsBadRequest

func IsBadRequest(err error) bool

IsBadRequest returns true if the given error is caused by a BadRequestError.

func IsInternalServer

func IsInternalServer(err error) bool

IsInternalServer returns true if the given error is caused by a InternalServerError.

func IsStatusError

func IsStatusError(err error) (int, bool)

IsStatusError returns the status code and true if the given error is caused by a StatusError.

func IsStatusErrorWithCode

func IsStatusErrorWithCode(err error, code int) bool

IsStatusErrorWithCode returns true if the given error is caused by a StatusError with given code.

func ParseResponseError

func ParseResponseError(r *http.Response, body []byte) error

ParseResponseError returns an error from given response. It tries to parse the body (if given body is nil, will be read from response) for ErrorResponse.

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 Info

type Info struct {
	NodeInfo
	Available int64 `json:"available"`
	Capacity  int64 `json:"capacity"`
}

Info holds information of a filesystem on a node.

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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