diff --git a/client.go b/client.go index 6580210..1be92b7 100644 --- a/client.go +++ b/client.go @@ -284,6 +284,7 @@ type Device struct { ProjectID *string DiverseFromDeviceUUID *string DiverseFromDeviceName *string + PrimaryDeviceUUID *string } // DeviceInterface describes Network Edge device interface diff --git a/internal/api/device.go b/internal/api/device.go index 494d468..aff7f89 100644 --- a/internal/api/device.go +++ b/internal/api/device.go @@ -45,6 +45,7 @@ type Device struct { ProjectID *string `json:"projectId,omitempty"` DiverseFromDeviceUUID *string `json:"diverseFromDeviceUuid,omitempty"` DiverseFromDeviceName *string `json:"diverseFromDeviceName,omitempty"` + PrimaryDeviceUUID *string `json:"primaryDeviceUuid,omitempty"` } // DeviceRequest describes network edge device creation request @@ -80,6 +81,7 @@ type DeviceRequest struct { Connectivity *string `json:"connectivity,omitempty"` ProjectID *string `json:"projectId,omitempty"` DiverseFromDeviceUUID *string `json:"diverseFromDeviceUuid,omitempty"` + PrimaryDeviceUUID *string `json:"primaryDeviceUuid,omitempty"` } // SecondaryDeviceRequest describes secondary device part of device creation request diff --git a/rest_device.go b/rest_device.go index b18a653..c9a1add 100644 --- a/rest_device.go +++ b/rest_device.go @@ -266,6 +266,7 @@ func mapDeviceAPIToDomain(apiDevice api.Device) *Device { device.ClusterDetails = mapDeviceClusterDetailsAPIToDomain(apiDevice.ClusterDetails) device.DiverseFromDeviceUUID = apiDevice.DiverseFromDeviceUUID device.DiverseFromDeviceName = apiDevice.DiverseFromDeviceName + device.PrimaryDeviceUUID = apiDevice.PrimaryDeviceUUID return &device } @@ -408,6 +409,7 @@ func createDeviceRequest(device Device) api.DeviceRequest { req.UserPublicKey = mapDeviceUserPublicKeyDomainToAPI(device.UserPublicKey) req.ClusterDetails = mapDeviceClusterDetailsDomainToAPI(device.ClusterDetails) req.DiverseFromDeviceUUID = device.DiverseFromDeviceUUID + req.PrimaryDeviceUUID = device.PrimaryDeviceUUID return req } diff --git a/rest_device_test.go b/rest_device_test.go index 32738fc..06324bc 100644 --- a/rest_device_test.go +++ b/rest_device_test.go @@ -28,6 +28,7 @@ var testDevice = Device{ TermLength: Int(24), ProjectID: String("68ccfd49-39b1-478e-957a-67c72f719d7a"), DiverseFromDeviceUUID: String("ed7891bd-15b4-4f72-ac56-d96cfdacddcc"), + PrimaryDeviceUUID: String("8b028560-4a91-4b52-87ba-9fae0fcb538c"), Throughput: Int(1), ThroughputUnit: String("Gbps"), Name: String("PaloAltoSRmy"), @@ -505,6 +506,7 @@ func verifyDeviceRequest(t *testing.T, device Device, req api.DeviceRequest) { assert.Equal(t, &termLengthStr, req.TermLength, "TermLength matches") assert.Equal(t, device.ProjectID, req.ProjectID, "Project Id matches") assert.Equal(t, device.DiverseFromDeviceUUID, req.DiverseFromDeviceUUID, "Diverse from Device UUID matches") + assert.Equal(t, device.PrimaryDeviceUUID, req.PrimaryDeviceUUID, "Primary Device UUID matches") if *device.IsBYOL { assert.Equal(t, DeviceLicenseModeBYOL, StringValue(req.LicenseMode), "LicenseMode matches") } else {