util

package
v0.0.0-...-1ac4f16 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(slice *[]string, s string) bool

Helper functions to check and remove string from a slice of strings.

func GetChannelName

func GetChannelName(sourceID, eventType, eventTypeVersion *string) string

GetChannelName function joins the sourceID, eventType and eventTypeVersion respectively with a '-' as a delimiter.

func GetDefaultChannelNamespace

func GetDefaultChannelNamespace() string

GetDefaultChannelNamespace() returns the default namespace of Knative/Eventing channels and subscriptions

func GetSubscriptionName

func GetSubscriptionName(kySubscriptionName, kySubscriptionNamespace *string) string

GetSubscriptionName joins the kySubscriptionName and kySubscriptionNamespace

func GetSubscriptionsForEventActivation

func GetSubscriptionsForEventActivation(ctx context.Context, client runtimeClient.Client, ea *eventingv1alpha1.EventActivation) ([]*subApis.Subscription, error)

GetSubscriptionsForEventActivation() gets all the subscriptions having the same "namespace" and the same "Source" as the "ea" object

func RemoveString

func RemoveString(slice *[]string, s string) (result []string)

func UpdateSubscriptionReadyStatus

func UpdateSubscriptionReadyStatus(sub *subApis.Subscription, conditionStatus subApis.ConditionStatus, msg string) *subApis.Subscription

func UpdateSubscriptionsEventActivatedStatus

func UpdateSubscriptionsEventActivatedStatus(subs []*subApis.Subscription, conditionStatus subApis.ConditionStatus) []*subApis.Subscription

func WriteSubscription

func WriteSubscription(ctx context.Context, client runtimeClient.Client, sub *subApis.Subscription) error

Types

type KnativeLib

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

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, 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

InjectClient injects a client, useful for running tests.

func (*KnativeLib) SendMessage

func (k *KnativeLib) SendMessage(channel *evapisv1alpha1.Channel, message *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
}

func Subscription

func Subscription(name string, namespace string) *SubscriptionBuilder

func (*SubscriptionBuilder) Build

func (*SubscriptionBuilder) EmptyReply

func (s *SubscriptionBuilder) EmptyReply() *SubscriptionBuilder

func (*SubscriptionBuilder) ToChannel

func (s *SubscriptionBuilder) ToChannel(name string) *SubscriptionBuilder

func (*SubscriptionBuilder) ToK8sService

func (s *SubscriptionBuilder) ToK8sService(k8sServiceName string) *SubscriptionBuilder

func (*SubscriptionBuilder) ToKNService

func (s *SubscriptionBuilder) ToKNService(knServiceName string) *SubscriptionBuilder

func (*SubscriptionBuilder) ToUri

type SubscriptionWithError

type SubscriptionWithError struct {
	Sub *subApis.Subscription
	Err error
}

func WriteSubscriptions

func WriteSubscriptions(ctx context.Context, client runtimeClient.Client, subs []*subApis.Subscription) []SubscriptionWithError

Jump to

Keyboard shortcuts

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