// GetServicePlanVisibilities fetches service plan visibilities for a plan by GUID.
422795
func (actor *Actor) GetServicePlanVisibilities(planGUID string) ([]ServicePlanVisibility, Warnings, error) {
	visibilities, warnings, err := actor.CloudControllerClient.GetServicePlanVisibilities(ccv2.Filter{
		Type:     constant.ServicePlanGUIDFilter,
		Operator: constant.EqualOperator,
		Values:   []string{planGUID},
	})
	if err != nil {
		return nil, Warnings(warnings), err
	}

	var visibilitesToReturn []ServicePlanVisibility
	for _, v := range visibilities {
		visibilitesToReturn = append(visibilitesToReturn, ServicePlanVisibility(v))
	}

	return visibilitesToReturn, Warnings(warnings), nil
}
811117
func (ctx *Context) GetService(vsID string) (*ServiceInfo, error) {
	ctx.mutex.RLock()
	defer ctx.mutex.RUnlock()

	vs, exists := ctx.services[vsID]

	if !exists {
		return nil, ErrObjectNotFound
	}

	result := ServiceInfo{Options: vs.options}

	// This is O(n), can be optimized with reverse backend map.
	for rsID, backend := range ctx.backends {
		if backend.service != vs {
			continue
		}

		result.Backends = append(result.Backends, rsID)
		result.Health += backend.metrics.Health
	}

	if len(result.Backends) == 0 {
		// Service without backends is healthy, albeit useless.
		result.Health = 1.0
	} else {
		result.Health /= float64(len(result.Backends))
	}

	return &result, nil
}
240838
func (a *HostAgent) GetServiceBindMounts(serviceID string, bindmounts *map[string]string) error {
	glog.V(4).Infof("ControlCenterAgent.GetServiceBindMounts(serviceID:%s)", serviceID)
	*bindmounts = make(map[string]string, 0)

	var evaluatedServiceResponse EvaluateServiceResponse
	if err := a.GetEvaluatedService(EvaluateServiceRequest{ServiceID: serviceID, InstanceID: 0}, &evaluatedServiceResponse); err != nil {
		return err
	}
	service := evaluatedServiceResponse.Service
	tenantID := evaluatedServiceResponse.TenantID

	response := map[string]string{}
	for _, volume := range service.Volumes {
		if volume.Type != "" && volume.Type != "dfs" {
			continue
		}

		resourcePath, err := a.setupVolume(tenantID, &service, volume)
		if err != nil {
			return err
		}

		glog.V(4).Infof("retrieved bindmount resourcePath:%s containerPath:%s", resourcePath, volume.ContainerPath)
		response[resourcePath] = volume.ContainerPath
	}
	*bindmounts = response

	return nil
}
985777
func (api *ProjectsAPI) GetServices(projectID string) (result *Services, err error) {
	uri := api.client.Endpoint + projectUrl + projectID + "/services"
	res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions)
	if err != nil {
		return
	}

	result = &Services{}
	err = json.Unmarshal(res, result)
	return
}
932951
func (actor Actor) GetServiceBrokers() ([]ServiceBroker, Warnings, error) {
	brokers, warnings, err := actor.CloudControllerClient.GetServiceBrokers()
	if err != nil {
		return nil, Warnings(warnings), err
	}

	var brokersToReturn []ServiceBroker
	for _, b := range brokers {
		brokersToReturn = append(brokersToReturn, ServiceBroker(b))
	}

	return brokersToReturn, Warnings(warnings), nil
}
1173072
func (r Resource_Metadata) GetServiceResource(serviceName *string, index *int) (resp string, err error) {
	params := []interface{}{
		serviceName,
		index,
	}
	err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getServiceResource", params, &r.Options, &resp)
	return
}
295221
func (c *Client) CreateServicePlanVisibilityByUniqueId(uniqueId string, organizationGuid string) (ServicePlanVisibility, error) {
	q := url.Values{}
	q.Set("q", fmt.Sprintf("unique_id:%s", uniqueId))
	plans, err := c.ListServicePlansByQuery(q)
	if err != nil {
		return ServicePlanVisibility{}, errors.Wrap(err, fmt.Sprintf("Couldn't find a service plan with unique_id: %s", uniqueId))
	}
	return c.CreateServicePlanVisibility(plans[0].Guid, organizationGuid)
}
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
}
411180
func (c *Client) GetAvailableBareMetalPlansForRegion(id int) ([]int, error) {
	var bareMetalPlanIDs []int
	if err := c.get(fmt.Sprintf(`regions/availability?DCID=%v`, id), &bareMetalPlanIDs); err != nil {
		return nil, err
	}
	return bareMetalPlanIDs, nil
}
956500
func (_m *State) GetDestinations(svc *types.Service) []types.Destination {
	ret := _m.Called(svc)

	var r0 []types.Destination
	if rf, ok := ret.Get(0).(func(*types.Service) []types.Destination); ok {
		r0 = rf(svc)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]types.Destination)
		}
	}

	return r0
}
96441
func (c *Client) GetServiceEndpoints(serviceIDs []string, reportImports, reportExports bool, validate bool) ([]applicationendpoint.EndpointReport, error) {
	request := &EndpointRequest{
		ServiceIDs:    serviceIDs,
		ReportImports: reportImports,
		ReportExports: reportExports,
		Validate:      validate,
	}
	result := make([]applicationendpoint.EndpointReport, 0)
	err := c.call("GetServiceEndpoints", request, &result)
	if err != nil {
		return nil, err
	}
	return result, nil
}
518820
func (s *StoreToEndpointsLister) GetServiceEndpoints(svc *api.Service) (ep api.Endpoints, err error) {
	for _, m := range s.Store.List() {
		ep = *m.(*api.Endpoints)
		if svc.Name == ep.Name && svc.Namespace == ep.Namespace {
			return ep, nil
		}
	}
	err = fmt.Errorf("could not find endpoints for service: %v", svc.Name)
	return
}
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)
}
1197213
func (a *LBClient) GetServiceBindMounts(serviceID string, bindmounts *map[string]string) error {
	glog.V(4).Infof("ControlCenterAgent.GetServiceBindMounts(serviceID:%s)", serviceID)
	return a.rpcClient.Call("ControlCenterAgent.GetServiceBindMounts", serviceID, bindmounts, 0)
}
125079
func (s *Server) GetServiceInstances(serviceID string, res *[]service.Instance) (err error) {
	insts, err := s.f.GetServiceInstances(s.context(), time.Now().Add(-time.Hour), serviceID)
	if err != nil {
		return
	}
	*res = insts
	return
}
1196937
func (client *Client) GetServiceInstanceServiceBindings(serviceInstanceGUID string) ([]ServiceBinding, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetServiceInstanceServiceBindingsRequest,
		URIParams:   map[string]string{"service_instance_guid": serviceInstanceGUID},
	})
	if err != nil {
		return nil, nil, err
	}

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

	return fullBindingsList, warnings, err
}
1110838
func (client *Client) GetServiceInstances(filters ...Filter) ([]ServiceInstance, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetServiceInstancesRequest,
		Query:       ConvertFilterParameters(filters),
	})
	if err != nil {
		return nil, nil, err
	}

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

	return fullInstancesList, warnings, err
}