//listServiceLB is a netctl interface routine to list
//service object
17652
func listServiceLB(ctx *cli.Context) {

	tenantName := ctx.String("tenant")
	if len(tenantName) == 0 {
		tenantName = "default"
	}
	_, err := getClient(ctx).TenantGet(tenantName)
	errCheck(ctx, err)

	svcList, err := getClient(ctx).ServiceLBList()
	errCheck(ctx, err)

	filtered := []*contivClient.ServiceLB{}

	if ctx.Bool("all") {
		filtered = *svcList
	} else {
		for _, svc := range *svcList {
			if svc.TenantName == tenantName {
				filtered = append(filtered, svc)
			}
		}
	}

	if ctx.Bool("json") {
		dumpJSONList(ctx, filtered)
	} else if ctx.Bool("quiet") {
		services := ""
		for _, service := range filtered {
			services += service.ServiceName + "\n"
		}
		os.Stdout.WriteString(services)
	} else {

		writer := tabwriter.NewWriter(os.Stdout, 0, 2, 2, ' ', 0)
		defer writer.Flush()
		writer.Write([]byte("ServiceName\tTenant\tNetwork\tSelectors\n"))
		writer.Write([]byte("---------\t--------\t-------\t-------\n"))
		for _, group := range filtered {
			writer.Write(
				[]byte(fmt.Sprintf("%v\t%v\t%v\t%v\t\n",
					group.ServiceName,
					group.TenantName,
					group.NetworkName,
					group.Selectors,
				)))
		}
	}
}
1111937
func (s *serviceLister) List(selector labels.Selector) (ret []*v1.Service, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1.Service))
	})
	return ret, err
}
1291677
func ListServices() ([]string, error) {
	// TODO(ericsnow) conn.ListUnits misses some inactive units, so we
	// would need conn.ListUnitFiles. Such a method has been requested.
	// (see https://github.com/coreos/go-systemd/issues/76). In the
	// meantime we use systemctl at the shell to list the services.
	// Once that is addressed upstream we can just call listServices here.
	names, err := Cmdline{}.ListAll()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return names, nil
}
469152
func (c *HyperClient) ListService(podID string) ([]*types.UserService, error) {
	resp, err := c.client.ServiceList(
		c.ctx,
		&types.ServiceListRequest{PodID: podID},
	)

	if err != nil {
		return nil, err
	}

	return resp.Services, nil
}
949952
func (c *ServicedCli) cmdServiceVariableList(ctx *cli.Context) {
	args := ctx.Args()
	if len(args) < 1 {
		fmt.Printf("Incorrect Usage.\n\n")
		cli.ShowCommandHelp(ctx, "list")
		return
	}

	svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}

	service, err := c.driver.GetService(svcDetails.ID)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}

	variables := service.Context
	keys := make([]string, 0)
	for k, _ := range variables {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	for _, key := range keys {
		fmt.Printf("%s %v\n", key, variables[key])
	}
}
1069428
func (s *ServicesService) ListServices(options *ListOptions) (*servicesResponse, error) {
	path := versioned(servicePath(""))
	servicesResponse := &servicesResponse{}

	path, err := addURLQueryOptions(path, options)
	if err != nil {
		return nil, err
	}

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

	servicesResponse.HttpResponse = resp
	return servicesResponse, nil
}
868618
func (c *Client) ListJobs(liveOnly bool) ([]Entry, error) {
	var resp []Entry
	var url string
	if liveOnly {
		url = fmt.Sprintf("%s?state=running", apiJobs)
	} else {
		url = apiJobs
	}
	req := request{
		method: client.GET,
		url:    url,
		resp:   &resp,
	}
	if _, err := c.sendRequest(req); err != nil {
		return nil, errors.Newf(err, "failed to list jobs")
	}
	return resp, nil
}
34820
func (c *Client) ListVCLs(i *ListVCLsInput) ([]*VCL, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d/vcl", i.Service, i.Version)
	resp, err := c.Get(path, nil)
	if err != nil {
		return nil, err
	}

	var vcls []*VCL
	if err := decodeJSON(&vcls, resp.Body); err != nil {
		return nil, err
	}
	sort.Stable(vclsByName(vcls))
	return vcls, nil
}
31260
func (s *ServiceOfferingService) ListServiceOfferings(p *ListServiceOfferingsParams) (*ListServiceOfferingsResponse, error) {
	resp, err := s.cs.newRequest("listServiceOfferings", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListServiceOfferingsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
106248
func ListFormatWrite(ctx formatter.Context, services []swarm.Service, info map[string]ListInfo) error {
	render := func(format func(subContext formatter.SubContext) error) error {
		for _, service := range services {
			serviceCtx := &serviceContext{service: service, mode: info[service.ID].Mode, replicas: info[service.ID].Replicas}
			if err := format(serviceCtx); err != nil {
				return err
			}
		}
		return nil
	}
	serviceCtx := serviceContext{}
	serviceCtx.Header = formatter.SubHeaderContext{
		"ID":       serviceIDHeader,
		"Name":     formatter.NameHeader,
		"Mode":     modeHeader,
		"Replicas": replicasHeader,
		"Image":    formatter.ImageHeader,
		"Ports":    formatter.PortsHeader,
	}
	return ctx.Write(&serviceCtx, render)
}
1118067
func (s *LoadBalancerService) ListNetscalerLoadBalancers(p *ListNetscalerLoadBalancersParams) (*ListNetscalerLoadBalancersResponse, error) {
	resp, err := s.cs.newRequest("listNetscalerLoadBalancers", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListNetscalerLoadBalancersResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
319458
func (c *Client) ListDictionaries(i *ListDictionariesInput) ([]*Dictionary, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d/dictionary", i.Service, i.Version)
	resp, err := c.Get(path, nil)
	if err != nil {
		return nil, err
	}

	var bs []*Dictionary
	if err := decodeJSON(&bs, resp.Body); err != nil {
		return nil, err
	}
	sort.Stable(dictionariesByName(bs))
	return bs, nil
}
496740
func (mr *MockServiceAccessMockRecorder) ListServices() *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServices", reflect.TypeOf((*MockServiceAccess)(nil).ListServices))
}
137668
func (s *ServicesService) List(options *ListServicesOptions) ([]*Service, *http.Response, error) {
	return s.ListWithContext(context.TODO(), options)
}
591823
func (s *Server) HandleListServices(c web.C, w http.ResponseWriter, r *http.Request) {
	services, err := s.Store.List("/services/")
	if err != nil {
		s.logger.Printf("ERROR: %s", err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	json.NewEncoder(w).Encode(struct {
		Services []string `json:"services"`
	}{Services: services})
}
548139
func (s *NetworkOfferingService) ListNetworkOfferings(p *ListNetworkOfferingsParams) (*ListNetworkOfferingsResponse, error) {
	resp, err := s.cs.newRequest("listNetworkOfferings", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListNetworkOfferingsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1005047
func (*Service) ListPlatforms(c context.Context, req *crimson.ListPlatformsRequest) (*crimson.ListPlatformsResponse, error) {
	platforms, err := listPlatforms(c, req)
	if err != nil {
		return nil, err
	}
	return &crimson.ListPlatformsResponse{
		Platforms: platforms,
	}, nil
}