// LXDProfile implements core.lxdprofile.LXDProfiler
187677
func (p lxdCharmArchiveProfiler) LXDProfile() lxdprofile.LXDProfile {
	if p.CharmArchive == nil {
		return nil
	}
	return p.CharmArchive.LXDProfile()
}
241354
func (mr *MockModelCacheCharmMockRecorder) LXDProfile() *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LXDProfile", reflect.TypeOf((*MockModelCacheCharm)(nil).LXDProfile))
}
932029
func unescapeLXDProfile(profile *charm.LXDProfile) *charm.LXDProfile {
	if profile == nil {
		return nil
	}
	unescapedProfile := charm.NewLXDProfile()
	unescapedProfile.Description = profile.Description
	// we know the size and shape of the type, so let's use UnescapeKey
	unescapedConfig := make(map[string]string, len(profile.Config))
	for k, v := range profile.Config {
		unescapedConfig[mongoutils.UnescapeKey(k)] = v
	}
	unescapedProfile.Config = unescapedConfig
	// this is more easy to reason about than using mongoutils.UnescapeKeys, which
	// requires looping from map[string]interface{} -> map[string]map[string]string
	unescapedDevices := make(map[string]map[string]string, len(profile.Devices))
	for k, v := range profile.Devices {
		nested := make(map[string]string, len(v))
		for vk, vv := range v {
			nested[mongoutils.UnescapeKey(vk)] = vv
		}
		unescapedDevices[mongoutils.UnescapeKey(k)] = nested
	}
	unescapedProfile.Devices = unescapedDevices
	return unescapedProfile
}
487148
func (m *MockModelCacheCharm) LXDProfile() lxdprofile.Profile {
	ret := m.ctrl.Call(m, "LXDProfile")
	ret0, _ := ret[0].(lxdprofile.Profile)
	return ret0
}
1052819
func MakeCPUProfileFilename(dir string, start time.Time, duration time.Duration) string {
	return makeProfileFilename(cpuProfilePrefix, dir, start, duration)
}
1274120
func WriteProfilesToFile(filename string, profiles []*Profile) error {
	out := io.Writer(os.Stdout)
	if filename != "-" {
		f, err := os.Create(filename)
		if err != nil {
			return err
		}
		defer f.Close()
		out = f
	}

	if err := WriteProfiles(out, profiles); err != nil {
		return err
	}

	return nil
}
918978
func javaCPUProfile(b []byte, period int64, parse func(b []byte) (uint64, []byte)) (*Profile, error) {
	p := &Profile{
		Period:     period * 1000,
		PeriodType: &ValueType{Type: "cpu", Unit: "nanoseconds"},
		SampleType: []*ValueType{{Type: "samples", Unit: "count"}, {Type: "cpu", Unit: "nanoseconds"}},
	}
	var err error
	var locs map[uint64]*Location
	if b, locs, err = parseCPUSamples(b, parse, false, p); err != nil {
		return nil, err
	}

	if err = parseJavaLocations(b, locs, p); err != nil {
		return nil, err
	}

	// Strip out addresses for better merge.
	if err = p.Aggregate(true, true, true, true, false); err != nil {
		return nil, err
	}

	return p, nil
}
33134
func (broker *lxdBroker) LXDProfileNames(containerName string) ([]string, error) {
	nameRetriever, ok := broker.manager.(container.LXDProfileNameRetriever)
	if !ok {
		return make([]string, 0), nil
	}
	return nameRetriever.LXDProfileNames(containerName)
}
618392
func (b *BigIP) DeleteUdpProfile(name string) error {
	return b.delete(uriLtm, uriProfile, uriUdp, name)
}
1199433
func (prof *Profiler) cpuXPath(x int) string {
	return filepath.Join(prof.cpuPath, fmt.Sprintf("cpu%d", x))
}
1275910
func (task *provisionerTask) gatherCharmLXDProfiles(instanceId, machineTag string, machineProfiles []string) []string {
	if names.IsContainerMachine(machineTag) {
		if manager, ok := task.broker.(container.LXDProfileNameRetriever); ok {
			if profileNames, err := manager.LXDProfileNames(instanceId); err == nil {
				return lxdprofile.LXDProfileNames(profileNames)
			}
		} else {
			logger.Tracef("failed to gather profile names, broker didn't conform to LXDProfileNameRetriever")
		}
	}
	return machineProfiles
}
765711
func (b *BigIP) ServerSSLProfiles() (*ServerSSLProfiles, error) {
	var serverSSLProfiles ServerSSLProfiles
	err, _ := b.getForEntity(&serverSSLProfiles, uriLtm, uriProfile, uriServerSSL)
	if err != nil {
		return nil, err
	}

	return &serverSSLProfiles, nil
}
1135830
func (b *BigIP) GetClientSSLProfile(name string) (*ClientSSLProfile, error) {
	var clientSSLProfile ClientSSLProfile
	err, ok := b.getForEntity(&clientSSLProfile, uriLtm, uriProfile, uriClientSSL, name)
	if err != nil {
		return nil, err
	}
	if !ok {
		return nil, nil
	}

	return &clientSSLProfile, nil
}
505126
func NewLXDProfileAPI(
	backend LXDProfileBackend,
	resources facade.Resources,
	authorizer facade.Authorizer,
	accessUnit common.GetAuthFunc,
	logger loggo.Logger,
) *LXDProfileAPI {
	logger.Tracef("NewLXDProfileAPI called with %s", authorizer.GetAuthTag())
	return &LXDProfileAPI{
		backend:    backend,
		resources:  resources,
		accessUnit: accessUnit,
		logger:     logger,
	}
}
1111239
func safeLXDProfile(profile *charm.LXDProfile) *charm.LXDProfile {
	if profile == nil {
		return nil
	}
	escapedProfile := charm.NewLXDProfile()
	escapedProfile.Description = profile.Description
	// we know the size and shape of the type, so let's use EscapeKey
	escapedConfig := make(map[string]string, len(profile.Config))
	for k, v := range profile.Config {
		escapedConfig[mongoutils.EscapeKey(k)] = v
	}
	escapedProfile.Config = escapedConfig
	// this is more easy to reason about than using mongoutils.EscapeKeys, which
	// requires looping from map[string]interface{} -> map[string]map[string]string
	escapedDevices := make(map[string]map[string]string, len(profile.Devices))
	for k, v := range profile.Devices {
		nested := make(map[string]string, len(v))
		for vk, vv := range v {
			nested[mongoutils.EscapeKey(vk)] = vv
		}
		escapedDevices[mongoutils.EscapeKey(k)] = nested
	}
	escapedProfile.Devices = escapedDevices
	return escapedProfile
}
691646
func (c *Config) AptFTPProxy() string {
	return addSchemeIfMissing("ftp", c.getWithFallback(AptFTPProxyKey, JujuFTPProxyKey, FTPProxyKey))
}
1062597
func PgXlogfileNameOffset(db XODB, v0 pgtypes.PgLsn) (pgtypes.Record, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.pg_xlogfile_name_offset($1)`

	// run query
	var ret pgtypes.Record
	XOLog(sqlstr, v0)
	err = db.QueryRow(sqlstr, v0).Scan(&ret)
	if err != nil {
		return pgtypes.Record{}, err
	}

	return ret, nil
}