forked from hashicorp/go-azure-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
predicates.go
181 lines (139 loc) · 4.36 KB
/
predicates.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
package share
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
type ProviderShareSubscriptionOperationPredicate struct {
Id *string
Name *string
Type *string
}
func (p ProviderShareSubscriptionOperationPredicate) Matches(input ProviderShareSubscription) bool {
if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) {
return false
}
if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) {
return false
}
if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) {
return false
}
return true
}
type ShareOperationPredicate struct {
Id *string
Name *string
Type *string
}
func (p ShareOperationPredicate) Matches(input Share) bool {
if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) {
return false
}
if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) {
return false
}
if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) {
return false
}
return true
}
type ShareSynchronizationOperationPredicate struct {
ConsumerEmail *string
ConsumerName *string
ConsumerTenantName *string
DurationMs *int64
EndTime *string
Message *string
StartTime *string
Status *string
SynchronizationId *string
}
func (p ShareSynchronizationOperationPredicate) Matches(input ShareSynchronization) bool {
if p.ConsumerEmail != nil && (input.ConsumerEmail == nil && *p.ConsumerEmail != *input.ConsumerEmail) {
return false
}
if p.ConsumerName != nil && (input.ConsumerName == nil && *p.ConsumerName != *input.ConsumerName) {
return false
}
if p.ConsumerTenantName != nil && (input.ConsumerTenantName == nil && *p.ConsumerTenantName != *input.ConsumerTenantName) {
return false
}
if p.DurationMs != nil && (input.DurationMs == nil && *p.DurationMs != *input.DurationMs) {
return false
}
if p.EndTime != nil && (input.EndTime == nil && *p.EndTime != *input.EndTime) {
return false
}
if p.Message != nil && (input.Message == nil && *p.Message != *input.Message) {
return false
}
if p.StartTime != nil && (input.StartTime == nil && *p.StartTime != *input.StartTime) {
return false
}
if p.Status != nil && (input.Status == nil && *p.Status != *input.Status) {
return false
}
if p.SynchronizationId != nil && (input.SynchronizationId == nil && *p.SynchronizationId != *input.SynchronizationId) {
return false
}
return true
}
type SynchronizationDetailsOperationPredicate struct {
DataSetId *string
DurationMs *int64
EndTime *string
FilesRead *int64
FilesWritten *int64
Message *string
Name *string
RowsCopied *int64
RowsRead *int64
SizeRead *int64
SizeWritten *int64
StartTime *string
Status *string
VCore *int64
}
func (p SynchronizationDetailsOperationPredicate) Matches(input SynchronizationDetails) bool {
if p.DataSetId != nil && (input.DataSetId == nil && *p.DataSetId != *input.DataSetId) {
return false
}
if p.DurationMs != nil && (input.DurationMs == nil && *p.DurationMs != *input.DurationMs) {
return false
}
if p.EndTime != nil && (input.EndTime == nil && *p.EndTime != *input.EndTime) {
return false
}
if p.FilesRead != nil && (input.FilesRead == nil && *p.FilesRead != *input.FilesRead) {
return false
}
if p.FilesWritten != nil && (input.FilesWritten == nil && *p.FilesWritten != *input.FilesWritten) {
return false
}
if p.Message != nil && (input.Message == nil && *p.Message != *input.Message) {
return false
}
if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) {
return false
}
if p.RowsCopied != nil && (input.RowsCopied == nil && *p.RowsCopied != *input.RowsCopied) {
return false
}
if p.RowsRead != nil && (input.RowsRead == nil && *p.RowsRead != *input.RowsRead) {
return false
}
if p.SizeRead != nil && (input.SizeRead == nil && *p.SizeRead != *input.SizeRead) {
return false
}
if p.SizeWritten != nil && (input.SizeWritten == nil && *p.SizeWritten != *input.SizeWritten) {
return false
}
if p.StartTime != nil && (input.StartTime == nil && *p.StartTime != *input.StartTime) {
return false
}
if p.Status != nil && (input.Status == nil && *p.Status != *input.Status) {
return false
}
if p.VCore != nil && (input.VCore == nil && *p.VCore != *input.VCore) {
return false
}
return true
}