forked from hootrhino/rulex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathin_end.go
51 lines (45 loc) · 1.01 KB
/
in_end.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package typex
import (
"rulex/utils"
"sync"
)
//
type InEnd struct {
sync.Mutex
Id string `json:"id"`
State ResourceState `json:"state"`
Type InEndType `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Binds *map[string]Rule `json:"-"`
Config *map[string]interface{} `json:"config"`
Resource XResource `json:"-"`
}
func (in *InEnd) GetState() ResourceState {
in.Lock()
defer in.Unlock()
return in.State
}
//
func (in *InEnd) SetState(s ResourceState) {
in.Lock()
defer in.Unlock()
in.State = s
}
//
func NewInEnd(t string,
n string,
d string,
c *map[string]interface{}) *InEnd {
return &InEnd{
Id: utils.MakeUUID("INEND"),
Type: InEndType(t),
Name: n,
Description: d,
Binds: &map[string]Rule{},
Config: c,
}
}
func (in *InEnd) GetConfig(k string) interface{} {
return (*in.Config)[k]
}