Documentation
¶
Index ¶
- Variables
- func IsAlreadyExists(err error) bool
- func IsBadRequest(err error) bool
- func IsConflict(err error) bool
- func IsForbidden(err error) bool
- func IsGone(err error) bool
- func IsInvalid(err error) bool
- func IsNotFound(err error) bool
- func IsResourceExpired(err error) bool
- func IsTimeout(err error) bool
- func IsUnauthorized(err error) bool
- type ApiStatus
- type ExtendStatusReason
- func (ExtendStatusReason) Descriptor() protoreflect.EnumDescriptor
- func (x ExtendStatusReason) Enum() *ExtendStatusReason
- func (ExtendStatusReason) EnumDescriptor() ([]byte, []int)deprecated
- func (x ExtendStatusReason) Number() protoreflect.EnumNumber
- func (x ExtendStatusReason) String() string
- func (ExtendStatusReason) Type() protoreflect.EnumType
- type Status
- type StatusDetails
- type StatusError
- type StatusReason
- func (StatusReason) Descriptor() protoreflect.EnumDescriptor
- func (x StatusReason) Enum() *StatusReason
- func (StatusReason) EnumDescriptor() ([]byte, []int)deprecated
- func (x StatusReason) Number() protoreflect.EnumNumber
- func (x StatusReason) String() string
- func (StatusReason) Type() protoreflect.EnumType
Constants ¶
This section is empty.
Variables ¶
var ( StatusReason_name = map[int32]string{ 0: "Unknown", 1: "Unauthorized", 2: "Forbidden", 3: "NotFound", 4: "AlreadyExists", 5: "Conflict", 6: "Gone", 7: "Invalid", 8: "ServerTimeout", 9: "Timeout", 10: "TooManyRequests", 11: "BadRequest", 12: "MethodNotAllowed", 13: "NotAcceptable", 14: "RequestEntityTooLarge", 15: "UnsupportedMediaType", 16: "InternalError", 17: "Expired", 18: "ServiceUnavailable", 20: "PaymentRequired", 21: "RequestTimeout", } StatusReason_value = map[string]int32{ "Unknown": 0, "Unauthorized": 1, "Forbidden": 2, "NotFound": 3, "AlreadyExists": 4, "Conflict": 5, "Gone": 6, "Invalid": 7, "ServerTimeout": 8, "Timeout": 9, "TooManyRequests": 10, "BadRequest": 11, "MethodNotAllowed": 12, "NotAcceptable": 13, "RequestEntityTooLarge": 14, "UnsupportedMediaType": 15, "InternalError": 16, "Expired": 17, "ServiceUnavailable": 18, "PaymentRequired": 20, "RequestTimeout": 21, } )
Enum value maps for StatusReason.
var ( ExtendStatusReason_name = map[int32]string{ 0: "QuotaExceed", 1: "OutOfRange", } ExtendStatusReason_value = map[string]int32{ "QuotaExceed": 0, "OutOfRange": 1, } )
Enum value maps for ExtendStatusReason.
var (
// optional int32 code = 1109;
E_Code = &file_status_proto_extTypes[1]
)
Extension fields to descriptorpb.EnumValueOptions.
var (
// optional int32 default_code = 1108;
E_DefaultCode = &file_status_proto_extTypes[0]
)
Extension fields to descriptorpb.EnumOptions.
var File_status_proto protoreflect.FileDescriptor
Functions ¶
func IsAlreadyExists ¶
IsAlreadyExists determines if err is an error which indicates that a specified resource already exists. It supports wrapped errors and returns false when the error is nil.
func IsBadRequest ¶
IsBadRequest returns true if the specified error was created by NewBadRequest. It supports wrapped errors and returns false when the error is nil.
func IsConflict ¶
IsConflict determines if err is an error which indicates the provided update conflicts. It supports wrapped errors and returns false when the error is nil.
func IsForbidden ¶
IsForbidden returns true if the specified error was created by NewForbidden. It supports wrapped errors and returns false when the error is nil.
func IsGone ¶
IsGone is true if the error indicates the requested resource is no longer available. It supports wrapped errors and returns false when the error is nil.
func IsInvalid ¶
IsInvalid determines if err is an error which indicates the provided resource is not valid. It supports wrapped errors and returns false when the error is nil.
func IsNotFound ¶
IsNotFound returns true if the specified error was created by NewNotFound. It supports wrapped errors and returns false when the error is nil.
func IsResourceExpired ¶
IsResourceExpired is true if the error indicates the resource has expired and the current action is no longer possible. It supports wrapped errors and returns false when the error is nil.
func IsTimeout ¶
IsTimeout is true if the error indicates the requested resource is no longer available. It supports wrapped errors and returns false when the error is nil.
func IsUnauthorized ¶
IsUnauthorized returns true if the specified error was created by NewUnauthorized. It supports wrapped errors and returns false when the error is nil.
Types ¶
type ExtendStatusReason ¶
type ExtendStatusReason int32
const ( ExtendStatusReason_QuotaExceed ExtendStatusReason = 0 ExtendStatusReason_OutOfRange ExtendStatusReason = 1 )
func (ExtendStatusReason) Descriptor ¶
func (ExtendStatusReason) Descriptor() protoreflect.EnumDescriptor
func (ExtendStatusReason) Enum ¶
func (x ExtendStatusReason) Enum() *ExtendStatusReason
func (ExtendStatusReason) EnumDescriptor
deprecated
func (ExtendStatusReason) EnumDescriptor() ([]byte, []int)
Deprecated: Use ExtendStatusReason.Descriptor instead.
func (ExtendStatusReason) Number ¶
func (x ExtendStatusReason) Number() protoreflect.EnumNumber
func (ExtendStatusReason) String ¶
func (x ExtendStatusReason) String() string
func (ExtendStatusReason) Type ¶
func (ExtendStatusReason) Type() protoreflect.EnumType
type Status ¶
type Status struct {
Code int32 `json:"statusCode"`
Reason string `json:"reason"`
Message string `json:"message"`
Details *StatusDetails
}
type StatusDetails ¶
type StatusError ¶
type StatusError struct {
ErrStatus Status
}
func (*StatusError) Error ¶
func (e *StatusError) Error() string
Error implements the Error interface.
func (*StatusError) Is ¶
func (e *StatusError) Is(err error) bool
func (*StatusError) Status ¶
func (e *StatusError) Status() Status
Status allows access to e's status without having to know the detailed workings of StatusError.
func (*StatusError) Unwrap ¶
func (e *StatusError) Unwrap() error
type StatusReason ¶
type StatusReason int32
const ( // Unknown means the server has declined to indicate a specific reason. // The details field may contain other information about this error. // Status code 500. StatusReason_Unknown StatusReason = 0 // the user to present appropriate authorization credentials (identified by the WWW-Authenticate header) // in order for the action to be completed. If the user has specified credentials on the request, the // server considers them insufficient. // Status code 401 StatusReason_Unauthorized StatusReason = 1 // Forbidden means the server can be reached and understood the request, but refuses // to take any further action. It is the result of the server being configured to deny access for some reason // to the requested resource by the client. // Status code 403 StatusReason_Forbidden StatusReason = 2 // NotFound means one or more resources required for this operation // could not be found. // Status code 404 StatusReason_NotFound StatusReason = 3 // AlreadyExists means the resource you are creating already exists. // Status code 409 StatusReason_AlreadyExists StatusReason = 4 // Conflict means the requested operation cannot be completed // due to a conflict in the operation. The client may need to alter the // request. Each resource may define custom details that indicate the // nature of the conflict. // Status code 409 StatusReason_Conflict StatusReason = 5 // Gone means the item is no longer available at the server and no // forwarding address is known. // Status code 410 StatusReason_Gone StatusReason = 6 // Invalid means the requested create or update operation cannot be // completed due to invalid data provided as part of the request. The client may // need to alter the request. When set, the client may use the StatusDetails // message field as a summary of the issues encountered. // Status code 422 StatusReason_Invalid StatusReason = 7 // ServerTimeout means the server can be reached and understood the request, // but cannot complete the action in a reasonable time. The client should retry the request. // This is may be due to temporary server load or a transient communication issue with // another server. Status code 500 is used because the HTTP spec provides no suitable // server-requested client retry and the 5xx class represents actionable errors. // Status code 500 StatusReason_ServerTimeout StatusReason = 8 // Timeout means that the request could not be completed within the given time. // Clients can get this response only when they specified a timeout param in the request, // or if the server cannot complete the operation within a reasonable amount of time. // The request might succeed with an increased value of timeout param. The client *should* // wait at least the number of seconds specified by the retryAfterSeconds field. // Details (optional): // // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried // // Status code 504 StatusReason_Timeout StatusReason = 9 // TooManyRequests means the server experienced too many requests within a // given window and that the client must wait to perform the action again. A client may // always retry the request that led to this error, although the client should wait at least // the number of seconds specified by the retryAfterSeconds field. // Details (optional): // // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried // // Status code 429 StatusReason_TooManyRequests StatusReason = 10 // BadRequest means that the request itself was invalid, because the request // doesn't make any sense, for example deleting a read-only object. This is different than // Invalid above which indicates that the API call could possibly succeed, but the // data was invalid. API calls that return BadRequest can never succeed. // Status code 400 StatusReason_BadRequest StatusReason = 11 // MethodNotAllowed means that the action the client attempted to perform on the // resource was not supported by the code - for instance, attempting to delete a resource that // can only be created. API calls that return MethodNotAllowed can never succeed. // Status code 405 StatusReason_MethodNotAllowed StatusReason = 12 // NotAcceptable means that the accept types indicated by the client were not acceptable // to the server - for instance, attempting to receive protobuf for a resource that supports only json and yaml. // API calls that return NotAcceptable can never succeed. // Status code 406 StatusReason_NotAcceptable StatusReason = 13 // RequestEntityTooLarge means that the request entity is too large. // Status code 413 StatusReason_RequestEntityTooLarge StatusReason = 14 // UnsupportedMediaType means that the content type sent by the client is not acceptable // to the server - for instance, attempting to send protobuf for a resource that supports only json and yaml. // API calls that return UnsupportedMediaType can never succeed. // Status code 415 StatusReason_UnsupportedMediaType StatusReason = 15 // InternalError indicates that an internal error occurred, it is unexpected // and the outcome of the call is unknown. // Details (optional): // // "causes" - The original error // // Status code 500 StatusReason_InternalError StatusReason = 16 // Expired indicates that the request is invalid because the content you are requesting // has expired and is no longer available. It is typically associated with watches that can't be // serviced. // Status code 410 (gone) StatusReason_Expired StatusReason = 17 // but the requested service is unavailable at this time. // Retrying the request after some time might succeed. // Status code 503 StatusReason_ServiceUnavailable StatusReason = 18 // PaymentRequired indicates that requested content is not available until the client makes a payment. StatusReason_PaymentRequired StatusReason = 20 StatusReason_RequestTimeout StatusReason = 21 )
func ReasonAndCodeForError ¶
func ReasonAndCodeForError(err error) (StatusReason, int32)
func (StatusReason) Descriptor ¶
func (StatusReason) Descriptor() protoreflect.EnumDescriptor
func (StatusReason) Enum ¶
func (x StatusReason) Enum() *StatusReason
func (StatusReason) EnumDescriptor
deprecated
func (StatusReason) EnumDescriptor() ([]byte, []int)
Deprecated: Use StatusReason.Descriptor instead.
func (StatusReason) Number ¶
func (x StatusReason) Number() protoreflect.EnumNumber
func (StatusReason) String ¶
func (x StatusReason) String() string
func (StatusReason) Type ¶
func (StatusReason) Type() protoreflect.EnumType