Skip to content

A Jamf Classic communication framework written in Swift

License

Notifications You must be signed in to change notification settings

damien-rivet/JamfKit

Repository files navigation

JamfKit

JamfKit

Swift iOS macOS tvOS

Travis branch Codecov Codacy grade Carthage compatible CocoaPods

JamfKit is an iOS / macOS / tvOS framework to communicate with the JSS API offered by any Jamf host.

Summary

Features

  • Includes JSON encoding / decoding support for most of the JSS objects
  • Includes Objective-C support
  • Includes Swift 5+ support
  • Includes ready-for-consumption CRUD URLRequest for JSS endpoints
  • Includes demonstration playgrounds for class handling or request generation

Installation

Carthage

To integrate JamfKit into your project, add the following line in your Cartfile:

github "Ethenyl/JamfKit"

Then run the following command:

$ carthage update

Cocoapods

To integrate JamfKit into your project, add the following line in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'JAMFKit'
end

Then run the following command:

$ pod install

Architecture

Protocols

Protocol Description
Endpoint Represents any JSS object that is matched by a JSS endpoint.
Identifiable Represents any JSS object that can be identified (either by ID or by name).
Requestable Represents an object that can be used to perform requests with any JSS endpoint.
Subset Represents any JSS object that contains a general object that can identify it.

Requestable conformance

The class that conform to Requestable exposes the following elements:

  • An failable initializer that takes a JSON payload and return the instantiated object
  • A function to return the JSON payload that represents the instance of the object

Classes

Class Desscription
BaseObject Represents the common denominator between most of the JSS objects which must contains at least an identifier and a name properties.
Building Represents a physical building.
Computer Represents a computer managed by Jamf, contains the general / location / purchasing information about the hardware.
ComputerCommand Represents a logical command that can be executed on any hardware element manageg by Jamf.
ComputerConfigurationProfile Represents a logical configuration profile that can be applied to any computer managed by Jamf.
ComputerGroup Represents a group of computers managed by Jamf, contains grouping information.
Department Represents a physical department.
DirectoryBinding Represents a logical binding between a computer and an active directory user.
MobileDeviceConfigurationProfile Represents a logical configuration profile that can be applied to any mobile device managed by Jamf.
MobileDevice Represents a mobile device managed by Jamf, contains the general information about the device.
MobileDeviceGroup Represents a group of mobile devices managed by Jamf, contains grouping information.
NetbootServer Represents a physical netboot server, contains information about the server and it's configuration.
NetworkSegment Represents a physical network segment, contains information about the segment and it's configuration.
Package Represents a logical application package, contains information about the application requirements and capabilities.
Partition Represents a logical partition for an hard drive installed inside an hardware element managed by Jamf.
Policy Reprents as logical policy that can be applied to any hardware element managed by Jamf.
PreciseDate Represents a logical date within JSS api, contains 3 properties, the date itself, an epoch variant of the date and an UTC version of the date.
Printer Represents a physical printer, contains information about the printer and it's configuration.
Script Represents a logical script that can be executed on one (or more) machine managed by Jamf.
Site Represents a physical location (building, office, etc.).
SMTPServer Represents the physical SMTP server configuration.
User Represents a Jamf user and contains the identification properties that are required to contact the actual user and identify the hardware devices assigned to him / her.

Usage

Getting started

Playgrounds

To get a quick look on how you can use JamfKit in your Jamf related features, you can check the Playgrounds included within the workspace.

Also check the unit tests, they should cover most of your needs.

Models

Most of the classes can be initialized with the bare minimul values, all the properties are then available for modification.

Requests

By adhering to the different CRUD protocols (Creatable, Readable, Updatable & Deletable), most of the JSS objects listed above are capable of supplying varying URLRequest that should fit any needs.

You'll find below the basic functions to get URLRequest:

Function Type HTTP Method Example Output
createRequest() instance POST building.createRequest() http://jss.host/jss/objects/1
readAllRequest() static GET Building.readAllRequest() http://jamf.com/jss/objects
readRequest(identifier:) static GET Building.readRequest(identifier: "12345") http://jamf.com/jss/objects/1
readRequest() instance GET building.readRequest() http://jamf.com/jss/objects/1
updateRequest() instance PUT building.updateRequest() http://jamf.com/jss/objects/1
deleteRequest(identifier:) static DELETE Building.deleteRequest(identifier: "12345") http://jamf.com/jss/objects/1
deleteRequest() instance DELETE building.deleteRequest() http://jamf.com/jss/objects/1

Some objects will offer variants of those requests, like MobileDevice with readRequestWithName() or deleteRequestWithSerialNumber() (with both static and instance variants).

Contributing

So, you want to help improve JamfKit? That's great! Any useful contribution is welcome!

Check CONTRIBUTING for more details on how you can contribute to JamfKit.

Code of conduct

Any contributions (issues, pull requests, comments, etc.) to JamfKit are more than welcome.

But before making any contribution, please make sure that you follow the CODE OF CONDUCT.

Otherwise, there's a great chance that your contribution will be removed / blocked / hidden.

FAQ

None for the moment.

Credits

JamfKit is owned and maintained by Ethenyl.

You can join the list by contributing to the repository.

License

JamfKit is released under the MIT license. See LICENSE for more details.

Packages

No packages published

Languages