utils

package
v0.0.0-...-ea047a2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolSettingsContentModeBinary     string = "BINARY"
	ProtocolSettingsContentModeStructured string = "STRUCTURED"
)

Variables

This section is empty.

Functions

func APIRuleGroupVersionResource

func APIRuleGroupVersionResource() schema.GroupVersionResource

func ConvertKymaSubToEventMeshSub

func ConvertKymaSubToEventMeshSub(subscription *eventingv1alpha2.Subscription, typeInfos []EventTypeInfo,
	apiRule *apigatewayv1beta1.APIRule, defaultWebhookAuth *types.WebhookAuth,
	defaultProtocolSettings *ProtocolSettings,
	defaultNamespace string, nameMapper NameMapper) (*types.Subscription, error)

func ConvertMsgToCE

func ConvertMsgToCE(msg *nats.Msg) (*cev2event.Event, error)

func GetCleanedEventMeshSubscription

func GetCleanedEventMeshSubscription(subscription *types.Subscription) *types.Subscription

func GetExposedURLFromAPIRule

func GetExposedURLFromAPIRule(apiRule *apigatewayv1beta1.APIRule, targetURL string) (string, error)

func GetHash

func GetHash(subscription *types.Subscription) (int64, error)

func GetWebhookAuthHash

func GetWebhookAuthHash(webhookAuth *types.WebhookAuth) (int64, error)

func IsEventMeshSubModified

func IsEventMeshSubModified(subscription *types.Subscription, hash int64) (bool, error)

func LoggerWithSubscription

func LoggerWithSubscription(log *zap.SugaredLogger,
	subscription *eventingv1alpha2.Subscription) *zap.SugaredLogger

LoggerWithSubscription returns a logger with the given subscription (v1alpha2) details.

func UpdateSubscriptionStatus

func UpdateSubscriptionStatus(ctx context.Context, dClient dynamic.Interface,
	sub *eventingv1alpha2.Subscription) error

UpdateSubscriptionStatus updates the status of all Kyma subscriptions on k8s.

Types

type ConnClosedHandler

type ConnClosedHandler func(conn *nats.Conn)

type EventTypeInfo

type EventTypeInfo struct {
	OriginalType  string
	CleanType     string
	ProcessedType string
}

type NameMapper

type NameMapper interface {
	MapSubscriptionName(subscriptionName, subscriptionNamespace string) string
}

NameMapper is used to map Kyma-specific resource names to their corresponding name on other (external) systems, e.g. on different eventing backends, the same Kyma subscription name could map to a different name.

func NewBEBSubscriptionNameMapper

func NewBEBSubscriptionNameMapper(domainName string, maxNameLength int) NameMapper

type ProtocolSettings

type ProtocolSettings struct {
	// ContentMode defines content mode for eventing based on BEB.
	// +optional
	ContentMode *string `json:"contentMode,omitempty"`

	// ExemptHandshake defines whether exempt handshake for eventing based on BEB.
	// +optional
	ExemptHandshake *bool `json:"exemptHandshake,omitempty"`

	// Qos defines quality of service for eventing based on BEB.
	// +optional
	Qos *string `json:"qos,omitempty"`

	// WebhookAuth defines the Webhook called by an active subscription in BEB.
	// +optional
	WebhookAuth *WebhookAuth `json:"webhookAuth,omitempty"`
}

ProtocolSettings defines the CE protocol setting specification implementation.

type WebhookAuth

type WebhookAuth struct {
	// Type defines type of authentication
	// +optional
	Type string `json:"type,omitempty"`

	// GrantType defines grant type for OAuth2
	GrantType string `json:"grantType"`

	// ClientID defines clientID for OAuth2
	ClientID string `json:"clientId"`

	// ClientSecret defines client secret for OAuth2
	ClientSecret string `json:"clientSecret"`

	// TokenURL defines token URL for OAuth2
	TokenURL string `json:"tokenUrl"`

	// Scope defines scope for OAuth2
	Scope []string `json:"scope,omitempty"`
}

WebhookAuth defines the Webhook called by an active subscription in BEB.

Jump to

Keyboard shortcuts

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