lxd/db/profiles.go
func (c *Cluster) ProfileGet(project, name string) (int64, *api.Profile, error) {
	var result *api.Profile
	var id int64

	err := c.Transaction(func(tx *ClusterTx) error {
		enabled, err := tx.ProjectHasProfiles(project)
		if err != nil {
			return errors.Wrap(err, "Check if project has profiles")
		}
		if !enabled {
			project = "default"
		}

		profile, err := tx.ProfileGet(project, name)
		if err != nil {
			return err
		}

		result = ProfileToAPI(profile)
		id = int64(profile.ID)

		return nil
	})
	if err != nil {
		return -1, nil, err
	}

	return id, result, nil
}
func (c *Cluster) ProfileGet(project, name string) (int64, *api.Profile, error) {
	var result *api.Profile
	var id int64

	err := c.Transaction(func(tx *ClusterTx) error {
		enabled, err := tx.ProjectHasProfiles(project)
		if err != nil {
			return errors.Wrap(err, "Check if project has profiles")
		}
		if !enabled {
			project = "default"
		}

		profile, err := tx.ProfileGet(project, name)
		if err != nil {
			return err
		}

		result = ProfileToAPI(profile)
		id = int64(profile.ID)

		return nil
	})
	if err != nil {
		return -1, nil, err
	}

	return id, result, nil
}
func ( c * Cluster ) ProfileGet ( project , name string ) ( int64 , * api . Profile , error ) { var result * api . Profile var id int64 err := c . Transaction ( func ( tx * ClusterTx ) error { enabled , err := tx . ProjectHasProfiles ( project ) if err != nil { return errors . Wrap ( err , " " ) } if ! enabled { project = " " } profile , err := tx . ProfileGet ( project , name ) if err != nil { return err } result = ProfileToAPI ( profile ) id = int64 ( profile . ID ) return nil } ) if err != nil { return - 1 , nil , err } return id , result , nil }
// ProfileGet returns the profile with the given name.
ProfileGet returns the profile with the given name .