Documentation ¶
Index ¶
- Constants
- func ActivateSubscriptionForKnSubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) error
- func ActivateSubscriptions(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) error
- func CheckIfEventActivationExistForSubscription(...) bool
- func ContainsString(slice *[]string, s string) bool
- func DeactivateSubscriptionForKnSubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) error
- func DeactivateSubscriptions(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) error
- func ErrorInvalidChannelNameLength(channelNameMaxLength int) *publish.Error
- func GetDefaultChannelNamespace() string
- func GetKnSubscriptionName(kySubscriptionName, kySubscriptionNamespace *string) string
- func GetKymaSubscriptionForSubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) (*kymaeventingv1alpha1.Subscription, error)
- func GetSubscriptionsForEventActivation(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) ([]*kymaeventingv1alpha1.Subscription, error)
- func IsSubscriptionActivated(sub *kymaeventingv1alpha1.Subscription) bool
- func RemoveString(slice *[]string, s string) (result []string)
- func SetNotReadySubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) error
- func SetReadySubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) error
- func UpdateEventActivation(...) error
- func UpdateKnativeSubscription(client messagingv1alpha1.MessagingV1alpha1Interface, ...) error
- func WriteSubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ...) error
- type ChannelReadyFunc
- type CurrentTime
- type DefaultCurrentTime
- type KnativeAccessLib
- type KnativeLib
- func (k *KnativeLib) CreateChannel(prefix, namespace string, labels map[string]string, ...) (*messagingV1Alpha1.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) GetChannelByLabels(namespace string, labels map[string]string) (*messagingV1Alpha1.Channel, error)
- func (k *KnativeLib) GetSubscription(name string, namespace string) (*messagingV1Alpha1.Subscription, error)
- func (k *KnativeLib) InjectClient(evClient eventingv1alpha1.EventingV1alpha1Interface, ...) error
- func (k *KnativeLib) MsgChannelClient() messagingv1alpha1.MessagingV1alpha1Interface
- func (k *KnativeLib) SendMessage(channel *messagingV1Alpha1.Channel, headers *map[string][]string, ...) error
- func (k *KnativeLib) UpdateSubscription(sub *messagingV1Alpha1.Subscription) (*messagingV1Alpha1.Subscription, error)
- type SubscriptionBuilder
- func (s *SubscriptionBuilder) Build() *messagingv1alpha1.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 ( // SubscriptionSourceID is the key for source id in label SubscriptionSourceID = "kyma-source-id" // SubscriptionEventType is the key for event type in label SubscriptionEventType = "kyma-event-type" // SubscriptionEventTypeVersion is the key for event type version in label SubscriptionEventTypeVersion = "kyma-event-type-version" // SubNs is the key for namespace of the subscription SubNs = "kyma-ns" )
const (
// FieldKnativeChannelName knative channel name field
FieldKnativeChannelName = "knative-channel-name"
)
Variables ¶
This section is empty.
Functions ¶
func ActivateSubscriptionForKnSubscription ¶
func ActivateSubscriptionForKnSubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, sub *kymaeventingv1alpha1.Subscription, log *zap.Logger, time CurrentTime) error
ActivateSubscriptionForKnSubscription activates a Kyma Subscription when Kn Subscription is ready
func ActivateSubscriptions ¶
func ActivateSubscriptions(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, subs []*kymaeventingv1alpha1.Subscription, log *zap.Logger, time CurrentTime) error
ActivateSubscriptions activates subscriptions.
func CheckIfEventActivationExistForSubscription ¶
func CheckIfEventActivationExistForSubscription(eventActivationLister applicationconnectorlistersv1alpha1.EventActivationLister, sub *kymaeventingv1alpha1.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 DeactivateSubscriptionForKnSubscription ¶
func DeactivateSubscriptionForKnSubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, sub *kymaeventingv1alpha1.Subscription, log *zap.Logger, time CurrentTime) error
DeactivateSubscriptionForKnSubscription deactivates a Kyma Subscription when Kn Subscription is not ready
func DeactivateSubscriptions ¶
func DeactivateSubscriptions(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, subs []*kymaeventingv1alpha1.Subscription, log *zap.Logger, time CurrentTime) error
DeactivateSubscriptions deactivate subscriptions.
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 GetKymaSubscriptionForSubscription ¶
func GetKymaSubscriptionForSubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, knSub *evapisv1alpha1.Subscription) (*kymaeventingv1alpha1.Subscription, error)
GetKymaSubscriptionForSubscription gets Kyma Subscription for a particular Knative Subscription
func GetSubscriptionsForEventActivation ¶
func GetSubscriptionsForEventActivation(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, ea *eventingv1alpha1.EventActivation) ([]*kymaeventingv1alpha1.Subscription, error)
GetSubscriptionsForEventActivation gets the "ea" object of all the subscriptions having the same "namespace" and the same "Source"
func IsSubscriptionActivated ¶
func IsSubscriptionActivated(sub *kymaeventingv1alpha1.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(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, sub *kymaeventingv1alpha1.Subscription, time CurrentTime) error
SetNotReadySubscription set subscription as not ready.
func SetReadySubscription ¶
func SetReadySubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, sub *kymaeventingv1alpha1.Subscription, msg string, time CurrentTime) error
SetReadySubscription set subscription as ready.
func UpdateEventActivation ¶
func UpdateEventActivation(client applicationconnectorclientv1alpha1.ApplicationconnectorV1alpha1Interface, ea *eventingv1alpha1.EventActivation) error
UpdateEventActivation handles Kyma EventActivation
func UpdateKnativeSubscription ¶
func UpdateKnativeSubscription(client messagingv1alpha1.MessagingV1alpha1Interface, subscription *evapisv1alpha1.Subscription) error
UpdateKnativeSubscription updates Knative subscription on change in Finalizer
func WriteSubscription ¶
func WriteSubscription(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, sub *kymaeventingv1alpha1.Subscription) error
WriteSubscription writes a subscription.
Types ¶
type ChannelReadyFunc ¶
type ChannelReadyFunc func(name string, lister evlistersv1alpha1.ChannelNamespaceLister) error
ChannelReadyFunc is a function used to ensure that a Channel has become Ready.
func WaitForChannelWithTimeout ¶
func WaitForChannelWithTimeout(timeout time.Duration) ChannelReadyFunc
WaitForChannelWithTimeout returns a function that waits until a Channel gets Ready or fails after a timeout.
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 { GetChannelByLabels(namespace string, labels map[string]string) (*messagingV1Alpha1.Channel, error) CreateChannel(prefix, namespace string, labels map[string]string, readyFn ...ChannelReadyFunc) (*messagingV1Alpha1.Channel, error) DeleteChannel(name string, namespace string) error CreateSubscription(name string, namespace string, channelName string, uri *string, labels map[string]string) error DeleteSubscription(name string, namespace string) error GetSubscription(name string, namespace string) (*messagingV1Alpha1.Subscription, error) UpdateSubscription(sub *messagingV1Alpha1.Subscription) (*messagingV1Alpha1.Subscription, error) SendMessage(channel *messagingV1Alpha1.Channel, headers *map[string][]string, message *string) error InjectClient(evClient eventingv1alpha1.EventingV1alpha1Interface, msgClient messagingv1alpha1.MessagingV1alpha1Interface) error MsgChannelClient() messagingv1alpha1.MessagingV1alpha1Interface }
KnativeAccessLib encapsulates the Knative access lib behaviours.
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 NewKnativeLib ¶
func NewKnativeLib() (*KnativeLib, error)
NewKnativeLib returns an interface to KnativeLib, which can be mocked
func (*KnativeLib) CreateChannel ¶
func (k *KnativeLib) CreateChannel(prefix, namespace string, labels map[string]string, readyFn ...ChannelReadyFunc) (*messagingV1Alpha1.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, labels map[string]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) GetChannelByLabels ¶
func (k *KnativeLib) GetChannelByLabels(namespace string, labels map[string]string) (*messagingV1Alpha1.Channel, error)
GetChannelByLabels return a knative channel fetched via label selectors so based on the labels, we assume that the list of channels should have only one item in it Hence, we'd be returning the item at 0th index.
func (*KnativeLib) GetSubscription ¶
func (k *KnativeLib) GetSubscription(name string, namespace string) (*messagingV1Alpha1.Subscription, error)
GetSubscription gets a Knative/Eventing subscription
func (*KnativeLib) InjectClient ¶
func (k *KnativeLib) InjectClient(evClient eventingv1alpha1.EventingV1alpha1Interface, msgClient messagingv1alpha1.MessagingV1alpha1Interface) error
InjectClient injects a client, useful for running tests.
func (*KnativeLib) MsgChannelClient ¶
func (k *KnativeLib) MsgChannelClient() messagingv1alpha1.MessagingV1alpha1Interface
MsgChannelClient returns a clientset interface for messaging v1alpha1 API
func (*KnativeLib) SendMessage ¶
func (k *KnativeLib) SendMessage(channel *messagingV1Alpha1.Channel, headers *map[string][]string, payload *string) error
SendMessage sends a message to a channel
func (*KnativeLib) UpdateSubscription ¶
func (k *KnativeLib) UpdateSubscription(sub *messagingV1Alpha1.Subscription) (*messagingV1Alpha1.Subscription, error)
UpdateSubscription updates an existing subscription
type SubscriptionBuilder ¶
type SubscriptionBuilder struct {
*messagingv1alpha1.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, labels map[string]string) *SubscriptionBuilder
Subscription returns a new SubscriptionBuilder instance.
func (*SubscriptionBuilder) Build ¶
func (s *SubscriptionBuilder) Build() *messagingv1alpha1.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 *kymaeventingv1alpha1.Subscription Err error }
SubscriptionWithError handles Kyma subscriptions
func WriteSubscriptions ¶
func WriteSubscriptions(client kymaeventingclientv1alpha1.EventingV1alpha1Interface, subs []*kymaeventingv1alpha1.Subscription) []SubscriptionWithError
WriteSubscriptions writes subscriptions.