/
res.go
71 lines (58 loc) · 1.92 KB
/
res.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
package restconf
import (
"github.com/tidwall/gjson"
)
type ErrorsRootNamespaceModel struct {
Errors ErrorsModel `json:"ietf-restconf:errors"`
}
type ErrorsRootModel struct {
Errors ErrorsModel `json:"errors"`
}
type ErrorsModel struct {
Error []ErrorModel `json:"error"`
}
type ErrorModel struct {
ErrorType string `json:"error-type"`
ErrorTag string `json:"error-tag"`
ErrorAppTag string `json:"error-app-tag,omitempty"`
ErrorPath string `json:"error-path,omitempty"`
ErrorMessage string `json:"error-message,omitempty"`
ErrorInfo string `json:"error-info,omitempty"`
}
type YangPatchStatusRootModel struct {
YangPatchStatus YangPatchStatusModel `json:"ietf-yang-patch:yang-patch-status"`
}
type YangPatchStatusModel struct {
PatchId string `json:"patch-id"`
GlobalStatus YangPatchStatusGlobalStatusModel `json:"global-status,omitempty"`
EditStatus YangPatchStatusEditStatusModel `json:"edit-status,omitempty"`
Errors ErrorsModel `json:"errors,omitempty"`
}
type YangPatchStatusGlobalStatusModel struct {
Ok bool `json:"ok"`
Errors ErrorsModel `json:"errors"`
}
type YangPatchStatusEditStatusModel struct {
Edit []YangPatchStatusEditStatusEditModel `json:"edit"`
}
type YangPatchStatusEditStatusEditModel struct {
EditId string `json:"edit-id"`
Ok bool `json:"ok"`
Errors ErrorsModel `json:"errors"`
}
type CapabilitiesRootModel struct {
Capabilities CapabilitiesModel `json:"ietf-restconf-monitoring:capabilities"`
}
type CapabilitiesModel struct {
Capability []string `json:"capability"`
}
// Res is an API response returned by client requests.
// Res.Res is a GJSON result, which offers advanced and safe parsing capabilities.
// https://github.com/tidwall/gjson
type Res struct {
Res gjson.Result
// HTTP response status code
StatusCode int
Errors ErrorsModel
YangPatchStatus YangPatchStatusModel
}