mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
23 lines
535 B
Go
23 lines
535 B
Go
|
package service
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
||
|
)
|
||
|
|
||
|
// ListSoftware retrieves the software running across hosts.
|
||
|
func (c *Client) ListSoftware(teamID *uint) ([]fleet.Software, error) {
|
||
|
verb, path := "GET", "/api/v1/fleet/software"
|
||
|
query := ""
|
||
|
if teamID != nil {
|
||
|
query = fmt.Sprintf("team_id=%d", *teamID)
|
||
|
}
|
||
|
var responseBody listSoftwareResponse
|
||
|
err := c.authenticatedRequestWithQuery(nil, verb, path, &responseBody, query)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return responseBody.Software, nil
|
||
|
}
|