/
azure_structs.go
222 lines (199 loc) · 5.6 KB
/
azure_structs.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
// Copyright 2021 NetApp, Inc. All Rights Reserved.
package api
import (
"time"
"github.com/netapp/trident/storage"
)
const (
StateAccepted = "Accepted"
StateCreating = "Creating"
StateAvailable = "Succeeded"
StateDeleting = "Deleting"
StateDeleted = "NoSuchState"
StateMoving = "Moving" // Currently unused by ANF
StateError = "Failed"
StateReverting = "Reverting"
ProtocolTypeNFSPrefix = "NFSv"
ProtocolTypeNFSv3 = ProtocolTypeNFSPrefix + "3"
ProtocolTypeNFSv41 = ProtocolTypeNFSPrefix + "4.1"
ProtocolTypeCIFS = "CIFS"
MountOptionKerberos5 = "sec=krb5"
MountOptionKerberos5I = "sec=krb5i"
MountOptionKerberos5P = "sec=krb5p"
ServiceLevelStandard = "Standard"
ServiceLevelPremium = "Premium"
ServiceLevelUltra = "Ultra"
FeatureUnixPermissions = "ANFUnixPermissions"
NetworkFeaturesBasic = "Basic"
NetworkFeaturesStandard = "Standard"
)
// AzureResources is the toplevel cache for the set of things we discover about our Azure environment.
type AzureResources struct {
ResourceGroups []*ResourceGroup
ResourceGroupMap map[string]*ResourceGroup
NetAppAccountMap map[string]*NetAppAccount
CapacityPoolMap map[string]*CapacityPool
VirtualNetworkMap map[string]*VirtualNetwork
SubnetMap map[string]*Subnet
StoragePoolMap map[string]storage.Pool
Features map[string]bool
lastUpdateTime time.Time
}
// ResourceGroup records details of a discovered Azure ResourceGroup.
type ResourceGroup struct {
Name string
NetAppAccounts []*NetAppAccount
VirtualNetworks []*VirtualNetwork
}
// NetAppAccount records details of a discovered ANF NetAppAccount.
type NetAppAccount struct {
ID string
ResourceGroup string
Name string
FullName string
Location string
Type string
CapacityPools []*CapacityPool
}
// VirtualNetwork records details of a discovered Azure Virtual Network.
type VirtualNetwork struct {
ID string
ResourceGroup string
Name string
FullName string
Location string
Type string
Subnets []*Subnet
}
// Subnet records details of a discovered Azure Subnet.
type Subnet struct {
ID string
ResourceGroup string
VirtualNetwork string
Name string
FullName string
Location string
Type string
}
// CapacityPool records details of a discovered Azure Subnet.
type CapacityPool struct {
ID string
ResourceGroup string
NetAppAccount string
Name string
FullName string
Location string
Type string
PoolID string
ServiceLevel string
ProvisioningState string
QosType string
}
// FileSystem records details of a discovered Azure Subnet.
type FileSystem struct {
ID string
ResourceGroup string
NetAppAccount string
CapacityPool string
Name string
FullName string
Location string
Type string
ExportPolicy ExportPolicy
Labels map[string]string
FileSystemID string
ProvisioningState string
CreationToken string
ProtocolTypes []string
QuotaInBytes int64
ServiceLevel string
SnapshotDirectory bool
UsedBytes int
SubnetID string
UnixPermissions string
MountTargets []MountTarget
SubvolumesEnabled bool
NetworkFeatures string
KerberosEnabled bool
}
// FilesystemCreateRequest embodies all the details of a volume to be created.
type FilesystemCreateRequest struct {
ResourceGroup string
NetAppAccount string
CapacityPool string
Name string
SubnetID string
CreationToken string
ExportPolicy ExportPolicy
Labels map[string]string
ProtocolTypes []string
QuotaInBytes int64
SnapshotDirectory bool
SnapshotID string
UnixPermissions string
NetworkFeatures string
KerberosEnabled bool
}
// ExportPolicy records details of a discovered Azure volume export policy.
type ExportPolicy struct {
Rules []ExportRule
}
// ExportRule records details of a discovered Azure volume export policy rule.
type ExportRule struct {
AllowedClients string
Cifs bool
Nfsv3 bool
Nfsv41 bool
RuleIndex int32
UnixReadOnly bool
UnixReadWrite bool
Kerberos5ReadOnly bool
Kerberos5ReadWrite bool
Kerberos5IReadOnly bool
Kerberos5IReadWrite bool
Kerberos5PReadOnly bool
Kerberos5PReadWrite bool
}
// MountTarget records details of a discovered Azure volume mount target.
type MountTarget struct {
MountTargetID string
FileSystemID string
IPAddress string
ServerFqdn string
}
// Snapshot records details of a discovered Azure snapshot.
type Snapshot struct {
ID string
ResourceGroup string
NetAppAccount string
CapacityPool string
Volume string
Name string
FullName string
Location string
Type string
Created time.Time
SnapshotID string
ProvisioningState string
}
// Subvolume records details of a discovered Azure Subvolume.
type Subvolume struct {
ID string
ResourceGroup string
NetAppAccount string
CapacityPool string
Volume string
Name string
FullName string
Type string
ProvisioningState string
Size int64
Created time.Time
}
// SubvolumeCreateRequest embodies all the details of a subvolume to be created.
type SubvolumeCreateRequest struct {
CreationToken string
Volume string
Size int64
Parent string
}