helper

package
v3.4.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2024 License: MPL-2.0 Imports: 21 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanAccessInstance

func CanAccessInstance(ctx context.Context, managementClient kube.Interface, namespace, name string, resource string) (bool, error)

func CanAccessProjectSecret

func CanAccessProjectSecret(ctx context.Context, managementClient kube.Interface, namespace, name string) (bool, error)

func GetCurrentUser

func GetCurrentUser(ctx context.Context, managementClient kube.Interface) (*managementv1.UserInfo, *clusterv1.EntityInfo, error)

func SelectCluster

func SelectCluster(ctx context.Context, baseClient client.Client, log log.Logger) (string, error)

SelectCluster lets the user select a cluster

func SelectProjectCluster

func SelectProjectCluster(ctx context.Context, baseClient client.Client, project *managementv1.Project, log log.Logger) (string, error)

SelectProjectCluster lets the user select a cluster from the project's allowed clusters

func SelectProjectOrCluster

func SelectProjectOrCluster(ctx context.Context, baseClient client.Client, clusterName, projectName string, allowClusterOnly bool, log log.Logger) (cluster string, project string, err error)

func SelectSpaceAndClusterName

func SelectSpaceAndClusterName(ctx context.Context, baseClient client.Client, spaceName, clusterName string, log log.Logger) (string, string, error)

SelectSpaceAndClusterName selects a space and cluster name

func SelectSpaceInstanceOrSpace

func SelectSpaceInstanceOrSpace(ctx context.Context, baseClient client.Client, spaceName, projectName, clusterName string, log log.Logger) (string, string, string, error)

func SelectSpaceTemplate

func SelectSpaceTemplate(ctx context.Context, baseClient client.Client, projectName, templateName string, log log.Logger) (*managementv1.SpaceTemplate, error)

func SelectUserOrTeam

func SelectUserOrTeam(ctx context.Context, baseClient client.Client, clusterName string, log log.Logger) (*clusterv1.EntityInfo, *clusterv1.EntityInfo, error)

SelectUserOrTeam lets the user select an user or team in a cluster

func SelectVirtualClusterAndSpaceAndClusterName

func SelectVirtualClusterAndSpaceAndClusterName(ctx context.Context, baseClient client.Client, virtualClusterName, spaceName, clusterName string, log log.Logger) (string, string, string, error)

func SelectVirtualClusterInstanceOrVirtualCluster

func SelectVirtualClusterInstanceOrVirtualCluster(ctx context.Context, baseClient client.Client, virtualClusterName, spaceName, projectName, clusterName string, log log.Logger) (string, string, string, string, error)

func SelectVirtualClusterTemplate

func SelectVirtualClusterTemplate(ctx context.Context, baseClient client.Client, projectName, templateName string, log log.Logger) (*managementv1.VirtualClusterTemplate, error)

Types

type ClusterSpace

type ClusterSpace struct {
	clusterv1.Space
	Cluster string
}

func GetSpaces

func GetSpaces(ctx context.Context, baseClient client.Client, log log.Logger) ([]ClusterSpace, error)

GetSpaces returns all spaces accessible by the user or team

type ClusterUserOrTeam

type ClusterUserOrTeam struct {
	Team          bool
	ClusterMember managementv1.ClusterMember
}

func SelectClusterUserOrTeam

func SelectClusterUserOrTeam(ctx context.Context, baseClient client.Client, clusterName, userName, teamName string, log log.Logger) (*ClusterUserOrTeam, error)

type ClusterVirtualCluster

type ClusterVirtualCluster struct {
	clusterv1.VirtualCluster
	Cluster string
}

func GetVirtualClusters

func GetVirtualClusters(ctx context.Context, baseClient client.Client, log log.Logger) ([]ClusterVirtualCluster, error)

GetVirtualClusters returns all virtual clusters the user has access to

type ProjectProjectSecret

type ProjectProjectSecret struct {
	ProjectSecret managementv1.ProjectSecret
	Project       string
}

func GetProjectSecrets

func GetProjectSecrets(ctx context.Context, managementClient kube.Interface, projectNames ...string) ([]*ProjectProjectSecret, error)

type SpaceInstanceProject

type SpaceInstanceProject struct {
	SpaceInstance *managementv1.SpaceInstance
	Project       *managementv1.Project
}

func GetSpaceInstances

func GetSpaceInstances(ctx context.Context, baseClient client.Client) ([]*SpaceInstanceProject, error)

type VirtualClusterInstanceProject

type VirtualClusterInstanceProject struct {
	VirtualCluster *managementv1.VirtualClusterInstance
	Project        *managementv1.Project
}

func GetVirtualClusterInstances

func GetVirtualClusterInstances(ctx context.Context, baseClient client.Client) ([]*VirtualClusterInstanceProject, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL