utils

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const CaSecretWrongTypeErrorMessage = "the CA bundle secret must be of type \"kubernetes.io/ts\""

Variables

This section is empty.

Functions

func ErrorTypeChecker added in v0.4.0

func ErrorTypeChecker(errorType ResourceInterceptorError, errorString string) bool

func ExcludedFieldsFromJson

func ExcludedFieldsFromJson(data map[string]interface{}, path string)

Remove the specified path from the json object Path examples :

INPUT

test1.test2

OUTPUT

test1:
  test2: value

INPUT

.test3
test3: value

OUTPUT

test7
test7: value

INPUT

.test4[this.string-is:the/same*key]test5[test6]

OUTPUT

test4:
"this.string-is:the/same*key":
  test5:
    test6: value

func FindCABundle added in v0.3.3

func FindCABundle(client client.Client, namespace string, name string) ([]byte, error)

func FindGlobalCABundle added in v0.3.3

func FindGlobalCABundle(client client.Client, host string) ([]byte, error)

func GetBranchesFromAnnotation added in v0.4.0

func GetBranchesFromAnnotation(in string) []string

func GetObjectFromWebhookRequest added in v0.3.1

func GetObjectFromWebhookRequest(decoder admission.Decoder, obj runtime.Object, req admission.Request) error

func OperationToVerb added in v0.3.1

func OperationToVerb(operation admissionv1.OperationType) ([]string, error)

func RemoteTargetNameConstructor added in v0.4.0

func RemoteTargetNameConstructor(upstreamRepo string, upstreamBranch string, targetRepo string, targetBranch string) (string, error)

func TypeBasedConditionRemover

func TypeBasedConditionRemover(conditions []metav1.Condition, typeKind string) []metav1.Condition

func TypeBasedConditionUpdater

func TypeBasedConditionUpdater(conditions []metav1.Condition, condition metav1.Condition) []metav1.Condition

Types

type CrendentialSearchError added in v0.4.0

type CrendentialSearchError struct {
	Reason     CrendentialSearchErrorReason
	RemoteUser syngit.RemoteUser
}

func (CrendentialSearchError) Error added in v0.4.0

func (cse CrendentialSearchError) Error() string

func (CrendentialSearchError) ShouldContains added in v0.4.0

func (cse CrendentialSearchError) ShouldContains(errorString string) bool

type CrendentialSearchErrorReason added in v0.4.0

type CrendentialSearchErrorReason string
const (
	SecretNotFound         CrendentialSearchErrorReason = "no Secret found for the current user to log on the git repository with the RemoteUser: %s"
	MoreThanOneSecretFound CrendentialSearchErrorReason = "more than one Secret found for the current user with the RemoteUser: %s"
	TokenNotFound          CrendentialSearchErrorReason = "" /* 155-byte string literal not displayed */
)

type DefaultRemoteTargetMismatchError added in v0.4.0

type DefaultRemoteTargetMismatchError struct {
	RemoteSyncer syngit.RemoteSyncer
	RemoteUser   syngit.RemoteUser
}

func (DefaultRemoteTargetMismatchError) Error added in v0.4.0

type DefaultRemoteTargetNotFoundError added in v0.4.0

type DefaultRemoteTargetNotFoundError struct {
	DefaultTargetName string
}

func (DefaultRemoteTargetNotFoundError) Error added in v0.4.0

func (DefaultRemoteTargetNotFoundError) ShouldContains added in v0.4.0

func (drtnfe DefaultRemoteTargetNotFoundError) ShouldContains(errorString string) bool

type DefaultRemoteUserNotFoundError added in v0.4.0

type DefaultRemoteUserNotFoundError struct {
	DefaultUserName string
}

func (DefaultRemoteUserNotFoundError) Error added in v0.4.0

func (drunfe DefaultRemoteUserNotFoundError) Error() string

func (DefaultRemoteUserNotFoundError) ShouldContains added in v0.4.0

func (drunfe DefaultRemoteUserNotFoundError) ShouldContains(errorString string) bool

type DenyGetRemoteUserError added in v0.4.0

