Skip to content

Commit f051583

Browse files
NFV-26837: introduce core field for device PATCH API (#26)
1 parent 5a90a78 commit f051583

File tree

3 files changed

+94
-78
lines changed

3 files changed

+94
-78
lines changed

client.go

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//Package ne implements Network Edge client
1+
// Package ne implements Network Edge client
22
package ne
33

44
import (
@@ -27,6 +27,10 @@ const (
2727
DeviceStateDeprovisioning = "DEPROVISIONING"
2828
//DeviceStateDeprovisioned Network Edge device was successfully deprovisioned
2929
DeviceStateDeprovisioned = "DEPROVISIONED"
30+
//DeviceStateResourceUpgradeInProgress Network Edge device is in process of resource upgrade
31+
DeviceStateResourceUpgradeInProgress = "RESOURCE_UPGRADE_IN_PROGRESS"
32+
//DeviceStateResourceUpgradeFailed Network Edge device resource upgrade has failed
33+
DeviceStateResourceUpgradeFailed = "RESOURCE_UPGRADE_FAILED"
3034

3135
//DeviceLicenseStateApplying license is in registration process
3236
DeviceLicenseStateApplying = "APPLYING_LICENSE"
@@ -89,7 +93,7 @@ const (
8993
DeviceLinkGroupStatusDeprovisioned = "DEPROVISIONED"
9094
)
9195

92-
//Client interface describes operations provided by Network Edge client library
96+
// Client interface describes operations provided by Network Edge client library
9397
type Client interface {
9498
GetAccounts(metroCode string) ([]Account, error)
9599
GetDeviceTypes() ([]DeviceType, error)
@@ -138,25 +142,26 @@ type Client interface {
138142
DeleteDeviceLinkGroup(uuid string) error
139143
}
140144

141-
//DeviceUpdateRequest describes composite request to update given Network Edge device
145+
// DeviceUpdateRequest describes composite request to update given Network Edge device
142146
type DeviceUpdateRequest interface {
143147
WithDeviceName(deviceName string) DeviceUpdateRequest
144148
WithTermLength(termLength int) DeviceUpdateRequest
145149
WithNotifications(notifications []string) DeviceUpdateRequest
150+
WithCore(core int) DeviceUpdateRequest
146151
WithAdditionalBandwidth(additionalBandwidth int) DeviceUpdateRequest
147152
WithACLTemplate(templateID string) DeviceUpdateRequest
148153
WithMgmtAclTemplate(mgmtAclTemplateUuid string) DeviceUpdateRequest
149154
Execute() error
150155
}
151156

152-
//SSHUserUpdateRequest describes composite request to update given Network Edge SSH user
157+
// SSHUserUpdateRequest describes composite request to update given Network Edge SSH user
153158
type SSHUserUpdateRequest interface {
154159
WithNewPassword(password string) SSHUserUpdateRequest
155160
WithDeviceChange(old []string, new []string) SSHUserUpdateRequest
156161
Execute() error
157162
}
158163

159-
//BGPUpdateRequest describes request to update given BGP configuration
164+
// BGPUpdateRequest describes request to update given BGP configuration
160165
type BGPUpdateRequest interface {
161166
WithLocalIPAddress(localIPAddress string) BGPUpdateRequest
162167
WithLocalASN(localASN int) BGPUpdateRequest
@@ -166,7 +171,7 @@ type BGPUpdateRequest interface {
166171
Execute() error
167172
}
168173

169-
//DeviceLinkUpdateRequest descrobes request to update given Device Link Group
174+
// DeviceLinkUpdateRequest descrobes request to update given Device Link Group
170175
type DeviceLinkUpdateRequest interface {
171176
WithGroupName(name string) DeviceLinkUpdateRequest
172177
WithSubnet(subnet string) DeviceLinkUpdateRequest
@@ -175,15 +180,15 @@ type DeviceLinkUpdateRequest interface {
175180
Execute() error
176181
}
177182

178-
//Error describes Network Edge error that occurs during API call processing
183+
// Error describes Network Edge error that occurs during API call processing
179184
type Error struct {
180185
//ErrorCode is short error identifier
181186
ErrorCode string
182187
//ErrorMessage is textual description of an error
183188
ErrorMessage string
184189
}
185190

186-
//ChangeError describes single error that occurred during update of selected target property
191+
// ChangeError describes single error that occurred during update of selected target property
187192
type ChangeError struct {
188193
Type string
189194
Target string
@@ -195,12 +200,12 @@ func (e ChangeError) Error() string {
195200
return fmt.Sprintf("change type '%s', target '%s', value '%s', cause: '%s'", e.Type, e.Target, e.Value, e.Cause)
196201
}
197202

198-
//UpdateError describes error that occurred during composite update request and consists of multiple atomic change errors
203+
// UpdateError describes error that occurred during composite update request and consists of multiple atomic change errors
199204
type UpdateError struct {
200205
Failed []ChangeError
201206
}
202207

203-
//AddChangeError functions add new atomic change error to update error structure
208+
// AddChangeError functions add new atomic change error to update error structure
204209
func (e *UpdateError) AddChangeError(changeType string, target string, value interface{}, cause error) {
205210
e.Failed = append(e.Failed, ChangeError{
206211
Type: changeType,
@@ -209,7 +214,7 @@ func (e *UpdateError) AddChangeError(changeType string, target string, value int
209214
Cause: cause})
210215
}
211216

212-
//ChangeErrorsCount returns number of atomic change errors in a given composite update error
217+
// ChangeErrorsCount returns number of atomic change errors in a given composite update error
213218
func (e UpdateError) ChangeErrorsCount() int {
214219
return len(e.Failed)
215220
}
@@ -222,15 +227,15 @@ func (e UpdateError) Error() string {
222227
return str
223228
}
224229

225-
//Account describes Network Edge customer account details
230+
// Account describes Network Edge customer account details
226231
type Account struct {
227232
Name *string
228233
Number *string
229234
Status *string
230235
UCMID *string
231236
}
232237

233-
//Device describes Network Edge device
238+
// Device describes Network Edge device
234239
type Device struct {
235240
UUID *string
236241
Name *string
@@ -276,7 +281,7 @@ type Device struct {
276281
ClusterDetails *ClusterDetails
277282
}
278283

279-
//DeviceInterface describes Network Edge device interface
284+
// DeviceInterface describes Network Edge device interface
280285
type DeviceInterface struct {
281286
ID *int
282287
Name *string
@@ -288,14 +293,14 @@ type DeviceInterface struct {
288293
Type *string
289294
}
290295

291-
//DeviceUserPublicKey describes public SSH key along with username that is
292-
//provisioned on a network device.
296+
// DeviceUserPublicKey describes public SSH key along with username that is
297+
// provisioned on a network device.
293298
type DeviceUserPublicKey struct {
294299
Username *string
295300
KeyName *string
296301
}
297302

298-
//DeviceType describes Network Edge device type
303+
// DeviceType describes Network Edge device type
299304
type DeviceType struct {
300305
Name *string
301306
Code *string
@@ -305,8 +310,8 @@ type DeviceType struct {
305310
MetroCodes []string
306311
}
307312

308-
//DevicePlatform describes Network Edge platform configurations
309-
//available for a given device type
313+
// DevicePlatform describes Network Edge platform configurations
314+
// available for a given device type
310315
type DevicePlatform struct {
311316
Flavor *string
312317
CoreCount *int
@@ -317,7 +322,7 @@ type DevicePlatform struct {
317322
LicenseOptions []string
318323
}
319324

320-
//DeviceSoftwareVersion describes available software packages and versions for a Network Edge device
325+
// DeviceSoftwareVersion describes available software packages and versions for a Network Edge device
321326
type DeviceSoftwareVersion struct {
322327
Version *string
323328
ImageName *string
@@ -328,15 +333,15 @@ type DeviceSoftwareVersion struct {
328333
PackageCodes []string
329334
}
330335

331-
//SSHUser describes Network Edge SSH user
336+
// SSHUser describes Network Edge SSH user
332337
type SSHUser struct {
333338
UUID *string
334339
Username *string
335340
Password *string
336341
DeviceUUIDs []string
337342
}
338343

339-
//BGPConfiguration describes Network Edge BGP configuration
344+
// BGPConfiguration describes Network Edge BGP configuration
340345
type BGPConfiguration struct {
341346
UUID *string
342347
ConnectionUUID *string
@@ -350,15 +355,15 @@ type BGPConfiguration struct {
350355
ProvisioningStatus *string
351356
}
352357

353-
//SSHPublicKey describes Network Edge SSH user public key
358+
// SSHPublicKey describes Network Edge SSH user public key
354359
type SSHPublicKey struct {
355360
UUID *string
356361
Name *string
357362
Value *string
358363
Type *string
359364
}
360365

361-
//ACLTemplate describes Network Edge device ACL template
366+
// ACLTemplate describes Network Edge device ACL template
362367
type ACLTemplate struct {
363368
UUID *string
364369
Name *string
@@ -370,8 +375,8 @@ type ACLTemplate struct {
370375
DeviceDetails []ACLTemplateDeviceDetails
371376
}
372377

373-
//ACLTemplateInboundRule describes inbound ACL rule that is part of
374-
//Network Edge device ACL template
378+
// ACLTemplateInboundRule describes inbound ACL rule that is part of
379+
// Network Edge device ACL template
375380
type ACLTemplateInboundRule struct {
376381
SeqNo *int
377382
FQDN *string // Deprecated: FQDN is no longer supported
@@ -384,27 +389,27 @@ type ACLTemplateInboundRule struct {
384389
Description *string
385390
}
386391

387-
//ACLTemplateDeviceDetails describes Device Details this template applied to
392+
// ACLTemplateDeviceDetails describes Device Details this template applied to
388393
type ACLTemplateDeviceDetails struct {
389394
UUID *string
390395
Name *string
391396
ACLStatus *string
392397
}
393398

394-
//DeviceAdditionalBandwidthDetails describes details of a device
395-
//additional badwidth
399+
// DeviceAdditionalBandwidthDetails describes details of a device
400+
// additional badwidth
396401
type DeviceAdditionalBandwidthDetails struct {
397402
AdditionalBandwidth *int
398403
Status *string
399404
}
400405

401-
//DeviceACLDetails describes details of a device
402-
//additional badwidth
406+
// DeviceACLDetails describes details of a device
407+
// additional badwidth
403408
type DeviceACLDetails struct {
404409
Status *string
405410
}
406411

407-
//DeviceLinkGroup describes details of a device link group
412+
// DeviceLinkGroup describes details of a device link group
408413
type DeviceLinkGroup struct {
409414
UUID *string
410415
Name *string
@@ -414,8 +419,8 @@ type DeviceLinkGroup struct {
414419
Links []DeviceLinkGroupLink
415420
}
416421

417-
//DeviceLinkGroupDevice describes details of a device within device
418-
//link group
422+
// DeviceLinkGroupDevice describes details of a device within device
423+
// link group
419424
type DeviceLinkGroupDevice struct {
420425
DeviceID *string
421426
ASN *int
@@ -424,8 +429,8 @@ type DeviceLinkGroupDevice struct {
424429
IPAddress *string
425430
}
426431

427-
//DeviceLinkGroupLink describes details if a link (connection) within
428-
//device link group
432+
// DeviceLinkGroupLink describes details if a link (connection) within
433+
// device link group
429434
type DeviceLinkGroupLink struct {
430435
AccountNumber *string
431436
Throughput *string
@@ -436,7 +441,7 @@ type DeviceLinkGroupLink struct {
436441
DestinationZoneCode *string
437442
}
438443

439-
//ClusterDetails describes Network Edge cluster device details
444+
// ClusterDetails describes Network Edge cluster device details
440445
type ClusterDetails struct {
441446
ClusterName *string
442447
NumOfNodes *int
@@ -447,7 +452,7 @@ type ClusterDetails struct {
447452
Node1 *ClusterNodeDetail
448453
}
449454

450-
//ClusterNodeDetail describes Network Edge cluster node details
455+
// ClusterNodeDetail describes Network Edge cluster node details
451456
type ClusterNodeDetail struct {
452457
UUID *string
453458
Name *string
@@ -464,7 +469,7 @@ type ClusterNode struct { // Deprecated: Use ClusterNodeDetail instead
464469
VendorConfiguration map[string]string
465470
}
466471

467-
//File describes Network Edge uploaded file
472+
// File describes Network Edge uploaded file
468473
type File struct {
469474
UUID *string
470475
FileName *string

0 commit comments

Comments
 (0)