-
Notifications
You must be signed in to change notification settings - Fork 22
/
00_additional_validation.pb.go
102 lines (85 loc) · 2.28 KB
/
00_additional_validation.pb.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// The contents of this file are hand-written to add AdditionalValidation to select message types
package v1
func (m *CheckPermissionRequest) AdditionalValidation() error {
if m.GetResource() != nil && m.GetResource().GetObjectId() == "*" {
return ObjectReferenceValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}
return nil
}
func (m *ExpandPermissionTreeRequest) AdditionalValidation() error {
if m.GetResource() != nil && m.GetResource().GetObjectId() == "*" {
return ObjectReferenceValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}
return nil
}
func (m *Precondition) AdditionalValidation() error {
if m.GetFilter() != nil {
return m.GetFilter().AdditionalValidation()
}
return nil
}
func (m *RelationshipFilter) AdditionalValidation() error {
if m.GetOptionalResourceId() == "*" {
return RelationshipFilterValidationError{
field: "OptionalResourceId",
reason: "alphanumeric value is required",
}
}
return nil
}
func (m *RelationshipUpdate) AdditionalValidation() error {
if m.GetRelationship() != nil {
return m.GetRelationship().AdditionalValidation()
}
return nil
}
func (m *Relationship) AdditionalValidation() error {
if m.GetResource() != nil && m.GetResource().GetObjectId() == "*" {
return ObjectReferenceValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}
return nil
}
func (m *DeleteRelationshipsRequest) AdditionalValidation() error {
if m.GetOptionalPreconditions() != nil {
for _, precondition := range m.GetOptionalPreconditions() {
err := precondition.AdditionalValidation()
if err != nil {
return err
}
}
}
if m.GetRelationshipFilter() != nil {
return m.GetRelationshipFilter().AdditionalValidation()
}
return nil
}
func (m *WriteRelationshipsRequest) AdditionalValidation() error {
if m.GetOptionalPreconditions() != nil {
for _, precondition := range m.GetOptionalPreconditions() {
err := precondition.AdditionalValidation()
if err != nil {
return err
}
}
}
if m.GetUpdates() != nil {
for _, update := range m.GetUpdates() {
if update.GetRelationship() != nil {
err := update.GetRelationship().AdditionalValidation()
if err != nil {
return err
}
}
}
}
return nil
}