Documentation
¶
Overview ¶
Package azureeventgrid emulates Azure Event Grid: custom topics with event subscriptions delivering to webhooks, Service Bus, Event Hubs and Storage queues (with retries and blob dead-lettering), and namespace topics with pull delivery. State is shared with the ARM plane; the HTTPS data plane serves the official publisher and namespace SDKs. See PARITY.md.
Index ¶
- Constants
- Variables
- func SignToken(resource string, expiry time.Time, key string) string
- type AdvancedFilter
- type ConfigProvider
- type Destination
- type DomainInfo
- type DomainTopicInfo
- type Event
- type Filter
- type Handler
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type InMemoryBackend
- func (b *InMemoryBackend) Acknowledge(ns, topicName, sub string, tokens []string) ([]string, []LockFailure, error)
- func (b *InMemoryBackend) ConfirmValidation(code string) bool
- func (b *InMemoryBackend) DeleteDomain(name string) error
- func (b *InMemoryBackend) DeleteDomainTopic(domainName, name string) error
- func (b *InMemoryBackend) DeleteNamespace(name string) error
- func (b *InMemoryBackend) DeleteNamespaceTopic(nsName, name string) error
- func (b *InMemoryBackend) DeletePullSubscription(ns, topicName, name string) error
- func (b *InMemoryBackend) DeleteScopedSubscription(sc Scope, name string) error
- func (b *InMemoryBackend) DeleteSubscription(topicName, name string) error
- func (b *InMemoryBackend) DeleteTopic(name string) error
- func (b *InMemoryBackend) DeliveryAttributes(sc Scope, name string) ([]map[string]any, error)
- func (b *InMemoryBackend) Domain(name string) (DomainInfo, error)
- func (b *InMemoryBackend) DomainKeys(name string) (Keys, error)
- func (b *InMemoryBackend) DomainTopic(domainName, name string) (DomainTopicInfo, error)
- func (b *InMemoryBackend) DomainTopics(domainName string) ([]DomainTopicInfo, error)
- func (b *InMemoryBackend) FullURL(topicName, name string) (string, error)
- func (b *InMemoryBackend) NamespaceExists(name string) bool
- func (b *InMemoryBackend) NamespaceKeys(name string) (Keys, error)
- func (b *InMemoryBackend) NamespaceTopicCreated(nsName, name string) (time.Time, error)
- func (b *InMemoryBackend) PatchScopedSubscription(ctx context.Context, sc Scope, name string, patch map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) Publish(topicName string, events []Event) error
- func (b *InMemoryBackend) PublishDomain(domainName string, events []Event) error
- func (b *InMemoryBackend) PublishNamespace(ns, topicName string, events []Event) error
- func (b *InMemoryBackend) PublishResourceEvent(ev ResourceEvent)
- func (b *InMemoryBackend) PullSubscription(ns, topicName, name string) (map[string]any, time.Time, error)
- func (b *InMemoryBackend) PutDomain(name, resourceID, inputSchema string, autoCreate, autoDelete *bool) (DomainInfo, error)
- func (b *InMemoryBackend) PutDomainTopic(domainName, name string) (time.Time, error)
- func (b *InMemoryBackend) PutNamespace(name string) error
- func (b *InMemoryBackend) PutNamespaceTopic(nsName, name string) (time.Time, error)
- func (b *InMemoryBackend) PutPullSubscription(ns, topicName, name string, props map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) PutScopedSubscription(ctx context.Context, sc Scope, name string, props map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) PutSubscription(ctx context.Context, topicName, name string, props map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) PutTopic(name, resourceID, inputSchema string) (TopicInfo, error)
- func (b *InMemoryBackend) Receive(ctx context.Context, ns, topicName, sub string, maxEvents int, ...) ([]Received, error)
- func (b *InMemoryBackend) RegenerateDomainKey(name, keyName string) (Keys, error)
- func (b *InMemoryBackend) RegenerateNamespaceKey(name, keyName string) (Keys, error)
- func (b *InMemoryBackend) RegenerateTopicKey(name, keyName string) (Keys, error)
- func (b *InMemoryBackend) Reject(ns, topicName, sub string, tokens []string) ([]string, []LockFailure, error)
- func (b *InMemoryBackend) Release(ns, topicName, sub string, tokens []string, delay time.Duration) ([]string, []LockFailure, error)
- func (b *InMemoryBackend) RenewLock(ns, topicName, sub string, tokens []string) ([]string, []LockFailure, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) ResolveNamespace(hostLabel, topicName string, r *http.Request, validate bool) (string, error)
- func (b *InMemoryBackend) ResolvePublisher(hostLabel string, r *http.Request, validate bool) (Publisher, error)
- func (b *InMemoryBackend) ResolveTopic(hostLabel string, r *http.Request, validate bool) (string, error)
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) RunDue(ctx context.Context) int
- func (b *InMemoryBackend) ScopedFullURL(sc Scope, name string) (string, error)
- func (b *InMemoryBackend) ScopedSubscription(sc Scope, name string) (map[string]any, error)
- func (b *InMemoryBackend) SetTargets(t Targets)
- func (b *InMemoryBackend) SetValidationBase(base string)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) Subscription(topicName, name string) (map[string]any, error)
- func (b *InMemoryBackend) SubscriptionCreated(topicName, name string) (time.Time, error)
- func (b *InMemoryBackend) SubscriptionNames(topicName string) ([]string, error)
- func (b *InMemoryBackend) Topic(name string) (TopicInfo, error)
- func (b *InMemoryBackend) TopicKeys(name string) (Keys, error)
- func (b *InMemoryBackend) TopicNames() []string
- type Keys
- type LockFailure
- type Message
- type Provider
- type Publisher
- type Received
- type ResourceEvent
- type RetryPolicy
- type Scope
- type Settings
- type Spec
- type Targets
- type TopicInfo
Constants ¶
const ( EventResourceWriteSuccess = "Microsoft.Resources.ResourceWriteSuccess" EventResourceDeleteSuccess = "Microsoft.Resources.ResourceDeleteSuccess" EventResourceActionSuccess = "Microsoft.Resources.ResourceActionSuccess" )
Azure Resource Manager event types and schema versions.
const ( SchemaEventGrid = "EventGridSchema" SchemaCloudEvent = "CloudEventSchemaV1_0" EndpointWebHook = "WebHook" EndpointServiceBusQ = "ServiceBusQueue" EndpointServiceBusT = "ServiceBusTopic" EndpointEventHub = "EventHub" EndpointStorageQueue = "StorageQueue" EndpointStorageBlob = "StorageBlob" StateSucceeded = "Succeeded" StateAwaitingManual = "AwaitingManualAction" DefaultMaxDeliveryAttempts = 30 DefaultEventTTLMinutes = 1440 )
Event schemas and endpoint types.
const ( // MaxRequestBytes is the largest publish request body accepted (Event Grid's 1 MB limit). MaxRequestBytes = 1 << 20 // MaxEventsPerRequest bounds the events of one publish request. MaxEventsPerRequest = 5000 )
const DefaultPort = 10007
DefaultPort is the Event Grid HTTPS data-plane port.
const (
// MaxReceiveEvents is the largest maxEvents a receive call honours.
MaxReceiveEvents = 100
)
Variables ¶
var ( ErrTopicNotFound = errors.New("azureeventgrid: topic not found") ErrSubscriptionNotFound = errors.New("azureeventgrid: event subscription not found") ErrDomainNotFound = errors.New("azureeventgrid: domain not found") ErrDomainTopicNotFound = errors.New("azureeventgrid: domain topic not found") ErrNamespaceNotFound = errors.New("azureeventgrid: namespace not found") ErrNamespaceTopicNotFound = errors.New("azureeventgrid: namespace topic not found") ErrPullSubNotFound = errors.New("azureeventgrid: namespace topic subscription not found") ErrInvalidName = errors.New("azureeventgrid: invalid entity name") ErrInvalidSpec = errors.New("azureeventgrid: invalid event subscription") ErrWebhookValidation = errors.New("azureeventgrid: webhook validation handshake failed") ErrInvalidEvent = errors.New("azureeventgrid: invalid event") ErrTooManyEvents = errors.New("azureeventgrid: too many events in one request") ErrNilAppContext = errors.New("azureeventgrid: nil app context") ErrAmbiguousTopic = errors.New("azureeventgrid: cannot determine the topic of the request") ErrBadLockToken = errors.New("azureeventgrid: lock token is invalid or expired") )
Backend errors.
ErrUnauthorized is returned when validation is on and no credential matches.
Functions ¶
Types ¶
type AdvancedFilter ¶
type AdvancedFilter struct {
Value any `json:"value,omitempty"`
OperatorType string `json:"operatorType"`
Key string `json:"key,omitempty"`
Values []any `json:"values,omitempty"`
}
AdvancedFilter is one entry of filter.advancedFilters.
type ConfigProvider ¶
type ConfigProvider interface {
GetAzureEventGridSettings() Settings
}
ConfigProvider extracts the Event Grid settings from the AppContext config.
type Destination ¶
type Destination struct {
Properties map[string]any `json:"properties,omitempty"`
EndpointType string `json:"endpointType"`
}
Destination is a delivery or dead-letter endpoint in ARM wire shape.
type DomainInfo ¶
type DomainInfo struct {
CreatedAt time.Time
Name string
ResourceID string
InputSchema string
AutoCreate bool
AutoDelete bool
}
DomainInfo is the exported view of a domain.
type DomainTopicInfo ¶
DomainTopicInfo is the exported view of a domain topic.
type Event ¶
type Event struct {
Fields map[string]any
ID string
Raw json.RawMessage
}
Event is one validated event: its raw JSON, decoded form and ID.
type Filter ¶
type Filter struct {
SubjectBeginsWith string `json:"subjectBeginsWith"`
SubjectEndsWith string `json:"subjectEndsWith"`
IncludedEventTypes []string `json:"includedEventTypes,omitempty"`
AdvancedFilters []AdvancedFilter `json:"advancedFilters,omitempty"`
IsSubjectCaseSensitive bool `json:"isSubjectCaseSensitive"`
EnableAdvancedFilteringOnArrays bool `json:"enableAdvancedFilteringOnArrays,omitempty"`
}
Filter selects the events an event subscription receives.
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
Settings Settings
Port int
// contains filtered or unexported fields
}
Handler owns the HTTPS listener and the delivery worker.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend, settings Settings) *Handler
NewHandler returns a Handler over backend.
func (*Handler) ExtractOperation ¶
ExtractOperation implements service.Service.
func (*Handler) ExtractResource ¶
ExtractResource implements service.Service.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations implements service.Service.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the echo handler of the HTTPS listener.
func (*Handler) MatchPriority ¶
MatchPriority implements service.Registerable.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: Event Grid listens on its own port.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is the Event Grid state shared by the ARM and data planes.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend returns an empty backend using the wall clock.
func (*InMemoryBackend) Acknowledge ¶
func (b *InMemoryBackend) Acknowledge(ns, topicName, sub string, tokens []string) ([]string, []LockFailure, error)
Acknowledge removes the locked events.
func (*InMemoryBackend) ConfirmValidation ¶
func (b *InMemoryBackend) ConfirmValidation(code string) bool
ConfirmValidation completes a manual webhook validation started by a validationUrl GET.
func (*InMemoryBackend) DeleteDomain ¶
func (b *InMemoryBackend) DeleteDomain(name string) error
DeleteDomain removes a domain with its topics and event subscriptions.
func (*InMemoryBackend) DeleteDomainTopic ¶
func (b *InMemoryBackend) DeleteDomainTopic(domainName, name string) error
DeleteDomainTopic removes a domain topic and its event subscriptions.
func (*InMemoryBackend) DeleteNamespace ¶
func (b *InMemoryBackend) DeleteNamespace(name string) error
DeleteNamespace removes a namespace with its topics.
func (*InMemoryBackend) DeleteNamespaceTopic ¶
func (b *InMemoryBackend) DeleteNamespaceTopic(nsName, name string) error
DeleteNamespaceTopic removes a namespace topic and its subscriptions.
func (*InMemoryBackend) DeletePullSubscription ¶
func (b *InMemoryBackend) DeletePullSubscription(ns, topicName, name string) error
DeletePullSubscription removes a namespace topic subscription.
func (*InMemoryBackend) DeleteScopedSubscription ¶
func (b *InMemoryBackend) DeleteScopedSubscription(sc Scope, name string) error
DeleteScopedSubscription removes an event subscription and its undelivered events; the last subscription of a domain topic also removes the topic when the domain auto-deletes topics.
func (*InMemoryBackend) DeleteSubscription ¶
func (b *InMemoryBackend) DeleteSubscription(topicName, name string) error
DeleteSubscription removes a custom topic's event subscription and its undelivered events.
func (*InMemoryBackend) DeleteTopic ¶
func (b *InMemoryBackend) DeleteTopic(name string) error
DeleteTopic removes a custom topic and its event subscriptions.
func (*InMemoryBackend) DeliveryAttributes ¶
DeliveryAttributes returns an event subscription's delivery attribute mappings with secret values included (getDeliveryAttributes).
func (*InMemoryBackend) Domain ¶
func (b *InMemoryBackend) Domain(name string) (DomainInfo, error)
Domain returns the domain.
func (*InMemoryBackend) DomainKeys ¶
func (b *InMemoryBackend) DomainKeys(name string) (Keys, error)
DomainKeys returns the domain's access keys.
func (*InMemoryBackend) DomainTopic ¶
func (b *InMemoryBackend) DomainTopic(domainName, name string) (DomainTopicInfo, error)
DomainTopic returns a domain topic.
func (*InMemoryBackend) DomainTopics ¶
func (b *InMemoryBackend) DomainTopics(domainName string) ([]DomainTopicInfo, error)
DomainTopics lists a domain's topics sorted by name.
func (*InMemoryBackend) FullURL ¶
func (b *InMemoryBackend) FullURL(topicName, name string) (string, error)
FullURL returns the complete webhook endpoint URL of a custom topic's event subscription.
func (*InMemoryBackend) NamespaceExists ¶
func (b *InMemoryBackend) NamespaceExists(name string) bool
NamespaceExists reports whether the namespace exists.
func (*InMemoryBackend) NamespaceKeys ¶
func (b *InMemoryBackend) NamespaceKeys(name string) (Keys, error)
NamespaceKeys returns the namespace's access keys.
func (*InMemoryBackend) NamespaceTopicCreated ¶
func (b *InMemoryBackend) NamespaceTopicCreated(nsName, name string) (time.Time, error)
NamespaceTopicCreated returns a namespace topic's creation time.
func (*InMemoryBackend) PatchScopedSubscription ¶
func (b *InMemoryBackend) PatchScopedSubscription( ctx context.Context, sc Scope, name string, patch map[string]any, ) (map[string]any, error)
PatchScopedSubscription applies an EventSubscriptionUpdateParameters body to an existing event subscription and returns its ARM properties. Only the supplied members change; the merged result is validated exactly as a PUT.
func (*InMemoryBackend) Publish ¶
func (b *InMemoryBackend) Publish(topicName string, events []Event) error
Publish fans events out to the matching event subscriptions of a topic.
func (*InMemoryBackend) PublishDomain ¶
func (b *InMemoryBackend) PublishDomain(domainName string, events []Event) error
PublishDomain fans events out to the subscriptions of the domain and of the domain topic each event names (EventGrid schema: "topic"; CloudEvents: "source"). Events for a topic without a domain topic reach only domain-scope subscriptions.
func (*InMemoryBackend) PublishNamespace ¶
func (b *InMemoryBackend) PublishNamespace(ns, topicName string, events []Event) error
PublishNamespace fans CloudEvents out to the matching subscriptions of a namespace topic.
func (*InMemoryBackend) PublishResourceEvent ¶
func (b *InMemoryBackend) PublishResourceEvent(ev ResourceEvent)
PublishResourceEvent delivers an Azure Resource Manager event to the event subscriptions of its Azure subscription and, when it has one, its resource group.
func (*InMemoryBackend) PullSubscription ¶
func (b *InMemoryBackend) PullSubscription(ns, topicName, name string) (map[string]any, time.Time, error)
PullSubscription returns the ARM properties and creation time of a namespace topic subscription.
func (*InMemoryBackend) PutDomain ¶
func (b *InMemoryBackend) PutDomain( name, resourceID, inputSchema string, autoCreate, autoDelete *bool, ) (DomainInfo, error)
PutDomain creates a domain or updates its resource ID, input schema and topic management flags; a nil flag means true, the Event Grid default.
func (*InMemoryBackend) PutDomainTopic ¶
func (b *InMemoryBackend) PutDomainTopic(domainName, name string) (time.Time, error)
PutDomainTopic creates a domain topic if absent.
func (*InMemoryBackend) PutNamespace ¶
func (b *InMemoryBackend) PutNamespace(name string) error
PutNamespace creates an Event Grid namespace if absent.
func (*InMemoryBackend) PutNamespaceTopic ¶
func (b *InMemoryBackend) PutNamespaceTopic(nsName, name string) (time.Time, error)
PutNamespaceTopic creates a namespace topic if absent.
func (*InMemoryBackend) PutPullSubscription ¶
func (b *InMemoryBackend) PutPullSubscription( ns, topicName, name string, props map[string]any, ) (map[string]any, error)
PutPullSubscription creates or updates a namespace topic subscription.
func (*InMemoryBackend) PutScopedSubscription ¶
func (b *InMemoryBackend) PutScopedSubscription( ctx context.Context, sc Scope, name string, props map[string]any, ) (map[string]any, error)
PutScopedSubscription creates or updates an event subscription on a custom topic, a domain or a domain topic. The first subscription of a missing domain topic creates it when the domain auto-creates topics.
func (*InMemoryBackend) PutSubscription ¶
func (b *InMemoryBackend) PutSubscription( ctx context.Context, topicName, name string, props map[string]any, ) (map[string]any, error)
PutSubscription creates or updates an event subscription on a custom topic and returns its ARM properties. A WebHook endpoint is validated first.
func (*InMemoryBackend) PutTopic ¶
func (b *InMemoryBackend) PutTopic(name, resourceID, inputSchema string) (TopicInfo, error)
PutTopic creates a custom topic or updates its resource ID and input schema.
func (*InMemoryBackend) Receive ¶
func (b *InMemoryBackend) Receive( ctx context.Context, ns, topicName, sub string, maxEvents int, wait time.Duration, ) ([]Received, error)
Receive locks up to maxEvents available events, waiting up to wait for the first one.
func (*InMemoryBackend) RegenerateDomainKey ¶
func (b *InMemoryBackend) RegenerateDomainKey(name, keyName string) (Keys, error)
RegenerateDomainKey replaces "key1" or "key2" (case-insensitive) with a new random key.
func (*InMemoryBackend) RegenerateNamespaceKey ¶
func (b *InMemoryBackend) RegenerateNamespaceKey(name, keyName string) (Keys, error)
RegenerateNamespaceKey replaces "key1" or "key2" with a new random key.
func (*InMemoryBackend) RegenerateTopicKey ¶
func (b *InMemoryBackend) RegenerateTopicKey(name, keyName string) (Keys, error)
RegenerateTopicKey replaces "key1" or "key2" (case-insensitive) with a new random key.
func (*InMemoryBackend) Reject ¶
func (b *InMemoryBackend) Reject(ns, topicName, sub string, tokens []string) ([]string, []LockFailure, error)
Reject removes (dead-letters) the locked events.
func (*InMemoryBackend) Release ¶
func (b *InMemoryBackend) Release( ns, topicName, sub string, tokens []string, delay time.Duration, ) ([]string, []LockFailure, error)
Release unlocks the events, making them available again after delay.
func (*InMemoryBackend) RenewLock ¶
func (b *InMemoryBackend) RenewLock(ns, topicName, sub string, tokens []string) ([]string, []LockFailure, error)
RenewLock extends the lock of the events by the subscription's lock duration.
func (*InMemoryBackend) ResolveNamespace ¶
func (b *InMemoryBackend) ResolveNamespace( hostLabel, topicName string, r *http.Request, validate bool, ) (string, error)
ResolveNamespace picks the namespace that holds topicName for a namespace data-plane request.
func (*InMemoryBackend) ResolvePublisher ¶
func (b *InMemoryBackend) ResolvePublisher(hostLabel string, r *http.Request, validate bool) (Publisher, error)
ResolvePublisher picks the custom topic or domain a publish request is for.
func (*InMemoryBackend) ResolveTopic ¶
func (b *InMemoryBackend) ResolveTopic(hostLabel string, r *http.Request, validate bool) (string, error)
ResolveTopic picks the custom topic a publish request is for.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore implements persistence.Persistable.
func (*InMemoryBackend) RunDue ¶
func (b *InMemoryBackend) RunDue(ctx context.Context) int
RunDue attempts every delivery whose time has come and returns how many were attempted. Network calls run outside the backend lock.
func (*InMemoryBackend) ScopedFullURL ¶
func (b *InMemoryBackend) ScopedFullURL(sc Scope, name string) (string, error)
ScopedFullURL returns the complete webhook endpoint URL of an event subscription.
func (*InMemoryBackend) ScopedSubscription ¶
ScopedSubscription returns the ARM properties of an event subscription.
func (*InMemoryBackend) SetTargets ¶
func (b *InMemoryBackend) SetTargets(t Targets)
SetTargets wires the Service Bus, Event Hubs, Storage Queue and Blob sinks.
func (*InMemoryBackend) SetValidationBase ¶
func (b *InMemoryBackend) SetValidationBase(base string)
SetValidationBase sets the base URL used in webhook validationUrl values.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot implements persistence.Persistable.
func (*InMemoryBackend) Subscription ¶
func (b *InMemoryBackend) Subscription(topicName, name string) (map[string]any, error)
Subscription returns the ARM properties of a custom topic's event subscription.
func (*InMemoryBackend) SubscriptionCreated ¶
func (b *InMemoryBackend) SubscriptionCreated(topicName, name string) (time.Time, error)
SubscriptionCreated returns an event subscription's creation time.
func (*InMemoryBackend) SubscriptionNames ¶
func (b *InMemoryBackend) SubscriptionNames(topicName string) ([]string, error)
SubscriptionNames returns a custom topic's event subscription names sorted.
func (*InMemoryBackend) Topic ¶
func (b *InMemoryBackend) Topic(name string) (TopicInfo, error)
Topic returns the custom topic.
func (*InMemoryBackend) TopicKeys ¶
func (b *InMemoryBackend) TopicKeys(name string) (Keys, error)
TopicKeys returns the topic's access keys.
func (*InMemoryBackend) TopicNames ¶
func (b *InMemoryBackend) TopicNames() []string
TopicNames returns the custom topic names sorted.
type LockFailure ¶
LockFailure reports a lock token an operation could not apply to.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Azure Event Grid.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init builds the backend and handler; the port is bound by Handler.StartWorker.
type Received ¶
type Received struct {
LockToken string
Event json.RawMessage
DeliveryCount int
}
Received is one event handed out by a receive call.
type ResourceEvent ¶
type ResourceEvent struct {
Time time.Time
Claims map[string]any
EventType string
SubscriptionID string
ResourceGroup string
ResourceURI string
Provider string
OperationName string
CorrelationID string
TenantID string
HTTPMethod string
HTTPURL string
ClientRequestID string
ClientIP string
}
ResourceEvent describes a successful Azure Resource Manager write, delete or action.
type RetryPolicy ¶
type RetryPolicy struct {
MaxDeliveryAttempts int `json:"maxDeliveryAttempts"`
EventTimeToLiveInMinutes int `json:"eventTimeToLiveInMinutes"`
}
RetryPolicy bounds the delivery retries of an event subscription.
type Scope ¶
Scope addresses the owner of event subscriptions: a custom topic (Topic only), a domain (Domain only), a domain topic (both) or an Azure Resource Manager scope such as a subscription, resource group or resource (Resource only).
type Settings ¶
type Settings struct {
TLSCertFile string `` //nolint:lll // config struct tags are intentionally verbose
/* 236-byte string literal not displayed */
TLSKeyFile string `` //nolint:lll // config struct tags are intentionally verbose
/* 138-byte string literal not displayed */
Advertise string `` //nolint:lll // config struct tags are intentionally verbose
/* 184-byte string literal not displayed */
Port int `` //nolint:lll // config struct tags are intentionally verbose
/* 252-byte string literal not displayed */
ValidateSAS bool `` //nolint:lll // config struct tags are intentionally verbose
/* 252-byte string literal not displayed */
}
Settings is the Kong-embedded configuration of the Event Grid emulator.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the settings used when no ConfigProvider exists.
type Spec ¶
type Spec struct {
DeadLetterDestination *Destination `json:"deadLetterDestination,omitempty"`
ExpirationTimeUTC string `json:"expirationTimeUtc,omitempty"`
EventDeliverySchema string `json:"eventDeliverySchema,omitempty"`
Destination Destination `json:"destination"`
Labels []string `json:"labels,omitempty"`
Filter Filter `json:"filter"`
RetryPolicy RetryPolicy `json:"retryPolicy"`
}
Spec is the configurable part of an event subscription, in ARM property shape.
type Targets ¶
type Targets interface {
SendServiceBus(queue, topic string, m Message) error
SendEventHub(namespace, hub string, m Message) error
SendStorageQueue(account, queue, text string, ttl time.Duration) error
PutBlob(account, container, blob string, data []byte, contentType string) error
}
Targets are the in-emulator sinks an event subscription can deliver into. Implementations live in internal/app so this package imports no sibling service.