util

package
v0.0.0-...-c560a75 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegexResourceName = "^[a-z0-9][a-z0-9-]*[a-z0-9]$"
)

Variables

This section is empty.

Functions

func CleanupLoginConfig

func CleanupLoginConfig() error

func CreateChoreoLabels

func CreateChoreoLabels(org, project, component, name string) map[string]string

func FormatAge

func FormatAge(t time.Time) string

func GetAllBuilds

func GetAllBuilds(orgName, projectName, componentName string) (*choreov1.BuildList, error)

func GetAllComponents

func GetAllComponents(orgName, projectName string) (*choreov1.ComponentList, error)

func GetAllDeployableArtifacts

func GetAllDeployableArtifacts(orgName, projectName, componentName string) (*choreov1.DeployableArtifactList, error)

func GetAllDeploymentTracks

func GetAllDeploymentTracks(orgName, projectName, componentName string) (*choreov1.DeploymentTrackList, error)

func GetAllDeployments

func GetAllDeployments(orgName, projectName, componentName string) (*choreov1.DeploymentList, error)

func GetAllEndpoints

func GetAllEndpoints(orgName, projectName, componentName, envName string) (*choreov1.EndpointList, error)

func GetAllEnvironments

func GetAllEnvironments(orgName string) (*choreov1.EnvironmentList, error)

func GetBuild

func GetBuild(orgName, projectName, componentName, buildName string) (*choreov1.Build, error)

func GetBuildNames

func GetBuildNames(orgName, projectName, componentName string) ([]string, error)

func GetComponent

func GetComponent(orgName, projectName, componentName string) (*choreov1.Component, error)

func GetComponentNames

func GetComponentNames(orgName, projectName string) ([]string, error)

func GetDataPlane

func GetDataPlane(orgName, dataPlaneName string) (*choreov1.DataPlane, error)

func GetDataPlaneNames

func GetDataPlaneNames(orgName string) ([]string, error)

func GetDataPlanes

func GetDataPlanes(orgName string) (*choreov1.DataPlaneList, error)

func GetDefaultKubeconfigPath

func GetDefaultKubeconfigPath() (string, error)

GetDefaultKubeconfigPath returns the default kubeconfig path

func GetDeployableArtifact

func GetDeployableArtifact(orgName, projectName, componentName, deployableArtifactName string) (*choreov1.DeployableArtifact, error)

func GetDeployableArtifactNames

func GetDeployableArtifactNames(orgName, projectName, componentName string) ([]string, error)

func GetDeployment

func GetDeployment(orgName, projectName, componentName, deploymentName string) (*choreov1.Deployment, error)

func GetDeploymentNames

func GetDeploymentNames(orgName, projectName, componentName string) ([]string, error)

func GetDeploymentTrack

func GetDeploymentTrack(orgName, projectName, componentName, trackName string) (*choreov1.DeploymentTrack, error)

func GetDeploymentTrackNames

func GetDeploymentTrackNames(orgName, projectName, componentName string) ([]string, error)

func GetEndpoint

func GetEndpoint(orgName, projectName, componentName, envName, endpointName string) (*choreov1.Endpoint, error)

func GetEnvironment

func GetEnvironment(orgName, envName string) (*choreov1.Environment, error)

func GetEnvironmentNames

func GetEnvironmentNames(orgName string) ([]string, error)

func GetK8sObjectYAMLFromCRD

func GetK8sObjectYAMLFromCRD(group, version, kind, name, namespace string) (string, error)

func GetKubeContextNames

func GetKubeContextNames(config *clientcmdapi.Config) []string

func GetKubernetesClient

func GetKubernetesClient() (client.Client, error)

func GetLoginConfigFilePath

func GetLoginConfigFilePath() (string, error)

func GetOrganization

func GetOrganization(name string) (*choreov1.Organization, error)

func GetOrganizationNames

func GetOrganizationNames() ([]string, error)

GetOrganizationNames retrieves a sorted list of organization names

func GetOrganizations

func GetOrganizations() (*choreov1.OrganizationList, error)

func GetProject

func GetProject(orgName, projectName string) (*choreov1.Project, error)

func GetProjectNames

func GetProjectNames(organization string) ([]string, error)

GetProjectNames retrieves a sorted list of project names in an organization

func GetProjects

func GetProjects(orgName string) (*choreov1.ProjectList, error)

func GetResource

func GetResource[T any, L client.ObjectList](namespace string, labels map[string]string) (*T, error)

GetResource fetches exactly one resource matching the given labels. T is a non-pointer struct (e.g. choreov1.Build). L is a pointer-to-list type (e.g. *choreov1.BuildList).

func GetResources

func GetResources[T any, L client.ObjectList](namespace string, labels map[string]string) (L, error)

GetResources fetches all resources matching the given labels. T is a non-pointer struct (e.g. choreov1.Build). L is a pointer-to-list type (e.g. *choreov1.BuildList).

func GetStatus

func GetStatus(conditions []metav1.Condition, conditionType string) string

func IsLoginConfigFileExists

func IsLoginConfigFileExists() bool

func LoadStoredConfig

func LoadStoredConfig() (*config.StoredConfig, error)

LoadStoredConfig reads the config file and unmarshals it into StoredConfig

func LoginWithContext

func LoginWithContext(kubeconfigPath, contextName string) error

func SaveLoginConfig

func SaveLoginConfig(kubeconfigPath, context string) error

func SaveStoredConfig

func SaveStoredConfig(cfg *config.StoredConfig) error

SaveStoredConfig writes the StoredConfig data to the config file

func ShowEquivalentCommand

func ShowEquivalentCommand(command string, flags map[string]string)

ShowEquivalentCommand prints the equivalent non-interactive command

func ValidateComponent

func ValidateComponent(val interface{}) error

func ValidateOrganization

func ValidateOrganization(val interface{}) error

func ValidateOrganizationParams

func ValidateOrganizationParams(cmdType CommandType, params interface{}) error

func ValidateParams

func ValidateParams(cmdType CommandType, resource ResourceType, params interface{}) error

func ValidateProject

func ValidateProject(val interface{}) error

func ValidateResourceName

func ValidateResourceName(resource string, val interface{}) error

func ValidateURL

func ValidateURL(val interface{}) error

Types

type CommandType

type CommandType string
const (
	CmdCreate CommandType = "create"
	CmdGet    CommandType = "get"
)

type GenericList

type GenericList interface {
	runtime.Object
	GetItems() []runtime.Object
}

type GenericResource

type GenericResource interface {
	metav1.Object
	runtime.Object
}

type ResourceType

type ResourceType string
const (
	ResourceProject            ResourceType = "project"
	ResourceComponent          ResourceType = "component"
	ResourceBuild              ResourceType = "build"
	ResourceDeployment         ResourceType = "deployment"
	ResourceDeploymentTrack    ResourceType = "deploymenttrack"
	ResourceEnvironment        ResourceType = "environment"
	ResourceDeployableArtifact ResourceType = "deployableartifact"
	ResourceEndpoint           ResourceType = "endpoint"
	ResourceOrganization       ResourceType = "organization"
	ResourceDataPlane          ResourceType = "dataplane"
)

Jump to

Keyboard shortcuts

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