Categorygithub.com/trustero/jamf-api-client-go
module
0.0.0-20221209170803-41494df6ba36
Repository: https://github.com/trustero/jamf-api-client-go.git
Documentation: pkg.go.dev

# README

jamf-api-client-go

This repository contains an unoffical Go API client for Jamf REST API's.

To see what functionality is available in the current API client release, please see the API Coverage doc.

Disclaimers

  • The API client remains in active development and has no affiliation to Jamf
  • This is not an official Jamf API client
  • The client is not formally supported by Datadog and the code is available as-is

Contribution is welcome and appreciated! 🚀 💜

Usage

import  jamf "github.com/trustero/jamf-api-client-go/classic"

// You can optionally setup a custom HTTP client to use which can
// include any settings you desire. If you would like to use the 
// default client configuration just pass nil. This will default 
// to a client that is simply configured with a timeout of 1 minute
myCustomHTTPClient := &http.Client{
  Timeout: time.Minute,
}

// Create a client instance to interact with API
j, err := jamf.NewClient("https://jamf.example.com", "YOUR_API_USER", "YOUR_USERS_PASSWORD_HERE", myCustomHTTPClient)
if err != nil {
  fmt.Println(err.Error())
  os.Exit(1)
}

// Example: Get All Computers
computers, err := j.Computers()
if err != nil {
  os.Exit(1)
}

// Example: Create Script
newScript := &jamf.ScriptContents{
  Name: "Script with API Creation",
}
s, err := j.CreateScript(newScript)
if err != nil {
  os.Exit(1)
}

// Example: Get Script Details
scriptDetails, err := j.ScriptDetails(37)
if err != nil {
  os.Exit(1)
}

More examples available here

Tests

Unit tests should exist for all endpoints and pass successfully prior to being checked into the main branch

go test -v ./... or make test

Alternatively, make pr-prep can be run to execute all tests, formatting, and linting

# Packages

No description provided by the author
No description provided by the author