package unipede import "net/http" type ( // MirrorPorts type is the main receiver type for the mirror_port call to // Unipede MirrorPorts struct { Count int `json:"count" bson:"count"` Errors []Error `json:"errors" bson:"errors"` Items []MirrorPort `json:"items" bson:"items"` Links map[string]Links `json:"links" bson:"links"` } // MirrorPort type is the struct representation of a span-session // configuration. MirrorPort struct { Created string `json:"created" bson:"created"` Id int `json:"id" bson:"id"` Direction string `json:"direction" bson:"direction"` Port string `json:"port" bson:"port"` Session int `json:"session" bson:"session"` UpDeviceId int `json:"up_device_id" bson:"up_device_id"` UpMirrorId int `json:"up_mirror_id" bson:"up_mirror_id"` Updated string `json:"updated" bson:"updated"` } ) // MirrorPortConfig method will pull the list of span sessions configured on a given switch // each span port will be listed as: //{ // "created": "2016-08-25 05:34:22 +0000", // "direction": "both", // "id": 8155032, // "port": "Gi0/20", // "session": 1, // "up_device_id": 23400, // "up_mirror_id": 618084, // "updated": "2018-01-31 02:33:47 +0000" //} func (u *Client) MirrorPortConfig(switchName string, refresh *int, options ...*UnipedeOptions) (MirrorPorts, error) { mp := new(MirrorPorts) o := processOptions(refresh, nil, options...) req, err := u.newRequest(unipedeURL+"devices/"+switchName+"/mirror_port", http.MethodGet, o, nil) if err != nil { return *mp, err } _, err = u.do(req, o, mp) return *mp, err }