Documentation ¶
Index ¶
- Constants
- func ActivateSubscriptions(ctx context.Context, client runtimeClient.Client, subs []*subApis.Subscription, ...) error
- func CheckIfEventActivationExistForSubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription) bool
- func ContainsString(slice *[]string, s string) bool
- func DeactivateSubscriptions(ctx context.Context, client runtimeClient.Client, subs []*subApis.Subscription, ...) error
- func EncodeChannelName(sourceID, eventType, eventTypeVersion *string) string
- func ErrorInvalidChannelNameLength(channelNameMaxLength int) *publish.Error
- func GetDefaultChannelNamespace() string
- func GetKnSubscriptionName(kySubscriptionName, kySubscriptionNamespace *string) string
- func GetSubscriptionsForEventActivation(ctx context.Context, client runtimeClient.Client, ...) ([]*subApis.Subscription, error)
- func IsSubscriptionActivated(sub *subApis.Subscription) bool
- func RemoveString(slice *[]string, s string) (result []string)
- func SetNotReadySubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription, ...) error
- func SetReadySubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription, ...) error
- func UpdateEventActivation(ctx context.Context, client runtimeClient.Client, ...) error
- func WriteSubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription) error
- type CurrentTime
- type DefaultCurrentTime
- type KnativeAccessLib
- type KnativeLib
- func (k *KnativeLib) CreateChannel(provisioner string, name string, namespace string, labels *map[string]string, ...) (*evapisv1alpha1.Channel, error)
- func (k *KnativeLib) CreateSubscription(name string, namespace string, channelName string, uri *string) error
- func (k *KnativeLib) DeleteChannel(name string, namespace string) error
- func (k *KnativeLib) DeleteSubscription(name string, namespace string) error
- func (k *KnativeLib) GetChannel(name string, namespace string) (*evapisv1alpha1.Channel, error)
- func (k *KnativeLib) GetSubscription(name string, namespace string) (*evapisv1alpha1.Subscription, error)
- func (k *KnativeLib) InjectClient(c eventingv1alpha1.EventingV1alpha1Interface) error
- func (k *KnativeLib) SendMessage(channel *evapisv1alpha1.Channel, headers *map[string][]string, payload *string) error
- func (k *KnativeLib) UpdateSubscription(sub *evapisv1alpha1.Subscription) (*evapisv1alpha1.Subscription, error)
- type SubscriptionBuilder
- func (s *SubscriptionBuilder) Build() *eventingv1alpha1.Subscription
- func (s *SubscriptionBuilder) EmptyReply() *SubscriptionBuilder
- func (s *SubscriptionBuilder) ToChannel(name string) *SubscriptionBuilder
- func (s *SubscriptionBuilder) ToK8sService(k8sServiceName string) *SubscriptionBuilder
- func (s *SubscriptionBuilder) ToKNService(knServiceName string) *SubscriptionBuilder
- func (s *SubscriptionBuilder) ToURI(uri *string) *SubscriptionBuilder
- type SubscriptionWithError
Constants ¶
const (
// FieldKnativeChannelName knative channel name field
FieldKnativeChannelName = "knative-channel-name"
)
Variables ¶
This section is empty.
Functions ¶
func ActivateSubscriptions ¶
func ActivateSubscriptions(ctx context.Context, client runtimeClient.Client, subs []*subApis.Subscription, log logr.Logger, time CurrentTime) error
ActivateSubscriptions activates subscriptions.
func CheckIfEventActivationExistForSubscription ¶
func CheckIfEventActivationExistForSubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription) bool
CheckIfEventActivationExistForSubscription returns a boolean value indicating if there is an EventActivation for the Subscription or not.
func ContainsString ¶
ContainsString returns true if the string exists in the array.
func DeactivateSubscriptions ¶
func DeactivateSubscriptions(ctx context.Context, client runtimeClient.Client, subs []*subApis.Subscription, log logr.Logger, time CurrentTime) error
DeactivateSubscriptions deactivate subscriptions.
func EncodeChannelName ¶
EncodeChannelName function encodes and joins the given event components to construct the encoded channel name
func ErrorInvalidChannelNameLength ¶
ErrorInvalidChannelNameLength returns a publish.Error instance.
func GetDefaultChannelNamespace ¶
func GetDefaultChannelNamespace() string
GetDefaultChannelNamespace returns the default namespace of Knative/Eventing channels and subscriptions
func GetKnSubscriptionName ¶
GetKnSubscriptionName joins the kySubscriptionName and kySubscriptionNamespace
func GetSubscriptionsForEventActivation ¶
func GetSubscriptionsForEventActivation(ctx context.Context, client runtimeClient.Client, ea *eventingv1alpha1.EventActivation) ([]*subApis.Subscription, error)
GetSubscriptionsForEventActivation gets the "ea" object of all the subscriptions having the same "namespace" and the same "Source"
func IsSubscriptionActivated ¶
func IsSubscriptionActivated(sub *subApis.Subscription) bool
IsSubscriptionActivated checks if the subscription is active or not.
func RemoveString ¶
RemoveString removes the string from in the array and returns a new array instance.
func SetNotReadySubscription ¶
func SetNotReadySubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription, time CurrentTime) error
SetNotReadySubscription set subscription as not ready.
func SetReadySubscription ¶
func SetReadySubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription, msg string, time CurrentTime) error
SetReadySubscription set subscription as ready.
func UpdateEventActivation ¶
func UpdateEventActivation(ctx context.Context, client runtimeClient.Client, u *eventingv1alpha1.EventActivation) error
UpdateEventActivation handles Kyma EventActivation
func WriteSubscription ¶
func WriteSubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription) error
WriteSubscription writes a subscription.
Types ¶
type CurrentTime ¶
CurrentTime handles current time
func NewDefaultCurrentTime ¶
func NewDefaultCurrentTime() CurrentTime
NewDefaultCurrentTime returns a new CurrentTime instance
type DefaultCurrentTime ¶
type DefaultCurrentTime struct{}
DefaultCurrentTime represents the default current time
func (*DefaultCurrentTime) GetCurrentTime ¶
func (t *DefaultCurrentTime) GetCurrentTime() metav1.Time
GetCurrentTime returns the current time.
type KnativeAccessLib ¶
type KnativeAccessLib interface { GetChannel(name string, namespace string) (*evapisv1alpha1.Channel, error) CreateChannel(provisioner string, name string, namespace string, labels *map[string]string, timeout time.Duration) (*evapisv1alpha1.Channel, error) DeleteChannel(name string, namespace string) error CreateSubscription(name string, namespace string, channelName string, uri *string) error DeleteSubscription(name string, namespace string) error GetSubscription(name string, namespace string) (*evapisv1alpha1.Subscription, error) UpdateSubscription(sub *evapisv1alpha1.Subscription) (*evapisv1alpha1.Subscription, error) SendMessage(channel *evapisv1alpha1.Channel, headers *map[string][]string, message *string) error InjectClient(c eventingv1alpha1.EventingV1alpha1Interface) error }
KnativeAccessLib encapsulates the Knative access lib behaviours.
func NewKnativeLib ¶
func NewKnativeLib() (KnativeAccessLib, error)
NewKnativeLib returns an interface to KnativeLib, which can be mocked
type KnativeLib ¶
type KnativeLib struct {
// contains filtered or unexported fields
}
KnativeLib represents the knative lib.
func GetKnativeLib ¶
func GetKnativeLib() (*KnativeLib, error)
GetKnativeLib returns the Knative/Eventing access layer
func (*KnativeLib) CreateChannel ¶
func (k *KnativeLib) CreateChannel(provisioner string, name string, namespace string, labels *map[string]string, timeout time.Duration) (*evapisv1alpha1.Channel, error)
CreateChannel creates a Knative/Eventing channel controlled by the specified provisioner
func (*KnativeLib) CreateSubscription ¶
func (k *KnativeLib) CreateSubscription(name string, namespace string, channelName string, uri *string) error
CreateSubscription creates a Knative/Eventing subscription for the specified channel
func (*KnativeLib) DeleteChannel ¶
func (k *KnativeLib) DeleteChannel(name string, namespace string) error
DeleteChannel deletes a Knative/Eventing channel
func (*KnativeLib) DeleteSubscription ¶
func (k *KnativeLib) DeleteSubscription(name string, namespace string) error
DeleteSubscription deletes a Knative/Eventing subscription
func (*KnativeLib) GetChannel ¶
func (k *KnativeLib) GetChannel(name string, namespace string) (*evapisv1alpha1.Channel, error)
GetChannel returns an existing Knative/Eventing channel, if it exists. If the channel doesn't exist, the error returned can be checked using the standard K8S function: "k8serrors.IsNotFound(err) "
func (*KnativeLib) GetSubscription ¶
func (k *KnativeLib) GetSubscription(name string, namespace string) (*evapisv1alpha1.Subscription, error)
GetSubscription gets a Knative/Eventing subscription
func (*KnativeLib) InjectClient ¶
func (k *KnativeLib) InjectClient(c eventingv1alpha1.EventingV1alpha1Interface) error
InjectClient injects a client, useful for running tests.
func (*KnativeLib) SendMessage ¶
func (k *KnativeLib) SendMessage(channel *evapisv1alpha1.Channel, headers *map[string][]string, payload *string) error
SendMessage sends a message to a channel
func (*KnativeLib) UpdateSubscription ¶
func (k *KnativeLib) UpdateSubscription(sub *evapisv1alpha1.Subscription) (*evapisv1alpha1.Subscription, error)
UpdateSubscription updates an existing subscription
type SubscriptionBuilder ¶
type SubscriptionBuilder struct {
*eventingv1alpha1.Subscription
}
SubscriptionBuilder represents the subscription builder that is used in the internal knative util package and the knative subscription controller tests.
func Subscription ¶
func Subscription(name string, namespace string) *SubscriptionBuilder
Subscription returns a new SubscriptionBuilder instance.
func (*SubscriptionBuilder) Build ¶
func (s *SubscriptionBuilder) Build() *eventingv1alpha1.Subscription
Build returns an v1alpha1.Subscription instance.
func (*SubscriptionBuilder) EmptyReply ¶
func (s *SubscriptionBuilder) EmptyReply() *SubscriptionBuilder
EmptyReply sets the SubscriptionBuilder Reply.
func (*SubscriptionBuilder) ToChannel ¶
func (s *SubscriptionBuilder) ToChannel(name string) *SubscriptionBuilder
ToChannel sets SubscriptionBuilder Channel.
func (*SubscriptionBuilder) ToK8sService ¶
func (s *SubscriptionBuilder) ToK8sService(k8sServiceName string) *SubscriptionBuilder
ToK8sService sets the SubscriptionBuilder Subscriber to Kubernetes service.
func (*SubscriptionBuilder) ToKNService ¶
func (s *SubscriptionBuilder) ToKNService(knServiceName string) *SubscriptionBuilder
ToKNService sets the SubscriptionBuilder Subscriber to Knative service.
func (*SubscriptionBuilder) ToURI ¶
func (s *SubscriptionBuilder) ToURI(uri *string) *SubscriptionBuilder
ToURI sets the SubscriptionBuilder Subscriber URI.
type SubscriptionWithError ¶
type SubscriptionWithError struct { Sub *subApis.Subscription Err error }
SubscriptionWithError handles Kyma subscriptions
func WriteSubscriptions ¶
func WriteSubscriptions(ctx context.Context, client runtimeClient.Client, subs []*subApis.Subscription) []SubscriptionWithError
WriteSubscriptions writes subscriptions.