-
Notifications
You must be signed in to change notification settings - Fork 2
/
commands.go
72 lines (58 loc) · 1.93 KB
/
commands.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package security
import (
"github.com/allada/gdd/protocol/shared"
)
type EnableCommand struct {
DestinationTargetID string
responseId int64
conn *shared.Connection
}
type EnableReturn struct {
}
func (c *EnableCommand) Initalize(targetId string, responseId int64, conn *shared.Connection) {
c.DestinationTargetID = targetId
c.responseId = responseId
c.conn = conn
}
func (c *EnableCommand) RespondWithError(code shared.ResponseErrorCodes, message string) {
c.conn.SendErrorResult(c.responseId, c.DestinationTargetID, code, message)
}
func (c *EnableCommand) Respond() {
c.conn.SendResult(c.responseId, c.DestinationTargetID, struct{}{})
}
type DisableCommand struct {
DestinationTargetID string
responseId int64
conn *shared.Connection
}
type DisableReturn struct {
}
func (c *DisableCommand) Initalize(targetId string, responseId int64, conn *shared.Connection) {
c.DestinationTargetID = targetId
c.responseId = responseId
c.conn = conn
}
func (c *DisableCommand) RespondWithError(code shared.ResponseErrorCodes, message string) {
c.conn.SendErrorResult(c.responseId, c.DestinationTargetID, code, message)
}
func (c *DisableCommand) Respond() {
c.conn.SendResult(c.responseId, c.DestinationTargetID, struct{}{})
}
type ShowCertificateViewerCommand struct {
DestinationTargetID string
responseId int64
conn *shared.Connection
}
type ShowCertificateViewerReturn struct {
}
func (c *ShowCertificateViewerCommand) Initalize(targetId string, responseId int64, conn *shared.Connection) {
c.DestinationTargetID = targetId
c.responseId = responseId
c.conn = conn
}
func (c *ShowCertificateViewerCommand) RespondWithError(code shared.ResponseErrorCodes, message string) {
c.conn.SendErrorResult(c.responseId, c.DestinationTargetID, code, message)
}
func (c *ShowCertificateViewerCommand) Respond() {
c.conn.SendResult(c.responseId, c.DestinationTargetID, struct{}{})
}