Swiftpack.co - Package - Ethenyl/JamfKit

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

  • [x] Includes JSON encoding / decoding support for most of the JSS objects
  • [x] Includes Objective-C support
  • [x] Includes Swift 4+ support
  • [x] Includes ready-for-consumption CRUD URLRequest for JSS endpoints
  • [x] 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.

Github

link
Stars: 18
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

0.3.1 - Apr 29, 2018

What's new

Added

  • Added tvOS compatibility [#78]

0.3.0 - Mar 13, 2018

What's new

Added

  • Added the possibility of configuring the Jamf host to target for generated URLRequest [#64]
  • Added the possibility to generate URLRequest [#70]
  • Implemented Computer configuration profile and Mobile device configuration profile models [#73]

Modified

  • Reworked objects with protocol composition [#71]

0.2.0 - Mar 13, 2018

What's new

Added

  • Implemented Building model [#2]
  • Implemented Computer model [#3]
  • Implemented Department model [#4]
  • Implemented Mobile device model [#5]
  • Implemented Policy model [#6]
  • Implemented Printer model [#7]
  • Implemented Mobile device group model [#24]
  • Implemented Netboot server model [#25]
  • Implemented Network segment model [#26]
  • Implemented Package model [#27]
  • Implemented SMTP server model [#28]
  • Implemented computer command model [#29]
  • Implemented Computer configuration model [#30]
  • Implemented Computer group model [#31]
  • Implemented Objective-C compatibility [#33]
  • Implemented Directory binding model [#45]
  • Implemented Script model [#46]
  • Implemented Partition model [#47]

Modified

  • Renamed solution to JamfKit (was JAMFKit previously) [#37]

0.1.0 - Mar 13, 2018

What's new

Added

  • Implemented Account model [#1]
  • Implemented Site model [#8]
  • Implemented User model [#9]
  • Implemented Base object [#10]
  • Implemented Hardware model [#19]
  • Added CocoaPods compatibility [#16]