How we can add Vlans to servers using Golang ? I am using soft layer-go package.
I have found the link to do it python but I want to know how it can be achieved via go packages
How we can add Vlans to servers using Golang ? I am using soft layer-go package.
I have found the link to do it python but I want to know how it can be achieved via go packages
Below you will find examples to order a virtual and a hardware server using go language.
https://softlayer.github.io/go/create_virtual_guest.go/
https://softlayer.github.io/go/create_server.go/
Just you have to add the vlan data "PrimaryNetworkComponent" and "PrimaryBackendNetworkComponent", like below example:
e.g. Virtual Server
virtualGuests := []datatypes.Virtual_Guest{
{ // Set SoftLayer_Virtual_Guest properties
Hostname : sl.String(hostname),
Domain : sl.String(domain),
PrimaryNetworkComponent : &datatypes.Virtual_Guest_Network_Component{
NetworkVlan: &datatypes.Network_Vlan{
Id: sl.Int(11111),
},
},
PrimaryBackendNetworkComponent : &datatypes.Virtual_Guest_Network_Component{
NetworkVlan: &datatypes.Network_Vlan{
Id: sl.Int(22222),
},
},
},
}