Documentation ¶
Index ¶
- func BillingRef(billingRef string) error
- func DefaultResponseErrorHandler(resp *http.Response) error
- func Duration(s string) (time.Duration, error)
- func ErrorIsOneOf(err error, msgs ...string) bool
- func Field(resp interface{}, field string) error
- func Fields(resp interface{}, fields ...string) error
- func ISO8601(t string) error
- func NameServer(name string) error
- func NetworkID(id string) error
- func NetworkName(name string) error
- func Prefix(pr string) error
- func PrefixLengthV4(prefix int64) error
- func ProjectID(projectID string) error
- func ProjectName(name string) error
- func PublicIP(ip string) error
- func RFC3339(t string) error
- func Response(resp interface{}, requestError error, checkNullFields ...string) error
- func ResponseObject(resp interface{}) error
- func SemVer(version string) error
- func StatusEquals(a ResponseInterface, statusCode ...int) bool
- func UUID(id string) error
- type ResponseInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BillingRef ¶
BillingRef validates a given billing reference
func DefaultResponseErrorHandler ¶
DefaultResponseErrorHandler is the default error handler used to check if a giving STACKIT API response returned an error
func ErrorIsOneOf ¶ added in v1.19.0
ErrorIsOneOf checks checks if a given error message has one of the provided sub strings
func Field ¶ added in v1.19.0
Field validates that given field in the response object is set (not nil)
func Fields ¶ added in v1.19.0
Fields validates that given fields in the response object are set (not nil)
func NameServer ¶ added in v1.29.2
NameServer validates a given server name
func NetworkName ¶ added in v1.29.2
NetworkName validates a given network name
func PrefixLengthV4 ¶ added in v1.29.2
PrefixLengthV4 validates a given server name.
func Response ¶ added in v1.9.0
Response validates a response interface and error if requestError has an error, it is returned if resp.Error is defined and not nil, it is returned if one of the field namess provided in []checkNullFields are nil, an error is returned
func ResponseObject ¶ added in v1.19.0
func ResponseObject(resp interface{}) error
ResponseObject validates the response response and checks if it has an Error field that's set
func StatusEquals ¶ added in v1.17.1
func StatusEquals(a ResponseInterface, statusCode ...int) bool
StatusEquals returns true if interface.StatusCode() equals a given http code if more than one status code is provided, the function will return true if one of them matches
Types ¶
type ResponseInterface ¶ added in v1.16.0
type ResponseInterface interface {
StatusCode() int
}