// ItemsToResources converts one or more items into one or more resources.
// NOTE: This is not necessarily a 1-to-1 conversion, and order is not preserved.
ItemsToResources converts one or more items into one or more resources.
NOTE: This is not necessarily a 1-to-1 conversion, and order is not preserved.
// ItemsToResources converts one or more items into one or more resources . // NOTE : This is not necessarily a 1 - to - 1 conversion and order is not preserved .
func ItemsToResources(items ...backend.Item) ([]services.Resource, error) {
	var resources []services.Resource
	users, rem, err := collectUserItems(items)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	for uname, uitems := range users {
		user, err := userFromUserItems(uname, uitems)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		resources = append(resources, user)
	}
	for _, item := range rem {
		rsc, err := itemToResource(item)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		resources = append(resources, rsc)
	}
	return resources, nil
}
func ItemsToResources ( items ... backend . Item ) ( [ ] services . Resource , error ) { var resources [ ] services . Resource users , rem , err := collectUserItems ( items ) if err != nil { return nil , trace . Wrap ( err ) } for uname , uitems := range users { user , err := userFromUserItems ( uname , uitems ) if err != nil { return nil , trace . Wrap ( err ) } resources = append ( resources , user ) } for _ , item := range rem { rsc , err := itemToResource ( item ) if err != nil { return nil , trace . Wrap ( err ) } resources = append ( resources , rsc ) } return resources , nil }
ItemsToResources converts one or more items into one or more resources.
ItemsToResources converts one or more items into one or more resources .
// User resources may be split across multiple items, so we must extract them first.