-
Notifications
You must be signed in to change notification settings - Fork 46
Description
As part of network gateway order we need to send two orders which has a different container each other.To order the network gateway with configured sshkeys for gateway and its members we need to create a payload as below
{
"parameters":[
{
"orderContainers":[
{
"complexType":"SoftLayer_Container_Product_Order_Hardware_Server_Gateway_Appliance",
"hardware":[
{
"hostname":"hostHA1test",
"userData":[
{
"value":"hardware member 1 "
}
]
},
{
"hostname":"hostHA2test",
"domain":"domain.com",
"userData":[
{
"value":"hardware member 2 "
}
]
}
],
"location":"LONDON02",
"packageId":236,
"quantity":2,
"prices":[
{
"id":177619
},
{
"id":72927
},
{
"id":420
},
{
"id":418
},
{
"id":21
},
{
"id":57
},
{
"id":906
},
{
"id":201189
},
{
"id":876
},
{
"id":14031
},
{
"id":342
},
{
"id":273
},
{
"id":792
},
{
"id":55
},
{
"id":58
}
],
"sshKeys":[
{
"sshKeyIds":[
94228
]
},
{
"sshKeyIds":[
94228,
94206,
63668
]
}
],
"clusterIdentifier":"praveenCluster"
},
{
"complexType":"SoftLayer_Container_Product_Order_Gateway_Appliance_Cluster",
"packageId":196,
"quantity":1,
"prices":[
{
"id":37110
}
],
"clusterIdentifier":"praveenCluster",
"sshKeys":[
{
"sshKeyIds":[
94228,
94206,
63668,
76146,
38390
]
}
]
}
]
}
]
}
With the existing softlayer go client we tried
orderTemplate:= datatypes.Container_Product_Order{}
OrderContainers: []datatypes.Container_Product_Order{
{ ComplexType: sl.String("SoftLayer_Container_Product_Order_Hardware_Server_Gateway_Appliance"),
Quantity: sl.Int(quantity),
PackageId: sl.Int(packageId),
Prices: prices,
Hardware: hardware,
Location: sl.String(location),
ClusterIdentifier:=datatypes.Container_Product_Order_Virtual_Guest{
sl.String("test")
}
},
{
ComplexType: sl.String("SoftLayer_Container_Product_Order_Gateway_Appliance_Cluster"),
Quantity: sl.Int(1),
PackageId: sl.Int(196),
Prices: []datatypes.Product_Item_Price{
{Id: sl.Int(37110)},
},
ClusterIdentifier:=datatypes.Container_Product_Order_Virtual_Guest{
sl.String("test")
},
},
},
}
here you can see that each order has an specific container (See the ComplexType attribute), however the code has an error, the “ClusterIdentifier” attribute is not recognized, because this attribute does not exists into the datatype “Container_Product_Order” and we cannot change it either :(.
Another way we tried is this:
orderTemplate2 := datatypes.Container_Product_Order_Gateway_Appliance_Cluster{}
orderTemplate2.ClusterIdentifier = sl.String("test")
orderTemplate2.Quantity = sl.Int(quantity)
orderTemplate2.PackageId = sl.Int(196)
orderTemplate2.Prices = pricesCluster
orderTemplate1:= datatypes.Container_Product_Order_Hardware_Server_Gateway_Appliance{}
orderTemplate1.PackageId = sl.Int(packageId)
orderTemplate1.Location = sl.String(location)
orderTemplate1.Prices = prices
orderTemplate1.Quantity = sl.Int(quantity)
orderTemplate1.Hardware = hardware
orderTemplate1.ClusterIdentifier = sl.String("test")
var orderData1 [2]datatypes.Container_Product_Order
orderData1 = append(orderData1, orderTemplate1)
fmt.Println(orderData1))
We created each order and then we tried to put them together in an “Container_Product_Order” Array, but this code did not work, because GO does not allow appending different objects from “Container_Product_Order” datatype.
Could you please help us the correct way of doing this