]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/aws/aws-sdk-go/aws/request/validation.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / aws / aws-sdk-go / aws / request / validation.go
index 4012462282197bf873b162c9ff8916adea6573dc..8630683f3174b3a0a35e33b1610485f695d88452 100644 (file)
@@ -17,6 +17,12 @@ const (
        ParamMinValueErrCode = "ParamMinValueError"
        // ParamMinLenErrCode is the error code for fields without enough elements.
        ParamMinLenErrCode = "ParamMinLenError"
+       // ParamMaxLenErrCode is the error code for value being too long.
+       ParamMaxLenErrCode = "ParamMaxLenError"
+
+       // ParamFormatErrCode is the error code for a field with invalid
+       // format or characters.
+       ParamFormatErrCode = "ParamFormatInvalidError"
 )
 
 // Validator provides a way for types to perform validation logic on their
@@ -232,3 +238,49 @@ func NewErrParamMinLen(field string, min int) *ErrParamMinLen {
 func (e *ErrParamMinLen) MinLen() int {
        return e.min
 }
+
+// An ErrParamMaxLen represents a maximum length parameter error.
+type ErrParamMaxLen struct {
+       errInvalidParam
+       max int
+}
+
+// NewErrParamMaxLen creates a new maximum length parameter error.
+func NewErrParamMaxLen(field string, max int, value string) *ErrParamMaxLen {
+       return &ErrParamMaxLen{
+               errInvalidParam: errInvalidParam{
+                       code:  ParamMaxLenErrCode,
+                       field: field,
+                       msg:   fmt.Sprintf("maximum size of %v, %v", max, value),
+               },
+               max: max,
+       }
+}
+
+// MaxLen returns the field's required minimum length.
+func (e *ErrParamMaxLen) MaxLen() int {
+       return e.max
+}
+
+// An ErrParamFormat represents a invalid format parameter error.
+type ErrParamFormat struct {
+       errInvalidParam
+       format string
+}
+
+// NewErrParamFormat creates a new invalid format parameter error.
+func NewErrParamFormat(field string, format, value string) *ErrParamFormat {
+       return &ErrParamFormat{
+               errInvalidParam: errInvalidParam{
+                       code:  ParamFormatErrCode,
+                       field: field,
+                       msg:   fmt.Sprintf("format %v, %v", format, value),
+               },
+               format: format,
+       }
+}
+
+// Format returns the field's required format.
+func (e *ErrParamFormat) Format() string {
+       return e.format
+}