boskos/ranch/ranch.go
func (r *Ranch) Update(name, owner, state string, ud *common.UserData) error {
	r.resourcesLock.Lock()
	defer r.resourcesLock.Unlock()

	res, err := r.Storage.GetResource(name)
	if err != nil {
		logrus.WithError(err).Errorf("could not find resource %s for update", name)
		return &ResourceNotFound{name}
	}
	if owner != res.Owner {
		return &OwnerNotMatch{owner: owner, request: res.Owner}
	}
	if state != res.State {
		return &StateNotMatch{res.State, state}
	}
	if res.UserData == nil {
		res.UserData = &common.UserData{}
	}
	res.UserData.Update(ud)
	res.LastUpdate = r.UpdateTime()
	if err := r.Storage.UpdateResource(res); err != nil {
		logrus.WithError(err).Errorf("could not update resource %s", res.Name)
		return err
	}
	return nil
}
func (r *Ranch) Update(name, owner, state string, ud *common.UserData) error {
	r.resourcesLock.Lock()
	defer r.resourcesLock.Unlock()

	res, err := r.Storage.GetResource(name)
	if err != nil {
		logrus.WithError(err).Errorf("could not find resource %s for update", name)
		return &ResourceNotFound{name}
	}
	if owner != res.Owner {
		return &OwnerNotMatch{owner: owner, request: res.Owner}
	}
	if state != res.State {
		return &StateNotMatch{res.State, state}
	}
	if res.UserData == nil {
		res.UserData = &common.UserData{}
	}
	res.UserData.Update(ud)
	res.LastUpdate = r.UpdateTime()
	if err := r.Storage.UpdateResource(res); err != nil {
		logrus.WithError(err).Errorf("could not update resource %s", res.Name)
		return err
	}
	return nil
}
func ( r * Ranch ) Update ( name , owner , state string , ud * common . UserData ) error { r . resourcesLock . Lock ( ) defer r . resourcesLock . Unlock ( ) res , err := r . Storage . GetResource ( name ) if err != nil { logrus . WithError ( err ) . Errorf ( " " , name ) return & ResourceNotFound { name } } if owner != res . Owner { return & OwnerNotMatch { owner : owner , request : res . Owner } } if state != res . State { return & StateNotMatch { res . State , state } } if res . UserData == nil { res . UserData = & common . UserData { } } res . UserData . Update ( ud ) res . LastUpdate = r . UpdateTime ( ) if err := r . Storage . UpdateResource ( res ) ; err != nil { logrus . WithError ( err ) . Errorf ( " " , res . Name ) return err } return nil }
// Update updates the timestamp of a target resource.
// In: name  - name of the target resource
//     state - current state of the resource
//     owner - current owner of the resource
// 	   info  - information on how to use the resource
// Out: nil on success, or
//      OwnerNotMatch error if owner does not match current owner of the resource, or
//      ResourceNotFound error if target named resource does not exist, or
//      StateNotMatch error if state does not match current state of the resource.
Update updates the timestamp of a target resource . In : name - name of the target resource state - current state of the resource owner - current owner of the resource info - information on how to use the resource Out : nil on success or OwnerNotMatch error if owner does not match current owner of the resource or ResourceNotFound error if target named resource does not exist or StateNotMatch error if state does not match current state of the resource .