1

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

  • Please try something out first and show us an minimal code example... https://stackoverflow.com/help/how-to-ask – phrogg Sep 25 '18 at 05:49

1 Answers1

0

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),
                },
            },
        },
    }
F.Ojeda
  • 718
  • 1
  • 4
  • 8