func instanceUUID(id string) (string, error) { // generate VM instance uuid, which will be used to query back VM u, err := sys.UUID() if err != nil { return "", err } namespace, err := uuid.Parse(u) if err != nil { return "", errors.Errorf("unable to parse VCH uuid: %s", err) } return uuid.NewSHA1(namespace, []byte(id)).String(), nil }
func getMachineID() ([]byte, error) { id := Sys.UUID if id == "" { return nil, fmt.Errorf("could not get machine id") } uid, err := uuid.Parse(id) if err != nil { return nil, err } return uid.MarshalBinary() }
func getMachineID() ([]byte, error) { id, err := sys.UUID() if err != nil { return nil, err } uid, err := uuid.Parse(id) if err != nil { return nil, err } return uid.MarshalBinary() }
func (s *SlackLink) getMinecraftFromSlack(userID string) *MinecraftPlayer { minecraftID, err := s.redis.HGet("slacklinks:slack-to-mc", userID).Result() if err == redis.Nil { return nil } else if err != nil { log.Printf("error in getMinecraftFromSlack: %v", err) return nil } id, err := uuid.Parse(minecraftID) if err != nil { // Invalid ID return nil } return s.getMinecraftPlayer(id) }
func ParseID(idStr string) (ID, error) { result, err := uuid.Parse(idStr) return ID(result), err }