// GetServiceDetailsAncestry returns a service and its ancestors
194495
func (f *Facade) GetServiceDetailsAncestry(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetailsAncestry"))
	s, err := f.serviceStore.GetServiceDetails(ctx, serviceID)
	if err != nil {
		return nil, err
	}

	if s.ParentServiceID != "" {
		ps, err := f.GetServiceDetailsAncestry(ctx, s.ParentServiceID)
		if err != nil {
			return nil, err
		}
		s.Parent = ps
	}

	return s, nil
}
1075735
func (c *Client) GetAllServiceDetails(since time.Duration) ([]service.ServiceDetails, error) {
	svcs := []service.ServiceDetails{}
	err := c.call("GetAllServiceDetails", since, &svcs)
	return svcs, err
}
342116
func NewServiceEntry(instance, service, domain string) *ServiceEntry {
	return &ServiceEntry{
		*NewServiceRecord(instance, service, domain),
		"",
		0,
		[]string{},
		0,
		nil,
		nil,
	}
}
616723
func (api *OffersAPI) GetConsumeDetails(args params.OfferURLs) (params.ConsumeOfferDetailsResults, error) {
	var consumeResults params.ConsumeOfferDetailsResults
	results := make([]params.ConsumeOfferDetailsResult, len(args.OfferURLs))

	offers, err := api.ApplicationOffers(args)
	if err != nil {
		return consumeResults, common.ServerError(err)
	}

	addrs, caCert, err := api.getControllerInfo()
	if err != nil {
		return consumeResults, common.ServerError(err)
	}

	controllerInfo := &params.ExternalControllerInfo{
		ControllerTag: api.ControllerModel.ControllerTag().String(),
		Addrs:         addrs,
		CACert:        caCert,
	}

	for i, result := range offers.Results {
		results[i].Error = result.Error
		if result.Error != nil {
			continue
		}
		offer := result.Result
		offerDetails := &offer.ApplicationOfferDetails
		results[i].Offer = offerDetails
		results[i].ControllerInfo = controllerInfo
		offerMacaroon, err := api.authContext.CreateConsumeOfferMacaroon(offerDetails, api.Authorizer.GetAuthTag().Id())
		if err != nil {
			results[i].Error = common.ServerError(err)
			continue
		}
		results[i].Macaroon = offerMacaroon
	}
	consumeResults.Results = results
	return consumeResults, nil
}
741397
func (_m *FacadeInterface) GetServiceInstances(ctx datastore.Context, since time.Time, serviceid string) ([]service.Instance, error) {
	ret := _m.Called(ctx, since, serviceid)

	var r0 []service.Instance
	if rf, ok := ret.Get(0).(func(datastore.Context, time.Time, string) []service.Instance); ok {
		r0 = rf(ctx, since, serviceid)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]service.Instance)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context, time.Time, string) error); ok {
		r1 = rf(ctx, since, serviceid)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1129521
func (s *CreateServiceActionOutput) SetServiceActionDetail(v *ServiceActionDetail) *CreateServiceActionOutput {
	s.ServiceActionDetail = v
	return s
}
818541
func (f *Facade) GetServiceList(ctx datastore.Context, serviceID string) ([]*service.Service, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceList"))
	svcs := make([]*service.Service, 0, 1)

	err := f.walkServices(ctx, serviceID, true, func(childService *service.Service) error {
		// Populate service config + addr info
		if err := f.fillOutService(ctx, childService); err != nil {
			return err
		}

		svcs = append(svcs, childService)
		return nil
	}, "GetServiceList")

	if err != nil {
		return nil, fmt.Errorf("error assembling list of services: %s", err)
	}

	return svcs, nil
}
558125
func (c *Conn) GetServiceProperty(service string, propertyName string) (*Property, error) {
	return c.getProperty(service, "org.freedesktop.systemd1.Service", propertyName)
}
906175
func (s *Server) GetService(serviceID string, svc *service.Service) error {
	sv, err := s.f.GetService(s.context(), serviceID)
	if err != nil {
		return err
	}
	*svc = *sv
	return nil
}
1289018
func (c *Clair) GetAncestry(ctx context.Context, name string) (*clairpb.GetAncestryResponse_Ancestry, error) {
	c.Logf("clair.ancestry.get name=%s", name)

	if c.grpcConn == nil {
		return nil, ErrNilGRPCConn
	}

	client := clairpb.NewAncestryServiceClient(c.grpcConn)

	resp, err := client.GetAncestry(ctx, &clairpb.GetAncestryRequest{
		AncestryName: name,
	})
	if err != nil {
		return nil, err
	}

	if resp == nil {
		return nil, errors.New("ancestry response was nil")
	}

	if resp.GetStatus() != nil {
		c.Logf("clair.ancestry.get ClairStatus=%#v", *resp.GetStatus())
	}

	return resp.GetAncestry(), 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)
}
1308974
func (s *storeImpl) GetServiceDetailsByParentID(ctx datastore.Context, parentID string, since time.Duration) ([]ServiceDetails, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetServiceDetailsByParentID"))
	query := map[string]interface{}{}
	termQuery := map[string]string{
		"ParentServiceID": parentID,
	}
	if since > 0 {
		t0 := time.Now().Add(-since)
		query["bool"] = map[string]interface{}{
			"must": []map[string]interface{}{
				map[string]interface{}{
					"term": termQuery,
				},
				map[string]interface{}{
					"range": map[string]interface{}{
						"UpdatedAt": map[string]string{
							"gte": t0.Format(time.RFC3339),
						},
					},
				},
			},
		}
	} else {
		query["term"] = termQuery
	}

	searchRequest := newServiceDetailsElasticRequest(map[string]interface{}{
		"query":  query,
		"fields": serviceDetailsFields,
		"size":   serviceDetailsLimit,
	})

	results, err := datastore.NewQuery(ctx).Execute(searchRequest)
	if err != nil {
		return nil, err
	}

	details := []ServiceDetails{}
	for results.HasNext() {
		var d ServiceDetails
		err := results.Next(&d)
		if err != nil {
			return nil, err
		}

		if hasChildren, err := s.hasChildren(ctx, d.ID); err == nil {
			d.HasChildren = hasChildren
		} else {
			return nil, err
		}

		s.fillDetailsVolatileInfo(&d)
		details = append(details, d)
	}

	return details, nil
}
106896
func (_m *FacadeInterface) GetServiceConfig(ctx datastore.Context, fileID string) (*servicedefinition.ConfigFile, error) {
	ret := _m.Called(ctx, fileID)

	var r0 *servicedefinition.ConfigFile
	if rf, ok := ret.Get(0).(func(datastore.Context, string) *servicedefinition.ConfigFile); ok {
		r0 = rf(ctx, fileID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*servicedefinition.ConfigFile)
		}
	}

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

	return r0, r1
}
646074
func (series *Series) GetDetail() (err error) {
	response, err := http.Get(fmt.Sprintf(GetDetailURL, APIKey, strconv.FormatUint(series.ID, 10)))

	if err != nil {
		return
	}

	data, err := ioutil.ReadAll(response.Body)

	if err != nil {
		return
	}

	// Unmarshal data into SeriesList object
	seriesList := SeriesList{}
	if err = xml.Unmarshal(data, &seriesList); err != nil {
		return
	}

	// Copy the first result into the series object
	*series = *seriesList.Series[0]

	episodeList := EpisodeList{}

	if err = xml.Unmarshal(data, &episodeList); err != nil {
		return
	}

	if series.Seasons == nil {
		series.Seasons = make(map[uint64][]*Episode)
	}

	for _, episode := range episodeList.Episodes {
		series.Seasons[episode.SeasonNumber] = append(series.Seasons[episode.SeasonNumber], episode)
	}

	return
}
734707
func (s *Operation) SetOperationDetails(v string) *Operation {
	s.OperationDetails = &v
	return s
}
429009
func GetService(svc *Service) (*Service, error) {
	svcs, err := services(svc)
	if err != nil {
		return nil, err
	}
	if len(svcs) == 0 {
		return nil, errors.New("no service found")
	}
	return svcs[0], nil
}
236443
func (s *Server) GetServiceDetailsByTenantID(tenantID string, response *[]service.ServiceDetails) error {
	svcs, err := s.f.GetServiceDetailsByTenantID(s.context(), tenantID)
	if err != nil {
		return err
	}
	*response = svcs
	return nil
}