jamf-api-client-go

module
v0.0.0-...-5cee9b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2023 License: Apache-2.0

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/DataDog/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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL