Documentation ¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/xumak-grid/go-grid/pkg/notifications/sns" ) type Message struct { Message string `json:"message"` Value int `json:"value"` } func main() { session, err := sns.NewSessionWithCredentials("XXXX", "XXXX", "us-east-1") if err != nil { fmt.Println("session error:", err) return } notify := sns.Notify{ Subject: "Bedrock deployment", TopicArn: "arn:aws:sns:us-east-1:281327226678:toolbelt_notification", Session: session, } type Message struct { Message string `json:"message"` } t := Message{"Toolbelt deployment success "} notify.AddNotification("toolbelt", t) k := Message{"k8s deplotment success"} notify.AddNotification("k8s", k) // publish all the messages err = notify.Publish() if err != nil { fmt.Println(err.Error()) } }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const (
MessageStructureRaw = "raw"
)
Variables ¶
This section is empty.
Functions ¶
func NewSessionWitToken ¶
NewSessionWitToken returns a new AWS session with the values provided
Types ¶
type Notify ¶
type Notify struct { Subject string `json:"-"` Messages map[string]interface{} `json:"messages"` TopicArn string `json:"-"` Session *session.Session `json:"-"` }
Notify represents a SNS notification
func (*Notify) AddNotification ¶
AddNotification adds notifications message to the Notify Messages map this addition does not override the messages already saved
Click to show internal directories.
Click to hide internal directories.