X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fnotification%2Fnotification.go;fp=pkg%2Fnotification%2Fnotification.go;h=5763a158ddde5465484f3e98e6bc4b32469313d0;hb=5152bd39551f19139752d89a795327ca9dd189db;hp=0000000000000000000000000000000000000000;hpb=272fb5b36779f68a944ca317fa6a6159da0128e3;p=ric-plt%2Fa1.git diff --git a/pkg/notification/notification.go b/pkg/notification/notification.go new file mode 100755 index 0000000..5763a15 --- /dev/null +++ b/pkg/notification/notification.go @@ -0,0 +1,25 @@ +package notification + +import ( + "bytes" + "net/http" + + "gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/a1" +) + +func SendNotification(notificationDestination string, body string) error { + a1.Logger.Debug("In SendNotification") + client := &http.Client{} + req, err := http.NewRequest("POST", notificationDestination, bytes.NewBuffer([]byte(body))) + if err != nil { + return err + } + req.Header.Set("User-Agent", "a1mediator") + res, err := client.Do(req) + if err != nil { + a1.Logger.Debug("Error sending POST message to %v+", notificationDestination) + return err + } + a1.Logger.Debug("Notification response %s received from far-end", res.Status) + return nil +}