// MDOps implements the Config interface for ConfigLocal.
19955
func (c *ConfigLocal) MDOps() MDOps {
	c.lock.RLock()
	defer c.lock.RUnlock()
	return c.mdops
}
461468
func (c *ConfigLocal) SetKeyOps(k libkey.KeyOps) {
	c.lock.Lock()
	defer c.lock.Unlock()
	c.kops = k
}
796675
func (s *UpdateBasePathMappingInput) SetPatchOperations(v []*PatchOperation) *UpdateBasePathMappingInput {
	s.PatchOperations = v
	return s
}
1009219
func insertAnnotationsOps(st *State, entity GlobalEntity, toInsert map[string]string) ([]txn.Op, error) {
	tag := entity.Tag()
	ops := []txn.Op{{
		C:      annotationsC,
		Id:     st.docID(entity.globalKey()),
		Assert: txn.DocMissing,
		Insert: &annotatorDoc{
			GlobalKey:   entity.globalKey(),
			Tag:         tag.String(),
			Annotations: toInsert,
		},
	}}

	switch tag := tag.(type) {
	case names.ModelTag:
		if tag.Id() == st.ControllerModelUUID() {
			// This is the controller model, and cannot be removed.
			// Ergo, we can skip the existence check below.
			return ops, nil
		}
	}

	// If the entity is not the controller model, add a DocExists check on the
	// entity document, in order to avoid possible races between entity
	// removal and annotation creation.
	coll, id, err := st.tagToCollectionAndId(tag)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return append(ops, txn.Op{
		C:      coll,
		Id:     id,
		Assert: txn.DocExists,
	}), nil
}
400543
func (md *RootMetadata) AddOp(o op) {
	md.data.Changes.AddOp(o)
}
603199
func (s *Settings) settingsUpdateOps() (settings.ItemChanges, []txn.Op) {
	changes := s.changes()
	if len(changes) == 0 {
		return changes, nil
	}

	updates := bson.M{}
	deletions := bson.M{}
	for _, ch := range changes {
		k := utils.EscapeKey(ch.Key)
		switch {
		case ch.IsAddition(), ch.IsModification():
			updates[k] = ch.NewValue
		case ch.IsDeletion():
			deletions[k] = 1
		}
	}

	ops := []txn.Op{{
		C:      s.collection,
		Id:     s.key,
		Assert: txn.DocExists,
		Update: setUnsetUpdateSettings(updates, deletions),
	}}
	return changes, ops
}
955366
func (c *ConfigLocal) MDServer() MDServer {
	c.lock.RLock()
	defer c.lock.RUnlock()
	return c.mdserv
}
659407
func (p ResourcePersistence) NewRemoveResourcesOps(applicationID string) ([]txn.Op, error) {
	docs, err := p.resources(applicationID)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return removeResourcesAndStorageCleanupOps(docs), nil
}
337080
func (c *Config) initOperations(specs []*loads.Document) {
	ops := Operations{}

	c.GroupMap = map[string]string{}
	VisitOperations(specs, func(op Operation) {
		ops[op.ID] = &op

		// Build a map of the group names to the group name appearing in operation ids
		// This is necessary because the group will appear without the domain
		// in the resource, but with the domain in the operationID, and we
		// will be unable to match the operationID to the resource because they
		// don't agree on the name of the group.
		// TODO: Fix this by getting the group-version-kind in the resource
		if *MungeGroups {
			if v, ok := op.op.Extensions[typeKey]; ok {
				gvk := v.(map[string]interface{})
				group, ok := gvk["group"].(string)
				if !ok {
					log.Fatalf("group not type string %v", v)
				}
				groupId := ""
				for _, s := range strings.Split(group, ".") {
					groupId = groupId + strings.Title(s)
				}
				c.GroupMap[strings.Title(strings.Split(group, ".")[0])] = groupId
			}
		}
	})

	c.Operations = ops
	c.mapOperationsToDefinitions()
	c.initOperationsFromTags(specs)

	VisitOperations(specs, func(target Operation) {
		if op, ok := c.Operations[target.ID]; !ok || op.Definition == nil {
			op.VerifyBlackListed()
		}
	})
	c.initOperationParameters()

	// Clear the operations.  We still have to calculate the operations because that is how we determine
	// the API Group for each definition.
	if !*BuildOps {
		c.Operations = Operations{}
		c.OperationCategories = []OperationCategory{}
		for _, d := range c.Definitions.All {
			d.OperationCategories = []*OperationCategory{}
		}
	}
}
95964
func (q *MatchPhraseQuery) Slop(slop int) *MatchPhraseQuery {
	q.slop = &slop
	return q
}
1163295
func (op *Operator) AutopilotGetConfiguration(q *QueryOptions) (*AutopilotConfiguration, error) {
	r := op.c.newRequest("GET", "/v1/operator/autopilot/configuration")
	r.setQueryOptions(q)
	_, resp, err := requireOK(op.c.doRequest(r))
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var out AutopilotConfiguration
	if err := decodeBody(resp, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
688523
func (op *Operator) AutopilotSetConfiguration(args *structs.AutopilotSetConfigRequest, reply *bool) error {
	if done, err := op.srv.forward("Operator.AutopilotSetConfiguration", args, args, reply); done {
		return err
	}

	// This action requires operator write access.
	rule, err := op.srv.ResolveToken(args.Token)
	if err != nil {
		return err
	}
	if rule != nil && !rule.OperatorWrite() {
		return acl.ErrPermissionDenied
	}

	// Apply the update
	resp, err := op.srv.raftApply(structs.AutopilotRequestType, args)
	if err != nil {
		op.srv.logger.Printf("[ERR] consul.operator: Apply failed: %v", err)
		return err
	}
	if respErr, ok := resp.(error); ok {
		return respErr
	}

	// Check if the return type is a bool.
	if respBool, ok := resp.(bool); ok {
		*reply = respBool
	}
	return nil
}
512270
func operatorConfigMap(appName, operatorName string, config *caas.OperatorConfig) *core.ConfigMap {
	configMapName := operatorConfigMapName(operatorName)
	return &core.ConfigMap{
		ObjectMeta: v1.ObjectMeta{
			Name: configMapName,
		},
		Data: map[string]string{
			appName + "-agent.conf": string(config.AgentConf),
		},
	}
}
737148
func (s *UpdateApiKeyInput) SetPatchOperations(v []*PatchOperation) *UpdateApiKeyInput {
	s.PatchOperations = v
	return s
}
394763
func (d *OvsDriver) GlobalConfigUpdate(inst core.InstanceInfo) error {
	// convert the netplugin config to ofnet config
	// currently, its only ArpMode
	var cfg ofnet.OfnetGlobalConfig
	switch inst.ArpMode {
	case "flood":
		cfg.ArpMode = ofnet.ArpFlood
	default:
		// set the default to proxy for graceful upgrade
		cfg.ArpMode = ofnet.ArpProxy
	}

	errs := ""
	for _, sw := range d.switchDb {
		err := sw.GlobalConfigUpdate(cfg)
		if err != nil {
			errs += err.Error()
		}
	}
	if errs != "" {
		return errors.New(errs)
	}

	return nil
}
586043
func (s *UpdateAccountInput) SetPatchOperations(v []*PatchOperation) *UpdateAccountInput {
	s.PatchOperations = v
	return s
}
324566
func (s *AllocateStaticIpOutput) SetOperations(v []*Operation) *AllocateStaticIpOutput {
	s.Operations = v
	return s
}