// Chown changes the user and group of the file. Unlike os.Chown, this takes
// a string username and group (since that's what HDFS uses.)
//
// If an empty string is passed for user or group, that field will not be
// changed remotely.
425356
func (c *Client) Chown(name string, user, group string) error {
	req := &hdfs.SetOwnerRequestProto{
		Src:       proto.String(name),
		Username:  proto.String(user),
		Groupname: proto.String(group),
	}
	resp := &hdfs.SetOwnerResponseProto{}

	err := c.namenode.Execute("setOwner", req, resp)
	if err != nil {
		return &os.PathError{"chown", name, interpretException(err)}
	}

	return nil
}
127795
func (f *File) Anon(paths ...string) {
	for _, p := range paths {
		f.imports[p] = importdef{name: "_", alias: true}
	}
}
1216004
func (v EtcdStorageVersion) String() string {
	switch v {
	case storageEtcd2:
		return "etcd2"
	case storageEtcd3:
		return "etcd3"
	default:
		panic(fmt.Sprintf("enum value %d missing from EtcdStorageVersion String() function", v))
	}
}
270679
func (d *Disk) SetDiskPlan(strPlan string) {
	switch strPlan {
	case "ssd":
		d.Plan = DiskPlanSSD
	case "hdd":
		d.Plan = DiskPlanHDD
	default:
		panic(fmt.Errorf("Invalid plan:%s", strPlan))
	}
}
794607
func (s *AlterRetentionPolicyStatement) String() string {
	var buf bytes.Buffer
	_, _ = buf.WriteString("ALTER RETENTION POLICY ")
	_, _ = buf.WriteString(QuoteIdent(s.Name))
	_, _ = buf.WriteString(" ON ")
	_, _ = buf.WriteString(QuoteIdent(s.Database))

	if s.Duration != nil {
		_, _ = buf.WriteString(" DURATION ")
		_, _ = buf.WriteString(FormatDuration(*s.Duration))
	}

	if s.Replication != nil {
		_, _ = buf.WriteString(" REPLICATION ")
		_, _ = buf.WriteString(strconv.Itoa(*s.Replication))
	}

	if s.ShardGroupDuration != nil {
		_, _ = buf.WriteString(" SHARD DURATION ")
		_, _ = buf.WriteString(FormatDuration(*s.ShardGroupDuration))
	}

	if s.Default {
		_, _ = buf.WriteString(" DEFAULT")
	}

	return buf.String()
}
1156237
func (s *SwarmingClient) Configure(c context.Context, dir, user string) error {
	// 0755 allows the directory structure to be read and listed by all users.
	// Useful when SSHing fo the instance.
	if err := os.MkdirAll(dir, 0755); err != nil {
		return errors.Annotate(err, "failed to create: %s", dir).Err()
	}
	if err := s.chown(c, dir, user); err != nil {
		return errors.Annotate(err, "failed to chown: %s", dir).Err()
	}
	zip := filepath.Join(dir, "swarming_bot.zip")
	switch _, err := os.Stat(zip); {
	case os.IsNotExist(err):
	case err != nil:
		return errors.Annotate(err, "failed to stat: %s", zip).Err()
	default:
		logging.Infof(c, "already installed: %s", zip)
		return nil
	}
	if err := s.fetch(c, zip, user); err != nil {
		return err
	}
	return s.autostart(c, zip, user)
}
1274927
func (s *GroupService) Remove(groupname string, username string) (*Response, error) {
	apiEndpoint := fmt.Sprintf("/rest/api/2/group/user?groupname=%s&username=%s", groupname, username)
	req, err := s.client.NewRequest("DELETE", apiEndpoint, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(req, nil)
	if err != nil {
		jerr := NewJiraError(resp, err)
		return resp, jerr
	}

	return resp, nil
}
941134
public static function chown($path, $user, $group = null)
    {

        // don't do anything under Windows
        if (FileSystem::getOsIdentifier() === self::OS_IDENTIFIER_WIN) {
            return;
        }

        // check if the path exists
        if (!file_exists($path)) {
            return false;
        }

        // change the owner
        if (chown($path, $user) === false) {
            throw new \Exception(sprintf('Can\'t change owner for directory/flie %s to %s', $path, $user));
        }

        // check if group is given too
        if (!is_null($group)) {
            if (chgrp($path, $group) === false) {
                throw new \Exception(sprintf('Can\'t change group for directory/flie %s to %s', $path, $group));
            }
        }

        return true;
    }
1339998
func (s *CreateSMBFileShareOutput) SetFileShareARN(v string) *CreateSMBFileShareOutput {
	s.FileShareARN = &v
	return s
}
1253793
func WriteTroughCacheWithNameFn(dirname string, fn func(string) string) Cache {
	return &writeTroughCache{
		memory: MemoryCache(),
		file:   FileCacheWithNameFn(dirname, fn),
	}
}
772029
func ChownByName(filePath, usr, grp string) error {
	var uid, gid int
	var err error

	if uid, err = GetUid(usr); err != nil {
		return err
	}

	if gid, err = GetGid(grp); err != nil {
		return err
	}

	return Chown(filePath, uid, gid)
}
601860
func Convert_v1_Group_To_user_Group(in *v1.Group, out *user.Group, s conversion.Scope) error {
	return autoConvert_v1_Group_To_user_Group(in, out, s)
}
1188842
function chown($filename, $uid, $recursive = false)
    {
        // quoting from <http://www.kernel.org/doc/man-pages/online/pages/man2/chown.2.html>,
        // "if the owner or group is specified as -1, then that ID is not changed"
        $attr = pack('N3', NET_SFTP_ATTR_UIDGID, $uid, -1);

        return $this->_setstat($filename, $attr, $recursive);
    }
350951
func NewSharedFileMembers(Users []*UserFileMembershipInfo, Groups []*GroupMembershipInfo, Invitees []*InviteeMembershipInfo) *SharedFileMembers {
	s := new(SharedFileMembers)
	s.Users = Users
	s.Groups = Groups
	s.Invitees = Invitees
	return s
}
619444
func (f *JSONConfigFile) GetUserConfigForUsername(nu NormalizedUsername) (*UserConfig, error) {
	if uc := f.copyUserConfigIfForUsername(nu); uc != nil {
		return uc, nil
	}
	return ImportUserConfigFromJSONWrapper(f.jw.AtKey("users").AtKey(nu.String()))
}
1218432
def chown(self, path, user, group, recursive=False):
        
        args = {
            'path': path,
            'user': user,
            'group': group,
            'recursive': recursive,
        }

        return self._client.json('filesystem.chown', args)
489276
def chgrp(path, group):
    '''
    
    '''
    path = os.path.expanduser(path)

    user = get_user(path)
    return chown(path, user, group)