forked from ionos-enterprise/ionos-enterprise-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paths.go
358 lines (288 loc) · 11.1 KB
/
paths.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
package profitbricks
import (
"fmt"
"net/url"
"path"
)
func safeJoin(str ...string) string {
for _, s := range str {
if s == "" {
panic(fmt.Sprintf("path contains empty element: %v", str))
}
}
return path.Join(str...)
}
// datacentersPath: "datacenters"
func datacentersPath() string {
return "datacenters"
}
// datacenterPath: "datacenters/<datacenterID>"
func datacenterPath(datacenterID string) string {
return safeJoin(datacentersPath(), url.QueryEscape(datacenterID))
}
// imagesPath: "images"
func imagesPath() string {
return "images"
}
// imagePath: "images/<imageID>"
func imagePath(imageID string) string {
return safeJoin(imagesPath(), url.QueryEscape(imageID))
}
// ipblocksPath: "ipblocks"
func ipblocksPath() string {
return "ipblocks"
}
// ipblockPath: "ipblocks/<ipblockID>"
func ipblockPath(ipblockID string) string {
return safeJoin(ipblocksPath(), url.QueryEscape(ipblockID))
}
// locationsPath: "locations"
func locationsPath() string {
return "locations"
}
// locationRegionPath: "locations/<regionID>"
func locationRegionPath(regionID string) string {
return safeJoin(locationsPath(), url.QueryEscape(regionID))
}
// locationPath: "locations/<regionID>/<locationID>"
func locationPath(regionID, locationID string) string {
return safeJoin(locationRegionPath(regionID), url.QueryEscape(locationID))
}
// snapshotsPath: "snapshots"
func snapshotsPath() string {
return "snapshots"
}
// snapshotPath: "snapshots/<snapshotID>"
func snapshotPath(snapshotID string) string {
return safeJoin(snapshotsPath(), url.QueryEscape(snapshotID))
}
// lansPath: "datacenters/<datacenterID>/lans"
func lansPath(datacenterID string) string {
return safeJoin(datacenterPath(datacenterID), "lans")
}
// lanPath: "datacenters/<datacenterID>/lans/<lanID>"
func lanPath(datacenterID, lanID string) string {
return safeJoin(lansPath(datacenterID), url.QueryEscape(lanID))
}
// loadbalancersPath: "datacenters/<datacenterID>/loadbalancers"
func loadbalancersPath(datacenterID string) string {
return safeJoin(datacenterPath(datacenterID), "loadbalancers")
}
// loadbalancerPath: "datacenters/<datacenterID>/loadbalancers/<loadbalancerID>"
func loadbalancerPath(datacenterID, loadbalancerID string) string {
return safeJoin(loadbalancersPath(datacenterID), url.QueryEscape(loadbalancerID))
}
// serversPath: "datacenters/<datacenterID>/servers"
func serversPath(datacenterID string) string {
return safeJoin(datacenterPath(datacenterID), "servers")
}
// serverPath: "datacenters/<datacenterID>/servers/<serverID>"
func serverPath(datacenterID, serverID string) string {
return safeJoin(serversPath(datacenterID), url.QueryEscape(serverID))
}
// serverStartPath: "datacenters/<datacenterID>/servers/<serverID>/start"
func serverStartPath(datacenterID, serverID string) string {
return safeJoin(serverPath(datacenterID, serverID), "start")
}
// serverStopPath: "datacenters/<datacenterID>/servers/<serverID>/stop"
func serverStopPath(datacenterID, serverID string) string {
return safeJoin(serverPath(datacenterID, serverID), "stop")
}
// serverRebootPath: "datacenters/<datacenterID>/servers/<serverID>/reboot"
func serverRebootPath(datacenterID, serverID string) string {
return safeJoin(serverPath(datacenterID, serverID), "reboot")
}
// volumesPath: "datacenters/<datacenterID>/volumes"
func volumesPath(datacenterID string) string {
return safeJoin(datacenterPath(datacenterID), "volumes")
}
// volume_path "datacenters/<datacenterID>/volumes/<volumeID>"
func volumePath(datacenterID, volumeID string) string {
return safeJoin(volumesPath(datacenterID), url.QueryEscape(volumeID))
}
// createSnapshotPath: "datacenters/<datacenterID>/volumes/<volumeID>/create-snapshot"
func createSnapshotPath(datacenterID, volumeID string) string {
return safeJoin(volumePath(datacenterID, volumeID), "create-snapshot")
}
// restoreSnapshotPath: "datacenters/<datacenterID>/volumes/<volumeID>/restore-snapshot"
func restoreSnapshotPath(datacenterID, volumeID string) string {
return safeJoin(volumePath(datacenterID, volumeID), "restore-snapshot")
}
// balancedNicsPath: "datacenters/<datacenterID>/loadbalancers/<loadbalancerID>/balancednics"
func balancedNicsPath(datacenterID, loadbalancerID string) string {
return safeJoin(loadbalancerPath(datacenterID, loadbalancerID), "balancednics")
}
// balancedNicPath: "datacenters/<datacenterID>/loadbalancers/<loadbalancerID>/balancednics/<balancedNicID>"
func balancedNicPath(datacenterID, loadbalancerID, balancedNicID string) string {
return safeJoin(balancedNicsPath(datacenterID, loadbalancerID), url.QueryEscape(balancedNicID))
}
// cdromsPath: "datacenters/<datacenterID>/servers/<serverID>/cdroms"
func cdromsPath(datacenterID, serverID string) string {
return safeJoin(serverPath(datacenterID, serverID), "cdroms")
}
// cdromPath: "datacenters/<datacenterID>/servers/<serverID>/cdroms/<cdID>"
func cdromPath(datacenterID, serverID, cdID string) string {
return safeJoin(cdromsPath(datacenterID, serverID), url.QueryEscape(cdID))
}
// attachedVolumesPath: "datacenters/<datacenterID>/servers/<serverID>/volumes"
func attachedVolumesPath(datacenterID, serverID string) string {
return safeJoin(serverPath(datacenterID, serverID), "volumes")
}
// attachedVolumePath: "datacenters/<datacenterID>/servers/<serverID>/volumes/<volumeID>"
func attachedVolumePath(datacenterID, serverID, volumeID string) string {
return safeJoin(attachedVolumesPath(datacenterID, serverID), url.QueryEscape(volumeID))
}
// nicsPath: "datacenters/<datacenterID>/servers/<serverID>/nics"
func nicsPath(datacenterID, serverID string) string {
return safeJoin(serverPath(datacenterID, serverID), "nics")
}
// nicPath: "datacenters/<datacenterID>/servers/<serverID>/nics/<nicID>"
func nicPath(datacenterID, serverID, nicID string) string {
return safeJoin(nicsPath(datacenterID, serverID), url.QueryEscape(nicID))
}
// firewallRulesPath: "datacenters/<datacenterID>/servers/<serverID>/nics/<nicID>/firewallrules"
func firewallRulesPath(datacenterID, serverID, nicID string) string {
return safeJoin(nicPath(datacenterID, serverID, nicID), "firewallrules")
}
// firewallRulePath:
// "datacenters/<datacenterID>/servers/<serverID>/nics/<nicID>/firewallrules/<firewallRuleID>"
func firewallRulePath(datacenterID, serverID, nicID, firewallRuleID string) string {
return safeJoin(firewallRulesPath(datacenterID, serverID, nicID), url.QueryEscape(firewallRuleID))
}
// RequestsPath: "requests"
func RequestsPath() string {
return "requests"
}
// RequestPath: "requests/<requestID>"
func RequestPath(requestID string) string {
return safeJoin(RequestsPath(), url.QueryEscape(requestID))
}
// RequestStatusPath: "requests/<requestID>/status"
func RequestStatusPath(requestID string) string {
return safeJoin(RequestPath(requestID), "status")
}
// contractsPath: "contracts"
func contractsPath() string {
return "contracts"
}
// umPath: "um"
func um() string {
return "um"
}
// groupsPath: "um/groups"
func groupsPath() string {
return safeJoin(um(), "groups")
}
// groupPath: "um/groups/<groupID>"
func groupPath(groupID string) string {
return safeJoin(groupsPath(), url.QueryEscape(groupID))
}
// sharesPath: "um/groups/<groupID>/shares"
func sharesPath(groupID string) string {
return safeJoin(groupPath(groupID), "shares")
}
// sharePath: "um/groups/<groupID>/shares/<resourceID>"
func sharePath(groupID string, resourceID string) string {
return safeJoin(sharesPath(groupID), url.QueryEscape(resourceID))
}
// groupUsersPath: "um/groups/<groupID>/users"
func groupUsersPath(groupID string) string {
return safeJoin(groupPath(groupID), "users")
}
// groupUserPath: "um/groups/<groupID>/users/<userID>"
func groupUserPath(groupID string, userID string) string {
return safeJoin(groupUsersPath(groupID), url.QueryEscape(userID))
}
// usersPath: "um/users"
func usersPath() string {
return safeJoin(um(), "users")
}
// userPath: "um/users/<userID>"
func userPath(userID string) string {
return safeJoin(usersPath(), url.QueryEscape(userID))
}
// resourcesPath: "um/resources"
func resourcesPath() string {
return safeJoin(um(), "resources")
}
// resourcesTypePath: "um/resources/<resourceType>"
func resourcesTypePath(resourceType string) string {
return safeJoin(resourcesPath(), url.QueryEscape(resourceType))
}
// resourcePath: "um/resources/<resourceType>/<resourceID>"
func resourcePath(resourceType string, resourceID string) string {
return safeJoin(resourcesTypePath(resourceType), url.QueryEscape(resourceID))
}
// tokensPath: "/tokens"
func tokensPath() string {
// comes with leading slash, as it is used for calls to a different api.
return "/tokens"
}
// tokenPath: "tokens/<tokenID>"
func tokenPath(tokenID string) string {
return safeJoin(tokensPath(), url.QueryEscape(tokenID))
}
// kubernetesClustersPath: "k8s"
func kubernetesClustersPath() string {
return "k8s"
}
// kubernetesClusterPath: "k8s/<clusterID>"
func kubernetesClusterPath(clusterID string) string {
return safeJoin(kubernetesClustersPath(), clusterID)
}
// kubeConfigPath: "k8s/<clusterID>/kubeconfig"
func kubeConfigPath(clusterID string) string {
return safeJoin(kubernetesClusterPath(clusterID), "kubeconfig")
}
// kubernetesNodePoolsPath: "k8s/<clusterID>/nodepools"
func kubernetesNodePoolsPath(clusterID string) string {
return safeJoin(kubernetesClusterPath(clusterID), "nodepools")
}
// kubernetesNodePoolPath: "k8s/<clusterID>/nodepools/<nodepoolID>"
func kubernetesNodePoolPath(clusterID, nodepoolID string) string {
return safeJoin(kubernetesNodePoolsPath(clusterID), nodepoolID)
}
// kubernetesNodesPath: "k8s/<clusterID>/nodepools/<nodepoolID>/nodes"
func kubernetesNodesPath(clusterID, nodepoolID string) string {
return safeJoin(kubernetesNodePoolPath(clusterID, nodepoolID), "nodes")
}
// kubernetesNodePath: "k8s/<clusterID>/nodepools/<nodepoolID>/nodes/<nodeID>"
func kubernetesNodePath(clusterID, nodepoolID, nodeID string) string {
return safeJoin(kubernetesNodesPath(clusterID, nodepoolID), nodeID)
}
// kubernetesNodeReplacePath: "k8s/<clusterID>/nodepools/<nodepoolID>/nodes/<nodeID>/replace"
func kubernetesNodeReplacePath(clusterID, nodepoolID, nodeID string) string {
return safeJoin(kubernetesNodePath(clusterID, nodepoolID, nodeID), "replace")
}
// backupUnitsPath: "backupunits"
func backupUnitsPath() string {
return "backupunits"
}
// backupUnitsPath: "backupunits/<backupUnitID>"
func backupUnitPath(backupUnitID string) string {
return safeJoin(backupUnitsPath(), backupUnitID)
}
// backupUnitSSOURLPath: "backupunits/backupUnitID/ssourl"
func backupUnitSSOURLPath(backupUnitID string) string {
return safeJoin(backupUnitsPath(), backupUnitID, "ssourl")
}
// s3KeysPath: "um/users/<userID>/s3keys"
func s3KeysPath(userID string) string {
return safeJoin(userPath(userID), "s3keys")
}
// s3KeysListPath: "um/users/<userID>/s3keys?depth=1"
func s3KeysListPath(userID string) string {
return safeJoin(userPath(userID), "s3keys?depth=1")
}
// s3KeyPath: "um/users/<userID>/s3keys/<s3KeyID>"
func s3KeyPath(userID string, s3KeyID string) string {
return safeJoin(s3KeysPath(userID), s3KeyID)
}
// PrivateCrossConnectsPath: "pccs"
func PrivateCrossConnectsPath() string {
return "pccs"
}
// PrivateCrossConnectPath: "pccs/<pccID>"
func PrivateCrossConnectPath(pccID string) string {
return safeJoin(PrivateCrossConnectsPath(), pccID)
}