Documentation ¶
Index ¶
- func EnsureNumber(field string, value string) (int64, error)
- func EnsurePositiveNumber(field string, value string) (int64, error)
- func PostError(ctx context.Context, w http.ResponseWriter, err error)
- func PostErrorIf(ctx context.Context, w http.ResponseWriter, err error)
- type Error
- func NewErrBadMatchType(match string) *Error
- func NewErrBladeNotFound(rackId string, bladeId int64) *Error
- func NewErrInvalidNumber(field string, value string) *Error
- func NewErrInvalidPositiveNumber(field string, value string) *Error
- func NewErrInvalidRateRequest() *Error
- func NewErrInvalidStepperMode(mode string) *Error
- func NewErrInvalidStepperRate(rate string) *Error
- func NewErrNoLoginActive(name string) *Error
- func NewErrNoSessionActive() *Error
- func NewErrPduNotFound(rackId string, pduID int64) *Error
- func NewErrRackNotFound(name string) *Error
- func NewErrRegionNotFound(name string) *Error
- func NewErrSessionNotFound(id int64) *Error
- func NewErrStepperFailedToSetPolicy() *Error
- func NewErrTorNotFound(rackId string, torID int64) *Error
- func NewErrUserAlreadyExists(name string) *Error
- func NewErrUserInvalidOperation(op string, user string) *Error
- func NewErrUserNotFound(name string) *Error
- func NewErrUserPermissionDenied() *Error
- func NewErrUserProtected(name string) *Error
- func NewErrUserStaleVersion(name string) *Error
- func NewErrZoneNotFound(name string) *Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureNumber ¶
EnsureNumber is a helper function that takes a query value as a string, and converts it. If this fails, it returns the appropriate Error.
func EnsurePositiveNumber ¶
EnsurePositiveNumber is a helper function that takes a query value as a string, converts it, and range checks it. If any of those operations fail it returns the appropriate Error.
func PostError ¶
func PostError(ctx context.Context, w http.ResponseWriter, err error)
PostError sets the appropriate http error, and logs it to the tracing system.
func PostErrorIf ¶
func PostErrorIf(ctx context.Context, w http.ResponseWriter, err error)
PostErrorIf sets and traces the http error, if there is one.
Types ¶
type Error ¶
Error is a custom common HTTP error type that includes the status code to use in a response.
func NewErrBadMatchType ¶
NewErrBadMatchType indicates that the If-Match value was syntactically incorrect, and could not be processed
func NewErrBladeNotFound ¶
NewErrBladeNotFound indicates that the rack was found but no blade was found
func NewErrInvalidNumber ¶
NewErrInvalidNumber indicates that the specified value could not be processed as a number.
func NewErrInvalidPositiveNumber ¶
NewErrInvalidPositiveNumber indicates that the specified value could not be processed as a positive number.
func NewErrInvalidRateRequest ¶
func NewErrInvalidRateRequest() *Error
NewErrInvalidRateRequest indicates that the automatic ticks-per-second rate was present, but the selected policy mode was not 'automatic'.
func NewErrInvalidStepperMode ¶
NewErrInvalidStepperMode indicates that an unrecognized simulated policy mode was requested.
func NewErrInvalidStepperRate ¶
NewErrInvalidStepperRate indicates that the supplied ticks-per-second rate was not recognized as a valid number.
func NewErrNoLoginActive ¶
NewErrNoLoginActive indicates that the specified user is not logged into this session
func NewErrNoSessionActive ¶
func NewErrNoSessionActive() *Error
NewErrNoSessionActive indicates that the request was made without first establishing a logged-in session
func NewErrPduNotFound ¶
NewErrPduNotFound indicates that the rack was found but no pdu was found
func NewErrRackNotFound ¶
NewErrRackNotFound indicates the specified rack do not exist and the http request (http.statusNotFound) determines to be the request was made against a non-existing rack.
func NewErrRegionNotFound ¶
NewErrRegionNotFound indicates the specified region does not exist and the http request (http.statusNotFound) determines to be the request was made against a non-existing region.
func NewErrSessionNotFound ¶
NewErrSessionNotFound creates an HTTP error indicating that the requested session ID was not found amongst the active sessions.
func NewErrStepperFailedToSetPolicy ¶
func NewErrStepperFailedToSetPolicy() *Error
NewErrStepperFailedToSetPolicy indicates that an error occurred while setting the new policy. This most likely is due to an ETag mismatch.
func NewErrTorNotFound ¶
NewErrTorNotFound indicates that the rack was found but no tor was found
func NewErrUserAlreadyExists ¶
NewErrUserAlreadyExists indicates the specified user account was previously created and the request was determined to be a duplicate Create request.
func NewErrUserInvalidOperation ¶
NewErrUserInvalidOperation indicates the operation requested for the supplied user account is invalid in some way, likely a non-existent operation code.
func NewErrUserNotFound ¶
NewErrUserNotFound indicates the specified user account was determined to not exist (i.e. the search succeeded but no record was found)
func NewErrUserPermissionDenied ¶
func NewErrUserPermissionDenied() *Error
NewErrUserPermissionDenied indicates the user does not have the appropriate permissions for the requested operation.
func NewErrUserProtected ¶
NewErrUserProtected indicates that the user entry may not be deleted.
func NewErrUserStaleVersion ¶
NewErrUserStaleVersion indicates that an operation against the specified user expected a different revision number than was found
func NewErrZoneNotFound ¶
NewErrZoneNotFound indicates the specified zone does not exist and the http request (http.statusNotFound) determines to be the request was made against a non-existing zone.
func (*Error) StatusCode ¶
StatusCode is used to extract a status from a standard Error