https://github.com/wolveix/fleet-go
A library to interface with FleetDM's API
https://github.com/wolveix/fleet-go
api fleet fleetdm library sdk-go
Last synced: 2 months ago
JSON representation
A library to interface with FleetDM's API
- Host: GitHub
- URL: https://github.com/wolveix/fleet-go
- Owner: wolveix
- License: gpl-3.0
- Created: 2024-12-02T20:46:53.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-04T16:39:58.000Z (6 months ago)
- Last Synced: 2025-02-01T11:25:46.774Z (4 months ago)
- Topics: api, fleet, fleetdm, library, sdk-go
- Language: Go
- Homepage: https://fleetdm.com
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fleet Go SDK
Go SDK for interacting with the [Fleet](https://fleetdm.com/) API.
_Note: this is incomplete, as I only implemented what I needed (+ low-hanging fruit). PRs welcome!._
## Usage
You can retrieve your API key via: https://fleetdm.com/docs/rest-api/rest-api#retrieve-your-api-token
```go
package mainimport (
"fmt"
"log"
"time""github.com/wolveix/fleet-go"
)func main() {
key := "your_api_key_here"
service := fleet.New("https://your.fleet.domain", key, 15*time.Second, false)user, err := service.FindMe()
if err != nil {
log.Fatal(err)
}fmt.Println(user.Email)
}
```## Retrieve Hosts
```go
package mainimport (
"fmt"
"log"
"time""github.com/wolveix/fleet-go"
)func main() {
key := "your_api_key_here"
service := fleet.New("https://your.fleet.domain", key, 15*time.Second, false)hosts, err := service.FindHosts()
if err != nil {
log.Fatal(err)
}
for _, host := range hosts {
fmt.Printf("Host details:\n- Hostname: %s\n- OS Version: %s\n\n", host.Hostname, host.OSVersion)
}
}
```## License
BSD licensed. See the [LICENSE](LICENSE) file for details.