// AssignLXDProfiles implements environs.LXDProfiler.
190684
func (broker *lxdBroker) AssignLXDProfiles(instId string, profilesNames []string, profilePosts []lxdprofile.ProfilePost) ([]string, error) {
	profileMgr, ok := broker.manager.(container.LXDProfileManager)
	if !ok {
		return []string{}, nil
	}
	return profileMgr.AssignLXDProfiles(instId, profilesNames, profilePosts)
}
116792
func FullProfilePath(pDir string) string {
	if pDir != "" {
		return pDir
	}
	// get user home dir:
	home := os.TempDir()
	u, err := user.Current()
	if err == nil {
		home = u.HomeDir
	}
	return filepath.Join(home, ProfileDir)

}
876095
func (m *MockGeneration) AssignAllUnits(arg0 string) error {
	ret := m.ctrl.Call(m, "AssignAllUnits", arg0)
	ret0, _ := ret[0].(error)
	return ret0
}
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
}
157373
func (c *Charm) LXDProfile() lxdprofile.Profile {
	c.mu.Lock()
	defer c.mu.Unlock()
	return c.details.LXDProfile
}
327017
func (s profileService) AssignProfile(profileUUID string, devices []string) (*ProfileResponse, error) {
	var response ProfileResponse
	var request = struct {
		ProfileUUID string   `json:"profile_uuid"`
		Devices     []string `json:"devices"`
	}{profileUUID, devices}
	req, err := s.client.NewRequest("PUT", assignProfilePath, request)
	if err != nil {
		return nil, err
	}
	err = s.client.Do(req, &response)
	if err != nil {
		return nil, err
	}
	return &response, nil
}
683314
func (r *REPL) cmdProfile() error {
	if r.profiler {
		r.profiler = false
	} else {
		r.profiler = true
	}
	return nil
}
715188
func (a *Client) PutProfilesLibraryIdentifier(params *PutProfilesLibraryIdentifierParams, authInfo runtime.ClientAuthInfoWriter) (*PutProfilesLibraryIdentifierOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPutProfilesLibraryIdentifierParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "PutProfilesLibraryIdentifier",
		Method:             "PUT",
		PathPattern:        "/profiles/library/{identifier}",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &PutProfilesLibraryIdentifierReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*PutProfilesLibraryIdentifierOK), nil
}
924280
func (env *environ) MaybeWriteLXDProfile(pName string, put *charm.LXDProfile) error {
	return nil
}
773035
func (m *Machine) SetCharmProfiles(profiles []string) error {
	if len(profiles) == 0 {
		return nil
	}
	buildTxn := func(attempt int) ([]txn.Op, error) {
		if attempt > 0 {
			if err := m.Refresh(); err != nil {
				return nil, errors.Trace(err)
			}
		}
		// Exit early if the Machine profiles doesn't need to change.
		mProfiles, err := m.CharmProfiles()
		if err != nil {
			return nil, errors.Trace(err)
		}
		mProfilesSet := set.NewStrings(mProfiles...)
		if mProfilesSet.Union(set.NewStrings(profiles...)).Size() == mProfilesSet.Size() {
			return nil, jujutxn.ErrNoOperations
		}

		ops := []txn.Op{{
			C:      instanceDataC,
			Id:     m.doc.DocID,
			Assert: txn.DocExists,
			Update: bson.D{{"$set", bson.D{{"charm-profiles", profiles}}}},
		}}

		return ops, nil
	}
	err := m.st.db().Run(buildTxn)
	return errors.Annotatef(err, "cannot update profiles for %q to %s", m, strings.Join(profiles, ", "))
}
187677
func (p lxdCharmArchiveProfiler) LXDProfile() lxdprofile.LXDProfile {
	if p.CharmArchive == nil {
		return nil
	}
	return p.CharmArchive.LXDProfile()
}
1259830
func (m *MockLXDProfileInstanceBroker) LXDProfileNames(arg0 string) ([]string, error) {
	ret := m.ctrl.Call(m, "LXDProfileNames", arg0)
	ret0, _ := ret[0].([]string)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
1078944
func (o *VPort) AssignRedirectionTargets(children RedirectionTargetsList) *bambou.Error {

	list := []bambou.Identifiable{}
	for _, c := range children {
		list = append(list, c)
	}

	return bambou.CurrentSession().AssignChildren(o, list, RedirectionTargetIdentity)
}
251830
func (b *BigIP) ClientSSLProfiles() (*ClientSSLProfiles, error) {
	var clientSSLProfiles ClientSSLProfiles
	err, _ := b.getForEntity(&clientSSLProfiles, uriLtm, uriProfile, uriClientSSL)
	if err != nil {
		return nil, err
	}

	return &clientSSLProfiles, nil
}
1312733
func (mr *MockLXDProfilerMockRecorder) LXDProfile() *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LXDProfile", reflect.TypeOf((*MockLXDProfiler)(nil).LXDProfile))
}
661448
func (o *L4Service) AssignL4ServiceGroups(children L4ServiceGroupsList) *bambou.Error {

	list := []bambou.Identifiable{}
	for _, c := range children {
		list = append(list, c)
	}

	return bambou.CurrentSession().AssignChildren(o, list, L4ServiceGroupIdentity)
}
487148
func (m *MockModelCacheCharm) LXDProfile() lxdprofile.Profile {
	ret := m.ctrl.Call(m, "LXDProfile")
	ret0, _ := ret[0].(lxdprofile.Profile)
	return ret0
}