MCPcopy
hub / github.com/kopia/kopia / notificationSendersFromRepo

Function notificationSendersFromRepo

notification/notification_send.go:89–112  ·  view source on GitHub ↗
(ctx context.Context, rep repo.Repository, severity Severity)

Source from the content-addressed store, hash-verified

87}
88
89func notificationSendersFromRepo(ctx context.Context, rep repo.Repository, severity Severity) ([]sender.Sender, error) {
90 profiles, err := notifyprofile.ListProfiles(ctx, rep)
91 if err != nil {
92 return nil, errors.Wrap(err, "unable to list notification profiles")
93 }
94
95 var result []sender.Sender
96
97 for _, p := range profiles {
98 if severity < p.MinSeverity {
99 continue
100 }
101
102 s, err := sender.GetSender(ctx, p.ProfileName, p.MethodConfig.Type, p.MethodConfig.Config)
103 if err != nil {
104 log(ctx).Warnw("unable to create sender for notification profile", "profile", p.ProfileName, "err", err)
105 continue
106 }
107
108 result = append(result, s)
109 }
110
111 return result, nil
112}
113
114// Send sends a notification for the given event.
115// Any errors encountered during the process are logged.

Callers 1

SendInternalFunction · 0.85

Calls 2

ListProfilesFunction · 0.92
GetSenderFunction · 0.92

Tested by

no test coverage detected