1 package resolver
2
3
4
5
6
7 import (
8 "context"
9 "fmt"
10
11 "edge-infra.dev/pkg/edge/api/graph/model"
12 )
13
14
15 func (r *mutationResolver) CreateLogClassificationLabel(ctx context.Context, logClassificationEdgeID string, labelEdgeID string) (string, error) {
16 created, err := r.LogClassificationLabelsService.CreateLogClassificationLabel(ctx, "", logClassificationEdgeID, labelEdgeID)
17 if err != nil {
18 return "", fmt.Errorf("Error Creating Log Classification Label: %s", err.Error())
19 }
20 return created, nil
21 }
22
23
24 func (r *mutationResolver) DeleteLogClassificationLabel(ctx context.Context, logClassificationLabelEdgeID string, logClassificationEdgeID string, labelEdgeID string) (bool, error) {
25 wasDeleted, err := r.LogClassificationLabelsService.DeleteLogClassificationLabel(ctx, logClassificationLabelEdgeID, logClassificationEdgeID, labelEdgeID)
26 if err != nil {
27 return false, fmt.Errorf("Error Deleting Log Classification Label: %s", err.Error())
28 }
29
30 return wasDeleted, nil
31 }
32
33
34 func (r *mutationResolver) UpdateLogClassificationLabel(ctx context.Context, logClassificationEdgeID string, labelEdgeID string) (string, error) {
35 updated, err := r.LogClassificationLabelsService.UpdateLogClassificationLabel(ctx, logClassificationEdgeID, labelEdgeID)
36 if err != nil {
37 return "", fmt.Errorf("Error Updating Log Classification Label: %s", err.Error())
38 }
39 return updated, nil
40 }
41
42
43 func (r *queryResolver) GetLogClassificationLabel(ctx context.Context, logClassificationLabelEdgeID string, logClassificationEdgeID string, labelEdgeID string) (*model.LogClassificationLabel, error) {
44 logClassificationLabel, err := r.LogClassificationLabelsService.GetLogClassificationLabel(ctx, logClassificationLabelEdgeID, logClassificationEdgeID, labelEdgeID)
45 if err != nil {
46 return nil, fmt.Errorf("Error Getting Log Classification Label: %s", err.Error())
47 }
48 return logClassificationLabel, nil
49 }
50
51
52 func (r *queryResolver) GetLogClassificationLabelsByLabel(ctx context.Context, labelEdgeID string) ([]*model.LogClassificationLabel, error) {
53 logClassificationLabels, err := r.LogClassificationLabelsService.GetLogClassificationLabelsByLabel(ctx, labelEdgeID)
54 if err != nil {
55 return nil, fmt.Errorf("Error Getting Log Classification Label: %s", err.Error())
56 }
57 return logClassificationLabels, nil
58 }
59
60
61 func (r *queryResolver) GetLogClassificationLabelsByBanner(ctx context.Context, bannerEdgeID string) ([]*model.LogClassificationLabel, error) {
62 logClassificationLabels, err := r.LogClassificationLabelsService.GetLogClassificationLabelsByBanner(ctx, bannerEdgeID)
63 if err != nil {
64 return nil, fmt.Errorf("Error Getting Log Classification Label: %s", err.Error())
65 }
66 return logClassificationLabels, nil
67 }
68
View as plain text