// Service returns the service. func (u *Unit) Service() (*Service, error) { serviceTag := names.ServiceTag(u.ServiceName()) service := &Service{ st: u.st, tag: serviceTag, } // Call Refresh() immediately to get the up-to-date // life and other needed locally cached fields. err := service.Refresh() if err != nil { return nil, err } return service, nil }
// Tag returns a name identifying the service that is safe to use // as a file name. The returned name will be different from other // Tag values returned by any other entities from the same state. func (s *Service) Tag() string { return names.ServiceTag(s.Name()) }
// ServiceTag returns the service tag. func (u *Unit) ServiceTag() string { return names.ServiceTag(u.ServiceName()) }