// Retrieve The number of services currently associated with the certificate.
489697
func (r Security_Certificate) GetAssociatedServiceCount() (resp int, err error) {
	err = r.Session.DoRequest("SoftLayer_Security_Certificate", "getAssociatedServiceCount", nil, &r.Options, &resp)
	return
}
844716
func (t *TrafficClones) GetCount() int {
	if t == nil || t.Count == nil {
		return 0
	}
	return *t.Count
}
161991
func (t *TrafficPath) GetCount() int {
	if t == nil || t.Count == nil {
		return 0
	}
	return *t.Count
}
1057785
func (s *serviceAccountLister) ServiceAccounts(namespace string) ServiceAccountNamespaceLister {
	return serviceAccountNamespaceLister{indexer: s.indexer, namespace: namespace}
}
358919
func (c *Client) GetServices(ctx context.Context) (map[string]string, error) {
	var services map[string]string

	req, err := c.NewRequest("GET", servicesPath, nil, nil)
	if err != nil {
		return nil, err
	}

	if err := c.Do(ctx, req, &services); err != nil {
		return nil, err
	}

	return services, err
}
530733
func (s *Storage) GetIosSuccess() int64 {
	var count int64
	getInt64(storage.IosSuccessKey, &count)

	return count
}
561967
func (c *Client) GetServices() ([]*models.Service, error) {
	resp, err := c.Service.GetService(nil)
	if err != nil {
		return nil, Hint(err)
	}
	return resp.Payload, nil
}
1221623
func GetServiceStateIDs(conn client.Connection, poolID, serviceID string) ([]StateRequest, error) {
	logger := plog.WithField("serviceid", serviceID)

	basepth := "/"
	if poolID != "" {
		basepth = path.Join("/pools", poolID)
	}

	spth := path.Join(basepth, "/services", serviceID)
	ch, err := conn.Children(spth)
	if err != nil && err != client.ErrNoNode {

		logger.WithError(err).Debug("Could not look up states on service")

		// TODO: wrap the error?
		return nil, err
	}

	states := make([]StateRequest, len(ch))
	for i, stateID := range ch {
		hostID, _, instanceID, err := ParseStateID(stateID)
		if err != nil {
			logger.WithField("stateid", stateID).WithError(err).Debug("Could not parse state")
			return nil, err
		}

		states[i] = StateRequest{
			PoolID:     poolID,
			HostID:     hostID,
			ServiceID:  serviceID,
			InstanceID: instanceID,
		}
	}

	logger.WithField("statecount", len(states)).Debug("Loaded state ids")
	return states, nil
}
1300057
func (s *ServicesService) GetService(serviceIdentifier string) (*serviceResponse, error) {
	path := versioned(servicePath(serviceIdentifier))
	serviceResponse := &serviceResponse{}

	resp, err := s.client.get(path, serviceResponse)
	if err != nil {
		return nil, err
	}

	serviceResponse.HttpResponse = resp
	return serviceResponse, nil
}
1356
func (c *Controller) GetSuccessCount() int {
	c.mutex.RLock()
	defer c.mutex.RUnlock()

	return c.successCount
}
1333550
func (cp *ConsulClient) getServiceInstances(key string, waitIdx uint64) ([]ServiceInfo, uint64, error) {
	var srvcList []ServiceInfo

	// Get the object from consul client
	kvs, meta, err := cp.client.KV().List(key, &api.QueryOptions{WaitIndex: waitIdx})
	if err != nil {
		log.Errorf("Error getting key %s. Err: %v", key, err)
		return nil, 0, err
	}

	// Consul returns success and a nil kv when a key is not found,
	// translate it to 'Key not found' error
	if kvs == nil {
		return []ServiceInfo{}, meta.LastIndex, nil
	}

	// Parse each node in the directory
	for _, kv := range kvs {
		var respSrvc ServiceInfo
		// Parse JSON response
		err = json.Unmarshal([]byte(kv.Value), &respSrvc)
		if err != nil {
			log.Errorf("Error parsing object %+v, Err %v", kv, err)
			return nil, 0, err
		}

		srvcList = append(srvcList, respSrvc)
	}

	return srvcList, meta.LastIndex, nil
}
823693
func (c Client) GetServiceLabels(service *ServiceItem, app *ApplicationItem, prefix string) (map[string]string, error) {
	extensionData := ServiceExtensionLabels{}
	err := c.GetServiceExtension(app.TypeName, app.TypeVersion, service.TypeName, prefix, &extensionData)
	if err != nil {
		return nil, err
	}

	prefixPeriod := prefix + "."

	labels := map[string]string{}
	if extensionData.Label != nil {
		for _, label := range extensionData.Label {
			if strings.HasPrefix(label.Key, prefixPeriod) {
				labelKey := strings.Replace(label.Key, prefixPeriod, "", -1)
				labels[labelKey] = label.Value
			}
		}
	}

	exists, properties, err := c.GetProperties(service.ID)
	if err != nil {
		return nil, err
	}

	if exists {
		for k, v := range properties {
			if strings.HasPrefix(k, prefixPeriod) {
				labelKey := strings.Replace(k, prefixPeriod, "", -1)
				labels[labelKey] = v
			}
		}
	}

	return labels, nil
}
1071203
func (r Virtual_DedicatedHost) GetPciDevices() (resp []datatypes.Virtual_Host_PciDevice, err error) {
	err = r.Session.DoRequest("SoftLayer_Virtual_DedicatedHost", "getPciDevices", nil, &r.Options, &resp)
	return
}
378262
func (f *Facade) GetServicesHealth(ctx datastore.Context) (map[string]map[int]map[string]health.HealthStatus, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServicesHealth"))
	store := f.serviceStore
	shs, err := store.GetAllServiceHealth(ctx)
	if err != nil {
		glog.Errorf("Could not look up services: %s", err)
		return nil, err
	}
	stats := make(map[string]map[int]map[string]health.HealthStatus)

	for _, svc := range shs {
		if stats[svc.ID], err = f.getServiceHealth(ctx, svc); err != nil {
			return nil, err
		}
	}
	return stats, nil
}
1274342
func (f *Facade) GetServiceInstances(ctx datastore.Context, since time.Time, serviceID string) ([]service.Instance, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceInstances"))
	logger := plog.WithField("serviceid", serviceID)

	// create an instance map to map instances to their memory usage
	instanceMap := make(map[string]*service.Usage)

	// keep track of the hosts previously looked up
	hostMap := make(map[string]host.Host)

	svc, err := f.serviceStore.Get(ctx, serviceID)
	if err != nil {

		logger.WithError(err).Debug("Could not look up service")

		// TODO: expecting wrapped error here
		return nil, err
	}

	logger = logger.WithFields(log.Fields{
		"servicename": svc.Name,
		"poolid":      svc.PoolID,
		"imageid":     svc.ImageID,
	})
	logger.Debug("Loaded service")

	// get the hash of the service image
	imageUUID, err := f.getImageUUID(ctx, svc.ImageID)
	if err != nil {
		return nil, err
	}

	states, err := f.zzk.GetServiceStates(ctx, svc.PoolID, svc.ID)
	if err != nil {

		logger.WithError(err).Debug("Could not look up running instances")
		return nil, err
	}

	logger = logger.WithField("instances", len(states))
	logger.Debug("Found running instances for service")

	metricsreq := make([]metrics.ServiceInstance, len(states))
	insts := make([]service.Instance, len(states))
	for i, state := range states {
		hst, ok := hostMap[state.HostID]
		if !ok {
			if err := f.hostStore.Get(ctx, host.HostKey(state.HostID), &hst); err != nil {

				logger.WithFields(log.Fields{
					"hostid":     state.HostID,
					"instanceid": state.InstanceID,
				}).WithError(err).Debug("Could not look up host for instance")

				return nil, err
			}
			hostMap[state.HostID] = hst
		}

		inst, err := f.getInstance(ctx, hst, *svc, imageUUID, state)
		if err != nil {
			return nil, err
		}
		metricsreq[i] = metrics.ServiceInstance{ServiceID: inst.ServiceID, InstanceID: inst.InstanceID}
		insts[i] = *inst
		instanceMap[fmt.Sprintf("%s-%d", inst.ServiceID, inst.InstanceID)] = &insts[i].MemoryUsage
	}

	// look up the metrics of all the instances
	if len(metricsreq) > 0 {
		metricsres, err := f.metricsClient.GetInstanceMemoryStats(since, metricsreq...)
		if err != nil {
			logger.WithError(err).Debug("Could not look up memory metrics for instances on service")
		} else {
			for _, metric := range metricsres {
				*instanceMap[fmt.Sprintf("%s-%s", metric.ServiceID, metric.InstanceID)] = service.Usage{
					Cur: metric.Last,
					Max: metric.Max,
					Avg: metric.Average,
				}
			}
		}
	}

	logger.Debug("Loaded instances for service")
	return insts, nil
}
619831
func (b *FusisBalancer) GetService(name string) (*types.Service, error) {
	return b.store.GetService(name)
}
840646
func (client *Client) GetServiceInstances(query ...Query) ([]ServiceInstance, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetServiceInstancesRequest,
		Query:       query,
	})
	if err != nil {
		return nil, nil, err
	}

	var fullServiceInstanceList []ServiceInstance
	warnings, err := client.paginate(request, ServiceInstance{}, func(item interface{}) error {
		if serviceInstance, ok := item.(ServiceInstance); ok {
			fullServiceInstanceList = append(fullServiceInstanceList, serviceInstance)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   ServiceInstance{},
				Unexpected: item,
			}
		}
		return nil
	})

	return fullServiceInstanceList, warnings, err
}