// UpdateResourcePool provides a mock function with given fields: ctx, entity
340355
func (_m *FacadeInterface) UpdateResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error {
	ret := _m.Called(ctx, entity)

	var r0 error
	if rf, ok := ret.Get(0).(func(datastore.Context, *pool.ResourcePool) error); ok {
		r0 = rf(ctx, entity)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
941065
func (c *Client) UpdatePool(pname, provider string, attrs map[string]interface{}) error {
	if c.BestAPIVersion() < 5 {
		return errors.New("updating storage pools is not supported by this version of Juju")
	}
	var results params.ErrorResults
	args := params.StoragePoolArgs{
		Pools: []params.StoragePool{{
			Name:     pname,
			Provider: provider,
			Attrs:    attrs,
		}},
	}
	if err := c.facade.FacadeCall("UpdatePool", args, &results); err != nil {
		return errors.Trace(err)
	}
	return results.OneError()
}
616707
func NewUpdateSource(cfg *config, log Log) UpdateSource {
	return newUpdateSource(cfg, defaultEndpoints.update, log)
}
1046890
func (p *Pool) UpdateNodes(nodes nodeList) {
	defer scopedLock(&p.mutx)()
	p.nodes = nodes
}
460811
func (p *patcher) patchResource(ctx context.Context, scope *RequestScope) (runtime.Object, bool, error) {
	p.namespace = request.NamespaceValue(ctx)
	switch p.patchType {
	case types.JSONPatchType, types.MergePatchType:
		p.mechanism = &jsonPatcher{
			patcher:      p,
			fieldManager: scope.FieldManager,
		}
	case types.StrategicMergePatchType:
		schemaReferenceObj, err := p.unsafeConvertor.ConvertToVersion(p.restPatcher.New(), p.kind.GroupVersion())
		if err != nil {
			return nil, false, err
		}
		p.mechanism = &smpPatcher{
			patcher:            p,
			schemaReferenceObj: schemaReferenceObj,
			fieldManager:       scope.FieldManager,
		}
	// this case is unreachable if ServerSideApply is not enabled because we will have already rejected the content type
	case types.ApplyPatchType:
		p.mechanism = &applyPatcher{
			fieldManager: scope.FieldManager,
			patch:        p.patchBytes,
			options:      p.options,
			creater:      p.creater,
			kind:         p.kind,
		}
		p.forceAllowCreate = true
	default:
		return nil, false, fmt.Errorf("%v: unimplemented patch type", p.patchType)
	}

	wasCreated := false
	p.updatedObjectInfo = rest.DefaultUpdatedObjectInfo(nil, p.applyPatch, p.applyAdmission)
	result, err := finishRequest(p.timeout, func() (runtime.Object, error) {
		// TODO: Pass in UpdateOptions to override UpdateStrategy.AllowUpdateOnCreate
		options, err := patchToUpdateOptions(p.options)
		if err != nil {
			return nil, err
		}
		updateObject, created, updateErr := p.restPatcher.Update(ctx, p.name, p.updatedObjectInfo, p.createValidation, p.updateValidation, p.forceAllowCreate, options)
		wasCreated = created
		return updateObject, updateErr
	})
	return result, wasCreated, err
}
701383
func (s *SourceService) UpdateSource(ctx context.Context, id influxdb.ID, upd influxdb.SourceUpdate) (*influxdb.Source, error) {
	src, err := s.s.FindSourceByID(ctx, id)
	if err != nil {
		return nil, err
	}

	if err := authorizeWriteSource(ctx, src.OrganizationID, id); err != nil {
		return nil, err
	}

	return s.s.UpdateSource(ctx, id, upd)
}
1158820
func (c *Client) RemoveResourcePool(poolID string) error {
	return c.call("RemoveResourcePool", poolID, nil)
}
351059
func (r *runtimeVM) UpdateContainer(c *Container, res *rspec.LinuxResources) error {
	logrus.Debug("runtimeVM.updateContainer() start")
	defer logrus.Debug("runtimeVM.updateContainer() end")

	// Lock the container
	c.opLock.Lock()
	defer c.opLock.Unlock()

	// Convert resources into protobuf Any type
	any, err := typeurl.MarshalAny(res)
	if err != nil {
		return err
	}

	if _, err := r.task.Update(r.ctx, &task.UpdateTaskRequest{
		ID:        c.ID(),
		Resources: any,
	}); err != nil {
		return errdefs.FromGRPC(err)
	}

	return nil
}
499158
func (f *Facade) RemoveResourcePool(ctx datastore.Context, id string) error {
	alog := f.auditLogger.
		Message(ctx, "Removing Resource Pool").
		Action(audit.Remove).ID(id).Type(pool.GetType())

	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveResourcePool"))
	glog.V(2).Infof("Facade.RemoveResourcePool: %s", id)
	if err := f.DFSLock(ctx).LockWithTimeout("remove resource pool", userLockTimeout); err != nil {
		glog.Warningf("Cannot remove resource pool: %s", err)
		return alog.Error(err)
	}
	defer f.DFSLock(ctx).Unlock()

	// CC-2024: do not delete the default resource pool
	if id == "default" {
		glog.Errorf("Cannot delete default resource pool")
		return alog.Error(ErrDefaultPool)
	}

	if hosts, err := f.FindHostsInPool(ctx, id); err != nil {
		return alog.Error(fmt.Errorf("could not verify hosts in pool %s: %s", id, err))
	} else if count := len(hosts); count > 0 {
		return alog.Error(fmt.Errorf("cannot delete pool %s: found %d hosts", id, count))
	}

	if svcs, err := f.GetServicesByPool(ctx, id); err != nil {
		return alog.Error(fmt.Errorf("could not verify services in pool %s: %s", id, err))
	} else if count := len(svcs); count > 0 {
		return alog.Error(fmt.Errorf("cannot delete pool %s: found %d services", id, count))
	}

	if err := f.delete(ctx, f.poolStore, pool.Key(id), beforePoolDelete, afterPoolDelete); err != nil {
		return alog.Error(err)
	}

	f.poolCache.SetDirty()

	return alog.Error(f.zzk.RemoveResourcePool(id))
}
1001447
func (s *Server) UpdateContainerResources(ctx context.Context, req *pb.UpdateContainerResourcesRequest) (resp *pb.UpdateContainerResourcesResponse, err error) {
	const operation = "update_container_resources"
	defer func() {
		recordOperation(operation, time.Now())
		recordError(operation, err)
	}()
	logrus.Debugf("UpdateContainerResources %+v", req)

	c, err := s.GetContainerFromShortID(req.GetContainerId())
	if err != nil {
		return nil, err
	}
	state := c.State()
	if !(state.Status == oci.ContainerStateRunning || state.Status == oci.ContainerStateCreated) {
		return nil, fmt.Errorf("container %s is not running or created state: %s", c.ID(), state.Status)
	}

	resources := toOCIResources(req.GetLinux())
	if err := s.Runtime().UpdateContainer(c, resources); err != nil {
		return nil, err
	}
	return &pb.UpdateContainerResourcesResponse{}, nil
}
44962
func (c *Client) GetResourcePool(poolID string) (*pool.ResourcePool, error) {
	response := pool.New(poolID)
	if err := c.call("GetResourcePool", poolID, response); err != nil {
		return nil, err
	}
	return response, nil
}
1154107
func (c *Client) UpdateEvent(e contract.Event) (err error) {
	conn := c.Pool.Get()
	defer conn.Close()

	id := e.ID

	o, err := eventByID(conn, id)
	if err != nil {
		if err == redis.ErrNil {
			return db.ErrNotFound
		}
		return err
	}

	e.Modified = db.MakeTimestamp()
	err = mergo.Merge(&e, o)
	if err != nil {
		return err
	}

	err = deleteEvent(conn, id)
	if err != nil {
		return err
	}

	_, err = addEvent(conn, e)
	return err
}
1181060
func (s *SourceService) UpdateSource(ctx context.Context, id platform.ID, upd platform.SourceUpdate) (*platform.Source, error) {
	return s.UpdateSourceFn(ctx, id, upd)
}
1217631
func (s *Server) GetResourcePools(empty struct{}, poolsReply *[]pool.ResourcePool) error {
	pools, err := s.f.GetResourcePools(s.context())
	if err != nil {
		return err
	}

	*poolsReply = pools
	return nil
}
785318
func (s *GeoDirectionalPoolsService) Update(k GeoDirectionalPoolKey, val interface{}) (*http.Response, error) {
	return s.client.put(k.URI(), val, nil)
}
1222380
func NewSimpleResourcePool(options Options) ResourcePool {
	numActive := new(int32)
	atomic.StoreInt32(numActive, 0)

	activeHighWaterMark := new(int32)
	atomic.StoreInt32(activeHighWaterMark, 0)

	var tokens sync2.Semaphore
	if options.OpenMaxConcurrency > 0 {
		tokens = sync2.NewBoundedSemaphore(uint(options.OpenMaxConcurrency))
	}

	return &simpleResourcePool{
		location:            "",
		options:             options,
		numActive:           numActive,
		activeHighWaterMark: activeHighWaterMark,
		openTokens:          tokens,
		mutex:               sync.Mutex{},
		idleHandles:         make([]*idleHandle, 0, 0),
		isLameDuck:          false,
	}
}
334772
func (c *Client) GetResourcePools() ([]pool.ResourcePool, error) {
	response := make([]pool.ResourcePool, 0)
	if err := c.call("GetResourcePools", empty, &response); err != nil {
		return []pool.ResourcePool{}, err
	}
	return response, nil
}