type DenyGetRemoteUserError struct {
	User          authv1.UserInfo
	RemoteUserRef v1.ObjectReference
}

func (DenyGetRemoteUserError) Error added in v0.4.0

func (grue DenyGetRemoteUserError) Error() string

func (DenyGetRemoteUserError) ShouldContains added in v0.4.0

func (grue DenyGetRemoteUserError) ShouldContains(errorString string) bool

type DenyGetSecretError added in v0.4.0

type DenyGetSecretError struct {
	User      authv1.UserInfo
	SecretRef v1.SecretReference
}

func (DenyGetSecretError) Error added in v0.4.0

func (gse DenyGetSecretError) Error() string

func (DenyGetSecretError) ShouldContains added in v0.4.0

func (gse DenyGetSecretError) ShouldContains(errorString string) bool

type DifferentUpstreamEmptyMergeStrategyError added in v0.4.0

type DifferentUpstreamEmptyMergeStrategyError struct {
	UpstreamRepository string
	UpstreamBranch     string
	TargetRepository   string
	TargetBranch       string
	MergeStrategy      string
}

func (DifferentUpstreamEmptyMergeStrategyError) Error added in v0.4.0

func (DifferentUpstreamEmptyMergeStrategyError) ShouldContains added in v0.4.0

func (duemse DifferentUpstreamEmptyMergeStrategyError) ShouldContains(errorString string) bool

type EmptyRequestError added in v0.4.0

type EmptyRequestError struct{}

func (EmptyRequestError) Error added in v0.4.0

func (ere EmptyRequestError) Error() string

func (EmptyRequestError) ShouldContains added in v0.4.0

func (ere EmptyRequestError) ShouldContains(errorString string) bool

type GitUrlParseError added in v0.4.0

type GitUrlParseError struct {
	ParseError error
}

func (GitUrlParseError) Error added in v0.4.0

func (gupe GitUrlParseError) Error() string

func (GitUrlParseError) ShouldContains added in v0.4.0

func (gupe GitUrlParseError) ShouldContains(errorString string) bool

type LabelSeletorParsingError added in v0.4.0

type LabelSeletorParsingError struct {
	Kind       LabelSeletorParsingErrorKind
	LabelError error
}

func (LabelSeletorParsingError) Error added in v0.4.0

func (lspe LabelSeletorParsingError) Error() string

func (LabelSeletorParsingError) ShouldContains added in v0.4.0

func (lspe LabelSeletorParsingError) ShouldContains(errorString string) bool

type LabelSeletorParsingErrorKind added in v0.4.0

type LabelSeletorParsingErrorKind string
const (
	RemoteUserBindingSelectorError LabelSeletorParsingErrorKind = "error parsing the LabelSelector for the remoteUserBindingSelector: "
	RemoteTargetSelectorError      LabelSeletorParsingErrorKind = "error parsing the LabelSelector for the remoteTargetSelector: "
)

type MultipleRemoteUserBindingError added in v0.4.0

type MultipleRemoteUserBindingError struct {
	RemoteUserBindingsCount int
}

func (MultipleRemoteUserBindingError) Error added in v0.4.0

func (mrube MultipleRemoteUserBindingError) Error() string

func (MultipleRemoteUserBindingError) ShouldContains added in v0.4.0

func (mrube MultipleRemoteUserBindingError) ShouldContains(errorString string) bool

type MultipleTargetError added in v0.4.0

type MultipleTargetError struct {
	RemoteTargetsCount int
}

func (MultipleTargetError) Error added in v0.4.0

func (mte MultipleTargetError) Error() string

func (MultipleTargetError) ShouldContains added in v0.4.0

func (mte MultipleTargetError) ShouldContains(errorString string) bool

type NonUniqueUserError added in v0.4.0

type NonUniqueUserError struct {
	UserCount int
}

func (NonUniqueUserError) Error added in v0.4.0

func (nuue NonUniqueUserError) Error() string

func (NonUniqueUserError) ShouldContains added in v0.4.0

func (nuue NonUniqueUserError) ShouldContains(errorString string) bool

type RemoteTargetNotFoundError added in v0.4.0

type RemoteTargetNotFoundError struct{}

