-
Notifications
You must be signed in to change notification settings - Fork 34
/
synchronization_job_restart_scope.go
63 lines (61 loc) · 2.14 KB
/
synchronization_job_restart_scope.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
package models
import (
"math"
"strings"
)
type SynchronizationJobRestartScope int
const (
NONE_SYNCHRONIZATIONJOBRESTARTSCOPE = 1
CONNECTORDATASTORE_SYNCHRONIZATIONJOBRESTARTSCOPE = 2
ESCROWS_SYNCHRONIZATIONJOBRESTARTSCOPE = 4
WATERMARK_SYNCHRONIZATIONJOBRESTARTSCOPE = 8
QUARANTINESTATE_SYNCHRONIZATIONJOBRESTARTSCOPE = 16
FULL_SYNCHRONIZATIONJOBRESTARTSCOPE = 32
FORCEDELETES_SYNCHRONIZATIONJOBRESTARTSCOPE = 64
)
func (i SynchronizationJobRestartScope) String() string {
var values []string
options := []string{"None", "ConnectorDataStore", "Escrows", "Watermark", "QuarantineState", "Full", "ForceDeletes"}
for p := 0; p < 7; p++ {
mantis := SynchronizationJobRestartScope(int(math.Pow(2, float64(p))))
if i&mantis == mantis {
values = append(values, options[p])
}
}
return strings.Join(values, ",")
}
func ParseSynchronizationJobRestartScope(v string) (any, error) {
var result SynchronizationJobRestartScope
values := strings.Split(v, ",")
for _, str := range values {
switch str {
case "None":
result |= NONE_SYNCHRONIZATIONJOBRESTARTSCOPE
case "ConnectorDataStore":
result |= CONNECTORDATASTORE_SYNCHRONIZATIONJOBRESTARTSCOPE
case "Escrows":
result |= ESCROWS_SYNCHRONIZATIONJOBRESTARTSCOPE
case "Watermark":
result |= WATERMARK_SYNCHRONIZATIONJOBRESTARTSCOPE
case "QuarantineState":
result |= QUARANTINESTATE_SYNCHRONIZATIONJOBRESTARTSCOPE
case "Full":
result |= FULL_SYNCHRONIZATIONJOBRESTARTSCOPE
case "ForceDeletes":
result |= FORCEDELETES_SYNCHRONIZATIONJOBRESTARTSCOPE
default:
return nil, nil
}
}
return &result, nil
}
func SerializeSynchronizationJobRestartScope(values []SynchronizationJobRestartScope) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i SynchronizationJobRestartScope) isMultiValue() bool {
return true
}