MCPcopy Index your code
hub / github.com/kopia/kopia / handleNotificationProfileCreate

Function handleNotificationProfileCreate

internal/server/api_notification_profile.go:14–30  ·  view source on GitHub ↗
(ctx context.Context, rc requestContext)

Source from the content-addressed store, hash-verified

12)
13
14func handleNotificationProfileCreate(ctx context.Context, rc requestContext) (any, *apiError) {
15 var cfg notifyprofile.Config
16
17 if err := json.Unmarshal(rc.body, &cfg); err != nil {
18 return nil, requestError(serverapi.ErrorMalformedRequest, "malformed request body: "+string(rc.body))
19 }
20
21 if err := repo.WriteSession(ctx, rc.rep, repo.WriteSessionOptions{
22 Purpose: "NotificationProfileCreate",
23 }, func(ctx context.Context, w repo.RepositoryWriter) error {
24 return notifyprofile.SaveProfile(ctx, w, cfg)
25 }); err != nil {
26 return nil, internalServerError(err)
27 }
28
29 return &serverapi.Empty{}, nil
30}
31
32func handleNotificationProfileTest(ctx context.Context, rc requestContext) (any, *apiError) {
33 var cfg notifyprofile.Config

Callers

nothing calls this directly

Calls 4

WriteSessionFunction · 0.92
SaveProfileFunction · 0.92
requestErrorFunction · 0.85
internalServerErrorFunction · 0.85

Tested by

no test coverage detected