package swClient import ( "errors" "github.rackspace.com/gorax/clients/unipede" "github.rackspace.com/gorax/libs/switchlib/swModels" ) type ( Switch struct { Name *string `json:"switch_name"` Config *SwConfig `json:"switch_config_items"` Model string `json:"model"` Updated *string `json:"updated"` config *string unipede *unipede.Client token *string } ) func New(u *unipede.Client, token, swname string) (*Switch, error) { if u == nil && token == "" { return nil, errors.New("Unipede client and token cannot be nil.") } if swname == "" { return nil, errors.New("Switch name cannot be empty.") } return &Switch{ Name: &swname, unipede: u, Config: &SwConfig{ IntStatus: &swModels.InterfacesStatus{}, Routes: &swModels.IPRoutes{}, }, token: &token, }, nil }