Documentation ¶
Index ¶
- Constants
- func IsFailureResponse(statusCode int) bool
- func IsInvalidVersionError(err error) bool
- func IsResourceAlreadyExistsError(err error) bool
- func IsResourceDownError(err error) bool
- func IsResourceInvalidCredentialsError(err error) bool
- func IsResourceNotFoundError(err error) bool
- func IsResourceUpError(err error) bool
- func IsServerError(err error) bool
- func IsServerErrorWithReason(err error, reason string) bool
- func IsStatus(statusCode int, responseBody string) (bool, error)
- func IsStatusAndReason(statusCode int, reason, responseBody string) (bool, error)
- func IsStatusAndReasonWithRawBody(statusCode int, reason string, resBody *io.ReadCloser) (bool, error)
- func IsStatusConditionFalse(responseBody *io.ReadCloser) (bool, error)
- func IsStatusConditionTrue(responseBody *io.ReadCloser) (bool, error)
- func IsStatusData(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceAlreadyExists(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceCreated(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceDeleted(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceDown(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceInvalidCredentials(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceNotFound(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceStarted(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceStopped(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceUp(responseBody *io.ReadCloser) (bool, error)
- func IsStatusResourceUpdated(responseBody *io.ReadCloser) (bool, error)
- func IsStatusWithRawBody(statusCode int, resBody *io.ReadCloser) (bool, error)
- func IsStatusWrongInput(responseBody *io.ReadCloser) (bool, error)
- func IsStatusWrongInputWithReason(responseBody *io.ReadCloser, reason string) (bool, error)
- func IsSuccessResponse(statusCode int) bool
- func IsUserError(err error) bool
- func IsWrongInputError(err error) bool
- func IsWrongInputWithReasonError(err error, reason string) bool
- func NewResponseError(resp *Response) error
- func ParseData(resBody *io.ReadCloser, v interface{}) error
- type Response
- func FromHTTPResponse(resp *http.Response, err error) (*Response, error)
- func NewEmptyResponse(statusCode int, statusText string) *Response
- func NewResponse(statusCode int, statusText string, data interface{}) (*Response, error)
- func ParseResponse(resBody *io.ReadCloser) (*Response, error)
- func StatusConditionFalse() *Response
- func StatusConditionTrue() *Response
- func StatusInvalidVersion() *Response
- func StatusResourceAlreadyExists() *Response
- func StatusResourceCreated() *Response
- func StatusResourceDeleted() *Response
- func StatusResourceDown() *Response
- func StatusResourceInvalidCredentials() *Response
- func StatusResourceNotFound() *Response
- func StatusResourceStarted() *Response
- func StatusResourceStopped() *Response
- func StatusResourceUp() *Response
- func StatusResourceUpdated() *Response
- func StatusServerErrorWithReason(reason string) *Response
- func StatusUserErrorWithReason(reason string) *Response
- func StatusWrongInput() *Response
- func StatusWrongInputWithReason(reason string) *Response
- type ResponseError
- type ResponsePayload
- type ServerResponse
Constants ¶
View Source
const ( STATUS_CODE_DATA = 10000 STATUS_CODE_RESOURCE_UP = 10001 STATUS_CODE_RESOURCE_DOWN = 10002 STATUS_CODE_RESOURCE_CREATED = 10003 STATUS_CODE_RESOURCE_STARTED = 10004 STATUS_CODE_RESOURCE_STOPPED = 10005 STATUS_CODE_RESOURCE_UPDATED = 10006 STATUS_CODE_RESOURCE_DELETED = 10007 STATUS_CODE_RESOURCE_NOT_FOUND = 10008 STATUS_CODE_RESOURCE_ALREADY_EXISTS = 10009 STATUS_CODE_RESOURCE_INVALID_CREDENTIALS = 10010 STATUS_CODE_CONDITION_TRUE = 10011 STATUS_CODE_CONDITION_FALSE = 10012 STATUS_CODE_WRONG_INPUT = 10013 STATUS_CODE_USER_ERROR = 10014 STATUS_CODE_SERVER_ERROR = 10015 STATUS_CODE_INVALID_VERSION_ERROR = 10016 STATUS_CODE_ACCOUNT_INACTIVE = 10017 )
Variables ¶
This section is empty.
Functions ¶
func IsFailureResponse ¶
func IsInvalidVersionError ¶
func IsResourceDownError ¶
func IsResourceNotFoundError ¶
func IsResourceUpError ¶
func IsServerError ¶
func IsServerErrorWithReason ¶
func IsStatusAndReason ¶
func IsStatusConditionFalse ¶
func IsStatusConditionFalse(responseBody *io.ReadCloser) (bool, error)
func IsStatusConditionTrue ¶
func IsStatusConditionTrue(responseBody *io.ReadCloser) (bool, error)
func IsStatusData ¶
func IsStatusData(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceAlreadyExists ¶
func IsStatusResourceAlreadyExists(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceCreated ¶
func IsStatusResourceCreated(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceDeleted ¶
func IsStatusResourceDeleted(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceDown ¶
func IsStatusResourceDown(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceInvalidCredentials ¶
func IsStatusResourceInvalidCredentials(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceNotFound ¶
func IsStatusResourceNotFound(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceStarted ¶
func IsStatusResourceStarted(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceStopped ¶
func IsStatusResourceStopped(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceUp ¶
func IsStatusResourceUp(responseBody *io.ReadCloser) (bool, error)
func IsStatusResourceUpdated ¶
func IsStatusResourceUpdated(responseBody *io.ReadCloser) (bool, error)
func IsStatusWithRawBody ¶
func IsStatusWithRawBody(statusCode int, resBody *io.ReadCloser) (bool, error)
func IsStatusWrongInput ¶
func IsStatusWrongInput(responseBody *io.ReadCloser) (bool, error)
func IsStatusWrongInputWithReason ¶
func IsStatusWrongInputWithReason(responseBody *io.ReadCloser, reason string) (bool, error)
func IsSuccessResponse ¶
func IsUserError ¶
func IsWrongInputError ¶
func NewResponseError ¶
func ParseData ¶
func ParseData(resBody *io.ReadCloser, v interface{}) error
Types ¶
type Response ¶
type Response struct { StatusCode int `json:"status_code"` StatusText string `json:"status_text"` Data json.RawMessage `json:"data,omitempty"` }
func NewEmptyResponse ¶
func NewResponse ¶
func ParseResponse ¶
func ParseResponse(resBody *io.ReadCloser) (*Response, error)
func StatusConditionFalse ¶
func StatusConditionFalse() *Response
func StatusConditionTrue ¶
func StatusConditionTrue() *Response
func StatusInvalidVersion ¶
func StatusInvalidVersion() *Response
func StatusResourceAlreadyExists ¶
func StatusResourceAlreadyExists() *Response
func StatusResourceCreated ¶
func StatusResourceCreated() *Response
func StatusResourceDeleted ¶
func StatusResourceDeleted() *Response
func StatusResourceDown ¶
func StatusResourceDown() *Response
func StatusResourceInvalidCredentials ¶
func StatusResourceInvalidCredentials() *Response
func StatusResourceNotFound ¶
func StatusResourceNotFound() *Response
func StatusResourceStarted ¶
func StatusResourceStarted() *Response
func StatusResourceStopped ¶
func StatusResourceStopped() *Response
func StatusResourceUp ¶
func StatusResourceUp() *Response
func StatusResourceUpdated ¶
func StatusResourceUpdated() *Response
func StatusWrongInput ¶
func StatusWrongInput() *Response
func (*Response) EnsureStatusCodes ¶
func (*Response) UnmarshalData ¶
type ResponseError ¶
type ResponseError struct {
// contains filtered or unexported fields
}
func (*ResponseError) Error ¶
func (err *ResponseError) Error() string
func (*ResponseError) StatusCode ¶
func (err *ResponseError) StatusCode() int
type ResponsePayload ¶
type ResponsePayload struct { StatusCode int `json:"status_code"` StatusText string `json:"status_text"` Data interface{} `json:"data,omitempty"` }
func StatusData ¶
func StatusData(data interface{}) ResponsePayload
type ServerResponse ¶
Click to show internal directories.
Click to hide internal directories.