// GetTenantMap returns a map that contains all tenant names and there ID's
550387
func (client *QuobyteClient) GetTenantMap() (map[string]string, error) {
	result := map[string]string{}
	response, err := client.GetTenant([]string{})

	if err != nil {
		return result, err
	}

	for _, tenant := range response.Tenants {
		result[tenant.Name] = tenant.TenantID
	}

	return result, nil
}
549003
func (c *Config) GetStringMapString(s string) map[string]string {
	return c.config.GetStringMapString(s)
}
1058335
func httpGetTenant(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	log.Debugf("Received httpGetTenant: %+v", vars)

	key := vars["key"]

	collections.tenantMutex.Lock()
	defer collections.tenantMutex.Unlock()
	obj := collections.tenants[key]
	if obj == nil {
		log.Infof("tenant %s not found", key)
		return nil, errors.New("tenant not found")
	}

	// Return the obj
	return obj, nil
}
639068
func parseMap(r reflect.Value, node *XMLNode, tag reflect.StructTag) error {
	if r.IsNil() {
		r.Set(reflect.MakeMap(r.Type()))
	}

	if tag.Get("flattened") == "" { // look at all child entries
		for _, entry := range node.Children["entry"] {
			parseMapEntry(r, entry, tag)
		}
	} else { // this element is itself an entry
		parseMapEntry(r, node, tag)
	}

	return nil
}
258122
func (f *File) GetMapFlat() map[string]string {
	ret := make(map[string]string)

	for _, section := range f.sections {
		name := section.Name()
		if section.name != "" {
			name = fmt.Sprintf("%s%s", name, DefaultNameKeySeparator)
		}

		for _, key := range section.keys {
			ret[fmt.Sprintf("%s%s", name, key)] = f.ValueManipFunc(section.GetRaw(key))
		}
	}

	return ret
}
683104
func (c *Client) CreateTenant(tenant TenantDefinition, o ...Modifier) (bool, error) {
	o = prepend(o, c.URL("POST", TenantEndpoint()), AdminAuthentication(c.AdminToken), Data(tenant))

	r, err := c.Send(o...)
	if err != nil {
		return false, err
	}

	defer r.Body.Close()

	if r.StatusCode > 399 {
		err = c.parseErrorResponse(r)
		if err, ok := err.(*HawkularClientError); ok {
			if err.Code != http.StatusConflict {
				return false, err
			}
			return false, nil
		}
		return false, err
	}
	return true, nil
}
919719
func (db *DB) GetTenantsForUser(user string) ([]*Tenant, error) {
	r, err := db.Query(`
	    SELECT t.uuid, t.name
	      FROM tenants t INNER JOIN memberships m ON m.tenant_uuid = t.uuid
	     WHERE m.user_uuid = ?`, user)
	if err != nil {
		return nil, err
	}
	defer r.Close()

	l := make([]*Tenant, 0)
	for r.Next() {
		t := &Tenant{}

		if err := r.Scan(&t.UUID, &t.Name); err != nil {
			return l, err
		}

		l = append(l, t)
	}

	return l, nil
}
297687
func (c ConfigAttributes) GetStringMap(attrName string, defaultValue map[string]string) (map[string]string, error) {
	if valData, ok := c[attrName]; ok {
		result := make(map[string]string)
		switch val := valData.(type) {
		case map[string]string:
			for k, v := range val {
				result[k] = v
			}
		case map[string]interface{}:
			for k, v := range val {
				result[k] = fmt.Sprintf("%v", v)
			}
		default:
			return nil, errors.NotValidf("string map value of type %T", val)
		}
		return result, nil
	}
	return defaultValue, nil
}
322307
func (p *provisioningIdentityMapper) createIdentityAndMapping(ctx context.Context, info authapi.UserIdentityInfo) (kuser.Info, error) {
	// Build the part of the identity we know about
	identity := &userapi.Identity{
		ObjectMeta: metav1.ObjectMeta{
			Name: info.GetIdentityName(),
		},
		ProviderName:     info.GetProviderName(),
		ProviderUserName: info.GetProviderUserName(),
		Extra:            info.GetExtra(),
	}

	// GetIdentities or create a persisted user pointing to the identity
	persistedUser, err := p.provisioningStrategy.UserForNewIdentity(ctx, getPreferredUserName(identity), identity)
	if err != nil {
		return nil, err
	}

	// CreateIdentity the identity pointing to the persistedUser
	identity.User = corev1.ObjectReference{
		Name: persistedUser.Name,
		UID:  persistedUser.UID,
	}
	if _, err := p.identity.Create(identity); err != nil {
		return nil, err
	}

	return userToInfo(persistedUser), nil
}
92862
func getTenantFromContainerInspect(containerInfo *types.ContainerJSON) string {
	tenant := "default"
	if containerInfo != nil && containerInfo.NetworkSettings != nil {
		for network := range containerInfo.NetworkSettings.Networks {
			if strings.Contains(network, "/") {
				//network name is of the form networkname/tenantname for non default tenant
				tenant = strings.Split(network, "/")[1]
			}
		}
	}
	return tenant
}
886962
func (_m *FacadeInterface) ListTenants(_a0 datastore.Context) ([]string, error) {
	ret := _m.Called(_a0)

	var r0 []string
	if rf, ok := ret.Get(0).(func(datastore.Context) []string); ok {
		r0 = rf(_a0)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]string)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context) error); ok {
		r1 = rf(_a0)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1164465
func (f *Facade) GetTenantIDs(ctx datastore.Context) ([]string, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetTenantIDs"))
	plog.Debug("Started Facade.GetTenantIDs")
	defer plog.Debug("Finished Facade.GetTenantIDs")

	svcs, err := f.GetServiceDetailsByParentID(ctx, "", 0)
	if err != nil {
		plog.WithError(err).Error("Could not get tenant IDs")
		return nil, err
	}
	tenantIDs := []string{}
	for _, tenant := range svcs {
		tenantIDs = append(tenantIDs, tenant.ID)
	}
	return tenantIDs, nil
}
533211
func getInterfaceMap() (map[string]net.Interface, error) {
	interfaces, err := net.Interfaces()
	if err != nil {
		plog.WithError(err).Debug("Unable to read network interfaces")
		return nil, err
	}
	//make a  of all ipaddresses to interface
	ips := make(map[string]net.Interface)
	for _, iface := range interfaces {
		addrs, err := iface.Addrs()
		if err != nil {
			plog.WithField("interface", iface.Name).WithError(err).Debug("Unable to read interface addresses")
			return nil, err
		}
		for _, ip := range addrs {
			normalIP := strings.SplitN(ip.String(), "/", 2)[0]
			normalIP = strings.Trim(strings.ToLower(normalIP), " ")

			ips[normalIP] = iface
		}
	}
	return ips, nil
}
1293805
func (f *Facade) GetServiceDetailsByTenantID(ctx datastore.Context, tenantID string) ([]service.ServiceDetails, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetailsByTenantID"))
	svcs, err := f.serviceStore.Query(ctx, service.Query{})
	if err != nil {
		return nil, err
	}
	return f.filterDetailsByTenantID(ctx, tenantID, svcs)
}
153254
func (s *GuestOSService) GetGuestOsMappingByID(id string, opts ...OptionFunc) (*GuestOsMapping, int, error) {
	p := &ListGuestOsMappingParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListGuestOsMapping(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.GuestOsMapping[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for GuestOsMapping UUID: %s!", id)
}
326774
func (up *tenantURLProvider) GetEnvironmentMapping() map[string]string {
	result := make(map[string]string)
	// Exclude internal namespaces where the user cannot deploy applications

	// Deployments API will receive requests by environment name (e.g. "run", "stage").
	// These names correspond to the "type" attribute in Namespaces.
	for envNS, attr := range up.namespaces {
		envName := attr.Type
		if envName == nil || len(*envName) == 0 {
			log.Error(nil, map[string]interface{}{
				"namespace": envNS,
			}, "namespace has no type")
		} else {
			result[*envName] = envNS
		}
	}
	return result
}
60164
func (this *ControlPlaneDao) GetTenantIDs(unused struct{}, tenantIDs *[]string) error {
	ctx := datastore.Get()
	defer ctx.Metrics().Stop(ctx.Metrics().Start("dao.GetTenantIDs"))
	if ids, err := this.facade.GetTenantIDs(ctx); err == nil {
		*tenantIDs = ids
		return nil
	} else {
		return err
	}
}