2014-03-08 05:36:47 +04:00
|
|
|
package image
|
2013-03-18 11:15:35 +04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-03-30 00:17:23 +03:00
|
|
|
"regexp"
|
2013-03-18 11:15:35 +04:00
|
|
|
)
|
|
|
|
|
2015-05-13 21:42:45 +03:00
|
|
|
var validHex = regexp.MustCompile(`^([a-f0-9]{64})$`)
|
|
|
|
|
2015-03-30 00:17:23 +03:00
|
|
|
// Check wheather id is a valid image ID or not
|
|
|
|
func ValidateID(id string) error {
|
|
|
|
if ok := validHex.MatchString(id); !ok {
|
2015-04-26 19:50:25 +03:00
|
|
|
return fmt.Errorf("image ID '%s' is invalid", id)
|
2015-03-30 00:17:23 +03:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|