go-api-sdk-jamfpro

module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT

README

Jamf API Client SDK in Go

Install

If you don't have a project yet and you're just trying to experiment with the package, you can create a new directory, initialize a new Go module there, and then try to fetch the dependency:

mkdir myproject
cd myproject
go mod init myproject
go get github.com/deploymenttheory/go-jamfpro-api@latest

to add module requirements and sums:

go mod tidy
package main

import (
  "fmt"
	"log"
	jamf "github.com/deploymenttheory/go-jamfpro-api"
)

func main() {
	// Credentials and URL for Jamf API
	username := "your-jamf-api-account"
	password := "your-jamf-api-account-password"
	url := "your-jamf-instance" // e.g., "yourcompany.jamfcloud.com"

	// Set up the configuration for the Jamf Pro API client
	cfg := jamf.Config{
		AuthMethod: jamf.BasicAuthConfig{
			Username: username,
			Password: password,
		},
		URL:              url,
		HTTPClient:       &http.Client{},
		HttpRetryTimeout: 30 * time.Second, // Optional, defaults to 10 seconds if not defined

	}
}	

Usage

sample code: examples

Get auth token in curl

$ curl -u username:password -X POST "https://xxxxx.jamfcloud.com/api/auth/tokens"
$ token=xxxxx
$ curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" "https://xxxxx.jamfcloud.com/api/v1/departments"

Go SDK for Jamf Pro API Progress Tracker

API Coverage Progress

Date: YYYY-MM-DD
Maintainer: [Your Name]

Overview

This document tracks the progress of API endpoint coverage tests. As endpoints are tested, they will be marked as covered.

Coverage Legend

  • ✅ - Covered
  • ❌ - Not Covered
  • ⚠️ - Partially Covered

Endpoints

Accounts - /JSSResource/accounts
  • ✅ GET /userid/{id} - GetAccountByID retrieves the Account by its ID
  • ✅ GET /username/{username} - GetAccountByName retrieves the Account by its name
  • ✅ GET / - GetAccounts retrieves all user accounts
  • ✅ GET /groupid/{id} - GetAccountGroupByID retrieves the Account Group by its ID
  • ✅ GET /groupname/{id} - GetAccountGroupByName retrieves the Account Group by its name
  • ✅ POST / - CreateAccount creates a new Jamf Pro Account.
  • ✅ POST /groupid/0 - CreateAccountGroup creates a new Jamf Pro Account Group.
  • ✅ PUT /userid/{id} - UpdateAccountByID updates an existing Jamf Pro Account by ID
  • ✅ PUT /username/{id} - UpdateAccountByName updates an existing Jamf Pro Account by Name
  • ✅ PUT /groupid/{id} - UpdateAccountGroupByID updates an existing Jamf Pro Account Group by ID
  • ✅ PUT /groupname/{id} - UpdateAccountGroupByName updates an existing Jamf Pro Account Group by Name
  • ✅ DELETE /userid/{id} - DeleteAccountByID deletes an existing Jamf Pro Account by ID
  • ✅ DELETE /username/{username} - DeleteAccountByName deletes an existing Jamf Pro Account by Name
  • ✅ DELETE /groupid/{id} - DeleteAccountGroupByID deletes an existing Jamf Pro Account Group by ID
  • ✅ DELETE /groupname/{username} - DeleteAccountGroupByName deletes an existing Jamf Pro Account Group by Name
Activation Code - /JSSResource/activationcode
  • ✅ GET /JSSResource/activationcode - GetActivationCode retrieves the current activation code.
  • ✅ PUT /JSSResource/activationcode - UpdateActivationCode updates the activation code.
SSO Failover - /api/v1/sso/failover/generate
  • ✅ GET /api/v1/sso/failover - GetSSOFailoverSettings retrieves the current failover settings
  • ✅ PUT /api/v1/sso/failover/generate - UpdateFailoverUrl updates failover url, by changing failover key to new one, and returns new failover settings

Progress Summary

  • Total Endpoints: 188
  • Covered: 1
  • Not Covered: 187
  • Partially Covered: 0

Notes

  • No preview api endpoints will be covered by this sdk. Only generally available endpoints will be covered.

Directories

Path Synopsis
Migration
examples/JCDS2 command
jamfpro
jcds2.go Jamf Pro Api Work in progress.
jcds2.go Jamf Pro Api Work in progress.
deprecated
apiclient
clientHelpers.go For utility/helper functions to support from the main package
clientHelpers.go For utility/helper functions to support from the main package
examples
concurrency/OauthConcurrentSessionTester command
concurrency_tester.go
concurrency_tester.go
sdk
http_client
http_client.go
http_client.go
jamfpro
http_logging.go
http_logging.go
utils
utilities.go For utility/helper functions to support from the main package
utilities.go For utility/helper functions to support from the main package

Jump to

Keyboard shortcuts

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