serviceaccess/serviceaccess.go
func (m *Manager) ListServiceInfo() (*ServiceInfo, error) {
	serviceInfo := &ServiceInfo{}
	services, err := m.Client.ListServices()
	if err != nil {
		return nil, err
	}
	for _, service := range services {
		plans, err := m.Client.ListServicePlansByQuery(url.Values{
			"q": []string{fmt.Sprintf("%s:%s", "service_guid", service.Guid)},
		})
		if err != nil {
			return nil, err
		}
		for _, plan := range plans {
			servicePlanInfo := serviceInfo.AddPlan(service.Label, plan)
			visibilities, err := m.Client.ListServicePlanVisibilitiesByQuery(url.Values{
				"q": []string{fmt.Sprintf("%s:%s", "service_plan_guid", plan.Guid)},
			})
			if err != nil {
				return nil, err
			}
			for _, visibility := range visibilities {
				servicePlanInfo.AddOrg(visibility.OrganizationGuid, visibility)
			}
		}
	}
	return serviceInfo, nil
}
func (m *Manager) ListServiceInfo() (*ServiceInfo, error) {
	serviceInfo := &ServiceInfo{}
	services, err := m.Client.ListServices()
	if err != nil {
		return nil, err
	}
	for _, service := range services {
		plans, err := m.Client.ListServicePlansByQuery(url.Values{
			"q": []string{fmt.Sprintf("%s:%s", "service_guid", service.Guid)},
		})
		if err != nil {
			return nil, err
		}
		for _, plan := range plans {
			servicePlanInfo := serviceInfo.AddPlan(service.Label, plan)
			visibilities, err := m.Client.ListServicePlanVisibilitiesByQuery(url.Values{
				"q": []string{fmt.Sprintf("%s:%s", "service_plan_guid", plan.Guid)},
			})
			if err != nil {
				return nil, err
			}
			for _, visibility := range visibilities {
				servicePlanInfo.AddOrg(visibility.OrganizationGuid, visibility)
			}
		}
	}
	return serviceInfo, nil
}
func ( m * Manager ) ListServiceInfo ( ) ( * ServiceInfo , error ) { serviceInfo := & ServiceInfo { } services , err := m . Client . ListServices ( ) if err != nil { return nil , err } for _ , service := range services { plans , err := m . Client . ListServicePlansByQuery ( url . Values { " " : [ ] string { fmt . Sprintf ( " " , " " , service . Guid ) } , } ) if err != nil { return nil , err } for _ , plan := range plans { servicePlanInfo := serviceInfo . AddPlan ( service . Label , plan ) visibilities , err := m . Client . ListServicePlanVisibilitiesByQuery ( url . Values { " " : [ ] string { fmt . Sprintf ( " " , " " , plan . Guid ) } , } ) if err != nil { return nil , err } for _ , visibility := range visibilities { servicePlanInfo . AddOrg ( visibility . OrganizationGuid , visibility ) } } } return serviceInfo , nil }
//ListServiceInfo - returns services and their cooresponding plans
ListServiceInfo - returns services and their cooresponding plans