// WithUIDGID allows the UID and GID for the Process to be set
426874
func WithUIDGID(uid, gid uint32) SpecOpts {
	return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
		setProcess(s)
		s.Process.User.UID = uid
		s.Process.User.GID = gid
		return nil
	}
}
1221106
func (o *DeleteTaskParams) WithID(id int64) *DeleteTaskParams {
	o.SetID(id)
	return o
}
589641
func getUserUIDGID(_ string) (int, int, error) {
	u, err := user.Lookup(libvirtUser)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	uid, err := strconv.ParseUint(u.Uid, 10, 32)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	gid, err := strconv.ParseUint(u.Gid, 10, 32)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	return int(uid), int(gid), nil
}
706232
func (s *Options) SetUid(v string) *Options {
	s.Uid = &v
	return s
}
610238
func (s *Permission) SetGranteeId(v string) *Permission {
	s.GranteeId = &v
	return s
}
151379
func GetGuid() string {
	b := make([]byte, 48)
	if _, err := io.ReadFull(rand.Reader, b); err != nil {
		return ""
	}
	return getMd5String(base64.URLEncoding.EncodeToString(b))
}
1108281
func (s *ResourceMetadata) SetUid(v string) *ResourceMetadata {
	s.Uid = &v
	return s
}
658191
func (o *GetEndpointIDConfigParams) WithID(id string) *GetEndpointIDConfigParams {
	o.SetID(id)
	return o
}
70045
func (s *FunctionRunAsConfig) SetUid(v int64) *FunctionRunAsConfig {
	s.Uid = &v
	return s
}
1212826
func (g *Generator) ClearLinuxGIDMappings() {
	if g.Config == nil || g.Config.Linux == nil {
		return
	}
	g.Config.Linux.GIDMappings = []rspec.LinuxIDMapping{}
}
1361503
func (o *DestroyOneParams) WithID(id string) *DestroyOneParams {
	o.SetID(id)
	return o
}
1061458
func (o *PatchEndpointIDConfigParams) WithID(id string) *PatchEndpointIDConfigParams {
	o.SetID(id)
	return o
}
503775
func generateID(appendWith string) (string, error) {
	random, err := rand.Int(rand.Reader, maxInt64)
	if err != nil {
		return "", nil
	}
	hostname, err := os.Hostname()
	if err != nil {
		hostname = "localhost"
	}
	pid := os.Getpid()
	nanoTime := time.Now().UTC().UnixNano()
	if len(appendWith) == 0 {
		return fmt.Sprintf("%d.%d.%d@%s", nanoTime, pid, random, hostname), nil
	}
	return fmt.Sprintf("%d.%d.%d.%s@%s", nanoTime, pid, random, appendWith, hostname), nil
}
1144885
func WithAdditionalGIDs(userstr string) SpecOpts {
	return func(ctx context.Context, client Client, c *containers.Container, s *Spec) (err error) {
		// For LCOW additional GID's not supported
		if s.Windows != nil {
			return nil
		}
		setProcess(s)
		setAdditionalGids := func(root string) error {
			var username string
			uid, err := strconv.Atoi(userstr)
			if err == nil {
				user, err := getUserFromPath(root, func(u user.User) bool {
					return u.Uid == uid
				})
				if err != nil {
					if os.IsNotExist(err) || err == errNoUsersFound {
						return nil
					}
					return err
				}
				username = user.Name
			} else {
				username = userstr
			}
			gids, err := getSupplementalGroupsFromPath(root, func(g user.Group) bool {
				// we only want supplemental groups
				if g.Name == username {
					return false
				}
				for _, entry := range g.List {
					if entry == username {
						return true
					}
				}
				return false
			})
			if err != nil {
				if os.IsNotExist(err) {
					return nil
				}
				return err
			}
			s.Process.User.AdditionalGids = gids
			return nil
		}
		if c.Snapshotter == "" && c.SnapshotKey == "" {
			if !isRootfsAbs(s.Root.Path) {
				return errors.Errorf("rootfs absolute path is required")
			}
			return setAdditionalGids(s.Root.Path)
		}
		if c.Snapshotter == "" {
			return errors.Errorf("no snapshotter set for container")
		}
		if c.SnapshotKey == "" {
			return errors.Errorf("rootfs snapshot not created for container")
		}
		snapshotter := client.SnapshotService(c.Snapshotter)
		mounts, err := snapshotter.Mounts(ctx, c.SnapshotKey)
		if err != nil {
			return err
		}
		return mount.WithTempMount(ctx, mounts, setAdditionalGids)
	}
}
886288
func WithRemoteAddrUser(uid, gid int) DaemonOpt {
	return func(r *remote) error {
		r.GRPC.UID = uid
		r.GRPC.GID = gid
		return nil
	}
}
106965
func (o *GetServiceIDParams) WithID(id int64) *GetServiceIDParams {
	o.SetID(id)
	return o
}
646868
func (r *Resource) WithID(id string) *Resource {
	r.u.Path += "/id:" + id
	return r
}