Documentation ¶
Index ¶
- func GenerateSubName(cs *eventduck.ChannelSubscriberSpec) string
- func GenerateTopicName(channelNamespace, channelName string) string
- func GetCredentials(ctx context.Context, client client.Client, secretRef *v1.ObjectReference, ...) (*google.Credentials, error)
- type PubSubClient
- type PubSubClientCreator
- type PubSubMessage
- type PubSubPublishResult
- type PubSubSubscription
- type PubSubTopic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSubName ¶
func GenerateSubName(cs *eventduck.ChannelSubscriberSpec) string
GenerateSubname Generates the GCP PubSub Subscription name given the Knative Channel's subscriber's namespace and name. Note that this requires the subscriber's ref to be set correctly. Note that it must be stable. The controller and dispatcher rely on this being generated identically.
func GenerateTopicName ¶
GenerateTopicName generates the GCP PubSub Topic name given the Knative Channel's namespace and name. Note that it must be stable. The controller and dispatcher rely on this being generated identically.
func GetCredentials ¶
func GetCredentials(ctx context.Context, client client.Client, secretRef *v1.ObjectReference, key string) (*google.Credentials, error)
GetCredentials gets GCP credentials from a secretRef. The credentials must be stored in JSON format in the secretRef.
Types ¶
type PubSubClient ¶
type PubSubClient interface { SubscriptionInProject(id, projectId string) PubSubSubscription CreateSubscription(ctx context.Context, id string, topic PubSubTopic) (PubSubSubscription, error) Topic(id string) PubSubTopic CreateTopic(ctx context.Context, id string) (PubSubTopic, error) }
PubSubClient is the set of methods we use on pubsub.Client. See pubsub.Client for documentation of the functions.
func GcpPubSubClientCreator ¶
func GcpPubSubClientCreator(ctx context.Context, creds *google.Credentials, googleCloudProject string) (PubSubClient, error)
GcpPubSubClientCreator creates a real GCP PubSub client. It should always be used, except during unit tests.
type PubSubClientCreator ¶
type PubSubClientCreator func(ctx context.Context, creds *google.Credentials, googleCloudProject string) (PubSubClient, error)
PubSubClientCreator creates a pubSubClient.
type PubSubMessage ¶
type PubSubMessage interface { ID() string Data() []byte Attributes() map[string]string Ack() Nack() }
PubSubMessage is the set of methods we use on pubsub.Message. It exists to make PubSubClient unit testable. See pubsub.Message for documentation of the functions.
type PubSubPublishResult ¶
type PubSubPublishResult interface { Ready() <-chan struct{} Get(ctx context.Context) (serverID string, err error) }
PubSubPublishResult is the set of methods we use on pubsub.PublishResult. It exists to make PubSubClient unit testable. See pubsub.PublishResult for documentation of any functions.
type PubSubSubscription ¶
type PubSubSubscription interface { Exists(ctx context.Context) (bool, error) ID() string Delete(ctx context.Context) error Receive(ctx context.Context, f func(context.Context, PubSubMessage)) error }
PubSubSubscription is the set of methods we use on pubsub.Subscription. It exists to make PubSubClient unit testable. See pubsub.Subscription for documentation of the functions.
type PubSubTopic ¶
type PubSubTopic interface { Exists(ctx context.Context) (bool, error) ID() string Delete(ctx context.Context) error Publish(ctx context.Context, msg *pubsub.Message) PubSubPublishResult Stop() }
PubSubTopic is the set of methods we use on pubsub.Topic. It exists to make PubSubClient unit testable. See pubsub.Topic for documentation of the functions.