utils

package
v0.0.0-...-af4d92e Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_ALLOW_RULE = "default-allow-rule"
View Source
const FORBIDDEN = "Forbidden"

Variables

This section is empty.

Functions

func AddRoleToSubject

func AddRoleToSubject(ctx context.Context, gc *gocloak.GoCloak, token, realm, idOfClient, sid string, subject api.Subject, role gocloak.Role) error

func DeleteRoleFromSubject

func DeleteRoleFromSubject(ctx context.Context, gc *gocloak.GoCloak, token, realm, idOfClient, sid string, subject api.Subject, role gocloak.Role) error

func GetSubjectID

func GetSubjectID(ctx context.Context, gc *gocloak.GoCloak, token, realm, idOfClient string, subject api.Subject) (string, error)

func GetSubjectRoles

func GetSubjectRoles(ctx context.Context, gc *gocloak.GoCloak, token, realm, idOfClient, sid string, subject api.Subject) ([]*gocloak.Role, error)

func HandleError

func HandleError(err error) (ctrl.Result, error)

func HasFinalizer

func HasFinalizer(i client.Object) bool

func IgnoreNotFound

func IgnoreNotFound(err error) error

func IsConfigMapEmpty

func IsConfigMapEmpty(cm *api.ConfigMapValue) bool

func IsNotFound

func IsNotFound(err error) (*gocloak.APIError, bool)

func MarkedAsDeleted

func MarkedAsDeleted(i client.Object) bool

func NoFinalizer

func NoFinalizer(i client.Object) bool

func Now

func Now() *metav1.Time

func Unwrap

func Unwrap[T any](v *T) T

Types

type ApiHelper

type ApiHelper struct {
	*BaseReconciler
	Context context.Context
	Object  Object
}

A api to manage log/event/status related to keycloak API resources.

func (*ApiHelper) AlreadyDeleted

func (api *ApiHelper) AlreadyDeleted() error

func (*ApiHelper) Created

func (api *ApiHelper) Created() error

func (*ApiHelper) Deleted

func (api *ApiHelper) Deleted() error

func (*ApiHelper) Error

func (api *ApiHelper) Error(action, text string, err error) error

func (*ApiHelper) EventUpdate

func (api *ApiHelper) EventUpdate(changelog diff.Changelog)

func (*ApiHelper) NoChange

func (api *ApiHelper) NoChange() error

func (*ApiHelper) Updated

func (api *ApiHelper) Updated() error

func (*ApiHelper) Waiting

func (api *ApiHelper) Waiting(text string) error

type BaseReconciler

type BaseReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	record.EventRecorder
}

func NewReconciler

func NewReconciler(mgr ctrl.Manager) BaseReconciler

func (*BaseReconciler) Api

func (r *BaseReconciler) Api(ctx context.Context, i Object) *ApiHelper

func (*BaseReconciler) AppendFinalizer

func (r *BaseReconciler) AppendFinalizer(ctx context.Context, i client.Object) error

Append the finalizer to the object

func (*BaseReconciler) AppendOwnerReferences

func (r *BaseReconciler) AppendOwnerReferences(ctx context.Context, i, owner client.Object) error

func (*BaseReconciler) CustomPatch

func (r *BaseReconciler) CustomPatch(ctx context.Context, i client.Object, key, value, previous string) error

func (*BaseReconciler) ExtractEndpoint

func (r *BaseReconciler) ExtractEndpoint(ctx context.Context, i Object) (*gocloak.GoCloak, string, error)

Extract the endpoint, but deal with several kind of errors

func (*BaseReconciler) RemoveFinalizer

func (r *BaseReconciler) RemoveFinalizer(ctx context.Context, i client.Object) error

func (*BaseReconciler) SyncLDAP

func (r *BaseReconciler) SyncLDAP(ctx context.Context, gc *gocloak.GoCloak, token string, i Object, ldap LDAPSync) error

type LDAPSync

type LDAPSync struct {
	Changed      bool
	Realm        string
	FederationID string
}

type NoReschedule

type NoReschedule struct{}

A wrapper for errors that should not retrigger the reconciler.

func (NoReschedule) Error

func (nr NoReschedule) Error() string

func (NoReschedule) Is

func (nr NoReschedule) Is(err error) bool

type Object

type Object interface {
	client.Object
	ApiStatus() *api.ApiStatus
	Endpoint() api.EndpointSelector
	Realm() string
}

type Reconciler

type Reconciler interface {
	BaseReconciler
}

type Reschedule

type Reschedule struct {
	RequeueAfter time.Duration
}

func (Reschedule) Error

func (r Reschedule) Error() string

func (Reschedule) Is

func (r Reschedule) Is(err error) bool

Jump to

Keyboard shortcuts

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