...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package recorder
17
18 import (
19 "fmt"
20 )
21
22 type Applied struct {
23 Id string
24 }
25
26 func (a Applied) Type() string {
27 return "Normal"
28 }
29
30 func (a Applied) Reason() string {
31 return "Applied"
32 }
33
34 func (a Applied) Message() string {
35 return fmt.Sprintf("Successfully apply chaos for %s", a.Id)
36 }
37
38 type Recovered struct {
39 Id string
40 }
41
42 func (r Recovered) Type() string {
43 return "Normal"
44 }
45
46 func (r Recovered) Reason() string {
47 return "Recovered"
48 }
49
50 func (r Recovered) Message() string {
51 return fmt.Sprintf("Successfully recover chaos for %s", r.Id)
52 }
53
54 type NotSupported struct {
55 Activity string
56 }
57
58 func (r NotSupported) Type() string {
59 return "Warning"
60 }
61
62 func (r NotSupported) Reason() string {
63 return "NotSupported"
64 }
65
66 func (r NotSupported) Message() string {
67 return fmt.Sprintf("%s is not supported", r.Activity)
68 }
69
70 func init() {
71 register(Applied{}, Recovered{}, NotSupported{})
72 }
73