// List all the projects on the cluster on a machine readable format and returns an error if any
List all the projects on the cluster on a machine readable format and returns an error if any
// List all the projects on the cluster on a machine readable format and returns an error if any
func List(context *genericclioptions.Context) (ProjectList, error) {
	currentProject := context.KClient.GetCurrentNamespace()
	projectSupport, err := context.Client.IsProjectSupported()
	if err != nil {
		return ProjectList{}, errors.Wrap(err, "unable to detect project support")
	}
	var allProjects []string
	if projectSupport {
		allProjects, err = context.Client.ListProjectNames()
		if err != nil {
			return ProjectList{}, errors.Wrap(err, "cannot get all the projects")
		}
	} else {
		allProjects, err = context.KClient.GetNamespaces()
		if err != nil {
			return ProjectList{}, errors.Wrap(err, "cannot get all the namespaces")
		}
	}
	var projects []Project
	for _, project := range allProjects {
		isActive := false
		if project == currentProject {
			isActive = true
		}
		projects = append(projects, GetMachineReadableFormat(project, isActive))
	}
	return getMachineReadableFormatForList(projects), nil
}
func List ( context * genericclioptions . Context ) ( ProjectList , error ) { currentProject := context . KClient . GetCurrentNamespace ( ) projectSupport , err := context . Client . IsProjectSupported ( ) if err != nil { return ProjectList { } , errors . Wrap ( err , " " ) } var allProjects [ ] string if projectSupport { allProjects , err = context . Client . ListProjectNames ( ) if err != nil { return ProjectList { } , errors . Wrap ( err , " " ) } } else { allProjects , err = context . KClient . GetNamespaces ( ) if err != nil { return ProjectList { } , errors . Wrap ( err , " " ) } } var projects [ ] Project for _ , project := range allProjects { isActive := false if project == currentProject { isActive = true } projects = append ( projects , GetMachineReadableFormat ( project , isActive ) ) } return getMachineReadableFormatForList ( projects ) , nil }
List all the projects on the cluster on a machine readable format and returns an error if any
List all the projects on the cluster on a machine readable format and returns an error if any
// Get apps from project