2014-03-08 01:36:47 +00:00
|
|
|
package image
|
2013-03-18 07:15:35 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-03-29 21:17:23 +00:00
|
|
|
"regexp"
|
2013-03-18 07:15:35 +00:00
|
|
|
)
|
|
|
|
|
2015-05-13 18:42:45 +00:00
|
|
|
var validHex = regexp.MustCompile(`^([a-f0-9]{64})$`)
|
|
|
|
|
2015-03-29 21:17:23 +00: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 16:50:25 +00:00
|
|
|
return fmt.Errorf("image ID '%s' is invalid", id)
|
2015-03-29 21:17:23 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|