utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManagerRole = "manager"
)

Variables

View Source
var (
	ErrorGroupNotFound = errors.New("group not found")
	ErrorUserNotFound  = errors.New("user not found")
)

Functions

func CastFloatToStr

func CastFloatToStr(val float64) string

func CastStrToFloat

func CastStrToFloat(val string) (float64, error)

func ValidateQuotaFields

func ValidateQuotaFields(c *gin.Context, cpuCap float64, memCap int) error

ValidateQuotaFields : Check if the data provided by admin are appropriate. The minimum possible values for CPU and memory for PowerVS instance is 0.25C and 2GB respectively.

Types

type KeyClockClient

type KeyClockClient struct {
	// contains filtered or unexported fields
}

func NewKeyClockClient

func NewKeyClockClient(ctx context.Context) *KeyClockClient

func (*KeyClockClient) AddUserToGroup

func (k *KeyClockClient) AddUserToGroup(userID, groupID string) error

func (*KeyClockClient) DeleteUserFromGroup

func (k *KeyClockClient) DeleteUserFromGroup(userID, groupID string) error

func (*KeyClockClient) GetClient

func (k *KeyClockClient) GetClient() *gocloak.GoCloak

func (*KeyClockClient) GetGroup

func (k *KeyClockClient) GetGroup(id string) (*models.Group, error)

func (*KeyClockClient) GetGroups

func (k *KeyClockClient) GetGroups() ([]models.Group, error)

func (*KeyClockClient) GetUser

func (k *KeyClockClient) GetUser(id string) (*models.User, error)

GetUser by ID

func (*KeyClockClient) GetUserGroups

func (k *KeyClockClient) GetUserGroups() []models.Group

func (*KeyClockClient) GetUserID

func (k *KeyClockClient) GetUserID() string

func (*KeyClockClient) GetUsers

func (k *KeyClockClient) GetUsers() ([]models.User, error)

GetUsers for listing all the users from keycloak

func (*KeyClockClient) IsMemberOfGroup

func (k *KeyClockClient) IsMemberOfGroup(name string) bool

func (*KeyClockClient) IsRole

func (k *KeyClockClient) IsRole(name string) bool

Jump to

Keyboard shortcuts

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