Documentation ¶
Overview ¶
Utility methods for PCTL Cluster manipulation
Utility methods for Config struct ¶
Utility methods for PCTL Group struct ¶
Utility methods for PCTL Project struct ¶
Utility methods for testing ¶
Utility methods for PCTL User struct ¶
General program utilities
Index ¶
- Variables
- func ApplyGroup(ctx context.Context, grp *groupv3.Group, auth *authprofile.Profile) error
- func ApplyProject(ctx context.Context, proj *systemv3.Project, auth *authprofile.Profile) error
- func AssertConfigNotEmpty(conf *config.Config) error
- func AssertStringNotEmpty(message, str string) diag.Diagnostics
- func AssertUniquePRNStruct(pnrStruct []*userv3.ProjectNamespaceRole) diag.Diagnostics
- func AssertUniqueRoles(pnrStruct []*userv3.ProjectNamespaceRole) diag.Diagnostics
- func BuildClusterStructFromResource(ctx context.Context, data *structs.Cluster) (*infrav3.Cluster, diag.Diagnostics)
- func BuildGroupStructFromResource(ctx context.Context, data *structs.Group) (*groupv3.Group, diag.Diagnostics)
- func BuildKubeConfigStruct(ctx context.Context, data *structs.KubeConfig, kubeconfigYAML string) (string, diag.Diagnostics)
- func BuildProjectStructFromResource(ctx context.Context, data *structs.Project) (*systemv3.Project, diag.Diagnostics)
- func BuildResourceFromClusterStruct(ctx context.Context, cluster *infrav3.Cluster, data *structs.Cluster, ...) diag.Diagnostics
- func BuildResourceFromGroupStruct(ctx context.Context, group *groupv3.Group, data *structs.Group) diag.Diagnostics
- func BuildResourceFromProjectStruct(ctx context.Context, project *systemv3.Project, data *structs.Project) diag.Diagnostics
- func BuildResourceFromUsersStruct(ctx context.Context, users []*userv3.User, data *structs.User) diag.Diagnostics
- func BuildUsersStructFromResource(ctx context.Context, data *structs.User) ([]*userv3.User, diag.Diagnostics)
- func CheckAllowEmptyProject(role string) diag.Diagnostics
- func CheckGroupsFromPNRStructExist(ctx context.Context, pnrStruct []*groupv3.ProjectNamespaceRole, ...) diag.Diagnostics
- func CheckProjectsFromPNRStructExist(ctx context.Context, pnrStruct []*userv3.ProjectNamespaceRole, ...) diag.Diagnostics
- func CheckUserRoleUsersExist(ctx context.Context, userRoles []*userv3.UserRole, auth *authprofile.Profile) diag.Diagnostics
- func CheckUsersExist(ctx context.Context, users []string, auth *authprofile.Profile) diag.Diagnostics
- func CreateCluster(ctx context.Context, cluster *infrav3.Cluster, auth *authprofile.Profile) error
- func DeleteCluster(ctx context.Context, name, project string, auth *authprofile.Profile) error
- func DeleteGroup(ctx context.Context, groupName string, auth *authprofile.Profile) error
- func DeleteProject(ctx context.Context, project string, auth *authprofile.Profile) error
- func DerefString(s *string) string
- func FilterUsers(users []*userv3.User, filter_is string, filter_is_value string, ...) ([]*userv3.User, error)
- func GetBootstrapFile(ctx context.Context, name, project string, auth *authprofile.Profile) (string, error)
- func GetCluster(ctx context.Context, name, project string, auth *authprofile.Profile) (*infrav3.Cluster, error)
- func GetConfigAsMap(conf *config.Config) map[string]interface{}
- func GetGroupByName(ctx context.Context, groupName string, auth *authprofile.Profile) (*groupv3.Group, error)
- func GetKubeConfig(ctx context.Context, accountID string, namespace string, cluster string, ...) (string, error)
- func GetProjectByName(ctx context.Context, projectName string, auth *authprofile.Profile) (*systemv3.Project, error)
- func GetUserByName(ctx context.Context, userName string, auth *authprofile.Profile) (*userv3.User, error)
- func GetUsers(ctx context.Context, params []string, auth *authprofile.Profile) ([]*userv3.User, error)
- func JsonToMap(jsonStr string) (map[string]interface{}, error)
- func ListAllClusters(ctx context.Context, projectId string, auth *authprofile.Profile) ([]*infrav3.Cluster, error)
- func MapToJsonString(jsonMap map[string]string) (string, error)
- func MultiEnvSearch(ks []string) string
- func SetBootstrapFileAndRelays(ctx context.Context, projectId, clusterId string, auth *authprofile.Profile) (string, []string, string, error)
- func UpdateCluster(ctx context.Context, cluster *infrav3.Cluster, auth *authprofile.Profile) error
- func ValidateProjectNamespaceRolesSet(pnrStruct []*userv3.ProjectNamespaceRole, projectRoles map[string]string) error
- func ValidateUserRolesSet(urStruct []*userv3.UserRole, userRoles map[string]string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrResourceNotExists = errors.New("resource does not exist") ErrOperationNotAllowed = errors.New("operation not allowed") ErrInvalidCredentials = errors.New("invalid credentials") )
error types
var NON_PROJECT_ROLES = []string{"ADMIN", "ADMIN_READ_ONLY"}
Thesea are the roles that don't require specifying a project
Functions ¶
func ApplyGroup ¶ added in v0.0.35
Apply group takes the group details and sends it to the core
func ApplyProject ¶ added in v0.0.35
Apply project takes the project details and sends it to the core
func AssertConfigNotEmpty ¶ added in v0.0.40
func AssertStringNotEmpty ¶ added in v0.0.29
func AssertStringNotEmpty(message, str string) diag.Diagnostics
AssertStringNotEmpty asserts when the string is not empty
func AssertUniquePRNStruct ¶ added in v0.0.43
func AssertUniquePRNStruct(pnrStruct []*userv3.ProjectNamespaceRole) diag.Diagnostics
Assures that the combination of project, role, namespace, and group are all unique
func AssertUniqueRoles ¶ added in v0.0.29
func AssertUniqueRoles(pnrStruct []*userv3.ProjectNamespaceRole) diag.Diagnostics
Check to make sure that the list of roles from ProjectNamespaceRole has unique role values. This is required due to a limitation with Paralus. See: https://github.com/paralus/paralus/issues/136
func BuildClusterStructFromResource ¶
func BuildClusterStructFromResource(ctx context.Context, data *structs.Cluster) (*infrav3.Cluster, diag.Diagnostics)
Build the cluster struct from a schema resource
func BuildGroupStructFromResource ¶ added in v0.0.29
func BuildGroupStructFromResource(ctx context.Context, data *structs.Group) (*groupv3.Group, diag.Diagnostics)
Build the group struct from a schema resource
func BuildKubeConfigStruct ¶ added in v0.0.45
func BuildKubeConfigStruct(ctx context.Context, data *structs.KubeConfig, kubeconfigYAML string) (string, diag.Diagnostics)
func BuildProjectStructFromResource ¶
func BuildProjectStructFromResource(ctx context.Context, data *structs.Project) (*systemv3.Project, diag.Diagnostics)
Build the project struct from a schema resource
func BuildResourceFromClusterStruct ¶
func BuildResourceFromClusterStruct(ctx context.Context, cluster *infrav3.Cluster, data *structs.Cluster, auth *authprofile.Profile) diag.Diagnostics
Build the schema resource from Cluster Struct
func BuildResourceFromGroupStruct ¶ added in v0.0.29
func BuildResourceFromGroupStruct(ctx context.Context, group *groupv3.Group, data *structs.Group) diag.Diagnostics
Build the schema resource from group Struct
func BuildResourceFromProjectStruct ¶
func BuildResourceFromProjectStruct(ctx context.Context, project *systemv3.Project, data *structs.Project) diag.Diagnostics
Build the schema resource from project Struct
func BuildResourceFromUsersStruct ¶ added in v0.0.46
func BuildResourceFromUsersStruct(ctx context.Context, users []*userv3.User, data *structs.User) diag.Diagnostics
Build the schema resource from users Struct
func BuildUsersStructFromResource ¶ added in v0.0.46
func BuildUsersStructFromResource(ctx context.Context, data *structs.User) ([]*userv3.User, diag.Diagnostics)
Build the project struct from a schema resource
func CheckAllowEmptyProject ¶ added in v0.0.33
func CheckAllowEmptyProject(role string) diag.Diagnostics
Check the role desired allows for no project specified
func CheckGroupsFromPNRStructExist ¶ added in v0.0.33
func CheckGroupsFromPNRStructExist(ctx context.Context, pnrStruct []*groupv3.ProjectNamespaceRole, auth *authprofile.Profile) diag.Diagnostics
Check groups specified in the ProjectNamespaceRoles struct exist in Paralus
func CheckProjectsFromPNRStructExist ¶ added in v0.0.33
func CheckProjectsFromPNRStructExist(ctx context.Context, pnrStruct []*userv3.ProjectNamespaceRole, auth *authprofile.Profile) diag.Diagnostics
Check projects specified in the ProjectNamespaceRoles struct exist in Paralus
func CheckUserRoleUsersExist ¶ added in v0.0.33
func CheckUserRoleUsersExist(ctx context.Context, userRoles []*userv3.UserRole, auth *authprofile.Profile) diag.Diagnostics
Check users from a UserRole structs exist in paralus
func CheckUsersExist ¶ added in v0.0.33
func CheckUsersExist(ctx context.Context, users []string, auth *authprofile.Profile) diag.Diagnostics
Check users from a list exist in paralus
func CreateCluster ¶ added in v0.0.35
Update cluster takes the updated cluster details and sends it to the core
func DeleteCluster ¶ added in v0.0.35
Delete the cluster
func DeleteGroup ¶ added in v0.0.35
Delete group
func DeleteProject ¶ added in v0.0.35
Delete project
func DerefString ¶ added in v0.0.48
Converts string pointer to string if not nul, other returns empty string
func FilterUsers ¶ added in v0.0.46
func FilterUsers(users []*userv3.User, filter_is string, filter_is_value string, filter_is_case_senstive bool, filter_allow_more_than_one bool) ([]*userv3.User, error)
Filter the list of users based on the filter value requested
func GetBootstrapFile ¶ added in v0.0.35
func GetBootstrapFile(ctx context.Context, name, project string, auth *authprofile.Profile) (string, error)
Will retrieve the bootstrap file for imported clusters
func GetCluster ¶ added in v0.0.35
func GetCluster(ctx context.Context, name, project string, auth *authprofile.Profile) (*infrav3.Cluster, error)
Retrieves cluster info
func GetConfigAsMap ¶ added in v0.0.23
retrieve the Config as a map
func GetGroupByName ¶ added in v0.0.35
func GetGroupByName(ctx context.Context, groupName string, auth *authprofile.Profile) (*groupv3.Group, error)
Get group by name
func GetKubeConfig ¶ added in v0.0.45
func GetKubeConfig(ctx context.Context, accountID string, namespace string, cluster string, auth *authprofile.Profile) (string, error)
retrieves the kubeconfig for the user with either all or specific cluster info
func GetProjectByName ¶ added in v0.0.35
func GetProjectByName(ctx context.Context, projectName string, auth *authprofile.Profile) (*systemv3.Project, error)
Get project by name
func GetUserByName ¶ added in v0.0.35
func GetUserByName(ctx context.Context, userName string, auth *authprofile.Profile) (*userv3.User, error)
Get user by name
func GetUsers ¶ added in v0.0.46
func GetUsers(ctx context.Context, params []string, auth *authprofile.Profile) ([]*userv3.User, error)
Get all users based on provided filter/limit/offset
func ListAllClusters ¶ added in v0.0.35
func ListAllClusters(ctx context.Context, projectId string, auth *authprofile.Profile) ([]*infrav3.Cluster, error)
ListAllClusters uses the lower level func ListClusters to retrieve a list of all clusters
func MapToJsonString ¶
Convert a map to json string
func MultiEnvSearch ¶
func SetBootstrapFileAndRelays ¶ added in v0.0.28
func SetBootstrapFileAndRelays(ctx context.Context, projectId, clusterId string, auth *authprofile.Profile) (string, []string, string, error)
Retrieve the YAML files that will be used to setup paralus agents in cluster and assign it to the schema Also retrieve the relays from the data of the relay-agent configMap YAML Due to the parallel nature of testing, it might be that the cluster would be created before the relay was effectively populated. So let's do a increased delay check
func UpdateCluster ¶ added in v0.0.35
Update cluster takes the updated cluster details and sends it to the core
func ValidateProjectNamespaceRolesSet ¶ added in v0.0.29
func ValidateProjectNamespaceRolesSet(pnrStruct []*userv3.ProjectNamespaceRole, projectRoles map[string]string) error
Validate that the passed in map of project roles match what was set in the project struct
Types ¶
This section is empty.