Documentation ¶
Index ¶
- Constants
- Variables
- func AddEventType(eventType string, subscription *eventingv1alpha2.Subscription)
- func AddSource(source string, subscription *eventingv1alpha2.Subscription)
- func DefaultReadyCondition() eventingv1alpha2.Condition
- func EventMeshAuthResponseSuccess(w http.ResponseWriter)
- func EventMeshCreateSuccess(w http.ResponseWriter)
- func EventMeshDeleteResponseSuccess(w http.ResponseWriter)
- func EventMeshGetSuccess(w http.ResponseWriter, name string)
- func EventMeshListSuccess(w http.ResponseWriter)
- func GetBinaryMessageHeaders() http.Header
- func GetFreePort() (int, error)
- func GetRestAPIObject(u *url.URL) string
- func GetStructuredMessageHeaders() http.Header
- func HaveAPIRuleName(name string) gomegatypes.GomegaMatcher
- func HaveAPIRuleOwnersRefs(uids ...ktypes.UID) gomegatypes.GomegaMatcher
- func HaveAPIRuleSpecRules(ruleMethods []string, accessStrategy, certsURL, path string) gomegatypes.GomegaMatcher
- func HaveAPIRuleSpecRulesWithOry(ruleMethods []string, accessStrategy, path string) gomegatypes.GomegaMatcher
- func HaveAPIRuleTrueStatusCondition() gomegatypes.GomegaMatcher
- func HaveCleanEventTypes(cleanEventTypes []eventingv1alpha2.EventType) gomegatypes.GomegaMatcher
- func HaveCondition(condition eventingv1alpha2.Condition) gomegatypes.GomegaMatcher
- func HaveEvent(event kcorev1.Event) gomegatypes.GomegaMatcher
- func HaveMaxInFlight(maxInFlight int) gomegatypes.GomegaMatcher
- func HaveNonZeroEv2Hash() gomegatypes.GomegaMatcher
- func HaveNonZeroEventMeshHash() gomegatypes.GomegaMatcher
- func HaveNonZeroEventMeshLocalHash() gomegatypes.GomegaMatcher
- func HaveNonZeroWebhookAuthHash() gomegatypes.GomegaMatcher
- func HaveNoneEmptyAPIRuleName() gomegatypes.GomegaMatcher
- func HaveNotEmptyAPIRule() gomegatypes.GomegaMatcher
- func HaveNotEmptyHost() gomegatypes.GomegaMatcher
- func HaveNotFoundSubscription() gomegatypes.GomegaMatcher
- func HaveStatusTypes(cleanEventTypes []eventingv1alpha2.EventType) gomegatypes.GomegaMatcher
- func HaveSubscriptionActiveCondition() gomegatypes.GomegaMatcher
- func HaveSubscriptionFinalizer(finalizer string) gomegatypes.GomegaMatcher
- func HaveSubscriptionName(name string) gomegatypes.GomegaMatcher
- func HaveSubscriptionNotReady() gomegatypes.GomegaMatcher
- func HaveSubscriptionReady() gomegatypes.GomegaMatcher
- func HaveTypeMatching(typeMatching eventingv1alpha2.TypeMatching) gomegatypes.GomegaMatcher
- func HaveTypes(types []string) gomegatypes.GomegaMatcher
- func HaveValidBEBNamespace(bebNamespaceKey, namespace string) gomegatypes.GomegaMatcher
- func HaveValidClientID(clientIDKey, clientID string) gomegatypes.GomegaMatcher
- func HaveValidClientSecret(clientSecretKey, clientSecret string) gomegatypes.GomegaMatcher
- func HaveValidEMSPublishURL(emsPublishURLKey, emsPublishURL string) gomegatypes.GomegaMatcher
- func HaveValidTokenEndpoint(tokenEndpointKey, tokenEndpoint string) gomegatypes.GomegaMatcher
- func IsAnEmptySubscription() gomegatypes.GomegaMatcher
- func IsEventMeshSubscriptionCreate(r *http.Request) bool
- func IsEventMeshSubscriptionDelete(r *http.Request) bool
- func MarkReady(rule *apigatewayv1beta1.APIRule)
- func NewAPIRule(subscription *eventingv1alpha2.Subscription, opts ...APIRuleOption) *apigatewayv1beta1.APIRule
- func NewBEBMessagingSecret(name, namespace string) *kcorev1.Secret
- func NewEventMeshSubscription(name, contentMode string, webhookURL string, events types.Events, ...) *types.Subscription
- func NewFakeSubscriptionClient(sub *eventingv1alpha2.Subscription) (dynamic.Interface, error)
- func NewNamespace(name string) *kcorev1.Namespace
- func NewSampleEventMeshSubscription() *types.Subscription
- func NewSubscriberSvc(name, namespace string) *kcorev1.Service
- func NewSubscription(name, namespace string, opts ...SubscriptionOpt) *eventingv1alpha2.Subscription
- func RunNatsServerOnPort(opts ...NatsServerOpt) *server.Server
- func SetSink(svcNamespace, svcName string, subscription *eventingv1alpha2.Subscription)
- func SetupSchemeOrDie() (*kruntime.Scheme, error)
- func ShutDownNATSServer(natsServer *server.Server)
- func StartDefaultJetStreamServer(port int) *server.Server
- func SubscriptionGroupVersionResource() kschema.GroupVersionResource
- func ToSubscription(unstructuredSub *kunstructured.Unstructured) (*eventingv1alpha2.Subscription, error)
- func ToUnstructuredAPIRule(obj interface{}) (*kunstructured.Unstructured, error)
- func ValidSinkURL(namespace, svcName string) string
- func ValidSinkURLWithPath(namespace, svcName, path string) string
- type APIRuleOption
- type EventMeshMock
- func (m *EventMeshMock) AddCreateResponseOverride(key string, responseFunc ResponseWithSub)
- func (m *EventMeshMock) AddGetResponseOverride(key string, responseFunc ResponseWithName)
- func (m *EventMeshMock) CountRequests(method, uri string) int
- func (m *EventMeshMock) Reset()
- func (m *EventMeshMock) ResetResponseOverrides()
- func (m *EventMeshMock) Start() string
- func (m *EventMeshMock) Stop()
- type EventMeshMockResponseOverride
- type NatsServerOpt
- type Response
- type ResponseUpdateReq
- type ResponseUpdateStateReq
- type ResponseWithName
- type ResponseWithSub
- type SafeRequests
- func (r *SafeRequests) GetSubscriptionNames() map[*http.Request]string
- func (r *SafeRequests) GetSubscriptions() map[*http.Request]types.Subscription
- func (r *SafeRequests) Len() int
- func (r *SafeRequests) PutSubscription(request *http.Request, subscription types.Subscription)
- func (r *SafeRequests) ReadEach(f func(request *http.Request, payload interface{}))
- func (r *SafeRequests) StoreRequest(request *http.Request)
- type SafeSubscriptions
- type Subscriber
- type SubscriberOption
- type SubscriptionOpt
- func WithBackend(backend eventingv1alpha2.Backend) SubscriptionOpt
- func WithCleanEventSourceAndType() SubscriptionOpt
- func WithCleanEventTypeOld() SubscriptionOpt
- func WithConditions(conditions []eventingv1alpha2.Condition) SubscriptionOpt
- func WithConfigValue(key, value string) SubscriptionOpt
- func WithDefaultSource() SubscriptionOpt
- func WithEmptyConfig() SubscriptionOpt
- func WithEmptyStatus() SubscriptionOpt
- func WithEmsSubscriptionStatus(status string) SubscriptionOpt
- func WithEventMeshExactType() SubscriptionOpt
- func WithEventSource(source string) SubscriptionOpt
- func WithEventType(eventType string) SubscriptionOpt
- func WithExactTypeMatching() SubscriptionOpt
- func WithFakeSubscriptionStatus() SubscriptionOpt
- func WithFinalizers(finalizers []string) SubscriptionOpt
- func WithInvalidProtocolSettingsQos() SubscriptionOpt
- func WithInvalidWebhookAuthGrantType() SubscriptionOpt
- func WithInvalidWebhookAuthType() SubscriptionOpt
- func WithMaxInFlight(maxInFlight int) SubscriptionOpt
- func WithMaxInFlightMessages(maxInFlight string) SubscriptionOpt
- func WithNonZeroDeletionTimestamp() SubscriptionOpt
- func WithNotCleanEventSourceAndType() SubscriptionOpt
- func WithNotCleanSource() SubscriptionOpt
- func WithNotCleanType() SubscriptionOpt
- func WithOrderCreatedFilter() SubscriptionOpt
- func WithOrderCreatedV1Event() SubscriptionOpt
- func WithProtocolEventMesh() SubscriptionOpt
- func WithSink(sink string) SubscriptionOpt
- func WithSinkURL(sinkURL string) SubscriptionOpt
- func WithSinkURLFromSvc(svc *kcorev1.Service) SubscriptionOpt
- func WithSource(source string) SubscriptionOpt
- func WithSourceAndType(eventSource, eventType string) SubscriptionOpt
- func WithStandardTypeMatching() SubscriptionOpt
- func WithStatus(status bool) SubscriptionOpt
- func WithStatusJSBackendTypes(types []eventingv1alpha2.JetStreamTypes) SubscriptionOpt
- func WithStatusTypes(cleanEventTypes []eventingv1alpha2.EventType) SubscriptionOpt
- func WithTypeMatching(typeMatching eventingv1alpha2.TypeMatching) SubscriptionOpt
- func WithTypeMatchingExact() SubscriptionOpt
- func WithTypeMatchingStandard() SubscriptionOpt
- func WithTypes(types []string) SubscriptionOpt
- func WithValidSink(svcNamespace, svcName string) SubscriptionOpt
- func WithWebhookAuthForEventMesh() SubscriptionOpt
Constants ¶
const ( TokenURLPath = "/auth" MessagingURLPath = "/messaging" )
const ( ApplicationName = "testapp1023" ApplicationNameNotClean = "test-app_1-0+2=3" OrderCreatedUncleanEvent = "order.cre-ä+t*ed.v2" OrderCreatedCleanEvent = "order.cre-ä+ted.v2" EventSourceUnclean = "s>o>*u*r>c.e" EventSourceClean = "source" EventMeshProtocol = "BEB" EventMeshNamespaceNS = "/default/ns" EventMeshNamespace = "/default/kyma/id" EventSource = "/default/kyma/id" EventTypePrefix = "prefix" EventMeshPrefix = "one.two.three" // three segments InvalidEventMeshPrefix = "one.two.three.four" // four segments EventTypePrefixEmpty = "" OrderCreatedV1Event = "order.created.v1" OrderCreatedV2Event = "order.created.v2" OrderCreatedV1EventNotClean = "order.c*r%e&a!te#d.v1" JetStreamSubject = "kyma" + "." + EventSourceClean + "." + OrderCreatedV1Event JetStreamSubjectV2 = "kyma" + "." + EventSourceClean + "." + OrderCreatedCleanEvent EventMeshExactType = EventMeshPrefix + "." + ApplicationNameNotClean + "." + OrderCreatedV1EventNotClean EventMeshOrderCreatedV1Type = EventMeshPrefix + "." + ApplicationName + "." + OrderCreatedV1Event OrderCreatedEventType = EventTypePrefix + "." + ApplicationName + "." + OrderCreatedV1Event OrderCreatedEventTypeNotClean = EventTypePrefix + "." + ApplicationNameNotClean + "." + OrderCreatedV1Event OrderCreatedEventTypePrefixEmpty = ApplicationName + "." + OrderCreatedV1Event CloudEventType = EventTypePrefix + "." + ApplicationName + ".order.created.v1" CloudEventData = "{\"foo\":\"bar\"}" CloudEventData2 = "{\"foo\":\"bar2\"}" JSStreamName = "kyma" EventID = "8945ec08-256b-11eb-9928-acde48001122" CloudEventSource = "/default/sap.kyma/id" CloudEventSpecVersion = "1.0" CeIDHeader = "ce-id" CeTypeHeader = "ce-type" CeSourceHeader = "ce-source" CeSpecVersionHeader = "ce-specversion" )
Variables ¶
Functions ¶
func AddEventType ¶
func AddEventType(eventType string, subscription *eventingv1alpha2.Subscription)
AddEventType adds a new type to the subscription.
func AddSource ¶
func AddSource(source string, subscription *eventingv1alpha2.Subscription)
AddSource adds the source value to the subscription.
func DefaultReadyCondition ¶
func DefaultReadyCondition() eventingv1alpha2.Condition
func EventMeshAuthResponseSuccess ¶
func EventMeshAuthResponseSuccess(w http.ResponseWriter)
EventMeshAuthResponseSuccess writes an oauth2 authentication Response to the writer for the happy-path.
func EventMeshCreateSuccess ¶
func EventMeshCreateSuccess(w http.ResponseWriter)
EventMeshCreateSuccess writes a Response to the writer for the happy-path of creating an EventMesh subscription.
func EventMeshDeleteResponseSuccess ¶
func EventMeshDeleteResponseSuccess(w http.ResponseWriter)
EventMeshDeleteResponseSuccess writes a Response to the writer for the happy-path of deleting an EventMesh subscription.
func EventMeshGetSuccess ¶
func EventMeshGetSuccess(w http.ResponseWriter, name string)
EventMeshGetSuccess writes a Response to the writer for the happy-path of getting an EventMesh subscription.
func EventMeshListSuccess ¶
func EventMeshListSuccess(w http.ResponseWriter)
EventMeshListSuccess writes a Response to the writer for the happy-path of listing a EventMesh subscription.
func GetBinaryMessageHeaders ¶
func GetFreePort ¶
GetFreePort determines a free port on the host. It does so by delegating the job to net.ListenTCP. Then providing a port of 0 to net.ListenTCP, it will automatically choose a port for us.
func GetRestAPIObject ¶
GetRestAPIObject gets the name of the involved object in a REST url. e.g. "/messaging/events/subscriptions/{subscriptionName}" => "{subscriptionName}".
func HaveAPIRuleName ¶
func HaveAPIRuleName(name string) gomegatypes.GomegaMatcher
func HaveAPIRuleOwnersRefs ¶
func HaveAPIRuleOwnersRefs(uids ...ktypes.UID) gomegatypes.GomegaMatcher
func HaveAPIRuleSpecRules ¶
func HaveAPIRuleSpecRules(ruleMethods []string, accessStrategy, certsURL, path string) gomegatypes.GomegaMatcher
func HaveAPIRuleSpecRulesWithOry ¶
func HaveAPIRuleSpecRulesWithOry(ruleMethods []string, accessStrategy, path string) gomegatypes.GomegaMatcher
func HaveAPIRuleTrueStatusCondition ¶
func HaveAPIRuleTrueStatusCondition() gomegatypes.GomegaMatcher
func HaveCleanEventTypes ¶
func HaveCleanEventTypes(cleanEventTypes []eventingv1alpha2.EventType) gomegatypes.GomegaMatcher
func HaveCondition ¶
func HaveCondition(condition eventingv1alpha2.Condition) gomegatypes.GomegaMatcher
func HaveEvent ¶
func HaveEvent(event kcorev1.Event) gomegatypes.GomegaMatcher
func HaveMaxInFlight ¶
func HaveMaxInFlight(maxInFlight int) gomegatypes.GomegaMatcher
func HaveNonZeroEv2Hash ¶
func HaveNonZeroEv2Hash() gomegatypes.GomegaMatcher
func HaveNonZeroEventMeshHash ¶
func HaveNonZeroEventMeshHash() gomegatypes.GomegaMatcher
func HaveNonZeroEventMeshLocalHash ¶
func HaveNonZeroEventMeshLocalHash() gomegatypes.GomegaMatcher
func HaveNonZeroWebhookAuthHash ¶
func HaveNonZeroWebhookAuthHash() gomegatypes.GomegaMatcher
func HaveNoneEmptyAPIRuleName ¶
func HaveNoneEmptyAPIRuleName() gomegatypes.GomegaMatcher
func HaveNotEmptyAPIRule ¶
func HaveNotEmptyAPIRule() gomegatypes.GomegaMatcher
func HaveNotEmptyHost ¶
func HaveNotEmptyHost() gomegatypes.GomegaMatcher
func HaveNotFoundSubscription ¶
func HaveNotFoundSubscription() gomegatypes.GomegaMatcher
func HaveStatusTypes ¶
func HaveStatusTypes(cleanEventTypes []eventingv1alpha2.EventType) gomegatypes.GomegaMatcher
func HaveSubscriptionActiveCondition ¶
func HaveSubscriptionActiveCondition() gomegatypes.GomegaMatcher
func HaveSubscriptionFinalizer ¶
func HaveSubscriptionFinalizer(finalizer string) gomegatypes.GomegaMatcher
func HaveSubscriptionName ¶
func HaveSubscriptionName(name string) gomegatypes.GomegaMatcher
func HaveSubscriptionNotReady ¶
func HaveSubscriptionNotReady() gomegatypes.GomegaMatcher
func HaveSubscriptionReady ¶
func HaveSubscriptionReady() gomegatypes.GomegaMatcher
func HaveTypeMatching ¶
func HaveTypeMatching(typeMatching eventingv1alpha2.TypeMatching) gomegatypes.GomegaMatcher
func HaveTypes ¶
func HaveTypes(types []string) gomegatypes.GomegaMatcher
func HaveValidBEBNamespace ¶
func HaveValidBEBNamespace(bebNamespaceKey, namespace string) gomegatypes.GomegaMatcher
func HaveValidClientID ¶
func HaveValidClientID(clientIDKey, clientID string) gomegatypes.GomegaMatcher
func HaveValidClientSecret ¶
func HaveValidClientSecret(clientSecretKey, clientSecret string) gomegatypes.GomegaMatcher
func HaveValidEMSPublishURL ¶
func HaveValidEMSPublishURL(emsPublishURLKey, emsPublishURL string) gomegatypes.GomegaMatcher
func HaveValidTokenEndpoint ¶
func HaveValidTokenEndpoint(tokenEndpointKey, tokenEndpoint string) gomegatypes.GomegaMatcher
func IsAnEmptySubscription ¶
func IsAnEmptySubscription() gomegatypes.GomegaMatcher
func IsEventMeshSubscriptionCreate ¶
IsEventMeshSubscriptionCreate determines if the http request is creating an EventMesh subscription.
func IsEventMeshSubscriptionDelete ¶
IsEventMeshSubscriptionDelete determines if the http request is deleting a EventMesh subscription.
func MarkReady ¶
func MarkReady(rule *apigatewayv1beta1.APIRule)
func NewAPIRule ¶
func NewAPIRule(subscription *eventingv1alpha2.Subscription, opts ...APIRuleOption) *apigatewayv1beta1.APIRule
NewAPIRule returns a valid APIRule.
func NewBEBMessagingSecret ¶
func NewEventMeshSubscription ¶
func NewEventMeshSubscription(name, contentMode string, webhookURL string, events types.Events, webhookAuth *types.WebhookAuth, ) *types.Subscription
func NewFakeSubscriptionClient ¶
func NewFakeSubscriptionClient(sub *eventingv1alpha2.Subscription) (dynamic.Interface, error)
NewFakeSubscriptionClient returns a fake dynamic subscription client.
func NewNamespace ¶
func NewSampleEventMeshSubscription ¶
func NewSampleEventMeshSubscription() *types.Subscription
func NewSubscriberSvc ¶
func NewSubscription ¶
func NewSubscription(name, namespace string, opts ...SubscriptionOpt) *eventingv1alpha2.Subscription
func RunNatsServerOnPort ¶
func RunNatsServerOnPort(opts ...NatsServerOpt) *server.Server
RunNatsServerOnPort will run a server with the given server options.
func SetSink ¶
func SetSink(svcNamespace, svcName string, subscription *eventingv1alpha2.Subscription)
SetSink sets the subscription's sink to a valid sink created from svcNameSpace and svcName.
func SetupSchemeOrDie ¶
SetupSchemeOrDie add a scheme to eventing API schemes.
func ShutDownNATSServer ¶
ShutDownNATSServer shuts down test NATS server and waits until shutdown is complete.
func StartDefaultJetStreamServer ¶
StartDefaultJetStreamServer will run a server on the given port.
func SubscriptionGroupVersionResource ¶
func SubscriptionGroupVersionResource() kschema.GroupVersionResource
SubscriptionGroupVersionResource returns the GVR of a subscription.
func ToSubscription ¶
func ToSubscription(unstructuredSub *kunstructured.Unstructured) (*eventingv1alpha2.Subscription, error)
ToSubscription converts an unstructured subscription into a typed one.
func ToUnstructuredAPIRule ¶
func ToUnstructuredAPIRule(obj interface{}) (*kunstructured.Unstructured, error)
ToUnstructuredAPIRule converts an APIRule object into a unstructured APIRule.
func ValidSinkURL ¶
ValidSinkURL converts a namespace and service name to a valid sink url.
func ValidSinkURLWithPath ¶
ValidSinkURLWithPath converts a namespace and service name to a valid sink url with path.
Types ¶
type APIRuleOption ¶
type APIRuleOption func(r *apigatewayv1beta1.APIRule)
func WithPath ¶
func WithPath() APIRuleOption
func WithService ¶
func WithService(name, host string) APIRuleOption
type EventMeshMock ¶
type EventMeshMock struct { Requests *SafeRequests Subscriptions *SafeSubscriptions TokenURL string MessagingURL string AuthResponse Response GetResponse ResponseWithName ListResponse Response CreateResponse Response UpdateResponse ResponseUpdateReq UpdateStateResponse ResponseUpdateStateReq DeleteResponse Response ResponseOverrides *EventMeshMockResponseOverride // contains filtered or unexported fields }
EventMeshMock implements a programmable mock for EventMesh.
func NewEventMeshMock ¶
func NewEventMeshMock() *EventMeshMock
func (*EventMeshMock) AddCreateResponseOverride ¶
func (m *EventMeshMock) AddCreateResponseOverride(key string, responseFunc ResponseWithSub)
func (*EventMeshMock) AddGetResponseOverride ¶
func (m *EventMeshMock) AddGetResponseOverride(key string, responseFunc ResponseWithName)
func (*EventMeshMock) CountRequests ¶
func (m *EventMeshMock) CountRequests(method, uri string) int
CountRequests counts the mock API requests using the given HTTP method and URI.
func (*EventMeshMock) Reset ¶
func (m *EventMeshMock) Reset()
func (*EventMeshMock) ResetResponseOverrides ¶
func (m *EventMeshMock) ResetResponseOverrides()
func (*EventMeshMock) Start ¶
func (m *EventMeshMock) Start() string
func (*EventMeshMock) Stop ¶
func (m *EventMeshMock) Stop()
type EventMeshMockResponseOverride ¶
type EventMeshMockResponseOverride struct { CreateResponse map[string]ResponseWithSub GetResponse map[string]ResponseWithName }
func NewEventMeshMockResponseOverride ¶
func NewEventMeshMockResponseOverride() *EventMeshMockResponseOverride
type NatsServerOpt ¶
func WithJetStreamEnabled ¶
func WithJetStreamEnabled() NatsServerOpt
func WithPort ¶
func WithPort(port int) NatsServerOpt
type Response ¶
type Response func(w http.ResponseWriter)
type ResponseUpdateReq ¶
type ResponseUpdateReq func(w http.ResponseWriter, key string, webhookAuth *emstypes.WebhookAuth)
func UpdateSubscriptionResponse ¶
func UpdateSubscriptionResponse(m *EventMeshMock) ResponseUpdateReq
UpdateSubscriptionResponse updates the webhook auth of subscription in the mock.
type ResponseUpdateStateReq ¶
func UpdateSubscriptionStateResponse ¶
func UpdateSubscriptionStateResponse(mock *EventMeshMock) ResponseUpdateStateReq
UpdateSubscriptionStateResponse updates the EventMesh subscription status in the mock.
type ResponseWithName ¶
type ResponseWithName func(w http.ResponseWriter, subscriptionName string)
func GetSubscriptionResponse ¶
func GetSubscriptionResponse(m *EventMeshMock) ResponseWithName
GetSubscriptionResponse checks if a subscription exists in the mock.
type ResponseWithSub ¶
type ResponseWithSub func(w http.ResponseWriter, subscription emstypes.Subscription)
type SafeRequests ¶
SafeRequests encapsulates Requests to provide mutual exclusion.
func NewSafeRequests ¶
func NewSafeRequests() *SafeRequests
NewSafeRequests returns a new instance of SafeRequests.
func (*SafeRequests) GetSubscriptionNames ¶
func (r *SafeRequests) GetSubscriptionNames() map[*http.Request]string
GetSubscriptionNames converts requests to a map of http requests and the actual subscription names.
func (*SafeRequests) GetSubscriptions ¶
func (r *SafeRequests) GetSubscriptions() map[*http.Request]types.Subscription
GetSubscriptions converts requests to a map of http requests and the actual subscriptions.
func (*SafeRequests) PutSubscription ¶
func (r *SafeRequests) PutSubscription(request *http.Request, subscription types.Subscription)
PutSubscription sets the subscription of a request.
func (*SafeRequests) ReadEach ¶
func (r *SafeRequests) ReadEach(f func(request *http.Request, payload interface{}))
ReadEach iterates over requests and executes a given func f with each iteration's request and payload.
func (*SafeRequests) StoreRequest ¶
func (r *SafeRequests) StoreRequest(request *http.Request)
StoreRequest adds a request to requests and sets it's corresponding subscription to nil.
type SafeSubscriptions ¶
SafeSubscriptions encapsulates Subscriptions to provide mutual exclusion.
func NewSafeSubscriptions ¶
func NewSafeSubscriptions() *SafeSubscriptions
NewSafeSubscriptions returns a new instance of SafeSubscriptions.
func (*SafeSubscriptions) DeleteSubscription ¶
func (s *SafeSubscriptions) DeleteSubscription(key string)
DeleteSubscription deletes a Subscription via the corresponding key.
func (*SafeSubscriptions) DeleteSubscriptionsByName ¶
func (s *SafeSubscriptions) DeleteSubscriptionsByName(name string)
DeleteSubscriptionsByName deletes all Subscriptions that contain the substring name in their own name.
func (*SafeSubscriptions) GetSubscription ¶
func (s *SafeSubscriptions) GetSubscription(key string) *emstypes.Subscription
GetSubscription returns a Subscription via the corresponding key.
func (*SafeSubscriptions) PutSubscription ¶
func (s *SafeSubscriptions) PutSubscription(key string, subscription *emstypes.Subscription)
PutSubscription adds a Subscription and it's corresponding key to SafeSubscriptions.
type Subscriber ¶
type Subscriber struct { SinkURL string InternalErrorURL string // contains filtered or unexported fields }
func NewSubscriber ¶
func NewSubscriber(opts ...SubscriberOption) *Subscriber
NewSubscriber creates a simple test Subscriber with http Endpoints to received, store end answer event data. NewSubscriber accepts SubscriberOpts for customization.
func (Subscriber) CheckEvent ¶
func (s Subscriber) CheckEvent(expectedData string) error
CheckEvent checks if the Subscriber received the expected string and will return an error if this is not the case.
func (Subscriber) CheckRetries ¶
func (s Subscriber) CheckRetries(expectedNoOfRetries int, expectedData string) error
CheckRetries checks if the number of retries specified by expectedData was done and if the data sent on each retry was correctly received.
func (*Subscriber) GetSubscriberListener ¶
func (s *Subscriber) GetSubscriberListener() net.Listener
func (*Subscriber) IsRunning ¶
func (s *Subscriber) IsRunning() bool
func (*Subscriber) Shutdown ¶
func (s *Subscriber) Shutdown()
type SubscriberOption ¶
type SubscriberOption func(*Subscriber)
func WithCloudEventServeMux ¶
func WithCloudEventServeMux() SubscriberOption
WithCloudEventServeMux will make the Subscriber store all CloudEvent-related date ("ce-..." header etc) at its "/store" e Endpoint instead of its default behaviour of only storing the http.Request.Body data.
func WithListener ¶
func WithListener(listener net.Listener) SubscriberOption
type SubscriptionOpt ¶
type SubscriptionOpt func(subscription *eventingv1alpha2.Subscription)
func WithBackend ¶
func WithBackend(backend eventingv1alpha2.Backend) SubscriptionOpt
WithBackend is a SubscriptionOpt that sets the status with the Backend value.
func WithCleanEventSourceAndType ¶
func WithCleanEventSourceAndType() SubscriptionOpt
WithCleanEventSourceAndType is a SubscriptionOpt that initializes subscription with a not clean event source and type.
func WithCleanEventTypeOld ¶
func WithCleanEventTypeOld() SubscriptionOpt
WithCleanEventTypeOld is a SubscriptionOpt that initializes subscription with a not clean event type from v1alpha2.
func WithConditions ¶
func WithConditions(conditions []eventingv1alpha2.Condition) SubscriptionOpt
func WithConfigValue ¶
func WithConfigValue(key, value string) SubscriptionOpt
func WithDefaultSource ¶
func WithDefaultSource() SubscriptionOpt
func WithEmptyConfig ¶
func WithEmptyConfig() SubscriptionOpt
func WithEmptyStatus ¶
func WithEmptyStatus() SubscriptionOpt
func WithEmsSubscriptionStatus ¶
func WithEmsSubscriptionStatus(status string) SubscriptionOpt
func WithEventMeshExactType ¶
func WithEventMeshExactType() SubscriptionOpt
func WithEventSource ¶
func WithEventSource(source string) SubscriptionOpt
WithEventSource is a SubscriptionOpt for creating a Subscription with a specific event source,.
func WithEventType ¶
func WithEventType(eventType string) SubscriptionOpt
WithEventType is a SubscriptionOpt for creating a Subscription with a specific event type, that itself gets created from the passed eventType.
func WithExactTypeMatching ¶
func WithExactTypeMatching() SubscriptionOpt
WithExactTypeMatching is a SubscriptionOpt for creating a Subscription with an exact type matching.
func WithFakeSubscriptionStatus ¶
func WithFakeSubscriptionStatus() SubscriptionOpt
func WithFinalizers ¶
func WithFinalizers(finalizers []string) SubscriptionOpt
func WithInvalidProtocolSettingsQos ¶
func WithInvalidProtocolSettingsQos() SubscriptionOpt
func WithInvalidWebhookAuthGrantType ¶
func WithInvalidWebhookAuthGrantType() SubscriptionOpt
func WithInvalidWebhookAuthType ¶
func WithInvalidWebhookAuthType() SubscriptionOpt
func WithMaxInFlight ¶
func WithMaxInFlight(maxInFlight int) SubscriptionOpt
WithMaxInFlight is a SubscriptionOpt that sets the status with the maxInFlightMessages int value.
func WithMaxInFlightMessages ¶
func WithMaxInFlightMessages(maxInFlight string) SubscriptionOpt
WithMaxInFlightMessages is a SubscriptionOpt that sets the status with the maxInFlightMessages string value.
func WithNonZeroDeletionTimestamp ¶
func WithNonZeroDeletionTimestamp() SubscriptionOpt
WithNonZeroDeletionTimestamp sets the deletion timestamp of the subscription to Now().
func WithNotCleanEventSourceAndType ¶
func WithNotCleanEventSourceAndType() SubscriptionOpt
WithNotCleanEventSourceAndType is a SubscriptionOpt that initializes subscription with a not clean event source and type.
func WithNotCleanSource ¶
func WithNotCleanSource() SubscriptionOpt
func WithNotCleanType ¶
func WithNotCleanType() SubscriptionOpt
WithNotCleanType initializes subscription with a not clean event-type A not clean event-type means it contains none-alphanumeric characters.
func WithOrderCreatedFilter ¶
func WithOrderCreatedFilter() SubscriptionOpt
func WithOrderCreatedV1Event ¶
func WithOrderCreatedV1Event() SubscriptionOpt
func WithProtocolEventMesh ¶
func WithProtocolEventMesh() SubscriptionOpt
func WithSink ¶
func WithSink(sink string) SubscriptionOpt
func WithSinkURL ¶
func WithSinkURL(sinkURL string) SubscriptionOpt
WithSinkURL is a SubscriptionOpt for creating a subscription with a specific sink.
func WithSinkURLFromSvc ¶
func WithSinkURLFromSvc(svc *kcorev1.Service) SubscriptionOpt
WithSinkURLFromSvc sets a kubernetes service as the sink.
func WithSource ¶
func WithSource(source string) SubscriptionOpt
func WithSourceAndType ¶
func WithSourceAndType(eventSource, eventType string) SubscriptionOpt
WithSourceAndType is a SubscriptionOpt for creating a Subscription with a specific eventSource and eventType.
func WithStandardTypeMatching ¶
func WithStandardTypeMatching() SubscriptionOpt
WithStandardTypeMatching is a SubscriptionOpt for creating a Subscription with a standard type matching.
func WithStatus ¶
func WithStatus(status bool) SubscriptionOpt
func WithStatusJSBackendTypes ¶
func WithStatusJSBackendTypes(types []eventingv1alpha2.JetStreamTypes) SubscriptionOpt
func WithStatusTypes ¶
func WithStatusTypes(cleanEventTypes []eventingv1alpha2.EventType) SubscriptionOpt
func WithTypeMatching ¶
func WithTypeMatching(typeMatching eventingv1alpha2.TypeMatching) SubscriptionOpt
WithTypeMatching is a SubscriptionOpt for creating a Subscription with a specific type matching,.
func WithTypeMatchingExact ¶
func WithTypeMatchingExact() SubscriptionOpt
WithTypeMatchingExact is a SubscriptionOpt that initializes the subscription with type matching to exact.
func WithTypeMatchingStandard ¶
func WithTypeMatchingStandard() SubscriptionOpt
WithTypeMatchingStandard is a SubscriptionOpt that initializes the subscription with type matching to standard.
func WithTypes ¶
func WithTypes(types []string) SubscriptionOpt
func WithValidSink ¶
func WithValidSink(svcNamespace, svcName string) SubscriptionOpt
WithValidSink is a SubscriptionOpt for creating a subscription with a valid sink that itself gets created from the svcNamespace and the svcName.
func WithWebhookAuthForEventMesh ¶
func WithWebhookAuthForEventMesh() SubscriptionOpt