func (RemoteTargetNotFoundError) Error added in v0.4.0

func (rtnfe RemoteTargetNotFoundError) Error() string

func (RemoteTargetNotFoundError) ShouldContains added in v0.4.0

func (rtnfe RemoteTargetNotFoundError) ShouldContains(errorString string) bool

type RemoteTargetSearchError added in v0.4.0

type RemoteTargetSearchError struct {
	UpstreamRepository string
	UpstreamBranch     string
	TargetRepository   string
	TargetBranch       string
}

func (RemoteTargetSearchError) Error added in v0.4.0

func (rtse RemoteTargetSearchError) Error() string

func (RemoteTargetSearchError) ShouldContains added in v0.4.0

func (rtse RemoteTargetSearchError) ShouldContains(errorString string) bool

type RemoteUserAlreadyBoundError added in v0.4.0

type RemoteUserAlreadyBoundError struct {
	ExistingRemoteUserBindingName string
}

func (RemoteUserAlreadyBoundError) Error added in v0.4.0

func (ruabe RemoteUserAlreadyBoundError) Error() string

func (RemoteUserAlreadyBoundError) ShouldContains added in v0.4.0

func (ruabe RemoteUserAlreadyBoundError) ShouldContains(errorString string) bool

type RemoteUserBindingNotFoundError added in v0.4.0

type RemoteUserBindingNotFoundError struct {
	Username string
}

func (RemoteUserBindingNotFoundError) Error added in v0.4.0

func (rubnfe RemoteUserBindingNotFoundError) Error() string

func (RemoteUserBindingNotFoundError) ShouldContains added in v0.4.0

func (rubnfe RemoteUserBindingNotFoundError) ShouldContains(errorString string) bool

type RemoteUserSearchError added in v0.4.0

type RemoteUserSearchError struct {
	Reason RemoteUserSearchErrorReason
	Fqdn   string
}

func (RemoteUserSearchError) Error added in v0.4.0

func (ruse RemoteUserSearchError) Error() string

func (RemoteUserSearchError) ShouldContains added in v0.4.0

func (ruse RemoteUserSearchError) ShouldContains(errorString string) bool

type RemoteUserSearchErrorReason added in v0.4.0

type RemoteUserSearchErrorReason string
const (
	RemoteUserNotFound         RemoteUserSearchErrorReason = "no RemoteUser found for the current user with this fqdn: "
	MoreThanOneRemoteUserFound RemoteUserSearchErrorReason = "more than one RemoteUser found for the current user with this fqdn: "
)

type ResourceInterceptorError added in v0.4.0

type ResourceInterceptorError interface {
	Error() string
	ShouldContains(errorString string) bool
}

type ResourceScopeForbiddenError added in v0.4.0

type ResourceScopeForbiddenError struct {
	User               authv1.UserInfo
	ForbiddenResources []string
}

func (ResourceScopeForbiddenError) Error added in v0.4.0

func (rsfe ResourceScopeForbiddenError) Error() string

func (ResourceScopeForbiddenError) ShouldContains added in v0.4.0

func (rsfe ResourceScopeForbiddenError) ShouldContains(errorString string) bool

type SameUpstreamDifferentMergeStrategyError added in v0.4.0

type SameUpstreamDifferentMergeStrategyError struct {
	UpstreamRepository string
	UpstreamBranch     string
	TargetRepository   string
	TargetBranch       string
	MergeStrategy      string
}

func (SameUpstreamDifferentMergeStrategyError) Error added in v0.4.0

func (SameUpstreamDifferentMergeStrategyError) ShouldContains added in v0.4.0

func (sudmse SameUpstreamDifferentMergeStrategyError) ShouldContains(errorString string) bool

type WrongYamlFormatError added in v0.4.0

type WrongYamlFormatError struct {
	Yaml string
}

func (WrongYamlFormatError) Error added in v0.4.0

func (wyfe WrongYamlFormatError) Error() string

func (WrongYamlFormatError) ShouldContains added in v0.4.0

func (wyfe WrongYamlFormatError) ShouldContains(errorString string) bool

Jump to

Keyboard shortcuts

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