func PersistentVolumeListHandler(ctx context.Context, list *v1.PersistentVolumeList, options Options) (component.Component, error) {
	if list == nil {
		return nil, errors.New("nil list")
	}

	cols := component.NewTableCols("Name", "Capacity", "Access Modes", "Reclaim Policy", "Status", "Claim", "Storage Class", "Reason", "Age")
	table := component.NewTable("Persistent Volumes", "We couldn't find any persistent volumes!", cols)

	for _, pv := range list.Items {
		row := component.TableRow{}
		nameLink, err := options.Link.ForObject(&pv, pv.Name)
		if err != nil {
			return nil, err
		}

		storage := pv.Spec.Capacity[v1.ResourceStorage]
		capacity := storage.String()

		accessModes := getAccessModesAsString(pv.Spec.AccessModes)

		claimLink, err := createBoundPersistentVolumeClaimLink(ctx, &pv, options)
		if err != nil {
			return nil, err
		}

		row["Name"] = nameLink
		row["Capacity"] = component.NewText(capacity)
		row["Access Modes"] = component.NewText(accessModes)
		row["Reclaim Policy"] = component.NewText(string(pv.Spec.PersistentVolumeReclaimPolicy))
		row["Status"] = component.NewText(string(pv.Status.Phase))
		row["Claim"] = claimLink
		row["Storage Class"] = component.NewText(pv.Spec.StorageClassName)
		row["Reason"] = component.NewText(pv.Status.Reason)
		row["Age"] = component.NewTimestamp(pv.CreationTimestamp.Time)

		table.Add(row)
	}

	return table, nil
}
// PersistentVolumeListHandler is a printFunc that creates a component to display multiple Persistent Volumes
PersistentVolumeListHandler is a printFunc that creates a component to display multiple Persistent Volumes
// PersistentVolumeListHandler is a printFunc that creates a component to display multiple Persistent Volumes
func PersistentVolumeListHandler(ctx context.Context, list *v1.PersistentVolumeList, options Options) (component.Component, error) {
	if list == nil {
		return nil, errors.New("nil list")
	}
	cols := component.NewTableCols("Name", "Capacity", "Access Modes", "Reclaim Policy", "Status", "Claim", "Storage Class", "Reason", "Age")
	table := component.NewTable("Persistent Volumes", "We couldn't find any persistent volumes!", cols)
	for _, pv := range list.Items {
		row := component.TableRow{}
		nameLink, err := options.Link.ForObject(&pv, pv.Name)
		if err != nil {
			return nil, err
		}
		storage := pv.Spec.Capacity[v1.ResourceStorage]
		capacity := storage.String()
		accessModes := getAccessModesAsString(pv.Spec.AccessModes)
		claimLink, err := createBoundPersistentVolumeClaimLink(ctx, &pv, options)
		if err != nil {
			return nil, err
		}
		row["Name"] = nameLink
		row["Capacity"] = component.NewText(capacity)
		row["Access Modes"] = component.NewText(accessModes)
		row["Reclaim Policy"] = component.NewText(string(pv.Spec.PersistentVolumeReclaimPolicy))
		row["Status"] = component.NewText(string(pv.Status.Phase))
		row["Claim"] = claimLink
		row["Storage Class"] = component.NewText(pv.Spec.StorageClassName)
		row["Reason"] = component.NewText(pv.Status.Reason)
		row["Age"] = component.NewTimestamp(pv.CreationTimestamp.Time)
		table.Add(row)
	}
	return table, nil
}
func PersistentVolumeListHandler ( ctx context . Context , list * v1 . PersistentVolumeList , options Options ) ( component . Component , error ) { if list == nil { return nil , errors . New ( " " ) } cols := component . NewTableCols ( " " , " " , " " , " " , " " , " " , " " , " " , " " ) table := component . NewTable ( " " , " " , cols ) for _ , pv := range list . Items { row := component . TableRow { } nameLink , err := options . Link . ForObject ( & pv , pv . Name ) if err != nil { return nil , err } storage := pv . Spec . Capacity [ v1 . ResourceStorage ] capacity := storage . String ( ) accessModes := getAccessModesAsString ( pv . Spec . AccessModes ) claimLink , err := createBoundPersistentVolumeClaimLink ( ctx , & pv , options ) if err != nil { return nil , err } row [ " " ] = nameLink row [ " " ] = component . NewText ( capacity ) row [ " " ] = component . NewText ( accessModes ) row [ " " ] = component . NewText ( string ( pv . Spec . PersistentVolumeReclaimPolicy ) ) row [ " " ] = component . NewText ( string ( pv . Status . Phase ) ) row [ " " ] = claimLink row [ " " ] = component . NewText ( pv . Spec . StorageClassName ) row [ " " ] = component . NewText ( pv . Status . Reason ) row [ " " ] = component . NewTimestamp ( pv . CreationTimestamp . Time ) table . Add ( row ) } return table , nil }
PersistentVolumeListHandler is a printFunc that creates a component to display multiple Persistent Volumes
PersistentVolumeListHandler is a printFunc that creates a component to display multiple Persistent Volumes