Documentation
¶
Index ¶
- Constants
- func AsMap(s *Status) (map[string]any, error)
- func BadRequest(w http.ResponseWriter, err error) error
- func Encode(w http.ResponseWriter, status *Status) error
- func Forbidden(w http.ResponseWriter, err error) error
- func InternalError(w http.ResponseWriter, err error) error
- func MethodNotAllowed(w http.ResponseWriter, err error) error
- func NotAcceptable(w http.ResponseWriter, err error) error
- func NotFound(w http.ResponseWriter, err error) error
- func ServiceUnavailable(w http.ResponseWriter, err error) error
- func Unauthorized(w http.ResponseWriter, err error) error
- type Status
- type StatusReason
Constants ¶
View Source
const ( StatusSuccess = "Success" StatusFailure = "Failure" )
Values of Status.Status
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, err error) error
func InternalError ¶
func InternalError(w http.ResponseWriter, err error) error
func MethodNotAllowed ¶
func MethodNotAllowed(w http.ResponseWriter, err error) error
func NotAcceptable ¶
func NotAcceptable(w http.ResponseWriter, err error) error
func ServiceUnavailable ¶
func ServiceUnavailable(w http.ResponseWriter, err error) error
func Unauthorized ¶
func Unauthorized(w http.ResponseWriter, err error) error
Types ¶
type Status ¶
type Status struct {
Kind string `json:"kind,omitempty"`
APIVersion string `json:"apiVersion,omitempty"`
// Status of the operation.
// One of: "Success" or "Failure".
Status string `json:"status,omitempty"`
// A human-readable description of the status of this operation.
Message string `json:"message,omitempty"`
// A machine-readable description of why this operation is in the
// "Failure" status. If this value is empty there
// is no information available. A Reason clarifies an HTTP status
// code but does not override it.
Reason StatusReason `json:"reason,omitempty"`
// Suggested HTTP return code for this status, 0 if not set.
Code int `json:"code,omitempty"`
}
Status is a return value for calls that don't return other objects.
type StatusReason ¶
type StatusReason string
StatusReason is an enumeration of possible failure causes. Each StatusReason must map to a single HTTP status code, but multiple reasons may map to the same HTTP status code.
const ( // StatusReasonUnknown means the server has declined to indicate a specific reason. // Status code 500. StatusReasonUnknown StatusReason = "" // the user to present appropriate authorization credentials. // Status code 401 StatusReasonUnauthorized StatusReason = "Unauthorized" // StatusReasonForbidden means the server can be reached and understood the request, but refuses // to take any further action. // Status code 403 StatusReasonForbidden StatusReason = "Forbidden" // StatusReasonNotFound means one or more resources required for this operation // could not be found. // Status code 404 StatusReasonNotFound StatusReason = "NotFound" // StatusReasonConflict means the requested operation cannot be completed // due to a conflict in the operation. // Status code 409 StatusReasonConflict StatusReason = "Conflict" // StatusReasonGone means the item is no longer available at the server and no // forwarding address is known. // Status code 410 StatusReasonGone StatusReason = "Gone" // StatusReasonInvalid means the requested create or update operation cannot be // completed due to invalid data provided as part of the request. // Status code 422 StatusReasonInvalid StatusReason = "Invalid" // StatusReasonTimeout means that the request could not be completed within the given time. // Status code 504 StatusReasonTimeout StatusReason = "Timeout" // StatusReasonTooManyRequests means the server experienced too many requests within a // given window and that the client must wait to perform the action again. // Status code 429 StatusReasonTooManyRequests StatusReason = "TooManyRequests" // StatusReasonBadRequest means that the request itself was invalid, because the request // doesn't make any sense. // Status code 400 StatusReasonBadRequest StatusReason = "BadRequest" // StatusReasonMethodNotAllowed means that the action the client attempted to perform not supported. // Status code 405 StatusReasonMethodNotAllowed StatusReason = "MethodNotAllowed" // StatusReasonNotAcceptable means that the accept types indicated by the client were not acceptable // to the server. // Status code 406 StatusReasonNotAcceptable StatusReason = "NotAcceptable" // StatusReasonRequestEntityTooLarge means that the request entity is too large. // Status code 413 StatusReasonRequestEntityTooLarge StatusReason = "RequestEntityTooLarge" // StatusReasonUnsupportedMediaType means that the content type sent by the client is not acceptable. // Status code 415 StatusReasonUnsupportedMediaType StatusReason = "UnsupportedMediaType" StatusUnprocessableEntity StatusReason = "UnprocessableEntity" // StatusReasonInternalError indicates that an internal error occurred. // Status code 500 StatusReasonInternalError StatusReason = "InternalError" // but the requested service is unavailable at this time. // Status code 503 StatusReasonServiceUnavailable StatusReason = "ServiceUnavailable" )
Click to show internal directories.
Click to hide internal directories.