Documentation
¶
Index ¶
- Constants
- Variables
- type ConfigProvider
- type Handler
- func (h *Handler) API() eventarcpb.EventarcServer
- func (h *Handler) Addr() string
- func (h *Handler) ExtractOperation(*echo.Context) string
- func (h *Handler) ExtractResource(*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) CloseIdleConnections()
- func (b *InMemoryBackend) CreateChannel(in *eventarcpb.CreateChannelRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) CreateChannelConnection(in *eventarcpb.CreateChannelConnectionRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) CreateTrigger(in *eventarcpb.CreateTriggerRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) DeleteChannel(in *eventarcpb.DeleteChannelRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) DeleteChannelConnection(in *eventarcpb.DeleteChannelConnectionRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) DeleteTrigger(in *eventarcpb.DeleteTriggerRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) GetChannel(name string) (*eventarcpb.Channel, error)
- func (b *InMemoryBackend) GetChannelConnection(name string) (*eventarcpb.ChannelConnection, error)
- func (b *InMemoryBackend) GetGoogleChannelConfig(name string) (*eventarcpb.GoogleChannelConfig, error)
- func (b *InMemoryBackend) GetIamPolicy(resource string, version int32) (*iampb.Policy, error)
- func (b *InMemoryBackend) GetLocation(name string) (*location.Location, error)
- func (b *InMemoryBackend) GetProvider(name string) (*eventarcpb.Provider, error)
- func (b *InMemoryBackend) GetTrigger(name string) (*eventarcpb.Trigger, error)
- func (b *InMemoryBackend) HandleStorageEvent(ev StorageEvent)
- func (b *InMemoryBackend) ListChannelConnections(in *eventarcpb.ListChannelConnectionsRequest) (*eventarcpb.ListChannelConnectionsResponse, error)
- func (b *InMemoryBackend) ListChannels(in *eventarcpb.ListChannelsRequest) (*eventarcpb.ListChannelsResponse, error)
- func (b *InMemoryBackend) ListLocations(in *location.ListLocationsRequest) (*location.ListLocationsResponse, error)
- func (b *InMemoryBackend) ListProviders(in *eventarcpb.ListProvidersRequest) (*eventarcpb.ListProvidersResponse, error)
- func (b *InMemoryBackend) ListTriggers(in *eventarcpb.ListTriggersRequest) (*eventarcpb.ListTriggersResponse, error)
- func (b *InMemoryBackend) PushHandler() http.Handler
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SetIamPolicy(in *iampb.SetIamPolicyRequest) (*iampb.Policy, error)
- func (b *InMemoryBackend) SetPushBase(base string)
- func (b *InMemoryBackend) SetRetryBackoff(minimum, maximum time.Duration)
- func (b *InMemoryBackend) SetServices(s Services)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TestIamPermissions(in *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error)
- func (b *InMemoryBackend) UpdateChannel(in *eventarcpb.UpdateChannelRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) UpdateGoogleChannelConfig(in *eventarcpb.UpdateGoogleChannelConfigRequest) (*eventarcpb.GoogleChannelConfig, error)
- func (b *InMemoryBackend) UpdateTrigger(in *eventarcpb.UpdateTriggerRequest) (*longrunningpb.Operation, error)
- type Provider
- type PubSub
- type Services
- type Settings
- type StorageEvent
- type Targets
- type Workflows
Constants ¶
const DefaultPort = 8138
DefaultPort is the dedicated gRPC and REST listener's default TCP port.
Variables ¶
var ErrNilAppContext = errors.New("gcpeventarc: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
Functions ¶
This section is empty.
Types ¶
type ConfigProvider ¶
type ConfigProvider interface {
GetGCPEventarcSettings() Settings
}
ConfigProvider extracts Eventarc configuration from the AppContext Config.
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
Port int
// contains filtered or unexported fields
}
Handler serves the Eventarc API on a dedicated gRPC and REST listener.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates a Handler; callers override Port from Settings.
func (*Handler) API ¶
func (h *Handler) API() eventarcpb.EventarcServer
API exposes the Eventarc service for in-process callers (dashboard proxy).
func (*Handler) ExtractOperation ¶
ExtractOperation is unused: requests never reach the shared router.
func (*Handler) ExtractResource ¶
ExtractResource is unused: requests never reach the shared router.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists the supported gRPC methods.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns a 404 handler; the real API is on the dedicated port.
func (*Handler) MatchPriority ¶
MatchPriority is irrelevant because RouteMatcher never matches.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: Eventarc runs on its own listener.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend holds all Eventarc state under one lock.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates an empty backend.
func (*InMemoryBackend) CloseIdleConnections ¶
func (b *InMemoryBackend) CloseIdleConnections()
CloseIdleConnections releases pooled delivery connections.
func (*InMemoryBackend) CreateChannel ¶
func (b *InMemoryBackend) CreateChannel(in *eventarcpb.CreateChannelRequest) (*longrunningpb.Operation, error)
CreateChannel creates a third-party channel with its Pub/Sub topic; it starts PENDING until a connection presents its activation token.
func (*InMemoryBackend) CreateChannelConnection ¶
func (b *InMemoryBackend) CreateChannelConnection( in *eventarcpb.CreateChannelConnectionRequest, ) (*longrunningpb.Operation, error)
CreateChannelConnection activates a channel by presenting its activation token.
func (*InMemoryBackend) CreateTrigger ¶
func (b *InMemoryBackend) CreateTrigger(in *eventarcpb.CreateTriggerRequest) (*longrunningpb.Operation, error)
CreateTrigger creates a trigger and its transport; the returned operation is already done.
func (*InMemoryBackend) DeleteChannel ¶
func (b *InMemoryBackend) DeleteChannel(in *eventarcpb.DeleteChannelRequest) (*longrunningpb.Operation, error)
DeleteChannel removes a channel, its topic and its connections; triggers still on the channel block it.
func (*InMemoryBackend) DeleteChannelConnection ¶
func (b *InMemoryBackend) DeleteChannelConnection( in *eventarcpb.DeleteChannelConnectionRequest, ) (*longrunningpb.Operation, error)
DeleteChannelConnection removes a connection; its channel goes INACTIVE.
func (*InMemoryBackend) DeleteTrigger ¶
func (b *InMemoryBackend) DeleteTrigger(in *eventarcpb.DeleteTriggerRequest) (*longrunningpb.Operation, error)
DeleteTrigger removes a trigger and the transport resources it owns.
func (*InMemoryBackend) GetChannel ¶
func (b *InMemoryBackend) GetChannel(name string) (*eventarcpb.Channel, error)
GetChannel returns a channel.
func (*InMemoryBackend) GetChannelConnection ¶
func (b *InMemoryBackend) GetChannelConnection(name string) (*eventarcpb.ChannelConnection, error)
GetChannelConnection returns a channel connection.
func (*InMemoryBackend) GetGoogleChannelConfig ¶
func (b *InMemoryBackend) GetGoogleChannelConfig(name string) (*eventarcpb.GoogleChannelConfig, error)
GetGoogleChannelConfig returns the location's config, an empty one until it is first updated.
func (*InMemoryBackend) GetIamPolicy ¶
GetIamPolicy returns the policy of a trigger or channel at the requested version.
func (*InMemoryBackend) GetLocation ¶
func (b *InMemoryBackend) GetLocation(name string) (*location.Location, error)
GetLocation describes one Eventarc location.
func (*InMemoryBackend) GetProvider ¶
func (b *InMemoryBackend) GetProvider(name string) (*eventarcpb.Provider, error)
GetProvider returns an event provider of the catalog.
func (*InMemoryBackend) GetTrigger ¶
func (b *InMemoryBackend) GetTrigger(name string) (*eventarcpb.Trigger, error)
GetTrigger returns a trigger.
func (*InMemoryBackend) HandleStorageEvent ¶
func (b *InMemoryBackend) HandleStorageEvent(ev StorageEvent)
HandleStorageEvent publishes ev to the transport topic of every trigger whose filters it satisfies.
func (*InMemoryBackend) ListChannelConnections ¶
func (b *InMemoryBackend) ListChannelConnections( in *eventarcpb.ListChannelConnectionsRequest, ) (*eventarcpb.ListChannelConnectionsResponse, error)
ListChannelConnections lists the connections of a location, or of every location for "-".
func (*InMemoryBackend) ListChannels ¶
func (b *InMemoryBackend) ListChannels(in *eventarcpb.ListChannelsRequest) (*eventarcpb.ListChannelsResponse, error)
ListChannels lists the channels of a location, or of every location for "-".
func (*InMemoryBackend) ListLocations ¶
func (b *InMemoryBackend) ListLocations(in *location.ListLocationsRequest) (*location.ListLocationsResponse, error)
ListLocations lists the Eventarc locations.
func (*InMemoryBackend) ListProviders ¶
func (b *InMemoryBackend) ListProviders( in *eventarcpb.ListProvidersRequest, ) (*eventarcpb.ListProvidersResponse, error)
ListProviders lists the event providers; filter matches a substring of name or display_name.
func (*InMemoryBackend) ListTriggers ¶
func (b *InMemoryBackend) ListTriggers(in *eventarcpb.ListTriggersRequest) (*eventarcpb.ListTriggersResponse, error)
ListTriggers lists the triggers of a location, or of every location for "-".
func (*InMemoryBackend) PushHandler ¶
func (b *InMemoryBackend) PushHandler() http.Handler
PushHandler receives the Pub/Sub push requests of trigger subscriptions and forwards each message as a CloudEvent to the trigger's destination. A non-2xx reply makes Pub/Sub redeliver with backoff.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads a snapshot, replacing all state.
func (*InMemoryBackend) SetIamPolicy ¶
func (b *InMemoryBackend) SetIamPolicy(in *iampb.SetIamPolicyRequest) (*iampb.Policy, error)
SetIamPolicy replaces a policy; a stale etag aborts the call.
func (*InMemoryBackend) SetPushBase ¶
func (b *InMemoryBackend) SetPushBase(base string)
SetPushBase records the base URL (scheme and host:port) the Pub/Sub emulator pushes events to.
func (*InMemoryBackend) SetRetryBackoff ¶
func (b *InMemoryBackend) SetRetryBackoff(minimum, maximum time.Duration)
SetRetryBackoff sets the minimum and maximum redelivery backoff of triggers created from now on.
func (*InMemoryBackend) SetServices ¶
func (b *InMemoryBackend) SetServices(s Services)
SetServices connects Eventarc to the other emulators.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises triggers, channels, connections, channel configs and operations.
func (*InMemoryBackend) TestIamPermissions ¶
func (b *InMemoryBackend) TestIamPermissions( in *iampb.TestIamPermissionsRequest, ) (*iampb.TestIamPermissionsResponse, error)
TestIamPermissions reports the requested Eventarc permissions as granted: the emulator authorises all callers.
func (*InMemoryBackend) UpdateChannel ¶
func (b *InMemoryBackend) UpdateChannel(in *eventarcpb.UpdateChannelRequest) (*longrunningpb.Operation, error)
UpdateChannel updates crypto_key_name and labels.
func (*InMemoryBackend) UpdateGoogleChannelConfig ¶
func (b *InMemoryBackend) UpdateGoogleChannelConfig( in *eventarcpb.UpdateGoogleChannelConfigRequest, ) (*eventarcpb.GoogleChannelConfig, error)
UpdateGoogleChannelConfig sets crypto_key_name and labels.
func (*InMemoryBackend) UpdateTrigger ¶
func (b *InMemoryBackend) UpdateTrigger(in *eventarcpb.UpdateTriggerRequest) (*longrunningpb.Operation, error)
UpdateTrigger updates the masked fields of a trigger.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Google Cloud Eventarc. It serves gRPC and REST on its own listener (see Handler.StartWorker) and never matches on the shared AWS router.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init creates the backend and handler; the port is bound in StartWorker.
type PubSub ¶
type PubSub interface {
CreateTopic(in *pubsubpb.Topic) (*pubsubpb.Topic, error)
GetTopic(name string) (*pubsubpb.Topic, error)
DeleteTopic(name string) error
CreateSubscription(in *pubsubpb.Subscription) (*pubsubpb.Subscription, error)
DeleteSubscription(name string) error
Publish(req *pubsubpb.PublishRequest) ([]string, error)
}
PubSub is the slice of the Pub/Sub emulator Eventarc uses as its event transport.
type Services ¶
Services are the emulators Eventarc reads from and delivers to; absent ones stay nil.
type Settings ¶
type Settings struct {
Port int `` //nolint:lll // config struct tags are intentionally verbose
/* 184-byte string literal not displayed */
}
Settings holds service-level configuration, embedded in the root CLI as CLI.GCPEventarc.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the settings used when no ConfigProvider is available.
type StorageEvent ¶
StorageEvent is a Cloud Storage object change. Type is the event type suffix (finalized, deleted, archived or metadataUpdated) and Data the object resource JSON.