// PTranslationMaps retrieves the list of child PTranslationMaps of the PSNATPool
974118
func (o *PSNATPool) PTranslationMaps(info *bambou.FetchingInfo) (PTranslationMapsList, *bambou.Error) {

	var list PTranslationMapsList
	err := bambou.CurrentSession().FetchChildren(o, PTranslationMapIdentity, &list, info)
	return list, err
}
971560
func ParseProcMaps(rd io.Reader) ([]*Mapping, error) {
	s := bufio.NewScanner(rd)
	return parseProcMapsFromScanner(s)
}
1355039
func (f *Facade) GetReadPools(ctx datastore.Context) ([]pool.ReadPool, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetReadPools"))

	var getPoolsFunc GetPoolsFunc = func() ([]pool.ReadPool, error) {
		pools, err := f.poolStore.GetResourcePools(ctx)

		if err != nil {
			return nil, fmt.Errorf("Could not load pools: %v", err)
		}

		readPools := []pool.ReadPool{}

		for i := range pools {
			f.calcPoolCapacity(ctx, &pools[i])
			f.calcPoolCommitment(ctx, &pools[i])

			readPools = append(readPools, pool.ReadPool{
				ID:                pools[i].ID,
				Description:       pools[i].Description,
				CreatedAt:         pools[i].CreatedAt,
				UpdatedAt:         pools[i].UpdatedAt,
				CoreCapacity:      pools[i].CoreCapacity,
				MemoryCapacity:    pools[i].MemoryCapacity,
				MemoryCommitment:  pools[i].MemoryCommitment,
				ConnectionTimeout: pools[i].ConnectionTimeout,
				Permissions:       pools[i].Permissions,
			})
		}
		return readPools, nil
	}

	return f.poolCache.GetPools(getPoolsFunc)
}
61597
func (a *Agent) TranslateAddresses(dc string, subj interface{}) {
	// CAUTION - SUBTLE! An agent running on a server can, in some cases,
	// return pointers directly into the immutable state store for
	// performance (it's via the in-memory RPC mechanism). It's never safe
	// to modify those values, so we short circuit here so that we never
	// update any structures that are from our own datacenter. This works
	// for address translation because we *never* need to translate local
	// addresses, but this is super subtle, so we've piped all the in-place
	// address translation into this function which makes sure this check is
	// done. This also happens to skip looking at any of the incoming
	// structure for the common case of not needing to translate, so it will
	// skip a lot of work if no translation needs to be done.
	if !a.config.TranslateWANAddrs || (a.config.Datacenter == dc) {
		return
	}

	// Translate addresses in-place, subject to the condition checked above
	// which ensures this is safe to do since we are operating on a local
	// copy of the data.
	switch v := subj.(type) {
	case structs.CheckServiceNodes:
		for _, entry := range v {
			entry.Node.Address = a.TranslateAddress(dc, entry.Node.Address, entry.Node.TaggedAddresses)
		}
	case *structs.Node:
		v.Address = a.TranslateAddress(dc, v.Address, v.TaggedAddresses)
	case structs.Nodes:
		for _, node := range v {
			node.Address = a.TranslateAddress(dc, node.Address, node.TaggedAddresses)
		}
	case structs.ServiceNodes:
		for _, entry := range v {
			entry.Address = a.TranslateAddress(dc, entry.Address, entry.TaggedAddresses)
		}
	default:
		panic(fmt.Errorf("Unhandled type passed to address translator: %#v", subj))
	}
}
240166
func ParseTranslations(rawKey string, tv TranslationValues) (translations Translations, err error) {
	// Load the translation templates from the file
	tt, err := loadTranslationTemplates(rawKey)
	if err != nil {
		log.Error("Error while parsing translations - Failed to load translations: ", err)
		return
	}
	translations = make(Translations)
	templateEngine := template.New("translations")
	buf := new(bytes.Buffer)
	// Iterate over the keys and values provided to render
	for key, value := range tv {
		// If a translation key is provided that does not exist in the file consider it an error
		template, exists := tt[key]
		if !exists {
			log.Error("Error while parsing translations - Trying to render an unexisting key: ", err)
			return
		}
		// If no translation values are provided, store the raw template (could be that there
		// are no values required for this template).
		if value == nil {
			translations[key] = template
			continue
		}
		// Make sure the buffer is empty
		buf.Reset()
		// Parse the template string in the template engine and render it in the buffer
		templateEngine.Parse(template)
		err = templateEngine.Execute(buf, value)
		if err != nil {
			log.Error("Error while parsing translations - Failed to render template: ", err)
			return
		}
		translations[key] = buf.String()
	}
	return
}
605044
func convertMap(in map[interface{}]interface{}) map[string]interface{} {
  rtn := make(map[string]interface{})
  for key, val := range in {
    // if the value is a map of interface interfaces
    // make sure to convert them as well    
    var newValue interface{}
    switch val.(type) {
      case []interface{}:
        newValue = convertArray(val.([]interface{}))
      case map[interface{}]interface{}:
        newValue = convertMap(val.(map[interface{}]interface{}))
      default:
        newValue = val
    }

    switch key.(type) {
    case string:
      rtn[key.(string)] = newValue
    }
  }

  return rtn  
}
605194
func (o *IngressACLTemplate) IngressACLEntryTemplates(info *bambou.FetchingInfo) (IngressACLEntryTemplatesList, *bambou.Error) {

	var list IngressACLEntryTemplatesList
	err := bambou.CurrentSession().FetchChildren(o, IngressACLEntryTemplateIdentity, &list, info)
	return list, err
}
409116
func TransformComprehensions(x interface{}, f func(interface{}) (Value, error)) (interface{}, error) {
	t := &GenericTransformer{func(x interface{}) (interface{}, error) {
		switch x := x.(type) {
		case *ArrayComprehension:
			return f(x)
		case *SetComprehension:
			return f(x)
		case *ObjectComprehension:
			return f(x)
		}
		return x, nil
	}}
	return Transform(t, x)
}
813340
func (e shortcutExpander) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error) {
	return e.RESTMapper.RESTMapping(gk, versions...)
}
361035
func newTopologyPairsMaps() *topologyPairsMaps {
	return &topologyPairsMaps{topologyPairToPods: make(map[topologyPair]podSet),
		podToTopologyPairs: make(map[string]topologyPairSet)}
}
756163
func PgTsConfigMapByMapcfgMaptokentypeMapseqno(db XODB, mapcfg pgtypes.Oid, maptokentype int, mapseqno int) (*PgTsConfigMap, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, mapcfg, maptokentype, mapseqno, mapdict ` +
		`FROM pg_catalog.pg_ts_config_map ` +
		`WHERE mapcfg = $1 AND maptokentype = $2 AND mapseqno = $3`

	// run query
	XOLog(sqlstr, mapcfg, maptokentype, mapseqno)
	ptcm := PgTsConfigMap{}

	err = db.QueryRow(sqlstr, mapcfg, maptokentype, mapseqno).Scan(&ptcm.Tableoid, &ptcm.Cmax, &ptcm.Xmax, &ptcm.Cmin, &ptcm.Xmin, &ptcm.Ctid, &ptcm.Mapcfg, &ptcm.Maptokentype, &ptcm.Mapseqno, &ptcm.Mapdict)
	if err != nil {
		return nil, err
	}

	return &ptcm, nil
}
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
}
374678
func getGlobalFieldMappings() []*types.EventFieldMapping {
	return []*types.EventFieldMapping{
		{
			ColumnName: types.SQLColumnLabelHeight,
			Field:      types.BlockHeightLabel,
			Type:       types.EventFieldTypeString,
		},
		{
			ColumnName: types.SQLColumnLabelTxHash,
			Field:      types.TxTxHashLabel,
			Type:       types.EventFieldTypeString,
		},
		{
			ColumnName: types.SQLColumnLabelEventType,
			Field:      types.EventTypeLabel,
			Type:       types.EventFieldTypeString,
		},
		{
			ColumnName: types.SQLColumnLabelEventName,
			Field:      types.EventNameLabel,
			Type:       types.EventFieldTypeString,
		},
	}
}
1341942
func (client DefaultClient) GetMappings() (map[int]Mapping, error) {
	req, err := http.NewRequest("GET", fmt.Sprintf("%s/rest/com.deniz.jira.mapping/latest/mappings", client.baseURL), nil)
	if err != nil {
		return nil, err
	}
	req.Header.Set("Accept", "application/json")
	req.SetBasicAuth(client.username, client.password)

	responseCode, data, err := client.consumeResponse(req)
	if err != nil {
		return nil, err
	}
	if responseCode != http.StatusOK {
		logger.Printf("JIRA response: %s\n", string(data))
		return nil, fmt.Errorf("error getting mappings.  Status code: %d.\n", responseCode)
	}

	var r []Mapping
	if err := json.Unmarshal(data, &r); err != nil {
		return nil, err
	}

	m := make(map[int]Mapping)
	for _, c := range r {
		m[c.ID] = c
	}
	return m, nil
}
696288
func (o *Domain) SPATSourcesPools(info *bambou.FetchingInfo) (SPATSourcesPoolsList, *bambou.Error) {

	var list SPATSourcesPoolsList
	err := bambou.CurrentSession().FetchChildren(o, SPATSourcesPoolIdentity, &list, info)
	return list, err
}
498485
func TranslatedMap(ctx context.Context, sourceInterface interface{}) map[string]interface{} {
	iType := reflect.TypeOf(sourceInterface).Elem()
	result := make(map[string]interface{})

	for i := 0; i < iType.NumField(); i++ {
		fieldName := reflect.TypeOf(sourceInterface).Elem().Field(i).Name
		fieldValue := reflect.ValueOf(sourceInterface).Elem().Field(i).String()

		result[fieldName] = Translate(ctx, fieldValue)
	}

	return result
}
232917
func (s *TelegrafConfigStore) FindUserResourceMappings(ctx context.Context, filter platform.UserResourceMappingFilter, opt ...platform.FindOptions) ([]*platform.UserResourceMapping, int, error) {
	return s.FindUserResourceMappingsF(ctx, filter, opt...)
}