Documentation ¶
Index ¶
- func CreateAndSetCACertPool(caFile string) (*x509.CertPool, error)
- func DeregisterApplication(w http.ResponseWriter, r *http.Request)
- func GetNotifications(w http.ResponseWriter, r *http.Request)
- func GetServices(w http.ResponseWriter, r *http.Request)
- func GetSubscriptions(w http.ResponseWriter, r *http.Request)
- func InitEaaContext(cfgPath string, eaaCtx *Context) error
- func NewEaaRouter(eaaCtx *Context) *mux.Router
- func PushNotificationToSubscribers(w http.ResponseWriter, r *http.Request)
- func RegisterApplication(w http.ResponseWriter, r *http.Request)
- func Run(parentCtx context.Context, cfgPath string) error
- func RunServer(parentCtx context.Context, eaaCtx *Context) error
- func SubscribeNamespaceNotifications(w http.ResponseWriter, r *http.Request)
- func SubscribeServiceNotifications(w http.ResponseWriter, r *http.Request)
- func UnsubscribeAllNotifications(w http.ResponseWriter, r *http.Request)
- func UnsubscribeNamespaceNotifications(w http.ResponseWriter, r *http.Request)
- func UnsubscribeServiceNotifications(w http.ResponseWriter, r *http.Request)
- type CertKeyPair
- type Certs
- type CertsInfo
- type Config
- type ConsumerConnection
- type ConsumerSubscription
- type Context
- type GoChannelMsgBroker
- type KafkaInterface
- type KafkaMsgBroker
- type NotificationDescriptor
- type NotificationFromProducer
- type NotificationMessage
- type NotificationSubscriptions
- type NotificationToConsumer
- type Route
- type Routes
- type Service
- type ServiceList
- type ServiceMessage
- type SubscriberIds
- type Subscription
- type SubscriptionList
- type SubscriptionMessage
- type URN
- type UniqueNotif
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAndSetCACertPool ¶
CreateAndSetCACertPool creates and set CA cert pool
func DeregisterApplication ¶
func DeregisterApplication(w http.ResponseWriter, r *http.Request)
DeregisterApplication implements https API
func GetNotifications ¶
func GetNotifications(w http.ResponseWriter, r *http.Request)
GetNotifications implements https API
func GetServices ¶
func GetServices(w http.ResponseWriter, r *http.Request)
GetServices implements https API
func GetSubscriptions ¶
func GetSubscriptions(w http.ResponseWriter, r *http.Request)
GetSubscriptions implements https API
func InitEaaContext ¶
InitEaaContext initializes the Eaa Context
func NewEaaRouter ¶
NewEaaRouter initializes EAA router
func PushNotificationToSubscribers ¶
func PushNotificationToSubscribers(w http.ResponseWriter, r *http.Request)
PushNotificationToSubscribers implements https API
func RegisterApplication ¶
func RegisterApplication(w http.ResponseWriter, r *http.Request)
RegisterApplication implements https API
func RunServer ¶
RunServer starts Edge Application Agent server listening on port read from config file
func SubscribeNamespaceNotifications ¶
func SubscribeNamespaceNotifications(w http.ResponseWriter, r *http.Request)
SubscribeNamespaceNotifications implements https API
func SubscribeServiceNotifications ¶
func SubscribeServiceNotifications(w http.ResponseWriter, r *http.Request)
SubscribeServiceNotifications implements https API
func UnsubscribeAllNotifications ¶
func UnsubscribeAllNotifications(w http.ResponseWriter, r *http.Request)
UnsubscribeAllNotifications implements https API
func UnsubscribeNamespaceNotifications ¶
func UnsubscribeNamespaceNotifications(w http.ResponseWriter, r *http.Request)
UnsubscribeNamespaceNotifications implements https API
func UnsubscribeServiceNotifications ¶
func UnsubscribeServiceNotifications(w http.ResponseWriter, r *http.Request)
UnsubscribeServiceNotifications implements https API
Types ¶
type CertKeyPair ¶
type CertKeyPair struct {
// contains filtered or unexported fields
}
CertKeyPair manages digital certificates.
func InitEaaCert ¶
func InitEaaCert(certInfo CertsInfo) (*CertKeyPair, error)
InitEaaCert generates cartificate for server signed by CA
type Certs ¶
type Certs struct {
// contains filtered or unexported fields
}
Certs stores certs and keys for root ca and eaa
type CertsInfo ¶
type CertsInfo struct { CaRootKeyPath string `json:"CaRootKeyPath"` CaRootPath string `json:"CaRootPath"` ServerCertPath string `json:"ServerCertPath"` ServerKeyPath string `json:"ServerKeyPath"` CommonName string `json:"CommonName"` KafkaCAPath string `json:"KafkaCAPath"` KafkaUserCertPath string `json:"KafkaUserCertPath"` KafkaUserKeyPath string `json:"KafkaUserKeyPath"` }
CertsInfo describes paths for certs used in configuration
type Config ¶
type Config struct { TLSEndpoint string `json:"TlsEndpoint"` OpenEndpoint string `json:"OpenEndpoint"` ValidationEndpoint string `json:"ValidationEndpoint"` HeartbeatInterval util.Duration `json:"HeartbeatInterval"` Certs CertsInfo `json:"Certs"` KafkaBroker string `json:"KafkaBroker"` }
Config describes EAA JSON config file
type ConsumerConnection ¶
type ConsumerConnection struct {
// contains filtered or unexported fields
}
ConsumerConnection stores websocket connection of a consumer
type ConsumerSubscription ¶
type ConsumerSubscription struct {
// contains filtered or unexported fields
}
ConsumerSubscription stores namespace notification subscribers and a map of services and their subscribers
type Context ¶
type Context struct { MsgBrokerCtx msgBroker // contains filtered or unexported fields }
Context holds all EAA structures
type GoChannelMsgBroker ¶
type GoChannelMsgBroker struct {
// contains filtered or unexported fields
}
GoChannelMsgBroker is a GoChannel-backed msgBroker
func NewGoChannelMsgBroker ¶
func NewGoChannelMsgBroker(eaaCtx *Context) *GoChannelMsgBroker
NewGoChannelMsgBroker creates and returns a GoChannel-backed msgBroker
type KafkaInterface ¶
type KafkaInterface interface { DefaultSaramaSubscriberConfig() *sarama.Config DefaultSaramaSyncPublisherConfig() *sarama.Config NewWithPartitioningMarshaler(generatePartitionKey kafka.GeneratePartitionKey) kafka.MarshalerUnmarshaler NewPublisher(config kafka.PublisherConfig, logger watermill.LoggerAdapter) (*kafka.Publisher, error) NewSubscriber(config kafka.SubscriberConfig, logger watermill.LoggerAdapter) (*kafka.Subscriber, error) }
KafkaInterface allows dependency injection for unit testing
var ( // KafkaBroker allows easey dependency injection for unit tests KafkaBroker KafkaInterface )
type KafkaMsgBroker ¶
type KafkaMsgBroker struct {
// contains filtered or unexported fields
}
KafkaMsgBroker is a Kafka-backed msgBroker
func NewKafkaMsgBroker ¶
func NewKafkaMsgBroker(eaaCtx *Context, consumerGroup string, tlsConfig *tls.Config) (*KafkaMsgBroker, error)
NewKafkaMsgBroker creates and returns a Kafka-backed msgBroker
type NotificationDescriptor ¶
type NotificationDescriptor struct { // Name of notification Name string `json:"name,omitempty"` // Version of notification Version string `json:"version,omitempty"` // Human readable description of notification Description string `json:"description,omitempty"` }
NotificationDescriptor describes a type used in EAA API
type NotificationFromProducer ¶
type NotificationFromProducer struct { // Name of notification Name string `json:"name,omitempty"` // Version of notification Version string `json:"version,omitempty"` // The payload can be any JSON object with a name // and version-specific schema. Payload json.RawMessage `json:"payload,omitempty"` }
NotificationFromProducer describes a type used in EAA API
type NotificationMessage ¶
type NotificationMessage struct { Notification *NotificationFromProducer URN *URN }
NotificationMessage is a message sent/received by a message broker
type NotificationSubscriptions ¶
NotificationSubscriptions is a synchronized map of a namespace notification struct to the consumer subscription struct
type NotificationToConsumer ¶
type NotificationToConsumer struct { // Name of notification Name string `json:"name,omitempty"` // Version of notification Version string `json:"version,omitempty"` // The payload can be any JSON object with a name // and version-specific schema. Payload json.RawMessage `json:"payload,omitempty"` // URN of the producer URN URN `json:"producer,omitempty"` }
NotificationToConsumer describes a type used in EAA API
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
Route describes traffic routing
type Service ¶
type Service struct { URN *URN `json:"urn,omitempty"` Description string `json:"description,omitempty"` EndpointURI string `json:"endpoint_uri,omitempty"` Status string `json:"status,omitempty"` Notifications []NotificationDescriptor `json:"notifications,omitempty"` Info json.RawMessage `json:"info,omitempty"` }
Service JSON struct
type ServiceList ¶
type ServiceList struct {
Services []Service `json:"services,omitempty"`
}
ServiceList JSON struct
type ServiceMessage ¶
ServiceMessage is a message sent/received by a message broker
type SubscriberIds ¶
type SubscriberIds []string
SubscriberIds stores subscriber ids as a slice of strings
func (*SubscriberIds) RemoveSubscriber ¶
func (sI *SubscriberIds) RemoveSubscriber(commonName string) bool
RemoveSubscriber delete consumer ID from subscribers list
type Subscription ¶
type Subscription struct { // The name of the producer app. The unique ID is optional for // subscribing and if not given will subscribe to any producer in the // namespace. URN *URN `json:"urn,omitempty"` // The list of all notification types registered by all producers in // this namespace. Notifications []NotificationDescriptor `json:"notifications,omitempty"` }
Subscription describes a type used in EAA API
type SubscriptionList ¶
type SubscriptionList struct {
Subscriptions []Subscription `json:"subscriptions,omitempty"`
}
SubscriptionList JSON struct
type SubscriptionMessage ¶
type SubscriptionMessage struct { ClientCommonName string Subscription *Subscription Action string Scope string }
SubscriptionMessage is a message sent/received by a message broker
type URN ¶
type URN struct { // The per-namespace unique portion of the URN that when appended to // the namespace with a separator forms the complete URN. ID string `json:"id,omitempty"` // The non-unique portion of the URN that identifies the class excluding // a trailing separator. Namespace string `json:"namespace,omitempty"` }
URN describes a type used in EAA API
func CommonNameStringToURN ¶
CommonNameStringToURN parses a common name string to a URN struct
type UniqueNotif ¶
type UniqueNotif struct {
// contains filtered or unexported fields
}
UniqueNotif stores information about unique notification. It is used as a key in NotificationSubscriptions map