// GetAssembleRuntimeUser finds a io.openshift.s2i.assemble-runtime-user label on the given image.
421276
func (d *stiDocker) GetAssembleRuntimeUser(image string) (string, error) {
	imageMetadata, err := d.CheckAndPullImage(image)
	if err != nil {
		return "", err
	}
	return getLabel(imageMetadata, constants.AssembleRuntimeUserLabel), nil
}
295066
func (d *stiDocker) GetAssembleInputFiles(image string) (string, error) {
	imageMetadata, err := d.CheckAndPullImage(image)
	if err != nil {
		return "", err
	}

	label := getLabel(imageMetadata, constants.AssembleInputFilesLabel)
	if len(label) == 0 {
		glog.V(0).Infof("warning: Image %q does not contain a value for the %s label", image, constants.AssembleInputFilesLabel)
	} else {
		glog.V(3).Infof("Image %q contains %s set to %q", image, constants.AssembleInputFilesLabel, label)
	}
	return label, nil
}
781529
func GetComponent() *api.ComponentStats {
	status := new(api.ComponentStats)
	status.Uptime = uint64(time.Now().Sub(startTime).Seconds())
	process, err := process.NewProcess(int32(os.Getpid()))
	if err == nil {
		if memory, err := process.MemoryInfo(); err == nil {
			status.Memory = &api.ComponentStats_MemoryStats{
				Memory: memory.RSS,
				Swap:   memory.Swap,
			}
		}
		status.Cpu = &api.ComponentStats_CPUStats{
			Percentage: float32(processPercentage),
		}
		if cpu, err := process.Times(); err == nil {
			status.Cpu.User = float32(cpu.User)
			status.Cpu.System = float32(cpu.System)
			status.Cpu.Idle = float32(cpu.Idle)
		}
	}
	status.Goroutines = uint64(runtime.NumGoroutine())
	memstats := new(runtime.MemStats)
	runtime.ReadMemStats(memstats)
	status.GcCpuFraction = float32(memstats.GCCPUFraction)
	if status.Memory == nil {
		status.Memory = new(api.ComponentStats_MemoryStats)
	}
	status.Memory.Heap = memstats.HeapInuse
	status.Memory.Stack = memstats.StackInuse
	return status
}
113955
func (api *Client) GetUserGroupMembers(userGroup string) ([]string, error) {
	return api.GetUserGroupMembersContext(context.Background(), userGroup)
}
456055
func (t *Template) GetAllAWSIAMUserResources() map[string]*resources.AWSIAMUser {
	results := map[string]*resources.AWSIAMUser{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSIAMUser:
			results[name] = resource
		}
	}
	return results
}
718350
func getUserFromImageUser(imageUser string) (*int64, string) {
	user := parseUserFromImageUser(imageUser)
	// return both nil if user is not specified in the image.
	if user == "" {
		return nil, ""
	}
	// user could be either uid or user name. Try to interpret as numeric uid.
	uid, err := strconv.ParseInt(user, 10, 64)
	if err != nil {
		// If user is non numeric, assume it's user name.
		return nil, user
	}
	// If user is a numeric uid.
	return &uid, ""
}
1240329
func (gitter *Gitter) GetUser() (*User, error) {

	var users []User
	response, err := gitter.get(gitter.config.apiBaseURL + "user")
	if err != nil {
		gitter.log(err)
		return nil, err
	}

	err = json.Unmarshal(response, &users)
	if err != nil {
		gitter.log(err)
		return nil, err
	}

	if len(users) > 0 {
		return &users[0], nil
	}

	err = APIError{What: "Failed to retrieve current user"}
	gitter.log(err)
	return nil, err
}
1363280
func NewRuntime(runtimeCommand string, bundleDir string) (Runtime, error) {
	var r Runtime
	var err error
	r.RuntimeCommand, err = exec.LookPath(runtimeCommand)
	if err != nil {
		return Runtime{}, err
	}

	r.BundleDir = bundleDir
	return r, err
}
212282
func (conf *Config) GetRuntime(name string) *types.Runtime {
	conf.Lock()
	defer conf.Unlock()
	if rt, ok := conf.Runtimes[name]; ok {
		return &rt
	}
	return nil
}
179449
func (t *Template) GetAllAWSAppStreamUserResources() map[string]*resources.AWSAppStreamUser {
	results := map[string]*resources.AWSAppStreamUser{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSAppStreamUser:
			results[name] = resource
		}
	}
	return results
}
70467
func GetIssueUserPairsByMode(userID, repoID int64, filterMode FilterMode, isClosed bool, page int) ([]*IssueUser, error) {
	ius := make([]*IssueUser, 0, 10)
	sess := x.Limit(20, (page-1)*20).Where("uid=?", userID).And("is_closed=?", isClosed)
	if repoID > 0 {
		sess.And("repo_id=?", repoID)
	}

	switch filterMode {
	case FILTER_MODE_ASSIGN:
		sess.And("is_assigned=?", true)
	case FILTER_MODE_CREATE:
		sess.And("is_poster=?", true)
	default:
		return ius, nil
	}
	err := sess.Find(&ius)
	return ius, err
}
660331
func (m *MemEngine) getUser(uid gregor.UID) *user {
	uidHex := uidToString(uid)
	if u, ok := m.users[uidHex]; ok {
		return u
	}
	u := newUser(m.log)
	m.users[uidHex] = u
	return u
}
926488
func getUserFromImage(user string) (*int64, string) {
	// return both empty if user is not specified in the image.
	if user == "" {
		return nil, ""
	}
	// split instances where the id may contain user:group
	user = strings.Split(user, ":")[0]
	// user could be either uid or user name. Try to interpret as numeric uid.
	uid, err := strconv.ParseInt(user, 10, 64)
	if err != nil {
		// If user is non numeric, assume it's user name.
		return nil, user
	}
	// If user is a numeric uid.
	return &uid, ""
}
136649
func (obj *Global) GetAuthenticatedUser(ctx context.Context) (string, error) {
	result := &struct {
		Return string	`json:"qReturn"`
	} {}
	err := obj.rpc(ctx, "GetAuthenticatedUser", result)
	return result.Return, err 
}
19223
func (s *UserService) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) {
	users, n, err := s.FindUsers(ctx, filter)
	if err != nil {
		return nil, &platform.Error{
			Op:  s.OpPrefix + platform.OpFindUser,
			Err: err,
		}
	}

	if n == 0 {
		return nil, &platform.Error{
			Code: platform.ENotFound,
			Op:   s.OpPrefix + platform.OpFindUser,
			Msg:  "no results found",
		}
	}

	return users[0], nil
}
584901
func generateRuntimeApp(appRunConfig *apps.App, am *schema.ImageManifest, podMounts []schema.Mount) (schema.RuntimeApp, error) {

	ra := schema.RuntimeApp{
		App: am.App,
		Image: schema.RuntimeImage{
			Name:   &am.Name,
			ID:     appRunConfig.ImageID,
			Labels: am.Labels,
		},
		Mounts:         MergeMounts(podMounts, appRunConfig.Mounts),
		ReadOnlyRootFS: appRunConfig.ReadOnlyRootFS,
	}

	appName, err := types.NewACName(appRunConfig.Name)
	if err != nil {
		return ra, errwrap.Wrap(errors.New("invalid app name format"), err)
	}
	ra.Name = *appName

	if appRunConfig.Exec != "" {
		// Create a minimal App section if not present
		if am.App == nil {
			ra.App = &types.App{
				User:  strconv.Itoa(os.Getuid()),
				Group: strconv.Itoa(os.Getgid()),
			}
		}
		ra.App.Exec = []string{appRunConfig.Exec}
	}

	if appRunConfig.Args != nil {
		ra.App.Exec = append(ra.App.Exec, appRunConfig.Args...)
	}

	if appRunConfig.WorkingDir != "" {
		ra.App.WorkingDirectory = appRunConfig.WorkingDir
	}

	if err := prepareIsolators(appRunConfig, ra.App); err != nil {
		return ra, err
	}

	if appRunConfig.User != "" {
		ra.App.User = appRunConfig.User
	}

	if appRunConfig.Group != "" {
		ra.App.Group = appRunConfig.Group
	}

	if appRunConfig.SupplementaryGIDs != nil {
		ra.App.SupplementaryGIDs = appRunConfig.SupplementaryGIDs
	}

	for k, v := range appRunConfig.Annotations {
		if _, ok := ra.Annotations.Get(k); ok {
			continue
		}
		kAci, err := types.NewACIdentifier(k)
		if err != nil {
			return ra, errwrap.Wrap(fmt.Errorf("error parsing annotation key %q", k), err)
		}

		ra.Annotations.Set(*kAci, v)
	}

	if appRunConfig.UserAnnotations != nil {
		ra.App.UserAnnotations = appRunConfig.UserAnnotations
	}

	if appRunConfig.UserLabels != nil {
		ra.App.UserLabels = appRunConfig.UserLabels
	}

	if appRunConfig.Stdin != "" {
		ra.Annotations.Set(stage1types.AppStdinMode, appRunConfig.Stdin.String())
	}
	if appRunConfig.Stdout != "" {
		ra.Annotations.Set(stage1types.AppStdoutMode, appRunConfig.Stdout.String())
	}
	if appRunConfig.Stderr != "" {
		ra.Annotations.Set(stage1types.AppStderrMode, appRunConfig.Stderr.String())
	}

	if appRunConfig.Environments != nil {
		envs := make([]string, 0, len(appRunConfig.Environments))
		for name, value := range appRunConfig.Environments {
			envs = append(envs, fmt.Sprintf("%s=%s", name, value))
		}
		// Let the app level environment override the environment variables.
		mergeEnvs(&ra.App.Environment, envs, true)
	}

	return ra, nil
}
737177
func (api *Client) GetUserProfile(userID string, includeLabels bool) (*UserProfile, error) {
	return api.GetUserProfileContext(context.Background(), userID, includeLabels)
}