pubsub

package
v0.0.0-...-20282f3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractData

func ExtractData[T any](m Message, out *T) error

ExtractData from a message into the given struct

Types

type MediaPackageInputNotification

type MediaPackageInputNotification struct {
	Version    string                              `json:"version"`
	ID         string                              `json:"id"`
	DetailType string                              `json:"detail-type"`
	Source     string                              `json:"source"`
	Account    string                              `json:"account"`
	Time       string                              `json:"time"`
	Region     string                              `json:"region"`
	Resources  []string                            `json:"resources"`
	Detail     mediaPackageInputNotificationDetail `json:"detail"`
}

func ParseMediaPackageNotification

func ParseMediaPackageNotification(data string) (*MediaPackageInputNotification, error)

ParseMediaPackageNotification parses a string into MediaPackageInputNotification

type Message

type Message struct {
	Message      Msg    `json:"message"`
	Subscription string `json:"subscription"`
}

Message represents the body of the message we get from PubSub

func MessageFromCtx

func MessageFromCtx(ctx *gin.Context) (*Message, error)

MessageFromCtx that was send to the server from PubSub

func (Message) Bytes

func (m Message) Bytes() ([]byte, error)

Bytes returns the decoded bytes of the message

func (Message) Validate

func (m Message) Validate(sharedKey string) bool

Validate if the message is signed with the correct key

type Msg

type Msg struct {
	Attributes  map[string]string `json:"attributes"`
	Data        string            `json:"data"`
	MessageID   string            `json:"messageId"`
	PublishTime time.Time         `json:"publishTime"`
}

Msg is the message encoded in the PubSub data

Jump to

Keyboard shortcuts

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