// List lists all the deployed services
List lists all the deployed services
// List lists all the deployed services
func List(client *occlient.Client, applicationName string) ([]ServiceInfo, error) {
	labels := map[string]string{
		applabels.ApplicationLabel: applicationName,
	}
	applicationSelector := util.ConvertLabelsToSelector(labels)
	serviceInstanceList, err := client.GetServiceInstanceList(applicationSelector)
	if err != nil {
		return nil, errors.Wrapf(err, "unable to list services")
	}
	var services []ServiceInfo
	for _, elem := range serviceInstanceList {
		services = append(services, ServiceInfo{Name: elem.Labels[componentlabels.ComponentLabel], Type: elem.Labels[componentlabels.ComponentTypeLabel], Status: elem.Status.Conditions[0].Reason})
	}
	return services, nil
}
func List ( client * occlient . Client , applicationName string ) ( [ ] ServiceInfo , error ) { labels := map [ string ] string { applabels . ApplicationLabel : applicationName , } applicationSelector := util . ConvertLabelsToSelector ( labels ) serviceInstanceList , err := client . GetServiceInstanceList ( applicationSelector ) if err != nil { return nil , errors . Wrapf ( err , " " ) } var services [ ] ServiceInfo for _ , elem := range serviceInstanceList { services = append ( services , ServiceInfo { Name : elem . Labels [ componentlabels . ComponentLabel ] , Type : elem . Labels [ componentlabels . ComponentTypeLabel ] , Status : elem . Status . Conditions [ 0 ] . Reason } ) } return services , nil }
List lists all the deployed services
List lists all the deployed services
//since, service is associated with application, it consist of application label as well // which we can give as a selector // get service instance list based on given selector // Iterate through serviceInstanceList and add to service