func NewUUID() types.UID { uuidLock.Lock() defer uuidLock.Unlock() result := uuid.NewUUID() // The UUID package is naive and can generate identical UUIDs if the // time interval is quick enough. // The UUID uses 100 ns increments so it's short enough to actively // wait for a new value. for uuid.Equal(lastUUID, result) == true { result = uuid.NewUUID() } lastUUID = result return types.UID(result.String()) }
func (u *Unstructured) GetUID() types.UID { return types.UID(getNestedString(u.Object, "metadata", "uid")) }
// NewUIDPreconditions returns a Preconditions with UID set. func NewUIDPreconditions(uid string) *Preconditions { u := types.UID(uid) return &Preconditions{UID: &u} }
// NewPreconditionDeleteOptions returns a DeleteOptions with a UID precondition set. func NewPreconditionDeleteOptions(uid string) *DeleteOptions { u := types.UID(uid) p := Preconditions{UID: &u} return &DeleteOptions{Preconditions: &p} }