ruby-jss 4.2.0b2 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +25 -7
- data/README-2.0.0.md +19 -8
- data/README.md +43 -30
- data/lib/jamf/api/classic/api_objects/patch_title.rb +0 -2
- data/lib/jamf/api/jamf_pro/api_objects/api_client.rb +3 -0
- data/lib/jamf/api/jamf_pro/api_objects/api_role.rb +3 -0
- data/lib/jamf/api/jamf_pro/api_objects/j_package.rb +307 -119
- data/lib/jamf/api/jamf_pro/api_objects/managed_software_updates/plan.rb +237 -0
- data/lib/jamf/api/jamf_pro/api_objects/managed_software_updates.rb +291 -0
- data/lib/jamf/api/jamf_pro/base_classes/oapi_object.rb +8 -0
- data/lib/jamf/api/jamf_pro/mixins/collection_resource.rb +23 -3
- data/lib/jamf/api/jamf_pro/mixins/filterable.rb +8 -0
- data/lib/jamf/api/jamf_pro/mixins/jpapi_resource.rb +17 -3
- data/lib/jamf/api/jamf_pro/mixins/macos_managed_updates.rb +2 -0
- data/lib/jamf/api/jamf_pro/mixins/prestage.rb +3 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/account_group.rb +123 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v1.rb +105 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/assign_remove_profile_response_sync_state.rb +112 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account_v1.rb +159 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/authentication_type.rb +97 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/{device_enrollment_disown_body.rb → available_updates.rb} +14 -10
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_application.rb +124 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_attachment.rb +102 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_certificate.rb +151 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_configuration_profile.rb +118 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching.rb +372 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_alert.rb +120 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_cache_detail.rb +97 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error.rb +98 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error_user_info.rb +89 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent.rb +131 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_alert.rb +105 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_capabilities.rb +124 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_details.rb +118 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_local_network.rb +97 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk.rb +143 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk_encryption.rb +120 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_extension_attribute.rb +175 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_font.rb +93 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general.rb +244 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware.rb +264 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_ibeacon.rb +81 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory.rb +276 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_file_vault.rb +127 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_licensed_software.rb +88 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_local_user_account.rb +196 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_mdm_capability.rb +88 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system.rb +148 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_package_receipts.rb +97 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition.rb +145 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_encryption.rb +94 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_file_vault2_state.rb +97 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_plugin.rb +93 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_v3.rb +129 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_printer.rb +99 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_purchase.rb +158 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_remote_management.rb +88 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_section.rb +109 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_security.rb +193 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_service.rb +81 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_software_update.rb +93 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_storage.rb +90 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_user_and_location.rb +131 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/dss_declaration.rb +111 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/dss_declarations.rb +88 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_method.rb +97 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/group_membership.rb +94 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute.rb +89 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/location_information.rb +146 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/{package_manifest.rb → location_information_v2.rb} +35 -37
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plan.rb +181 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plan_event_store.rb +85 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plan_group_post.rb +99 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plan_post.rb +98 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plan_post_response.rb +100 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plan_toggle.rb +115 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plan_toggle_status.rb +169 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plan_toggle_status_wrapper.rb +91 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_plans.rb +102 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_status.rb +173 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/managed_software_update_statuses.rb +102 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name_v2.rb +94 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names_v2.rb +118 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/plan_configuration_post.rb +142 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/plan_device.rb +105 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/plan_device_post.rb +97 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/plan_device_response.rb +96 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/plan_group_post.rb +96 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/plan_search_results.rb +89 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/plan_status.rb +127 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/{device_enrollment_prestage.rb → prestage_purchasing_information.rb} +51 -88
- data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information_v2.rb +174 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment_v2.rb +94 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/v1_site.rb +91 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas.rb +24 -1
- data/lib/jamf/composer.rb +114 -107
- data/lib/jamf/oapi_validate.rb +1 -0
- data/lib/jamf/version.rb +1 -1
- data/test/bin/runtests +2 -2
- data/test/lib/jamf_test/collection_tests.rb +10 -2
- data/test/tests/computer_group.rb +29 -12
- data/test/tests/{jp_building.rb → j_building.rb} +2 -2
- data/test/tests/j_package.rb +47 -0
- metadata +87 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19c9e79713c2ae52e27acf1baaecdf03446328ebce206b0d4a6d6c995d98e0cf
|
4
|
+
data.tar.gz: b05700b3f5e07771b257af10da6b73cf44334916cbdc0442d9d7aca539518af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d400c1033d40a4128d5021e21f3fd367158caf2ed176108bf912198f76f4669bfd3500b26e0677279a9d87c65dc69974fe636588d100256f64a79315d64747b0
|
7
|
+
data.tar.gz: 631190601b377d45d1cb1ba80ec54decf662f7b6223d311f6b6e3a73dfea5731b86bac7d5046d47a6364395a3abb5b4ef4c1b1add424868da917ed037152fa8c
|
data/CHANGES.md
CHANGED
@@ -15,14 +15,14 @@ __Please update all installations of ruby-jss to at least v1.6.0.__
|
|
15
15
|
Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue and providing examples of how it could be exploited.
|
16
16
|
|
17
17
|
--------
|
18
|
-
## \[4.2.0]
|
18
|
+
## \[4.2.0] 2025-06-11
|
19
19
|
|
20
20
|
### Moving forward with the Jamf Pro API
|
21
21
|
With this release, we begin the long process of porting existing classes from the Classic API to the Jamf Pro API where possible, starting with `Jamf::Package`. So far, our implementation of classes from the Jamf Pro API has been limited to those not already implemented via the Classic API.
|
22
22
|
|
23
|
-
However, because of our stated goals for implementing things in the Jamf Pro API (see [README-2.0.0.md](README-2.0.0.md)), we can't just change the existing classes without breaking lots of code. For example, in order to eliminate various 'hidden permissions requirements' and adhere more closely to the actual API, we're [eliminating cross-object validation](README-2.0.0.md#cross-object-validation-in-setters).
|
23
|
+
However, because of our stated goals and changes for implementing things in the Jamf Pro API (see [README-2.0.0.md](README-2.0.0.md)), we can't just change the existing classes without breaking lots of code. For example, in order to eliminate various 'hidden permissions requirements' and adhere more closely to the actual API, we're [eliminating cross-object validation](README-2.0.0.md#cross-object-validation-in-setters).
|
24
24
|
|
25
|
-
For Packages
|
25
|
+
For Packages this means that when setting the categoryId, for example, you must provide an id, not a category name. In the existing `Jamf::Package` class using the Classic API, you could provide a name, and ruby-jss would look at the categories in the API and validate/convert to an id. This required 'undocumented' permissions to see the category endpoints when working with the package endpoints. NOTE: if you have read-permissions on categories, you can still use the `Jamf::Category.valid_id` method to convert from names to ids yourself. That method is available for all collection classes in both APIs.
|
26
26
|
|
27
27
|
In order to move forward with Jamf Pro-based classes, while providing reasonable backward compatibility, here's the plan:
|
28
28
|
|
@@ -30,15 +30,16 @@ In order to move forward with Jamf Pro-based classes, while providing reasonable
|
|
30
30
|
- The original Classic API-based class will be marked as deprecated when the matching J-class is released.
|
31
31
|
- The deprecated classes will exist for at least one year (probably longer) but will get few, if any, updates, mostly limited to security-related fixes. As of this release, `Jamf::Package` and `Jamf::Building` are deprecated.
|
32
32
|
- During the deprecation period, please update all your code to use the new Jamf Pro API-based classes.
|
33
|
-
- When the older Classic API-based class is actually removed, the
|
33
|
+
- When the older Classic API-based class is actually removed, the remaining Jamf Pro API-based class will be aliased back to the original name, without the `J`. So at that point `Jamf::Package` and `Jamf::JPackage` will be the same class. At this time please start updating your code to use the non-J version of the class name.
|
34
34
|
- After some long-ish period of time (2-5 years?), the `J` version of the class name will be removed. Or - maybe not! Aliases are cheap :-)
|
35
35
|
|
36
36
|
If you have thoughts or comments on this, please reach out:
|
37
37
|
- [Open an issue on github](https://github.com/PixarAnimationStudios/ruby-jss/issues)
|
38
|
-
- [Email
|
38
|
+
- [Email us at ruby-jss@pixar.com](mailto:ruby-jss@pixar.com)
|
39
39
|
- Join the conversation in the [#ruby-jss Macadmins Slack Channel](https://macadmins.slack.com/archives/C03C7F563MK)
|
40
40
|
|
41
41
|
### Added
|
42
|
+
|
42
43
|
- `Jamf::JPackage`: The first major migration of a class from the Classic to the Jamf Pro API.
|
43
44
|
- Implements the /v1/packages endpoints
|
44
45
|
- Support for manifests
|
@@ -48,6 +49,19 @@ If you have thoughts or comments on this, please reach out:
|
|
48
49
|
- The package must have a manifest
|
49
50
|
- The .pkg file must be a "Product Archive", e.g. it must contain a 'Distribution' file, as when created with the `productbuild` command. Component packages created with `pkgbuild` will not work.
|
50
51
|
- The .pkg file must be signed.
|
52
|
+
|
53
|
+
- Collection Resource classes from the Jamf Pro API can now define a constant OBJECT_NAME_ATTR, which indicates the attribute that holds the individual object's name, if that isn't "name".
|
54
|
+
|
55
|
+
For example, Computer and MobileDevice prestage objects, the name is in the "displayName" attribute. For JPackages via the Jamf Pro API, the package object's name (not its file name) is in the "packageName" object.
|
56
|
+
|
57
|
+
When the OBJECT_NAME_ATTR is defined, the class can use "name" as a alias of the OBJECT_NAME_ATTR with getters & setters (`name=` is an alias of `displayName=`, etc) and can be used for .fetch and .valid_id: `Jamf::JPackage.fetch name: 'foo'` is the same as `Jamf::JPackage.fetch packageName: 'foo'`
|
58
|
+
|
59
|
+
For some objects this isn't relevant, e.g. Inventory Preload Records, but for JPAPI that use variations on the word 'name' for the objects actual name, this will help normalize things, and keep better compatility with objects from the Classic API, which all use 'name'.
|
60
|
+
|
61
|
+
- `Jamf::ManagedSoftwareUpdates` This module replaces the deprecated MacOSManagedUpdates class, giving access to the `v1/managed-software-updates` endpoints for creating and querying Software Update plans and their statuses. This code is preliminary and provides basic access. It will probably be enhanced in the future.
|
62
|
+
|
63
|
+
See the `Jamf::ManagedSoftwareUpdates.send_managed_sw_update` and `Jamf::ManagedSoftwareUpdates.status` module methods, and the `Jamf::ManagedSoftwareUpdates::Plan` class,
|
64
|
+
|
51
65
|
|
52
66
|
### Changed
|
53
67
|
- `Jamf::JpBuilding` is now known as `Jamf::JBuilding`
|
@@ -69,17 +83,21 @@ If you have thoughts or comments on this, please reach out:
|
|
69
83
|
|
70
84
|
- Fix to ensure passing correct connection object when fetching.
|
71
85
|
|
86
|
+
- Fix for `CollectionResource.valid_id` for JP API objects, it now works when given an identifier and value, eg `SomeClass.valid_id displayName: 'foobar'`
|
87
|
+
|
72
88
|
### Deprecated
|
73
89
|
- `Jamf::Package` and `Jamf::Building` are now deprecated amd will be removed in a future release. Please update your code to use `Jamf::JBuilding` and `Jamf::JPackage`
|
74
90
|
|
75
91
|
- Auto-generated OAPISchemas are no longer used _directly_. There's still too much inconsistency and other problems that arise from using them as we were. See the NOTE from the previous release.
|
76
92
|
|
77
|
-
For the forseeable future we'll keep the overall structure of the class/mixin hierarchy, and will probably use
|
93
|
+
For the forseeable future we'll keep the overall structure of the class/mixin hierarchy, and will probably use auto-generated classes as a starting point, but as new classes are added to ruby-jss via the Jamf Pro API, the `OAPISchemas` classes will be hand-built and maintained as needed, just like APIObject classes always have been for objects in the Classic API.
|
78
94
|
|
79
|
-
To start with, we're keeping the ones currently in use (about 40 of them) where they've always lived, in the `lib/jamf/api/jamf_pro/oapi_schemas` directory, and the new bespoke ones will go there also. The other ~550 unused auto-generated classes
|
95
|
+
To start with, we're keeping the ones currently in use (about 40 of them) where they've always lived, in the `lib/jamf/api/jamf_pro/oapi_schemas` directory, and the new bespoke ones will go there also. The other ~550 unused auto-generated classes have been removed from ruby-jss.
|
80
96
|
|
81
97
|
For details about how the've been auto-generated, see the `generate_object_models` tool in the bin directory.
|
82
98
|
|
99
|
+
- `Jamf::MacOSManagedUpdates` This endpoint has been deprecated by Jamf, and replaced with the more broad, and future-proof `Jamf::ManagedSoftwareUpdates` module.
|
100
|
+
|
83
101
|
--------
|
84
102
|
## \[4.1.1] 2024-06-25
|
85
103
|
|
data/README-2.0.0.md
CHANGED
@@ -34,7 +34,7 @@ These changes have been in mind for some time, but the requirement in late 2022
|
|
34
34
|
- [The valid_id method for Classic API collection classes](#the-valid_id-method-for-classic-api-collection-classes)
|
35
35
|
- [Planned deprecations](#planned-deprecations)
|
36
36
|
- [Use of the term 'api'](#use-of-the-term-api)
|
37
|
-
- [
|
37
|
+
- [map_all_ids_to method for Classic API collection classes](#map_all_ids_to-method-for-classic-api-collection-classes)
|
38
38
|
- [Using .make, #create, and #update for Classic API objects](#using-make-create-and-update-for-classic-api-objects)
|
39
39
|
- [JSS::CONFIG](#jssconfig)
|
40
40
|
- [Jamf::Connection instance methods #next_refresh, #secs_to_refresh, & #time_to_refresh](#jamfconnection-instance-methods-next_refresh-secs_to_refresh---time_to_refresh)
|
@@ -76,7 +76,7 @@ The announcement with Jamf Pro 10.35 that the Classic API can use, and will even
|
|
76
76
|
|
77
77
|
#### A single Connection class
|
78
78
|
|
79
|
-
There is now one `Jamf::Connection` class, instances of which are connections to a Jamf Pro server. Once connected, the connection instance maintains connections to _both_ APIs and other classes use them as needed. As before, there are low-level methods available for sending HTTP requests manually, which are specific to each API. See the documentation for
|
79
|
+
There is now one `Jamf::Connection` class, instances of which are connections to a Jamf Pro server. Once connected, the connection instance maintains connections to _both_ APIs and other classes use them as needed. As before, there are low-level methods available for sending HTTP requests manually, which are specific to each API. See the documentation for [Jamf::Connection](https://www.rubydoc.info/gems/ruby-jss/Jamf/Connection) for details.
|
80
80
|
|
81
81
|
##### Connecting to the API
|
82
82
|
|
@@ -91,7 +91,7 @@ Other connection parameters can be passed in as normal.
|
|
91
91
|
|
92
92
|
###### The default connection
|
93
93
|
|
94
|
-
The top-level module methods for accessing the 'default' connection are still available and are now synonyms: `Jamf.cnx` and `JSS.api` both return the current default Jamf::Connection instance. There is also a top-level
|
94
|
+
The top-level module methods for accessing the 'default' connection are still available and are now synonyms: `Jamf.cnx` and `JSS.api` both return the current default Jamf::Connection instance. There is also a top-level method`Jamf.connect` which is the same as `Jamf.cnx.connect`. The top-level methods for changing the default connection are still there.
|
95
95
|
|
96
96
|
NOTE: The use of `JSS::API` has been deprecated for years now, and still is (see below).
|
97
97
|
|
@@ -118,6 +118,13 @@ The `.all` method, and its relatives like `.all_ids`, `.all_names`, etc. exist f
|
|
118
118
|
To confirm which API a class comes from, just look at its `API_SOURCE` constant, e.g. `Jamf::Computer::API_SOURCE`. This constant will return a symbol, either `:classic` or `:jamf_pro`
|
119
119
|
|
120
120
|
### Automatic code generation
|
121
|
+
---
|
122
|
+
**UPDATE**
|
123
|
+
|
124
|
+
As of version 4.2.0, the auto-generated class definitions will only be used as a starting point for more bespoke, hand-maintained classes. This is due to ongoing inconsistencies across the Jamf Pro API, and occasional name-clashes.
|
125
|
+
See the Deprecations section for version 4.2.0 in the [CHANGES](CHANGES.md) file for a longer explaination.
|
126
|
+
|
127
|
+
---
|
121
128
|
|
122
129
|
While the Classic API classes in ruby-jss are very hand-built and must be manually edited to add access to new data, the Jamf Pro API has an OpenAPI3 specification - a JSON document that fully describes the entire API and what it can do.
|
123
130
|
|
@@ -133,7 +140,7 @@ If you develop ruby-jss, please see (documentation link will go here) for more i
|
|
133
140
|
|
134
141
|
### Autoloading with Zeitwerk
|
135
142
|
|
136
|
-
Because
|
143
|
+
Because ruby-jss implements so many classes and modules, it's a waste of memory and time to load all of them in every time you `require 'ruby-jss'`, since most of them will never be used for any given application.
|
137
144
|
|
138
145
|
To deal with this, ruby-jss now uses the wonderfully cool [Zeitwerk gem](https://github.com/fxn/zeitwerk) to automatically load only the files needed for classes and modules as they are used.
|
139
146
|
|
@@ -172,7 +179,11 @@ The `.all` method will never deliver paged results, however if you give it a `fi
|
|
172
179
|
|
173
180
|
### API data are no longer cached (?)
|
174
181
|
|
175
|
-
|
182
|
+
---
|
183
|
+
**NOTE:**
|
184
|
+
Caching has been removed for the objects from the Jamf Pro API, but remains for those from the Classic API. The re-instatement of caching for JP API objects is pending discussion with other users of ruby-jss.
|
185
|
+
|
186
|
+
---
|
176
187
|
|
177
188
|
Pre-2.0, methods that would fetch large datasets from the server would always cache that data in the Connection object, and by default use the cache in future calls unless a `refresh` parameter is given. These datasets included:
|
178
189
|
|
@@ -274,7 +285,7 @@ Here are the things we are planning on removing or changing in the coming months
|
|
274
285
|
|
275
286
|
In ruby-jss < 2.0, the term `api` is used with the Classic API in method names, method parameters, instance variables, attributes, and constants. It is used to pass, access, refer to, or hold instances of JSS::APIConnnection, e.g. so a method that talks to the server would use the passed connection rather than the module-wide default connection.
|
276
287
|
|
277
|
-
The term 'api' is inappropriate because the thing being
|
288
|
+
The term 'api' is inappropriate because the thing being referred to is a 'connection' not an 'api'. Now that there are actually two APIs at play, that usage is even less appropriate.
|
278
289
|
|
279
290
|
Going forward, use `cnx` (simpler to type than 'connection') instead. Example:
|
280
291
|
|
@@ -384,11 +395,11 @@ Or when you try to set the value of an extension attribute on a Computer object,
|
|
384
395
|
|
385
396
|
This validation happens before you try to send the new data to the server.
|
386
397
|
|
387
|
-
This type of pre-validation will be
|
398
|
+
This type of pre-validation will not be use when using the Jamf Pro API, for 3 reasons:
|
388
399
|
|
389
400
|
1) The API itself will perform this validation when you send the data, and will return an error if there's a problem.
|
390
401
|
2) Removing this validation will simplify the code, and reduce interdependency between objects
|
391
|
-
3) Removing this code will make it easier to understand the permissions needed to do things in ruby-jss
|
402
|
+
3) Removing this code will make it easier to understand the permissions needed to do things in ruby-jss, removing 'hidden permissions requirements' when interacting with class-specific API endpoints.
|
392
403
|
|
393
404
|
The last point is very important. Right now, in order to be able to manipulate the scope of any scopable object, the account with which you're accessing the API must have at least 'read' permission on all the different kinds of objects that _might_ be in the scope: computers, computer groups, buildings, departments, network segments, and so on. Removing or limiting the validation-based interdependency will make it easier to limit the access needed for API service accounts, and thereby increase overall security.
|
394
405
|
|
data/README.md
CHANGED
@@ -1,24 +1,6 @@
|
|
1
1
|
# ruby-jss: Working with the Jamf Pro APIs in Ruby
|
2
2
|
[](http://badge.fury.io/rb/ruby-jss)
|
3
3
|
|
4
|
-
## Version 2.0.0 has been released
|
5
|
-
|
6
|
-
Version 2.0.0 has major changes! While we've strived for _mostly_ being backward compatible, and have done lots of testing, YMMV. Please report any issues.
|
7
|
-
|
8
|
-
_NOTE_: ruby-jss 2.0 is not completely backward compatible, please see [README-2.0.0.md](README-2.0.0.md) for more info
|
9
|
-
|
10
|
-
### Highlights
|
11
|
-
|
12
|
-
- Support for Ruby 3.x
|
13
|
-
- tested in 3.0 and 3.1
|
14
|
-
- Combined access to both the Classic and Jamf Pro APIs
|
15
|
-
- A single namespace module
|
16
|
-
- Connection objects talk to both APIs & automatically handle details like bearer tokens
|
17
|
-
- Auto-generated code for Jamf Pro API objects
|
18
|
-
- Autoloading of code using [Zeitwerk](https://github.com/fxn/zeitwerk)
|
19
|
-
|
20
|
-
For details about the changes, the document [README-2.0.0.md](README-2.0.0.md).
|
21
|
-
|
22
4
|
## _IMPORTANT_: Known Security Issue in v1.5.3 and below
|
23
5
|
|
24
6
|
Versions of ruby-jss prior to 1.6.0 contain a known security issue due to how we were using the 'plist' gem.
|
@@ -35,8 +17,6 @@ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue an
|
|
35
17
|
|
36
18
|
<!-- TOC -->
|
37
19
|
|
38
|
-
- [Version 2.0.0 has been released](#version-200-has-been-released)
|
39
|
-
- [Highlights](#highlights)
|
40
20
|
- [IMPORTANT: Known Security Issue in v1.5.3 and below](#important-known-security-issue-in-v153-and-below)
|
41
21
|
- [DESCRIPTION](#description)
|
42
22
|
- [SYNOPSIS](#synopsis)
|
@@ -50,6 +30,7 @@ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue an
|
|
50
30
|
- [Updating Objects](#updating-objects)
|
51
31
|
- [Deleting Objects](#deleting-objects)
|
52
32
|
- [OBJECTS IMPLEMENTED](#objects-implemented)
|
33
|
+
- [Migrating classes from the Classic to the Jamf Pro API](#migrating-classes-from-the-classic-to-the-jamf-pro-api)
|
53
34
|
- [Other useful classes & modules:](#other-useful-classes--modules)
|
54
35
|
- [Object-related API endpoints](#object-related-api-endpoints)
|
55
36
|
- [CONFIGURATION](#configuration)
|
@@ -64,7 +45,7 @@ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue an
|
|
64
45
|
|
65
46
|
## DESCRIPTION
|
66
47
|
|
67
|
-
ruby-jss defines a Ruby module called `Jamf`, which is used for accessing the 'Classic' and
|
48
|
+
ruby-jss defines a Ruby module called `Jamf`, which is used for accessing both the 'Classic' and
|
68
49
|
'Jamf Pro' APIs of a Jamf Pro server. Jamf Pro is an enterprise-level management tool for Apple
|
69
50
|
devices from [Jamf.com](http://www.jamf.com/). ruby-jss is available as a [ruby gem](https://rubygems.org/gems/ruby-jss), and the
|
70
51
|
[source is on github](https://github.com/PixarAnimationStudios/ruby-jss).
|
@@ -74,16 +55,17 @@ Details like authentication tokens, token refreshing, JSON and XML parsing, and
|
|
74
55
|
which API are all handled under-the-hood.
|
75
56
|
|
76
57
|
The Jamf module abstracts many API resources as Ruby objects, and provides methods for interacting with those
|
77
|
-
resources. It also
|
78
|
-
Jamf-related tools
|
79
|
-
point, and the installation of those objects on client machines. (See [BEYOND THE API](#beyond-the-api))
|
58
|
+
resources. It can also provide some features that aren't a part of the API itself, but come with other
|
59
|
+
Jamf-related tools.
|
80
60
|
|
81
61
|
The Jamf module is not a complete implementation of the Jamf Pro APIs. Only some objects are modeled,
|
82
62
|
some only minimally. Of those, some are read-only, some partially writable, some fully read-write.
|
83
63
|
We've implemented the things we need in our environment, and as our needs grow, we'll add more.
|
84
64
|
Hopefully others will find it useful, and add more to it as well.
|
85
65
|
|
86
|
-
|
66
|
+
For some of the major changes that happened with the release of v2.0.0, see [README-2.0.0](README-2.0.0.md)
|
67
|
+
|
68
|
+
[Full technical documentation can be found at rubydoc.info](http://www.rubydoc.info/gems/ruby-jss/)
|
87
69
|
|
88
70
|
## SYNOPSIS
|
89
71
|
|
@@ -173,6 +155,8 @@ Most of the time, you'll only need a single connection to a single server, and t
|
|
173
155
|
you can also create multiple Connection objects, to different servers, or perhaps the same server with different credentials and
|
174
156
|
access, and pass those connection objects into methods using the `cnx:` parameter as appropriate.
|
175
157
|
|
158
|
+
This is especially important when creating tools that use threads or fibers to perform different tasks concurrently. In such cases the default connection should never be used, and every task should use its own connection object, preferably closing it when done.
|
159
|
+
|
176
160
|
```ruby
|
177
161
|
# Make connections to 2 different Jamf servers.
|
178
162
|
# The .new class method accepts the same parameters as the #connect instance method,
|
@@ -316,27 +300,34 @@ Here's some of what we've implemented so far. See each Class's [documentation(ht
|
|
316
300
|
* {Jamf::AdvancedComputerSearch}
|
317
301
|
* {Jamf::AdvancedMobileDeviceSearch}
|
318
302
|
* {Jamf::AdvancedUserSearch}
|
319
|
-
* {Jamf::
|
303
|
+
* {Jamf::APIClient}
|
304
|
+
* {Jamf::APIRole}
|
305
|
+
* {Jamf::Building} (Classic, deprecated), {Jamf::JBuilding} (Jamf Pro)
|
320
306
|
* {Jamf::Category}
|
321
307
|
* {Jamf::Computer}
|
322
308
|
* {Jamf::ComputerExtensionAttribute}
|
323
309
|
* {Jamf::ComputerGroup}
|
324
310
|
* {Jamf::ComputerInvitation}
|
311
|
+
* {Jamf::ComputerPrestage}
|
325
312
|
* {Jamf::Department}
|
313
|
+
* {Jamf::DeviceEnrollment}
|
326
314
|
* {Jamf::DistributionPoint}
|
327
315
|
* {Jamf::DockItem}
|
328
316
|
* {Jamf::EBook}
|
329
317
|
* {Jamf::IBeacon}
|
318
|
+
* {Jamf::InventoryPreloadRecord}
|
330
319
|
* {Jamf::LdapServer}
|
320
|
+
* {Jamf::MacApplication}
|
331
321
|
* {Jamf::MobileDevice}
|
332
322
|
* {Jamf::MobileDeviceApplication}
|
333
323
|
* {Jamf::MobileDeviceConfigurationProfile}
|
334
324
|
* {Jamf::MobileDeviceExtensionAttribute}
|
335
325
|
* {Jamf::MobileDeviceGroup}
|
326
|
+
* {Jamf::MobileDevicePrestage}
|
336
327
|
* {Jamf::NetBootServer}
|
337
328
|
* {Jamf::NetworkSegment}
|
338
329
|
* {Jamf::OSXConfigurationProfile}
|
339
|
-
* {Jamf::Package}
|
330
|
+
* {Jamf::Package} (Classic, deprecated), {Jamf::JPackage} (Jamf Pro)
|
340
331
|
* {Jamf::PatchTitle}
|
341
332
|
* {Jamf::PatchTitle::Version}
|
342
333
|
* {Jamf::PatchExternalSource}
|
@@ -344,7 +335,8 @@ Here's some of what we've implemented so far. See each Class's [documentation(ht
|
|
344
335
|
* {Jamf::PatchPolicy}
|
345
336
|
* {Jamf::Peripheral}
|
346
337
|
* {Jamf::PeripheralType}
|
347
|
-
* {Jamf::Policy}
|
338
|
+
* {Jamf::Policy}
|
339
|
+
* {Jamf::Printer}
|
348
340
|
* {Jamf::RemovableMacAddress}
|
349
341
|
* {Jamf::RestrictedSoftware}
|
350
342
|
* {Jamf::Script}
|
@@ -353,10 +345,28 @@ Here's some of what we've implemented so far. See each Class's [documentation(ht
|
|
353
345
|
* {Jamf::User}
|
354
346
|
* {Jamf::UserExtensionAttribute}
|
355
347
|
* {Jamf::UserGroup}
|
348
|
+
* {Jamf::VPPAccount}
|
356
349
|
* {Jamf::WebHook}
|
357
350
|
|
358
351
|
**NOTE** Most Computer and MobileDevice data gathered by an Inventory Upate (a.k.a. 'recon') is not editable.
|
359
352
|
|
353
|
+
#### Migrating classes from the Classic to the Jamf Pro API
|
354
|
+
|
355
|
+
With the release of version 4.2.0, we begin the long process of porting existing classes from the Classic API to the Jamf Pro API where possible, starting with `Jamf::Package`. Before that, our implementation of classes from the Jamf Pro API has been limited to those not already implemented via the Classic API, such as `Jamf::InventoryPreloadRecord`.
|
356
|
+
|
357
|
+
However, because of our stated goals for implementing things in the Jamf Pro API (see [README-2.0.0.md](README-2.0.0.md)), we can't just change the existing classes without breaking lots of code. For example, in order to eliminate various 'hidden permissions requirements' and adhere more closely to the actual API, we're [eliminating cross-object validation](README-2.0.0.md#cross-object-validation-in-setters).
|
358
|
+
|
359
|
+
For example, for Packages this means that when setting the categoryId, you must provide an id, not a category name. In Jamf::Package, using the Classic API, you could provide a name, and behind-the-scenes ruby-jss would look at the categories in the API and validate/convert to an id. This required 'undocumented' read-permissions to the categories when working with packages. NOTE: if you do have read-permissions on categories, you can still use the `Jamf::Category.valid_id` method to convert from names to ids yourself. That method is available for all collection classes in both APIs.
|
360
|
+
|
361
|
+
In order to move forward with Jamf Pro-based classes, while providing reasonable backward compatibility, here's the plan:
|
362
|
+
|
363
|
+
- For each class being migrated, and new class, prepended with `J` will be created. So for accessing packages via the Jamf Pro API, we are introducing the class `Jamf::JPackage`.
|
364
|
+
- The original Classic API-based class will be marked as deprecated when the matching J-class is released.
|
365
|
+
- The deprecated classes will exist for at least one year (probably longer) but will get few, if any, updates, mostly limited to security-related fixes.
|
366
|
+
- During the deprecation period, please update all your code to use the new Jamf Pro API-based classes.
|
367
|
+
- When the older Classic API-based class is actually removed, the remaning Jamf Pro API-based class will be aliased back to the original name, without the `J`. So at that point `Jamf::Package` and `Jamf::JPackage` will be the same class. At this time please start updating your code to use the non-J version of the class name.
|
368
|
+
- After some long-ish period of time (2-5 years?), the `J` version of the class name will be removed. Or - maybe not! Aliases are cheap :-)
|
369
|
+
|
360
370
|
#### Other useful classes & modules:
|
361
371
|
|
362
372
|
These modules either provide stand-alone methods, or are mixed in to other classes to extend their functionality. See their documentation for details
|
@@ -367,7 +377,7 @@ These modules either provide stand-alone methods, or are mixed in to other class
|
|
367
377
|
|
368
378
|
* {Jamf::Scopable} - a module that handles Scope for those objects that can be scoped. It defines the Scope class used in those objects. Instances of Scope are where you change targets, limitations, and exclusions.
|
369
379
|
|
370
|
-
* {Jamf::MDM} - a module that handles sending MDM commands. It is accessed via the Computer and MobileDevice classes and their instances.
|
380
|
+
* {Jamf::MDM} - a module that handles sending MDM commands via the Classic API. It is accessed via the Computer and MobileDevice classes and their instances.
|
371
381
|
|
372
382
|
## Object-related API endpoints
|
373
383
|
|
@@ -398,10 +408,13 @@ The currently known attributes are:
|
|
398
408
|
|
399
409
|
* api_server_name [String] the hostname of the Jamf API server
|
400
410
|
* api_server_port [Integer] the port number for the API connection
|
401
|
-
|
411
|
+
# api_ssl_version [String] the SSL version to use for the connection. Default is TLSv1_2
|
412
|
+
* api_verify_cert [Boolean] if SSL is used, should the certificate be verified? (usually false for a self-signed cert)
|
402
413
|
* api_username [String] the Jamf username for connecting to the API
|
403
414
|
* api_timeout_open [Integer] the number of seconds for the open-connection timeout
|
404
415
|
* api_timeout [Integer] the number of seconds for the response timeout
|
416
|
+
* package_manifest_base_url [String] Used by JPackage#generate_manifest.
|
417
|
+
The base-url for downloading a package for installation. The JPackage#fileName is appended to this to create the full URL.
|
405
418
|
|
406
419
|
To put a standard server & username on all client machines, and auto-accept the Jamf's self-signed https certificate, create the file /etc/ruby-jss.conf containing three lines like this:
|
407
420
|
|
@@ -58,7 +58,6 @@ module Jamf
|
|
58
58
|
#
|
59
59
|
class PatchTitle < Jamf::APIObject
|
60
60
|
|
61
|
-
include Jamf::Sitable
|
62
61
|
include Jamf::Categorizable
|
63
62
|
include Jamf::Creatable
|
64
63
|
include Jamf::Updatable
|
@@ -539,7 +538,6 @@ module Jamf
|
|
539
538
|
add_changed_pkg_xml obj unless @changed_pkgs.empty?
|
540
539
|
|
541
540
|
add_category_to_xml doc
|
542
|
-
add_site_to_xml doc
|
543
541
|
|
544
542
|
doc.to_s
|
545
543
|
end # rest_xml
|