ruby-jss 1.6.4 → 2.0.0a10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (705) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGES.md +40 -4
  4. data/README-2.0.0.md +316 -0
  5. data/README.md +48 -34
  6. data/bin/cgrouper +3 -3
  7. data/bin/jamfHelperBackgrounder +2 -2
  8. data/bin/netseg-update +3 -3
  9. data/data/ruby-jss.conf.example +1 -1
  10. data/lib/{jss/api_object → jamf/api/classic/api_objects}/account.rb +29 -22
  11. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_computer_search.rb +6 -6
  12. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_mobile_device_search.rb +6 -6
  13. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_user_search.rb +6 -6
  14. data/lib/{jss/api_object → jamf/api/classic/api_objects}/building.rb +6 -6
  15. data/lib/{jss/api_object → jamf/api/classic/api_objects}/categorizable.rb +10 -10
  16. data/lib/{jss/api_object → jamf/api/classic/api_objects}/category.rb +17 -15
  17. data/lib/{jss/api_object → jamf/api/classic/api_objects}/computer.rb +210 -111
  18. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/computer_extension_attribute.rb +19 -19
  19. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/computer_group.rb +8 -8
  20. data/lib/{jss/api_object → jamf/api/classic/api_objects}/computer_invitation.rb +8 -8
  21. data/lib/{jss/api_object → jamf/api/classic/api_objects}/creatable.rb +22 -24
  22. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable/criteria.rb +24 -24
  23. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable/criterion.rb +15 -15
  24. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable.rb +25 -28
  25. data/lib/{jss/api_object → jamf/api/classic/api_objects}/department.rb +7 -7
  26. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding.rb +40 -40
  27. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/active_directory.rb +47 -47
  28. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/admitmac.rb +56 -56
  29. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/centrify.rb +15 -15
  30. data/lib/{jss/api_object → jamf/api/classic/api_objects/directory_binding_type}/directory_binding_type.rb +2 -25
  31. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/open_directory.rb +19 -19
  32. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/powerbroker_identity_services.rb +1 -1
  33. data/lib/jamf/api/classic/api_objects/directory_binding_type.rb +47 -0
  34. data/lib/{jss/api_object/disk_encryption_configurations.rb → jamf/api/classic/api_objects/disk_encryption_configuration.rb} +14 -14
  35. data/lib/{jss/api_object → jamf/api/classic/api_objects}/distribution_point.rb +41 -35
  36. data/lib/{jss/api_object → jamf/api/classic/api_objects}/dock_item.rb +12 -12
  37. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ebook.rb +3 -3
  38. data/lib/{jss/api_object → jamf/api/classic/api_objects}/extendable.rb +23 -23
  39. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ibeacon.rb +15 -15
  40. data/lib/{jss/api_object/self_servable → jamf/api/classic/api_objects}/icon.rb +8 -8
  41. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ldap_server.rb +45 -34
  42. data/lib/{jss/api_object → jamf/api/classic/api_objects}/locatable.rb +6 -6
  43. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mac_application.rb +18 -18
  44. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/audit_event.rb +4 -4
  45. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/casper_imaging_log.rb +4 -5
  46. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/casper_remote_log.rb +4 -4
  47. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/computer_usage_log.rb +4 -4
  48. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/ebook.rb +7 -7
  49. data/lib/{jss/api_object/management_history/hashlike.rb → jamf/api/classic/api_objects/management_history/hash_like.rb} +3 -3
  50. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mac_app_store_app.rb +4 -4
  51. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mdm_command.rb +9 -9
  52. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mobile_device_app.rb +4 -4
  53. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/policy_log.rb +5 -5
  54. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/screen_sharing_log.rb +4 -4
  55. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/user_location_change.rb +4 -4
  56. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history.rb +226 -189
  57. data/lib/{jss/api_object → jamf/api/classic/api_objects}/matchable.rb +9 -6
  58. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mdm.rb +256 -151
  59. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mobile_device.rb +55 -39
  60. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mobile_device_application.rb +77 -35
  61. data/lib/{jss/api_object/configuration_profile → jamf/api/classic/api_objects}/mobile_device_configuration_profile.rb +7 -10
  62. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/mobile_device_extension_attribute.rb +19 -19
  63. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/mobile_device_group.rb +8 -8
  64. data/lib/{jss/api_object → jamf/api/classic/api_objects}/netboot_server.rb +6 -6
  65. data/lib/{jss/api_object → jamf/api/classic/api_objects}/network_segment.rb +75 -61
  66. data/lib/{jss/api_object/configuration_profile → jamf/api/classic/api_objects}/osx_configuration_profile.rb +7 -7
  67. data/lib/{jss/api_object → jamf/api/classic/api_objects}/package.rb +83 -74
  68. data/lib/{jss/api_object/patch_source → jamf/api/classic/api_objects}/patch_external_source.rb +9 -9
  69. data/lib/{jss/api_object/patch_source → jamf/api/classic/api_objects}/patch_internal_source.rb +5 -5
  70. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_policy.rb +70 -68
  71. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_title/version.rb +15 -15
  72. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_title.rb +76 -64
  73. data/lib/{jss/api_object → jamf/api/classic/api_objects}/peripheral.rb +24 -24
  74. data/lib/{jss/api_object → jamf/api/classic/api_objects}/peripheral_type.rb +20 -20
  75. data/lib/{jss/api_object → jamf/api/classic/api_objects}/policy.rb +113 -112
  76. data/lib/{jss/api_object → jamf/api/classic/api_objects}/printer.rb +52 -52
  77. data/lib/{jss/api_object → jamf/api/classic/api_objects}/purchasable.rb +6 -6
  78. data/lib/{jss/api_object → jamf/api/classic/api_objects}/removable_macaddr.rb +7 -7
  79. data/lib/{jss/api_object → jamf/api/classic/api_objects}/restricted_software.rb +21 -21
  80. data/lib/{jss/api_object → jamf/api/classic/api_objects}/scopable/scope.rb +69 -64
  81. data/lib/{jss/api_object → jamf/api/classic/api_objects}/scopable.rb +11 -13
  82. data/lib/{jss/api_object → jamf/api/classic/api_objects}/script.rb +22 -22
  83. data/lib/{jss/api_object → jamf/api/classic/api_objects}/self_servable.rb +49 -47
  84. data/lib/{jss/api_object → jamf/api/classic/api_objects}/sitable.rb +8 -8
  85. data/lib/{jss/api_object → jamf/api/classic/api_objects}/site.rb +6 -6
  86. data/lib/{jss/api_object → jamf/api/classic/api_objects}/software_update_server.rb +5 -5
  87. data/lib/{jss/api_object → jamf/api/classic/api_objects}/updatable.rb +13 -13
  88. data/lib/{jss/api_object → jamf/api/classic/api_objects}/uploadable.rb +71 -29
  89. data/lib/{jss/api_object → jamf/api/classic/api_objects}/user.rb +18 -18
  90. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/user_extension_attribute.rb +12 -12
  91. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/user_group.rb +7 -7
  92. data/lib/{jss/api_object → jamf/api/classic/api_objects}/vpp_account.rb +15 -15
  93. data/lib/{jss/api_object → jamf/api/classic/api_objects}/vppable.rb +5 -5
  94. data/lib/{jss/api_object/webhook.rb → jamf/api/classic/api_objects/web_hook.rb} +15 -15
  95. data/lib/{jss/api_object → jamf/api/classic/base_classes}/advanced_search.rb +36 -40
  96. data/lib/{jss → jamf/api/classic/base_classes}/api_object.rb +314 -274
  97. data/lib/{jss/api_object → jamf/api/classic/base_classes}/configuration_profile.rb +13 -16
  98. data/lib/{jss/api_object → jamf/api/classic/base_classes}/extension_attribute.rb +55 -59
  99. data/lib/{jss/api_object → jamf/api/classic/base_classes}/group.rb +45 -43
  100. data/lib/{jss/api_object → jamf/api/classic/base_classes}/patch_source.rb +107 -87
  101. data/lib/{jss → jamf/api/classic}/xml_workaround.rb +12 -12
  102. data/lib/jamf/api/connection/attributes.rb +177 -0
  103. data/lib/jamf/api/connection/cache.rb +148 -0
  104. data/lib/jamf/api/connection/classic_api.rb +287 -0
  105. data/lib/jamf/api/connection/connect.rb +491 -0
  106. data/lib/jamf/api/connection/constants.rb +106 -0
  107. data/lib/jamf/api/connection/default_connection.rb +103 -0
  108. data/lib/jamf/api/connection/jamf_pro_api.rb +170 -0
  109. data/lib/jamf/api/connection/jamf_pro_api_error.rb +109 -0
  110. data/lib/jamf/api/connection/token.rb +289 -99
  111. data/lib/jamf/api/connection.rb +186 -819
  112. data/lib/jamf/api/jamf_pro/api_objects/computer_prestage.rb +82 -0
  113. data/lib/jamf/api/jamf_pro/api_objects/device_enrollment.rb +358 -0
  114. data/lib/jamf/api/jamf_pro/api_objects/inventory_preload_record.rb +163 -0
  115. data/lib/jamf/api/jamf_pro/api_objects/jp_building.rb +116 -0
  116. data/lib/jamf/api/jamf_pro/api_objects/mobile_device_prestage.rb +87 -0
  117. data/lib/jamf/api/jamf_pro/base_classes/oapi_object.rb +602 -0
  118. data/lib/jamf/api/{mixins → jamf_pro/mixins}/bulk_deletable.rb +2 -1
  119. data/lib/jamf/api/jamf_pro/mixins/change_log.rb +246 -0
  120. data/lib/jamf/api/jamf_pro/mixins/collection_resource.rb +762 -0
  121. data/lib/jamf/api/{mixins → jamf_pro/mixins}/filterable.rb +21 -14
  122. data/lib/jamf/api/{mixins → jamf_pro/mixins}/immutable.rb +6 -8
  123. data/lib/jamf/api/jamf_pro/mixins/jpapi_resource.rb +167 -0
  124. data/lib/jamf/api/{mixins → jamf_pro/mixins}/lockable.rb +29 -3
  125. data/lib/jamf/api/jamf_pro/mixins/prestage.rb +346 -0
  126. data/lib/jamf/api/{mixins → jamf_pro/mixins}/sortable.rb +7 -17
  127. data/lib/jamf/api/{mixins → jamf_pro/mixins}/uncreatable.rb +2 -2
  128. data/lib/jamf/api/{mixins → jamf_pro/mixins}/undeletable.rb +2 -2
  129. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_preview_search_results.rb +90 -0
  130. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_search_results.rb +90 -0
  131. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_v2_search_results.rb +90 -0
  132. data/lib/jamf/api/jamf_pro/oapi_schemas/account.rb +160 -0
  133. data/lib/jamf/api/jamf_pro/oapi_schemas/account_group.rb +124 -0
  134. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences.rb +108 -0
  135. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v1.rb +106 -0
  136. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v4.rb +118 -0
  137. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_history.rb +161 -0
  138. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_history_search_results.rb +90 -0
  139. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_summary.rb +132 -0
  140. data/lib/jamf/api/jamf_pro/oapi_schemas/admin_account.rb +83 -0
  141. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search.rb +117 -0
  142. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search_criteria_choices.rb +84 -0
  143. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search_search_results.rb +90 -0
  144. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_user_content_search.rb +117 -0
  145. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_user_content_search_search_results.rb +90 -0
  146. data/lib/jamf/api/jamf_pro/oapi_schemas/android_details.rb +163 -0
  147. data/lib/jamf/api/jamf_pro/oapi_schemas/api_error.rb +90 -0
  148. data/lib/jamf/api/jamf_pro/oapi_schemas/api_error_cause.rb +107 -0
  149. data/lib/jamf/api/jamf_pro/oapi_schemas/app_analytics_setting.rb +88 -0
  150. data/lib/jamf/api/jamf_pro/oapi_schemas/app_dynamics_config.rb +134 -0
  151. data/lib/jamf/api/jamf_pro/oapi_schemas/app_path.rb +91 -0
  152. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_form_input_field.rb +115 -0
  153. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_form_input_field_search_results.rb +90 -0
  154. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_settings.rb +105 -0
  155. data/lib/jamf/api/jamf_pro/oapi_schemas/apple_tv_details.rb +133 -0
  156. data/lib/jamf/api/jamf_pro/oapi_schemas/application_attributes.rb +88 -0
  157. data/lib/jamf/api/jamf_pro/oapi_schemas/application_configuration.rb +88 -0
  158. data/lib/jamf/api/jamf_pro/oapi_schemas/assign_remove_profile_response_sync_state.rb +113 -0
  159. data/lib/jamf/api/jamf_pro/oapi_schemas/attributes.rb +101 -0
  160. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account.rb +159 -0
  161. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account_v1.rb +159 -0
  162. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_token.rb +91 -0
  163. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_token_v1.rb +91 -0
  164. data/lib/jamf/api/jamf_pro/oapi_schemas/authorization.rb +117 -0
  165. data/lib/jamf/api/jamf_pro/oapi_schemas/authorization_v1.rb +117 -0
  166. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_ad_migration_report_process_status.rb +116 -0
  167. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_ad_migration_report_request.rb +103 -0
  168. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration.rb +95 -0
  169. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration_request.rb +93 -0
  170. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration_update.rb +93 -0
  171. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_mappings.rb +158 -0
  172. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration.rb +147 -0
  173. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration_request.rb +146 -0
  174. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration_update.rb +132 -0
  175. data/lib/jamf/api/jamf_pro/oapi_schemas/branding_image_url.rb +87 -0
  176. data/lib/jamf/api/jamf_pro/oapi_schemas/building.rb +138 -0
  177. data/lib/jamf/api/jamf_pro/oapi_schemas/building_search_results.rb +90 -0
  178. data/lib/jamf/api/jamf_pro/oapi_schemas/cache_settings.rb +150 -0
  179. data/lib/jamf/api/jamf_pro/oapi_schemas/categories_search_results.rb +90 -0
  180. data/lib/jamf/api/jamf_pro/oapi_schemas/category.rb +104 -0
  181. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_details.rb +91 -0
  182. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_identity_v1.rb +102 -0
  183. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_identity_v2.rb +108 -0
  184. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_key.rb +90 -0
  185. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_record.rb +147 -0
  186. data/lib/jamf/api/jamf_pro/oapi_schemas/classic_ldap_mappings.rb +169 -0
  187. data/lib/jamf/api/jamf_pro/oapi_schemas/client_check_in_v2.rb +165 -0
  188. data/lib/jamf/api/jamf_pro/oapi_schemas/client_check_in_v3.rb +135 -0
  189. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common.rb +109 -0
  190. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common_request.rb +98 -0
  191. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common_response.rb +109 -0
  192. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_connection_pool_statistics.rb +175 -0
  193. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_connection_status.rb +84 -0
  194. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_keystore.rb +104 -0
  195. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_keystore_file.rb +106 -0
  196. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_mappings_request.rb +106 -0
  197. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_mappings_response.rb +109 -0
  198. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_request.rb +152 -0
  199. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_response.rb +149 -0
  200. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_update.rb +149 -0
  201. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_application.rb +125 -0
  202. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_attachment.rb +103 -0
  203. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_certificate.rb +128 -0
  204. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_configuration_profile.rb +119 -0
  205. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching.rb +373 -0
  206. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_alert.rb +121 -0
  207. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_cache_detail.rb +98 -0
  208. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error.rb +99 -0
  209. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error_user_info.rb +90 -0
  210. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent.rb +132 -0
  211. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_alert.rb +106 -0
  212. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_capabilities.rb +125 -0
  213. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_details.rb +119 -0
  214. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_local_network.rb +98 -0
  215. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk.rb +144 -0
  216. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk_encryption.rb +121 -0
  217. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_extension_attribute.rb +176 -0
  218. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_font.rb +94 -0
  219. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general.rb +231 -0
  220. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general_update.rb +113 -0
  221. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware.rb +265 -0
  222. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware_update.rb +107 -0
  223. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_ibeacon.rb +82 -0
  224. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_collection_preferences.rb +166 -0
  225. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_collection_settings.rb +109 -0
  226. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_recovery_lock_password_response.rb +84 -0
  227. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_response.rb +276 -0
  228. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_search_results.rb +90 -0
  229. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_update_request.rb +125 -0
  230. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_licensed_software.rb +89 -0
  231. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_local_user_account.rb +190 -0
  232. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_location.rb +94 -0
  233. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_mdm_capability.rb +89 -0
  234. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system.rb +133 -0
  235. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system_update.rb +83 -0
  236. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_overview.rb +180 -0
  237. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_package_receipts.rb +98 -0
  238. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition.rb +146 -0
  239. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_encryption.rb +94 -0
  240. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_file_vault2_state.rb +98 -0
  241. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_plugin.rb +94 -0
  242. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage.rb +107 -0
  243. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_search_results.rb +90 -0
  244. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_search_results_v2.rb +90 -0
  245. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_v2.rb +130 -0
  246. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_printer.rb +100 -0
  247. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_purchase.rb +159 -0
  248. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_remote_management.rb +95 -0
  249. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_section.rb +110 -0
  250. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_security.rb +180 -0
  251. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_service.rb +82 -0
  252. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_software_update.rb +94 -0
  253. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_storage.rb +91 -0
  254. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_user_and_location.rb +132 -0
  255. data/lib/jamf/api/jamf_pro/oapi_schemas/computers_search_results.rb +90 -0
  256. data/lib/jamf/api/jamf_pro/oapi_schemas/configuration_profile.rb +103 -0
  257. data/lib/jamf/api/jamf_pro/oapi_schemas/configuration_search_results.rb +91 -0
  258. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_candidate_request.rb +124 -0
  259. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_response.rb +123 -0
  260. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_status_response.rb +86 -0
  261. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_update_request.rb +110 -0
  262. data/lib/jamf/api/jamf_pro/oapi_schemas/country.rb +88 -0
  263. data/lib/jamf/api/jamf_pro/oapi_schemas/country_codes.rb +84 -0
  264. data/lib/jamf/api/jamf_pro/oapi_schemas/create_path.rb +98 -0
  265. data/lib/jamf/api/jamf_pro/oapi_schemas/csa_token.rb +94 -0
  266. data/lib/jamf/api/jamf_pro/oapi_schemas/current_account.rb +160 -0
  267. data/lib/jamf/api/jamf_pro/oapi_schemas/current_authorization.rb +109 -0
  268. data/lib/jamf/api/jamf_pro/oapi_schemas/data_roaming_setting.rb +88 -0
  269. data/lib/jamf/api/jamf_pro/oapi_schemas/database_password.rb +89 -0
  270. data/lib/jamf/api/jamf_pro/oapi_schemas/day_of_week.rb +93 -0
  271. data/lib/jamf/api/jamf_pro/oapi_schemas/delete_user_command.rb +94 -0
  272. data/lib/jamf/api/jamf_pro/oapi_schemas/department.rb +98 -0
  273. data/lib/jamf/api/jamf_pro/oapi_schemas/departments_search_results.rb +90 -0
  274. data/lib/jamf/api/jamf_pro/oapi_schemas/deployment_task.rb +130 -0
  275. data/lib/jamf/api/jamf_pro/oapi_schemas/deployment_task_search_results.rb +92 -0
  276. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_configuration_request.rb +92 -0
  277. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_configuration_response.rb +105 -0
  278. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_configuration_search_results.rb +91 -0
  279. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_configuration_update.rb +92 -0
  280. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_server_request.rb +166 -0
  281. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_server_response.rb +163 -0
  282. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_server_update.rb +171 -0
  283. data/lib/jamf/api/jamf_pro/oapi_schemas/device_communication_settings.rb +129 -0
  284. data/lib/jamf/api/jamf_pro/oapi_schemas/device_compliance_information.rb +118 -0
  285. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_device.rb +163 -0
  286. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_device_search_results.rb +90 -0
  287. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_disown_body.rb +84 -0
  288. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_disown_response.rb +83 -0
  289. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance.rb +164 -0
  290. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance_search_results.rb +90 -0
  291. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance_sync_status.rb +99 -0
  292. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_prestage.rb +216 -0
  293. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_prestage_v2.rb +235 -0
  294. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_token.rb +95 -0
  295. data/lib/jamf/api/jamf_pro/oapi_schemas/diagnostic_submission_setting.rb +88 -0
  296. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook.rb +153 -0
  297. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_exclusions.rb +138 -0
  298. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_limitations.rb +98 -0
  299. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_scope.rb +171 -0
  300. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_search_results.rb +90 -0
  301. data/lib/jamf/api/jamf_pro/oapi_schemas/enable_lost_mode_command.rb +94 -0
  302. data/lib/jamf/api/jamf_pro/oapi_schemas/engage.rb +85 -0
  303. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group.rb +123 -0
  304. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group_preview.rb +135 -0
  305. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group_v2.rb +133 -0
  306. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization.rb +107 -0
  307. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_branding_settings.rb +112 -0
  308. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_dependencies.rb +84 -0
  309. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_dependency.rb +94 -0
  310. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_ldap_group_access.rb +88 -0
  311. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel.rb +90 -0
  312. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_ldap_auth.rb +122 -0
  313. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_list.rb +84 -0
  314. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_sso_auth.rb +114 -0
  315. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_text.rb +113 -0
  316. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_search_results.rb +90 -0
  317. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_search_results_v2.rb +90 -0
  318. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_v2.rb +116 -0
  319. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_method.rb +98 -0
  320. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_process_text_object.rb +347 -0
  321. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_settings.rb +264 -0
  322. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_settings_v2.rb +274 -0
  323. data/lib/jamf/api/jamf_pro/oapi_schemas/export_field.rb +92 -0
  324. data/lib/jamf/api/jamf_pro/oapi_schemas/export_parameters.rb +118 -0
  325. data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attribute.rb +116 -0
  326. data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attribute_v2.rb +117 -0
  327. data/lib/jamf/api/jamf_pro/oapi_schemas/external_recipient.rb +92 -0
  328. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment.rb +90 -0
  329. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment_delete.rb +84 -0
  330. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment_v2.rb +90 -0
  331. data/lib/jamf/api/jamf_pro/oapi_schemas/filter.rb +105 -0
  332. data/lib/jamf/api/jamf_pro/oapi_schemas/font_path.rb +91 -0
  333. data/lib/jamf/api/jamf_pro/oapi_schemas/get_computer_prestage.rb +106 -0
  334. data/lib/jamf/api/jamf_pro/oapi_schemas/get_computer_prestage_v2.rb +105 -0
  335. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization.rb +88 -0
  336. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel.rb +90 -0
  337. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_ldap_auth.rb +94 -0
  338. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_sso_auth.rb +94 -0
  339. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_text.rb +94 -0
  340. data/lib/jamf/api/jamf_pro/oapi_schemas/get_mobile_device_prestage.rb +106 -0
  341. data/lib/jamf/api/jamf_pro/oapi_schemas/get_mobile_device_prestage_v2.rb +104 -0
  342. data/lib/jamf/api/jamf_pro/oapi_schemas/group_mappings.rb +139 -0
  343. data/lib/jamf/api/jamf_pro/oapi_schemas/group_membership.rb +95 -0
  344. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search.rb +107 -0
  345. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search_request.rb +86 -0
  346. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search_response.rb +92 -0
  347. data/lib/jamf/api/jamf_pro/oapi_schemas/history_search_results.rb +142 -0
  348. data/lib/jamf/api/jamf_pro/oapi_schemas/history_search_results_v1.rb +92 -0
  349. data/lib/jamf/api/jamf_pro/oapi_schemas/href_response.rb +169 -0
  350. data/lib/jamf/api/jamf_pro/oapi_schemas/icon_response.rb +92 -0
  351. data/lib/jamf/api/jamf_pro/oapi_schemas/id_and_name.rb +93 -0
  352. data/lib/jamf/api/jamf_pro/oapi_schemas/id_and_name_v2.rb +89 -0
  353. data/lib/jamf/api/jamf_pro/oapi_schemas/ids.rb +96 -0
  354. data/lib/jamf/api/jamf_pro/oapi_schemas/initialize.rb +134 -0
  355. data/lib/jamf/api/jamf_pro/oapi_schemas/initialize_v1.rb +134 -0
  356. data/lib/jamf/api/jamf_pro/oapi_schemas/install_package.rb +104 -0
  357. data/lib/jamf/api/jamf_pro/oapi_schemas/integer_wrapper.rb +85 -0
  358. data/lib/jamf/api/jamf_pro/oapi_schemas/internal_recipient.rb +95 -0
  359. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_information.rb +114 -0
  360. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_error.rb +124 -0
  361. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_error.rb +90 -0
  362. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_error_cause.rb +106 -0
  363. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_success.rb +87 -0
  364. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute.rb +90 -0
  365. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute_column.rb +88 -0
  366. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute_column_result.rb +90 -0
  367. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_invalid_csv_response.rb +89 -0
  368. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record.rb +249 -0
  369. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_search_results.rb +92 -0
  370. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_search_results_v2.rb +90 -0
  371. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_v2.rb +264 -0
  372. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_branding_configuration.rb +130 -0
  373. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_branding_search_results.rb +90 -0
  374. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_details.rb +256 -0
  375. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_details_v2.rb +256 -0
  376. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_application_response.rb +96 -0
  377. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_nation_credentials.rb +91 -0
  378. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_package_response.rb +108 -0
  379. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_information.rb +125 -0
  380. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_server_url.rb +93 -0
  381. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_version.rb +83 -0
  382. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_protect_plan.rb +126 -0
  383. data/lib/jamf/api/jamf_pro/oapi_schemas/language_code.rb +95 -0
  384. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_request.rb +100 -0
  385. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_response.rb +102 -0
  386. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_update.rb +100 -0
  387. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_group.rb +108 -0
  388. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_group_search_results.rb +92 -0
  389. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_server.rb +95 -0
  390. data/lib/jamf/api/jamf_pro/oapi_schemas/linked_connect_profile.rb +127 -0
  391. data/lib/jamf/api/jamf_pro/oapi_schemas/linked_connect_profile_search_results.rb +90 -0
  392. data/lib/jamf/api/jamf_pro/oapi_schemas/locale.rb +89 -0
  393. data/lib/jamf/api/jamf_pro/oapi_schemas/location.rb +126 -0
  394. data/lib/jamf/api/jamf_pro/oapi_schemas/location_information.rb +147 -0
  395. data/lib/jamf/api/jamf_pro/oapi_schemas/location_information_v2.rb +147 -0
  396. data/lib/jamf/api/jamf_pro/oapi_schemas/location_v2.rb +125 -0
  397. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_branding_configuration.rb +119 -0
  398. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_branding_search_results.rb +90 -0
  399. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_managed_software_update.rb +113 -0
  400. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_managed_software_update_response.rb +92 -0
  401. data/lib/jamf/api/jamf_pro/oapi_schemas/markdown.rb +85 -0
  402. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_client_type.rb +91 -0
  403. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command.rb +110 -0
  404. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_client.rb +89 -0
  405. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_request.rb +90 -0
  406. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_state.rb +90 -0
  407. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_type.rb +173 -0
  408. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_signing_certificate.rb +102 -0
  409. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_mappings.rb +85 -0
  410. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_test_search_request.rb +93 -0
  411. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_test_search_response.rb +91 -0
  412. data/lib/jamf/api/jamf_pro/oapi_schemas/memcached_endpoints.rb +114 -0
  413. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device.rb +154 -0
  414. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_application.rb +101 -0
  415. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_attachment.rb +90 -0
  416. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_attachment_v2.rb +90 -0
  417. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_certificate_v1.rb +88 -0
  418. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_certificate_v2.rb +88 -0
  419. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details.rb +236 -0
  420. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details_get_v2.rb +84 -0
  421. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details_v2.rb +254 -0
  422. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_ebook.rb +95 -0
  423. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_extension_attribute_results.rb +84 -0
  424. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_group.rb +97 -0
  425. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage.rb +137 -0
  426. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name.rb +95 -0
  427. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name_v2.rb +95 -0
  428. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names.rb +119 -0
  429. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names_v2.rb +119 -0
  430. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_search_results.rb +90 -0
  431. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_search_results_v2.rb +90 -0
  432. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_v2.rb +176 -0
  433. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_params.rb +145 -0
  434. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_results.rb +90 -0
  435. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_results_v2.rb +90 -0
  436. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_v2.rb +159 -0
  437. data/lib/jamf/api/jamf_pro/oapi_schemas/network.rb +172 -0
  438. data/lib/jamf/api/jamf_pro/oapi_schemas/network_v2.rb +180 -0
  439. data/lib/jamf/api/jamf_pro/oapi_schemas/notification.rb +97 -0
  440. data/lib/jamf/api/jamf_pro/oapi_schemas/notification_type.rb +141 -0
  441. data/lib/jamf/api/jamf_pro/oapi_schemas/notification_v1.rb +97 -0
  442. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history.rb +138 -0
  443. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history_note.rb +138 -0
  444. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history_v1.rb +107 -0
  445. data/lib/jamf/api/jamf_pro/oapi_schemas/order_by.rb +96 -0
  446. data/lib/jamf/api/jamf_pro/oapi_schemas/package_manifest.rb +149 -0
  447. data/lib/jamf/api/jamf_pro/oapi_schemas/parent_app.rb +131 -0
  448. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_ids_on_dashboard.rb +84 -0
  449. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_attempt.rb +103 -0
  450. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_attempt_action.rb +95 -0
  451. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_log.rb +125 -0
  452. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_log_search_results.rb +90 -0
  453. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_on_dashboard.rb +83 -0
  454. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_summary.rb +147 -0
  455. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_version.rb +97 -0
  456. data/lib/jamf/api/jamf_pro/oapi_schemas/personal_hotspot_setting.rb +88 -0
  457. data/lib/jamf/api/jamf_pro/oapi_schemas/plan_search_results.rb +90 -0
  458. data/lib/jamf/api/jamf_pro/oapi_schemas/plugin_path.rb +91 -0
  459. data/lib/jamf/api/jamf_pro/oapi_schemas/policy_properties.rb +92 -0
  460. data/lib/jamf/api/jamf_pro/oapi_schemas/policy_properties_v1.rb +92 -0
  461. data/lib/jamf/api/jamf_pro/oapi_schemas/post_computer_prestage_v2.rb +86 -0
  462. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_dependencies.rb +86 -0
  463. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_dependency.rb +94 -0
  464. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_file_attachment.rb +96 -0
  465. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_file_attachment_v2.rb +96 -0
  466. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information.rb +175 -0
  467. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information_v2.rb +175 -0
  468. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope.rb +85 -0
  469. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment.rb +94 -0
  470. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment_v2.rb +95 -0
  471. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_response.rb +110 -0
  472. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_response_v2.rb +110 -0
  473. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_update.rb +114 -0
  474. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_v2.rb +85 -0
  475. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_sync_status.rb +99 -0
  476. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_sync_status_v2.rb +99 -0
  477. data/lib/jamf/api/jamf_pro/oapi_schemas/process_texts_search_results.rb +92 -0
  478. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_registration_request.rb +99 -0
  479. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_settings_response.rb +142 -0
  480. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_updatable_settings_request.rb +84 -0
  481. data/lib/jamf/api/jamf_pro/oapi_schemas/provisioning_profile.rb +96 -0
  482. data/lib/jamf/api/jamf_pro/oapi_schemas/purchasing.rb +154 -0
  483. data/lib/jamf/api/jamf_pro/oapi_schemas/purchasing_v2.rb +154 -0
  484. data/lib/jamf/api/jamf_pro/oapi_schemas/put_computer_prestage.rb +83 -0
  485. data/lib/jamf/api/jamf_pro/oapi_schemas/put_computer_prestage_v2.rb +92 -0
  486. data/lib/jamf/api/jamf_pro/oapi_schemas/put_mobile_device_prestage.rb +83 -0
  487. data/lib/jamf/api/jamf_pro/oapi_schemas/put_mobile_device_prestage_v2.rb +83 -0
  488. data/lib/jamf/api/jamf_pro/oapi_schemas/recalculation_results.rb +93 -0
  489. data/lib/jamf/api/jamf_pro/oapi_schemas/recipient.rb +95 -0
  490. data/lib/jamf/api/jamf_pro/oapi_schemas/recipients.rb +83 -0
  491. data/lib/jamf/api/jamf_pro/oapi_schemas/redeploy_jamf_management_framework_response.rb +89 -0
  492. data/lib/jamf/api/jamf_pro/oapi_schemas/reenrollment.rb +118 -0
  493. data/lib/jamf/api/jamf_pro/oapi_schemas/remote_administration_response.rb +108 -0
  494. data/lib/jamf/api/jamf_pro/oapi_schemas/remote_administration_search_results.rb +91 -0
  495. data/lib/jamf/api/jamf_pro/oapi_schemas/renew_mdm_profile_response.rb +83 -0
  496. data/lib/jamf/api/jamf_pro/oapi_schemas/restart_device_command.rb +96 -0
  497. data/lib/jamf/api/jamf_pro/oapi_schemas/retry_patch_policy_params.rb +98 -0
  498. data/lib/jamf/api/jamf_pro/oapi_schemas/safelisted_apps.rb +85 -0
  499. data/lib/jamf/api/jamf_pro/oapi_schemas/script.rb +193 -0
  500. data/lib/jamf/api/jamf_pro/oapi_schemas/scripts_search_results.rb +90 -0
  501. data/lib/jamf/api/jamf_pro/oapi_schemas/search_active_patch_history_params.rb +122 -0
  502. data/lib/jamf/api/jamf_pro/oapi_schemas/search_patch_policy_log_params.rb +122 -0
  503. data/lib/jamf/api/jamf_pro/oapi_schemas/security.rb +131 -0
  504. data/lib/jamf/api/jamf_pro/oapi_schemas/security_v2.rb +130 -0
  505. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_install_settings.rb +93 -0
  506. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_interaction_settings.rb +123 -0
  507. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_login_settings.rb +114 -0
  508. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_settings.rb +101 -0
  509. data/lib/jamf/api/jamf_pro/oapi_schemas/session.rb +83 -0
  510. data/lib/jamf/api/jamf_pro/oapi_schemas/session_candidate_request.rb +109 -0
  511. data/lib/jamf/api/jamf_pro/oapi_schemas/session_details.rb +176 -0
  512. data/lib/jamf/api/jamf_pro/oapi_schemas/session_details_search_results.rb +91 -0
  513. data/lib/jamf/api/jamf_pro/oapi_schemas/session_status.rb +99 -0
  514. data/lib/jamf/api/jamf_pro/oapi_schemas/set_recovery_lock_command.rb +83 -0
  515. data/lib/jamf/api/jamf_pro/oapi_schemas/settings_command.rb +168 -0
  516. data/lib/jamf/api/jamf_pro/oapi_schemas/shared_device_configuration.rb +88 -0
  517. data/lib/jamf/api/jamf_pro/oapi_schemas/signature.rb +94 -0
  518. data/lib/jamf/api/jamf_pro/oapi_schemas/site.rb +92 -0
  519. data/lib/jamf/api/jamf_pro/oapi_schemas/smart_search_criterion.rb +119 -0
  520. data/lib/jamf/api/jamf_pro/oapi_schemas/software_title_configuration.rb +90 -0
  521. data/lib/jamf/api/jamf_pro/oapi_schemas/software_title_patch_policy_summaries.rb +90 -0
  522. data/lib/jamf/api/jamf_pro/oapi_schemas/software_update_settings.rb +89 -0
  523. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore.rb +129 -0
  524. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_cert_parse_response.rb +131 -0
  525. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_details.rb +108 -0
  526. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_parse.rb +104 -0
  527. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_response.rb +121 -0
  528. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_response_with_details.rb +94 -0
  529. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_with_details.rb +94 -0
  530. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_metadata_url.rb +84 -0
  531. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_settings.rb +241 -0
  532. data/lib/jamf/api/jamf_pro/oapi_schemas/startup_status.rb +186 -0
  533. data/lib/jamf/api/jamf_pro/oapi_schemas/static_user_group.rb +92 -0
  534. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity.rb +108 -0
  535. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_certificate_upload.rb +100 -0
  536. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_create.rb +91 -0
  537. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_search_results.rb +90 -0
  538. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_update.rb +84 -0
  539. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_features.rb +106 -0
  540. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_settings_request.rb +108 -0
  541. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_settings_response.rb +122 -0
  542. data/lib/jamf/api/jamf_pro/oapi_schemas/time_frame.rb +88 -0
  543. data/lib/jamf/api/jamf_pro/oapi_schemas/time_zone.rb +108 -0
  544. data/lib/jamf/api/jamf_pro/oapi_schemas/tv_os_details.rb +133 -0
  545. data/lib/jamf/api/jamf_pro/oapi_schemas/udids.rb +84 -0
  546. data/lib/jamf/api/jamf_pro/oapi_schemas/update_apple_tv.rb +88 -0
  547. data/lib/jamf/api/jamf_pro/oapi_schemas/update_ios.rb +82 -0
  548. data/lib/jamf/api/jamf_pro/oapi_schemas/update_ios_v2.rb +82 -0
  549. data/lib/jamf/api/jamf_pro/oapi_schemas/update_mobile_device.rb +123 -0
  550. data/lib/jamf/api/jamf_pro/oapi_schemas/update_mobile_device_v2.rb +138 -0
  551. data/lib/jamf/api/jamf_pro/oapi_schemas/update_tv_os.rb +88 -0
  552. data/lib/jamf/api/jamf_pro/oapi_schemas/user_attributes.rb +118 -0
  553. data/lib/jamf/api/jamf_pro/oapi_schemas/user_mappings.rb +194 -0
  554. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search.rb +113 -0
  555. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search_request.rb +86 -0
  556. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search_response.rb +92 -0
  557. data/lib/jamf/api/jamf_pro/oapi_schemas/v1_site.rb +91 -0
  558. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_ca_record.rb +148 -0
  559. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_pki_payload_record.rb +88 -0
  560. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_pki_payload_record_search_results.rb +90 -0
  561. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_service_status.rb +84 -0
  562. data/lib/jamf/api/jamf_pro/oapi_schemas/verbose_package_deployment_response.rb +91 -0
  563. data/lib/jamf/api/jamf_pro/oapi_schemas/voice_roaming_setting.rb +88 -0
  564. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_content.rb +154 -0
  565. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location.rb +87 -0
  566. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_list_view.rb +172 -0
  567. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_patch.rb +112 -0
  568. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_post.rb +115 -0
  569. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_locations.rb +90 -0
  570. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscription.rb +87 -0
  571. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscription_base.rb +128 -0
  572. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscriptions.rb +90 -0
  573. data/lib/jamf/api/jamf_pro/oapi_schemas/vpp_admin_account.rb +120 -0
  574. data/lib/jamf/api/jamf_pro/oapi_schemas/vpp_token_subscription.rb +124 -0
  575. data/lib/jamf/api/jamf_pro/oapi_schemas/web_link.rb +88 -0
  576. data/lib/jamf/api/jamf_pro/oapi_schemas.rb +35 -0
  577. data/lib/{jss/ruby_extensions/string.rb → jamf/api/jamf_pro/other_classes/change_log_entry.rb} +12 -10
  578. data/lib/jamf/api/{attribute_classes → jamf_pro/other_classes}/ip_address.rb +2 -8
  579. data/lib/jamf/api/jamf_pro/other_classes/pager.rb +257 -0
  580. data/lib/jamf/api/{attribute_classes → jamf_pro/other_classes}/timestamp.rb +18 -14
  581. data/lib/jamf/{api/mixins/base_class.rb → base_class.rb} +8 -8
  582. data/lib/jamf/client/jamf_binary.rb +104 -98
  583. data/lib/jamf/client/jamf_helper.rb +263 -255
  584. data/lib/jamf/client/management_action.rb +71 -72
  585. data/lib/jamf/client.rb +15 -86
  586. data/lib/jamf/composer.rb +5 -5
  587. data/lib/jamf/configuration.rb +219 -196
  588. data/lib/jamf/{api/json_objects/prestage_sync_status.rb → constants.rb} +15 -32
  589. data/lib/{jss → jamf}/db_connection.rb +23 -31
  590. data/lib/{jpapi.rb → jamf/deprecations/deprecated_api_constant.rb} +3 -4
  591. data/lib/jamf/deprecations/deprecated_config_constant.rb +25 -0
  592. data/lib/jamf/exceptions.rb +14 -15
  593. data/lib/jamf/oapi_validate.rb +502 -0
  594. data/lib/jamf/ruby_extensions/array/predicates.rb +3 -1
  595. data/lib/jamf/ruby_extensions/array/utils.rb +2 -11
  596. data/lib/jamf/ruby_extensions/array.rb +1 -1
  597. data/lib/jamf/ruby_extensions/filetest/predicates.rb +2 -1
  598. data/lib/jamf/ruby_extensions/filetest.rb +1 -1
  599. data/lib/jamf/ruby_extensions/hash/{backports.rb → utils.rb} +53 -34
  600. data/lib/jamf/ruby_extensions/hash.rb +3 -3
  601. data/lib/jamf/ruby_extensions/ipaddr/utils.rb +7 -4
  602. data/lib/jamf/ruby_extensions/ipaddr.rb +2 -2
  603. data/lib/jamf/ruby_extensions/object/predicates.rb +3 -1
  604. data/lib/jamf/ruby_extensions/object.rb +1 -1
  605. data/lib/jamf/ruby_extensions/pathname/predicates.rb +3 -1
  606. data/lib/jamf/ruby_extensions/pathname/utils.rb +11 -5
  607. data/lib/jamf/ruby_extensions/pathname.rb +1 -1
  608. data/lib/jamf/ruby_extensions/string/conversions.rb +16 -1
  609. data/lib/jamf/ruby_extensions/string/predicates.rb +3 -1
  610. data/lib/jamf/ruby_extensions/string.rb +1 -3
  611. data/lib/{jss/ruby_extensions/time.rb → jamf/ruby_extensions/time/utils.rb} +40 -25
  612. data/lib/{jss/version.rb → jamf/ruby_extensions/time.rb} +7 -6
  613. data/lib/jamf/ruby_extensions.rb +9 -9
  614. data/lib/jamf/utility.rb +626 -410
  615. data/lib/jamf/validate.rb +86 -125
  616. data/lib/jamf/version.rb +3 -3
  617. data/lib/jamf.rb +76 -131
  618. data/lib/jss-api.rb +2 -2
  619. data/lib/jss.rb +3 -215
  620. data/lib/ruby-jss.rb +2 -2
  621. data/lib/zeitwerk_config.rb +162 -0
  622. data/test/README.md +27 -112
  623. data/test/bin/runtests +57 -130
  624. data/test/lib/jamf_test/APITest.rb +80 -0
  625. data/test/lib/jamf_test/auth.rb +267 -0
  626. data/test/lib/jamf_test/collection_tests.rb +393 -0
  627. data/test/lib/{testhelper.rb → jamf_test.rb} +8 -11
  628. data/{lib/jss/ruby_extensions/filetest.rb → test/tests/category.rb} +17 -20
  629. data/test/tests/device_enrollment.rb +101 -0
  630. data/test/tests/inventory_preload_record.rb +131 -0
  631. data/{lib/jss/ruby_extensions.rb → test/tests/jp_building.rb} +16 -12
  632. data/test/tests/policy.rb +163 -0
  633. metadata +646 -204
  634. data/lib/jamf/api/base_classes/collection_resource.rb +0 -612
  635. data/lib/jamf/api/base_classes/json_object.rb +0 -1103
  636. data/lib/jamf/api/base_classes/prestage.rb +0 -503
  637. data/lib/jamf/api/base_classes/resource.rb +0 -259
  638. data/lib/jamf/api/base_classes/singleton_resource.rb +0 -88
  639. data/lib/jamf/api/connection/api_error.rb +0 -111
  640. data/lib/jamf/api/connection/api_error_styleguide.rb +0 -96
  641. data/lib/jamf/api/json_objects/change_log_entry.rb +0 -77
  642. data/lib/jamf/api/json_objects/country.rb +0 -51
  643. data/lib/jamf/api/json_objects/device_enrollment_device.rb +0 -165
  644. data/lib/jamf/api/json_objects/device_enrollment_device_sync_state.rb +0 -81
  645. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +0 -71
  646. data/lib/jamf/api/json_objects/inventory_preload_extension_attribute.rb +0 -57
  647. data/lib/jamf/api/json_objects/locale.rb +0 -59
  648. data/lib/jamf/api/json_objects/md_prestage_name.rb +0 -57
  649. data/lib/jamf/api/json_objects/md_prestage_names.rb +0 -82
  650. data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +0 -214
  651. data/lib/jamf/api/json_objects/prestage_assignment.rb +0 -76
  652. data/lib/jamf/api/json_objects/prestage_location.rb +0 -104
  653. data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +0 -132
  654. data/lib/jamf/api/json_objects/prestage_scope.rb +0 -57
  655. data/lib/jamf/api/json_objects/time_zone.rb +0 -105
  656. data/lib/jamf/api/mixins/change_log.rb +0 -288
  657. data/lib/jamf/api/mixins/extendable.rb +0 -75
  658. data/lib/jamf/api/mixins/pageable.rb +0 -208
  659. data/lib/jamf/api/mixins/searchable.rb +0 -202
  660. data/lib/jamf/api/resources/collection_resources/building.rb +0 -121
  661. data/lib/jamf/api/resources/collection_resources/category.rb +0 -83
  662. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +0 -89
  663. data/lib/jamf/api/resources/collection_resources/department.rb +0 -78
  664. data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +0 -384
  665. data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +0 -289
  666. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +0 -143
  667. data/lib/jamf/api/resources/collection_resources/script.rb +0 -226
  668. data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +0 -141
  669. data/lib/jamf/api/resources/singleton_resources/locales.rb +0 -155
  670. data/lib/jamf/api/resources/singleton_resources/time_zones.rb +0 -213
  671. data/lib/jamf/compatibility.rb +0 -88
  672. data/lib/jamf/ruby_extensions/dig.rb +0 -52
  673. data/lib/jamf/ruby_extensions/string/backports.rb +0 -66
  674. data/lib/jss/api_connection.rb +0 -1029
  675. data/lib/jss/api_object/app_store_country_codes.rb +0 -298
  676. data/lib/jss/api_object/computer/application_installs.rb +0 -118
  677. data/lib/jss/client/jamf_binary.rb +0 -132
  678. data/lib/jss/client/jamf_helper.rb +0 -298
  679. data/lib/jss/client/management_action.rb +0 -113
  680. data/lib/jss/client.rb +0 -301
  681. data/lib/jss/compatibility.rb +0 -88
  682. data/lib/jss/composer.rb +0 -190
  683. data/lib/jss/configuration.rb +0 -319
  684. data/lib/jss/exceptions.rb +0 -115
  685. data/lib/jss/ruby_extensions/array.rb +0 -52
  686. data/lib/jss/ruby_extensions/hash.rb +0 -140
  687. data/lib/jss/ruby_extensions/ipaddr.rb +0 -92
  688. data/lib/jss/ruby_extensions/object.rb +0 -19
  689. data/lib/jss/ruby_extensions/pathname.rb +0 -78
  690. data/lib/jss/ruby_extensions/string/backports.rb +0 -68
  691. data/lib/jss/ruby_extensions/string/conversions.rb +0 -69
  692. data/lib/jss/ruby_extensions/string/predicates.rb +0 -57
  693. data/lib/jss/server.rb +0 -146
  694. data/lib/jss/utility.rb +0 -672
  695. data/lib/jss/validate.rb +0 -248
  696. data/test/lib/testhelper/auth.rb +0 -275
  697. data/test/lib/testhelper/patch_mgmt.rb +0 -123
  698. data/test/specs/api_connection_spec.rb +0 -57
  699. data/test/specs/patch01_source_spec.rb +0 -54
  700. data/test/specs/patch02_internal_source_spec.rb +0 -88
  701. data/test/specs/patch03_external_source_spec.rb +0 -120
  702. data/test/specs/patch04_titles_spec.rb +0 -207
  703. data/test/specs/patch05_policies_spec.rb +0 -119
  704. data/test/specs/patch06_cleanup_spec.rb +0 -52
  705. data/test/specs/policy_spec.rb +0 -112
data/lib/jamf/utility.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Pixar
1
+ # Copyright 2022 Pixar
2
2
 
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -23,429 +23,645 @@
23
23
  #
24
24
  #
25
25
 
26
- # The Module
27
26
  module Jamf
28
27
 
29
- # Constants
30
- ###################################
31
-
32
- # These Utility constants are useful all over the place.
33
- # Many of them are commonly used Strings.
34
-
35
- BLANK = ''.freeze
36
-
37
- UNDERSCORE = '_'.freeze
38
-
39
28
  # A collection of useful utility methods. Mostly for
40
29
  # converting values between formats, parsing data, and
41
30
  # user interaction.
31
+ # This module should be extended into the Jamf Module so all methods
32
+ # become module methods
33
+ ########################
34
+ module Utility
35
+
36
+ include Jamf::Constants
37
+
38
+ # Hash of 'minor' => 'maint'
39
+ # The maximum maint release for macOS 10.minor.maint
40
+ # e.g the highest release of 10.6 was 10.6.8, the highest release of
41
+ # 10.15 was 10.15.7
42
+ #
43
+ # 12 is the default for the current OS and higher
44
+ # (and hoping apple doesn't release 10.16.13)
45
+ OS_TEN_MAXS = {
46
+ 2 => 8,
47
+ 3 => 9,
48
+ 4 => 11,
49
+ 5 => 8,
50
+ 6 => 8,
51
+ 7 => 5,
52
+ 8 => 5,
53
+ 9 => 5,
54
+ 10 => 5,
55
+ 11 => 6,
56
+ 12 => 6,
57
+ 13 => 6,
58
+ 14 => 6,
59
+ 15 => 7
60
+ }
61
+
62
+ # Hash of 'major' => 'minor'
63
+ # The maximum minor release for macOS major.minor
64
+ # e.g. the highest release of 11 is 11.12
65
+ #
66
+ # 12 is the default for the current OS and higher
67
+ # (and hoping apple doesn't release, e.g., 11.13)
68
+ MAC_OS_MAXS = {
69
+ 11 => 12,
70
+ 12 => 12,
71
+ 13 => 12,
72
+ 14 => 12,
73
+ 15 => 12,
74
+ 16 => 12,
75
+ 17 => 12,
76
+ 18 => 12,
77
+ 19 => 12,
78
+ 20 => 12
79
+ }
80
+
81
+ # Converts an OS Version into an Array of equal or higher OS versions, up to
82
+ # some non-existant max, hopefully far in the future, currently 20.12.10
83
+ #
84
+ # This array can then be joined with commas and used as the value of the
85
+ # os_requirements for Packages and Scripts.
86
+ #
87
+ # It's unlikely that this method, as written, will still be in use by
88
+ # the release of macOS 20.12.10, but currently thats the upper limit.
89
+ #
90
+ # Hopefully well before then JAMF will implement a "minimum OS" in Jamf Pro
91
+ # itself, then we could avoid the inherant limitations in using a method like
92
+ # this.
93
+ #
94
+ # When the highest maint. release of an OS version is not known, because its
95
+ # the currently released OS version or higher, then this method assumes '12'
96
+ # e.g. '10.16.12', '11.12', '12.12', etc.
97
+ #
98
+ # Apple has never released more than 11 updates to a version of macOS
99
+ # (that being 10.4), so hopefully 12 is enough
100
+ #
101
+ # Since Big Sur might report itself as either '10.16' or '11.x.x', this method
102
+ # will allow for both possibilities, and the array will contain whatever
103
+ # iterations needed for both version numbers
104
+ #
105
+ # @param min_os [String] the mimimum OS version to expand, e.g. ">=10.9.4" or "11.1"
106
+ #
107
+ # @return [Array] Nearly all potential OS versions from the minimum to 20.12.10
108
+ #
109
+ # @example
110
+ # JSS.expand_min_os ">=10.9.4" # => returns this array
111
+ # # ["10.9.4",
112
+ # # "10.9.5",
113
+ # # "10.10.x"
114
+ # # ...
115
+ # # "10.16.x",
116
+ # # "11.x",
117
+ # # "12.x",
118
+ # # ...
119
+ # # "20.x"]
120
+ #
121
+ #
122
+ def expand_min_os(min_os)
123
+ min_os = min_os.delete '>='
124
+
125
+ # split the version into major, minor and maintenance release numbers
126
+ major, minor, maint = min_os.split('.')
127
+ minor = 'x' if minor.nil? || minor == '0'
128
+ maint = 'x' if maint.nil? || maint == '0'
42
129
 
43
- # TODO: confirm need for each method in Jamf Pro API.
44
-
45
- # Converts an OS Version into an Array of higher OS versions.
46
- #
47
- # It's unlikely that this library will still be in use as-is by the release of OS X 10.30.20.
48
- # Hopefully well before then JAMF will implement a "minimum OS" in the JSS itself.
49
- #
50
- # @param min_os [String] the mimimum OS version to expand, e.g. ">=10.6.7" or "10.6.7"
51
- #
52
- # @return [Array] Nearly all potential OS versions from the minimum to 10.19.x.
53
- #
54
- # @example
55
- # JSS.expand_min_os ">=10.6.7" # => returns this array
56
- # # ["10.6.7",
57
- # # "10.6.8",
58
- # # "10.6.9",
59
- # # ...
60
- # # "10.6.20",
61
- # # "10.7.x",
62
- # # "10.8.x",
63
- # # ...
64
- # # "10.30.x"]
65
- #
66
- #
67
- def self.expand_min_os(min_os)
68
- min_os = min_os.delete '>='
69
-
70
- # split the version into major, minor and maintenance release numbers
71
- (maj, min, maint) = min_os.split('.')
72
- maint = 'x' if maint.nil? || maint == '0'
73
-
74
- # if the maint release number is an "x" just start the list of OK OS's with it
75
- if maint == 'x'
76
- ok_oses = [maj + '.' + min.to_s + '.x']
77
-
78
- # otherwise, start with it and explicitly add all maint releases up to 20
79
- # (and hope apple doesn't do more than 20 maint releases for an OS)
80
- else
81
130
  ok_oses = []
82
- (maint.to_i..20).each do |m|
83
- ok_oses << maj + '.' + min + '.' + m.to_s
84
- end # each m
131
+
132
+ # Deal with 10.x.x up to 10.16
133
+ if major == '10'
134
+
135
+ # In big sur with SYSTEM_VERSION_COMPAT
136
+ # set, it will only ever report as `10.16`
137
+ # So if major is 10 and minor is 16, ignore maint
138
+ # and start explicitly at '10.16'
139
+ if minor == '16'
140
+ ok_oses << '10.16'
141
+
142
+ # But for Catalina and below, we need to
143
+ # expand things out
144
+ else
145
+ # e.g. 10.14.x
146
+ # doesn't expand to anything
147
+ if maint == 'x'
148
+ ok_oses << "10.#{minor}.x"
149
+
150
+ # e.g. 10.15.5
151
+ # expand to 10.15.5, 10.15.6, 10.15.7
152
+ else
153
+ max_maint_for_minor = OS_TEN_MAXS[minor.to_i]
154
+
155
+ (maint.to_i..max_maint_for_minor).each do |m|
156
+ ok_oses << "#{major}.#{minor}.#{m}"
157
+ end # each m
158
+ end # if maint == x
159
+
160
+ # now if we started below catalina, account for everything
161
+ # up to 10.15.x
162
+ ((minor.to_i + 1)..15).each { |v| ok_oses << "10.#{v}.x" } if minor.to_i < 15
163
+
164
+ # and add big sur with SYSTEM_VERSION_COMPAT
165
+ ok_oses << '10.16'
166
+ end # if minor == 16
167
+
168
+ # now reset these so we can go higher
169
+ major = '11'
170
+ minor = 'x'
171
+ maint = 'x'
172
+ end # if major == 10
173
+
174
+ # if the min os is 11.0.0 or equiv, and we aven't added 10.16
175
+ # for SYSTEM_VERSION_COMPAT, add it now
176
+ ok_oses << '10.16' if ['11', '11.x', '11.x.x', '11.0', '11.0.0'].include?(min_os) && !ok_oses.include?('10.16')
177
+
178
+ # e.g. 11.x, or 11.x.x
179
+ # expand to 11.x, 12.x, 13.x, ... 20.x
180
+ if minor == 'x'
181
+ ((major.to_i)..20).each { |v| ok_oses << "#{v}.x" }
182
+
183
+ # e.g. 11.2.x
184
+ # expand to 11.2.x, 11.3.x, ... 11.12.x,
185
+ # 12.x, 13.x, ... 20.x
186
+ elsif maint == 'x'
187
+ # first expand the minors out to their max
188
+ # e.g. 11.2.x, 11.3.x, ... 11.12.x
189
+ max_minor_for_major = MAC_OS_MAXS[major.to_i]
190
+ ((minor.to_i)..max_minor_for_major).each do |m|
191
+ ok_oses << "#{major}.#{m}.x"
192
+ end # each m
193
+
194
+ # then add the majors out to 20
195
+ ((major.to_i + 1)..20).each { |v| ok_oses << "#{v}.x" }
196
+
197
+ # e.g. 11.2.3
198
+ # expand to 11.2.3, 11.2.4, ... 11.2.10,
199
+ # 11.3.x, 11.4.x, ... 11.12.x,
200
+ # 12.x, 13.x, ... 20.x
201
+ else
202
+ # first expand the maints out to 10
203
+ # e.g. 11.2.3, 11.2.4, ... 11.2.10
204
+ ((maint.to_i)..10).each { |mnt| ok_oses << "#{major}.#{minor}.#{mnt}" }
205
+
206
+ # then expand the minors out to their max
207
+ # e.g. 11.3.x, ... 11.12.x
208
+ max_minor_for_major = MAC_OS_MAXS[major.to_i]
209
+ ((minor.to_i + 1)..max_minor_for_major).each { |min| ok_oses << "#{major}.#{min}.x" }
210
+
211
+ # then add the majors out to 20
212
+ ((major.to_i + 1)..20).each { |v| ok_oses << "#{v}.x" }
213
+ end
214
+
215
+ ok_oses
216
+ end # def expand_min_os(min_os)
217
+
218
+ # Scripts and packages can have processor limitations.
219
+ # This method tests a given processor, against a requirement
220
+ # to see if the requirement is met.
221
+ #
222
+ # @param requirement[String] The processor requirement.
223
+ # either 'ppc', 'x86', or some variation on "none", nil, or empty
224
+ #
225
+ # @param processor[String] the processor to check, defaults to
226
+ # the processor of the current machine. Any flavor of intel
227
+ ## is (i486, i386, x86-64, etc) is treated as "x86"
228
+ #
229
+ # @return [Boolean] can this pkg be installed with the processor
230
+ # given?
231
+ #
232
+ def processor_ok?(requirement, processor = nil)
233
+ return true if requirement.to_s.empty? || requirement =~ /none/i
234
+
235
+ processor ||= `/usr/bin/uname -p`
236
+ requirement == (processor.to_s.include?('86') ? 'x86' : 'ppc')
85
237
  end
86
238
 
87
- # now account for all OS X versions starting with 10.
88
- # up to at least 10.30.x
89
- ((min.to_i + 1)..30).each do |v|
90
- ok_oses << maj + '.' + v.to_s + '.x'
91
- end # each v
92
- ok_oses
93
- end
94
-
95
- # Scripts and packages can have processor limitations.
96
- # This method tests a given processor, against a requirement
97
- # to see if the requirement is met.
98
- #
99
- # @param requirement[String] The processor requirement.
100
- # either 'ppc', 'x86', or some variation on "none", nil, or empty
101
- #
102
- # @param processor[String] the processor to check, defaults to
103
- # the processor of the current machine. Any flavor of intel
104
- ## is (i486, i386, x86-64, etc) is treated as "x86"
105
- #
106
- # @return [Boolean] can this pkg be installed with the processor
107
- # given?
108
- #
109
- def self.processor_ok?(requirement, processor = nil)
110
- return true if requirement.to_s.empty? || requirement =~ /none/i
111
- processor ||= `/usr/bin/uname -p`
112
- requirement == (processor.to_s.include?('86') ? 'x86' : 'ppc')
113
- end
114
-
115
- # Scripts and packages can have OS limitations.
116
- # This method tests a given OS, against a requirement list
117
- # to see if the requirement is met.
118
- #
119
- # @param requirement[String,Array] The os requirement list, a comma-seprated string
120
- # or array of strings of allows OSes. e.g. 10.7, 10.8.5 or 10.9.x
121
- #
122
- # @param processor[String] the os to check, defaults to
123
- # the os of the current machine.
124
- #
125
- # @return [Boolean] can this pkg be installed with the processor
126
- # given?
127
- #
128
- def self.os_ok?(requirement, os_to_check = nil)
129
- return true if requirement.to_s =~ /none/i
130
- return true if requirement.to_s == 'n'
131
- requirement = JSS.to_s_and_a(requirement)[:arrayform]
132
- return true if requirement.empty?
133
-
134
- os_to_check ||= `/usr/bin/sw_vers -productVersion`.chomp
135
-
136
- # convert the requirement array into an array of regexps.
137
- # examples:
138
- # "10.8.5" becomes /^10\.8\.5$/
139
- # "10.8" becomes /^10.8(.0)?$/
140
- # "10.8.x" /^10\.8\.?\d*$/
141
- req_regexps = requirement.map do |r|
142
- if r.end_with?('.x')
143
- /^#{r.chomp('.x').gsub('.', '\.')}(\.?\d*)*$/
144
-
145
- elsif r =~ /^\d+\.\d+$/
146
- /^#{r.gsub('.', '\.')}(.0)?$/
239
+ # Scripts and packages can have OS limitations.
240
+ # This method tests a given OS, against a requirement list
241
+ # to see if the requirement is met.
242
+ #
243
+ # @param requirement[String,Array] The os requirement list, a comma-seprated string
244
+ # or array of strings of allows OSes. e.g. 10.7, 10.8.5 or 10.9.x
245
+ #
246
+ # @param processor[String] the os to check, defaults to
247
+ # the os of the current machine.
248
+ #
249
+ # @return [Boolean] can this pkg be installed with the processor
250
+ # given?
251
+ #
252
+ def os_ok?(requirement, os_to_check = nil)
253
+ return true if requirement.to_s =~ /none/i
254
+ return true if requirement.to_s == 'n'
255
+
256
+ requirement = JSS.to_s_and_a(requirement)[:arrayform]
257
+ return true if requirement.empty?
258
+
259
+ os_to_check ||= `/usr/bin/sw_vers -productVersion`.chomp
260
+
261
+ # convert the requirement array into an array of regexps.
262
+ # examples:
263
+ # "10.8.5" becomes /^10\.8\.5$/
264
+ # "10.8" becomes /^10.8(.0)?$/
265
+ # "10.8.x" /^10\.8\.?\d*$/
266
+ req_regexps = requirement.map do |r|
267
+ if r.end_with?('.x')
268
+ /^#{r.chomp('.x').gsub('.', '\.')}(\.?\d*)*$/
269
+
270
+ elsif r =~ /^\d+\.\d+$/
271
+ /^#{r.gsub('.', '\.')}(.0)?$/
272
+
273
+ else
274
+ /^#{r.gsub('.', '\.')}$/
275
+ end
276
+ end
277
+
278
+ req_regexps.each { |re| return true if os_to_check =~ re }
279
+ false
280
+ end
147
281
 
282
+ # Given a list of data as a comma-separated string, or an Array of strings,
283
+ # return a Hash with both versions.
284
+ #
285
+ # Some parts of the JSS require lists as comma-separated strings, while
286
+ # often those data are easier work with as arrays. This method is a handy way
287
+ # to get either form when given either form.
288
+ #
289
+ # @param somedata [String, Array] the data to parse, of either class,
290
+ #
291
+ # @return [Hash{:stringform => String, :arrayform => Array}] the data as both comma-separated String and Array
292
+ #
293
+ # @example
294
+ # JSS.to_s_and_a "foo, bar, baz" # Hash => {:stringform => "foo, bar, baz", :arrayform => ["foo", "bar", "baz"]}
295
+ #
296
+ # JSS.to_s_and_a ["foo", "bar", "baz"] # Hash => {:stringform => "foo, bar, baz", :arrayform => ["foo", "bar", "baz"]}
297
+ #
298
+ def to_s_and_a(somedata)
299
+ case somedata
300
+ when nil
301
+ valstr = ''
302
+ valarr = []
303
+ when String
304
+ valstr = somedata
305
+ valarr = somedata.split(/,\s*/)
306
+ when Array
307
+ valstr = somedata.join ', '
308
+ valarr = somedata
148
309
  else
149
- /^#{r.gsub('.', '\.')}$/
310
+ raise Jamf::InvalidDataError, 'Input must be a comma-separated String or an Array of Strings'
311
+ end # case
312
+ { stringform: valstr, arrayform: valarr }
313
+ end # to_s_and_a
314
+
315
+ # a wrapper around Time.parse that returns nil for
316
+ # nil, zero, and empty values.
317
+ def parse_time(a_datetime)
318
+ return nil if NIL_DATES.include? a_datetime
319
+
320
+ Time.parse a_datetime.to_s
321
+ end
322
+
323
+ # Parse a plist into a Ruby data structure. The plist parameter may be
324
+ # a String containing an XML plist, or a path to a plist file, or it may be
325
+ # a Pathname object pointing to a plist file. The plist files may be XML or
326
+ # binary.
327
+ #
328
+ # @param plist[Pathname, String] the plist XML, or the path to a plist file
329
+ #
330
+ # @param symbol_keys[Boolean] should any Hash keys in the result be converted
331
+ # into Symbols rather than remain as Strings?
332
+ #
333
+ # @return [Object] the parsed plist as a ruby hash,array, etc.
334
+ #
335
+ def parse_plist(plist, symbol_keys: false)
336
+ require 'cfpropertylist'
337
+
338
+ # did we get a string of xml, or a string pathname?
339
+ case plist
340
+ when String
341
+ return CFPropertyList.native_types(CFPropertyList::List.new(data: plist).value, symbol_keys) if plist.include? '</plist>'
342
+
343
+ plist = Pathname.new plist
344
+ when Pathname
345
+ true
346
+ else
347
+ raise ArgumentError, 'Argument must be a path (as a Pathname or String) or a String of XML'
348
+ end # case plist
349
+
350
+ # if we're here, its a Pathname
351
+ raise Jamf::MissingDataError, "No such file: #{plist}" unless plist.file?
352
+
353
+ CFPropertyList.native_types(CFPropertyList::List.new(file: plist).value, symbol_keys)
354
+ end # parse_plist
355
+
356
+ # Convert any ruby data to an XML plist.
357
+ #
358
+ # NOTE: Binary data is tricky. Easiest way is to pass in a
359
+ # Pathname or IO object (anything that responds to `read` and
360
+ # returns a bytestring)
361
+ # and then the CFPropertyList.guess method will read it and
362
+ # convert it to a Plist <data> element with base64 encoded
363
+ # data.
364
+ # For more info, see CFPropertyList.guess
365
+ #
366
+ # @param data [Object] the data to be converted, usually a Hash
367
+ #
368
+ # @return [String] the object converted into an XML plist
369
+ #
370
+ def xml_plist_from(data)
371
+ require 'cfpropertylist'
372
+ plist = CFPropertyList::List.new
373
+ plist.value = CFPropertyList.guess(data, convert_unknown_to_string: true)
374
+ plist.to_str(CFPropertyList::List::FORMAT_XML)
375
+ end
376
+
377
+ # Converts JSS epoch (unix epoch + milliseconds) to a Ruby Time object
378
+ #
379
+ # @param epoch[String, Integer, nil]
380
+ #
381
+ # @return [Time, nil] nil is returned if epoch is nil, 0 or an empty String.
382
+ #
383
+ def epoch_to_time(epoch)
384
+ return nil if NIL_DATES.include? epoch
385
+
386
+ Time.at(epoch.to_i / 1000.0)
387
+ end # parse_date
388
+
389
+ # Given a name, singular or plural, of a Jamf::APIObject subclass as a String
390
+ # or Symbol (e.g. :computer/'computers'), return the class itself
391
+ # (e.g. Jamf::Computer)
392
+ # The available names are the RSRC_LIST_KEY
393
+ # and RSRC_OBJECT_KEY values for each APIObject subclass.
394
+ #
395
+ # @seealso Jamf.cnx_object_names
396
+ #
397
+ # @param name[String,Symbol] The name of a Jamf::APIObject subclass, singluar
398
+ # or plural
399
+ #
400
+ # @return [Class] The class
401
+ #
402
+ def api_object_class(name)
403
+ klass = api_object_names[name.downcase.to_sym]
404
+ raise Jamf::InvalidDataError, "Unknown API Object Class: #{name}" unless klass
405
+
406
+ klass
407
+ end
408
+
409
+ # APIObject subclasses have singular names, and are, of course
410
+ # capitalized, e.g. 'Computer'
411
+ # But we often want to refer to them in the plural, or lowercase,
412
+ # e.g. 'computers'
413
+ # This method returns a Hash of the RSRC_LIST_KEY (a plural symbol)
414
+ # and the RSRC_OBJECT_KEY (a singular symbol) of each APIObject
415
+ # subclass, keyed to the class itself, such that both :computer
416
+ # and :computers are keys for Jamf::Computer and both :policy and
417
+ # :policies are keys for Jamf::Policy, and so on.
418
+ #
419
+ # @return [Hash] APIObject subclass names to Classes
420
+ #
421
+ def api_object_names
422
+ return @api_object_names if @api_object_names
423
+
424
+ @api_object_names ||= {}
425
+ JSS.constants.each do |const|
426
+ klass = JSS.const_get const
427
+ next unless klass.is_a? Class
428
+ next unless klass.ancestors.include? Jamf::APIObject
429
+
430
+ @api_object_names[klass.const_get(:RSRC_LIST_KEY).to_sym] = klass if klass.constants.include? :RSRC_LIST_KEY
431
+ @api_object_names[klass.const_get(:RSRC_OBJECT_KEY).to_sym] = klass if klass.constants.include? :RSRC_OBJECT_KEY
150
432
  end
433
+ @api_object_names
151
434
  end
152
435
 
153
- req_regexps.each { |re| return true if os_to_check =~ re }
154
- false
155
- end
156
-
157
- # Given a list of data as a comma-separated string, or an Array of strings,
158
- # return a Hash with both versions.
159
- #
160
- # Some parts of the JSS require lists as comma-separated strings, while
161
- # often those data are easier work with as arrays. This method is a handy way
162
- # to get either form when given either form.
163
- #
164
- # @param somedata [String, Array] the data to parse, of either class,
165
- #
166
- # @return [Hash{:stringform => String, :arrayform => Array}] the data as both comma-separated String and Array
167
- #
168
- # @example
169
- # JSS.to_s_and_a "foo, bar, baz" # Hash => {:stringform => "foo, bar, baz", :arrayform => ["foo", "bar", "baz"]}
170
- #
171
- # JSS.to_s_and_a ["foo", "bar", "baz"] # Hash => {:stringform => "foo, bar, baz", :arrayform => ["foo", "bar", "baz"]}
172
- #
173
- def self.to_s_and_a(somedata)
174
- case somedata
175
- when nil
176
- valstr = ''
177
- valarr = []
178
- when String
179
- valstr = somedata
180
- valarr = somedata.split(/,\s*/)
181
- when Array
182
- valstr = somedata.join ', '
183
- valarr = somedata
184
- else
185
- raise Jamf::InvalidDataError, 'Input must be a comma-separated String or an Array of Strings'
186
- end # case
187
- { stringform: valstr, arrayform: valarr }
188
- end # to_s_and_a
189
-
190
- # Parse a plist into a Ruby data structure. The plist parameter may be
191
- # a String containing an XML plist, or a path to a plist file, or it may be
192
- # a Pathname object pointing to a plist file. The plist files may be XML or
193
- # binary.
194
- #
195
- # @param plist[Pathname, String] the plist XML, or the path to a plist file
196
- #
197
- # @param symbol_keys[Boolean] should any Hash keys in the result be converted
198
- # into Symbols rather than remain as Strings?
199
- #
200
- # @return [Object] the parsed plist as a ruby hash,array, etc.
201
- #
202
- def self.parse_plist(plist, symbol_keys: false)
203
- require 'cfpropertylist'
204
-
205
- # did we get a string of xml, or a string pathname?
206
- case plist
207
- when String
208
- return CFPropertyList.native_types(CFPropertyList::List.new(data: plist).value, symbol_keys) if plist.include? '</plist>'
209
-
210
- plist = Pathname.new plist
211
- when Pathname
212
- true
213
- else
214
- raise ArgumentError, 'Argument must be a path (as a Pathname or String) or a String of XML'
215
- end # case plist
216
-
217
- # if we're here, its a Pathname
218
- raise JSS::MissingDataError, "No such file: #{plist}" unless plist.file?
219
-
220
- CFPropertyList.native_types(CFPropertyList::List.new(file: plist).value, symbol_keys)
221
- end # parse_plist
222
-
223
- # Convert any ruby data to an XML plist.
224
- #
225
- # NOTE: Binary data is tricky. Easiest way is to pass in a
226
- # Pathname or IO object (anything that responds to `read` and
227
- # returns a bytestring)
228
- # and then the CFPropertyList.guess method will read it and
229
- # convert it to a Plist <data> element with base64 encoded
230
- # data.
231
- # For more info, see CFPropertyList.guess
232
- #
233
- # @param data [Object] the data to be converted, usually a Hash
234
- #
235
- # @return [String] the object converted into an XML plist
236
- #
237
- def self.xml_plist_from(data)
238
- require 'cfpropertylist'
239
- plist = CFPropertyList::List.new
240
- plist.value = CFPropertyList.guess(data, convert_unknown_to_string: true)
241
- plist.to_str(CFPropertyList::List::FORMAT_XML)
242
- end
243
-
244
- # TODO: Sill needed in Jamf API?
245
- #
246
- # Converts anything that responds to #to_s to a Time, or nil
247
- #
248
- # Return nil if the item is nil, 0 or an empty String.
249
- #
250
- # Otherwise the item converted to a string, and parsed with DateTime.parse.
251
- # It is then examined to see if it has a UTC offset. If not, the local offset
252
- # is applied, then the DateTime is converted to a Time.
253
- #
254
- # @param a_datetime [#to_s] The thing to convert to a time.
255
- #
256
- # @return [Time, nil] nil is returned if a_datetime is nil, 0 or an empty String.
257
- #
258
- def self.parse_time(a_datetime)
259
- return nil if NIL_DATES.include? a_datetime
260
-
261
- the_dt = DateTime.parse(a_datetime.to_s)
262
-
263
- # The microseconds in DateTimes are stored as a fraction of a day.
264
- # Convert them to an integer of microseconds
265
- usec = (the_dt.sec_fraction * 60 * 60 * 24 * (10**6)).to_i
266
-
267
- # if the UTC offset of the datetime is zero, make a new one with the correct local offset
268
- # (which might also be zero if we happen to be in GMT)
269
- the_dt = DateTime.new(the_dt.year, the_dt.month, the_dt.day, the_dt.hour, the_dt.min, the_dt.sec, Jamf::TIME_ZONE_OFFSET) if the_dt.offset.zero?
270
- # now convert it to a Time and return it
271
- Time.at the_dt.strftime('%s').to_i, usec
272
- end # parse_time
273
-
274
- # TODO: Sill needed in Jamf API?
275
- #
276
- # Converts JSS epoch (unix epoch + milliseconds) to a Ruby Time object
277
- #
278
- # @param epoch[String, Integer, nil]
279
- #
280
- # @return [Time, nil] nil is returned if epoch is nil, 0 or an empty String.
281
- #
282
- def self.epoch_to_time(epoch)
283
- return nil if NIL_DATES.include? epoch
284
- Time.at(epoch.to_i / 1000.0)
285
- end # parse_date
286
-
287
- # TODO: Move to APIObject
288
- #
289
- # Given a name, singular or plural, of a Jamf::APIObject subclass as a String
290
- # or Symbol (e.g. :computer/'computers'), return the class itself
291
- # (e.g. Jamf::Computer)
292
- # The available names are the RSRC_LIST_KEY
293
- # and RSRC_OBJECT_KEY values for each APIObject subclass.
294
- #
295
- # @seealso JSS.api_object_names
296
- #
297
- # @param name[String,Symbol] The name of a Jamf::APIObject subclass, singluar
298
- # or plural
299
- #
300
- # @return [Class] The class
301
- #
302
- def self.api_object_class(name)
303
- klass = api_object_names[name.downcase.to_sym]
304
- raise Jamf::InvalidDataError, "Unknown API Object Class: #{name}" unless klass
305
- klass
306
- end
307
-
308
- # TODO: Move to APIObject
309
- #
310
- # APIObject subclasses have singular names, and are, of course
311
- # capitalized, e.g. 'Computer'
312
- # But we often want to refer to them in the plural, or lowercase,
313
- # e.g. 'computers'
314
- # This method returns a Hash of the RSRC_LIST_KEY (a plural symbol)
315
- # and the RSRC_OBJECT_KEY (a singular symbol) of each APIObject
316
- # subclass, keyed to the class itself, such that both :computer
317
- # and :computers are keys for Jamf::Computer and both :policy and
318
- # :policies are keys for Jamf::Policy, and so on.
319
- #
320
- # @return [Hash] APIObject subclass names to Classes
321
- #
322
- def self.api_object_names
323
- return @api_object_names if @api_object_names
324
- @api_object_names ||= {}
325
- JSS.constants.each do |const|
326
- klass = JSS.const_get const
327
- next unless klass.is_a? Class
328
- next unless klass.ancestors.include? Jamf::APIObject
329
- @api_object_names[klass.const_get(:RSRC_LIST_KEY).to_sym] = klass if klass.constants.include? :RSRC_LIST_KEY
330
- @api_object_names[klass.const_get(:RSRC_OBJECT_KEY).to_sym] = klass if klass.constants.include? :RSRC_OBJECT_KEY
436
+ # Given a string of xml element text, escape any characters that would make XML unhappy.
437
+ # * & => &amp;
438
+ # * " => &quot;
439
+ # * < => &lt;
440
+ # * > => &gt;
441
+ # * ' => &apos;
442
+ #
443
+ # @param string [String] the string to make xml-compliant.
444
+ #
445
+ # @return [String] the xml-compliant string
446
+ #
447
+ def escape_xml(string)
448
+ string.gsub(/&/, '&amp;').gsub(/"/, '&quot;').gsub(/>/, '&gt;').gsub(/</, '&lt;').gsub(/'/, '&apos;')
331
449
  end
332
- @api_object_names
333
- end
334
-
335
- # TODO: Update or remove for Jamf API
336
- # Parse a JSS Version number into something comparable.
337
- #
338
- # This method returns a Hash with these keys:
339
- # * :major => the major version, Integer
340
- # * :minor => the minor version, Integor
341
- # * :maint => the revision, Integer (also available as :patch and :revision)
342
- # * :build => the revision, String
343
- # * :version => a Gem::Version object built from :major, :minor, :revision
344
- # which can be easily compared with other Gem::Version objects.
345
- #
346
- # NOTE: the :version value ignores build numbers, so comparisons
347
- # only compare major.minor.maint
348
- #
349
- # @param version[String] a JSS version number from the API
350
- #
351
- # @return [Hash{Symbol => String, Gem::Version}] the parsed version data.
352
- #
353
- def self.parse_jss_version(version)
354
- major, second_part, *_rest = version.split('.')
355
- raise Jamf::InvalidDataError, 'JSS Versions must start with "x.x" where x is one or more digits' unless major =~ /\d$/ && second_part =~ /^\d/
356
-
357
- release, build = version.split(/-/)
358
-
359
- major, minor, revision = release.split '.'
360
- minor ||= 0
361
- revision ||= 0
362
-
363
- {
364
- major: major.to_i,
365
- minor: minor.to_i,
366
- revision: revision.to_i,
367
- maint: revision.to_i,
368
- patch: revision.to_i,
369
- build: build,
370
- version: Gem::Version.new("#{major}.#{minor}.#{revision}")
371
- }
372
- end
373
-
374
- # @return [Boolean] is this code running as root?
375
- #
376
- def self.superuser?
377
- Process.euid.zero?
378
- end
379
-
380
- # Retrive one or all lines from whatever was piped to standard input.
381
- #
382
- # Standard input is read completely the first time this method is called
383
- # and the lines are stored as an Array in the module var @stdin_lines
384
- #
385
- # @param line[Integer] which line of stdin is being retrieved.
386
- # The default is zero (0) which returns all of stdin as a single string.
387
- #
388
- # @return [String, nil] the requested ling of stdin, or nil if it doesn't exist.
389
- #
390
- def self.stdin(line = 0)
391
- @stdin_lines ||= ($stdin.tty? ? [] : $stdin.read.lines.map { |l| l.chomp("\n") })
392
-
393
- return @stdin_lines.join("\n") if line <= 0
394
- idx = line - 1
395
- @stdin_lines[idx]
396
- end
397
-
398
- # Prompt for a password in a terminal.
399
- #
400
- # @param message [String] the prompt message to display
401
- #
402
- # @return [String] the text typed by the user
403
- #
404
- def self.prompt_for_password(message)
405
- begin
406
- $stdin.reopen '/dev/tty' unless $stdin.tty?
407
- $stderr.print "#{message} "
408
- system '/bin/stty -echo'
409
- pw = $stdin.gets.chomp("\n")
410
- puts
411
- ensure
412
- system '/bin/stty echo'
413
- end # begin
414
- pw
415
- end
416
-
417
- # Very handy!
418
- # lifted from
419
- # http://stackoverflow.com/questions/4136248/how-to-generate-a-human-readable-time-range-using-ruby-on-rails
420
- #
421
- def self.humanize_secs(secs)
422
- [[60, :second], [60, :minute], [24, :hour], [7, :day], [52.179, :week], [1_000_000, :year]].map do |count, name|
423
- next unless secs > 0
424
-
425
- secs, n = secs.divmod(count)
426
- n = n.to_i
427
- "#{n} #{n == 1 ? name : (name.to_s + 's')}"
428
- end.compact.reverse.join(' ')
429
- end
430
-
431
- # un/set devmode mode.
432
- # Useful when coding - methods can call JSS.devmode? and then
433
- # e.g. spit out something instead of performing some action.
434
- #
435
- # @param [Symbol] Set devmode :on or :off
436
- #
437
- # @return [Boolean] The new state of devmode
438
- #
439
- def self.devmode(setting)
440
- @devmode = setting == :on
441
- end
442
-
443
- # is devmode currently on?
444
- #
445
- # @return [Boolean]
446
- #
447
- def self.devmode?
448
- @devmode
449
- end
450
+
451
+ # Given an element name and an array of content, generate an Array of
452
+ # REXML::Element objects with that name, and matching content.
453
+ # Given element name 'foo' and the array ['bar','morefoo']
454
+ # The array of REXML elements would render thus:
455
+ # <foo>bar</foo>
456
+ # <foo>morefoo</foo>
457
+ #
458
+ # @param element [#to_s] an element_name like :foo
459
+ #
460
+ # @param list [Array<#to_s>] an Array of element content such as ["bar", :morefoo]
461
+ #
462
+ # @return [Array<REXML::Element>]
463
+ #
464
+ def array_to_rexml_array(element, list)
465
+ raise Jamf::InvalidDataError, 'Arg. must be an Array.' unless list.is_a? Array
466
+
467
+ element = element.to_s
468
+ list.map do |v|
469
+ e = REXML::Element.new(element)
470
+ e.text = v
471
+ e
472
+ end
473
+ end
474
+
475
+ # Given a simple Hash, convert it to an array of REXML Elements such that each
476
+ # key becomes an element, and its value becomes the text content of
477
+ # that element
478
+ #
479
+ # @example
480
+ # my_hash = {:foo => "bar", :baz => :morefoo}
481
+ # xml = JSS.hash_to_rexml_array(my_hash)
482
+ # xml.each{|x| puts x }
483
+ #
484
+ # <foo>bar</foo>
485
+ # <baz>morefoo</baz>
486
+ #
487
+ # @param hash [Hash{#to_s => #to_s}] the Hash to convert
488
+ #
489
+ # @return [Array<REXML::Element>] the Array of REXML elements.
490
+ #
491
+ def hash_to_rexml_array(hash)
492
+ raise InvalidDataError, 'Arg. must be a Hash.' unless hash.is_a? Hash
493
+
494
+ ary = []
495
+ hash.each_pair do |k, v|
496
+ el = REXML::Element.new k.to_s
497
+ el.text = v
498
+ ary << el
499
+ end
500
+ ary
501
+ end
502
+
503
+ # Given an Array of Hashes with :id and/or :name keys, return
504
+ # a single REXML element with a sub-element for each item,
505
+ # each of which contains a :name or :id element.
506
+ #
507
+ # @param list_element [#to_s] the name of the XML element that contains the list.
508
+ # e.g. :computers
509
+ #
510
+ # @param item_element [#to_s] the name of each XML element in the list,
511
+ # e.g. :computer
512
+ #
513
+ # @param item_list [Array<Hash>] an Array of Hashes each with a :name or :id key.
514
+ #
515
+ # @param content [Symbol] which hash key should be used as the content of if list item? Defaults to :name
516
+ #
517
+ # @return [REXML::Element] the item list as REXML
518
+ #
519
+ # @example
520
+ # comps = [{:id=>2,:name=>'kimchi'},{:id=>5,:name=>'mantis'}]
521
+ # xml = JSS.item_list_to_rexml_list(:computers, :computer , comps, :name)
522
+ # puts xml
523
+ # # output manually formatted for clarity. No newlines in the real xml string
524
+ # <computers>
525
+ # <computer>
526
+ # <name>kimchi</name>
527
+ # </computer>
528
+ # <computer>
529
+ # <name>mantis</name>
530
+ # </computer>
531
+ # </computers>
532
+ #
533
+ # # if content is :id, then, eg. <name>kimchi</name> would be <id>2</id>
534
+ #
535
+ def item_list_to_rexml_list(list_element, item_element, item_list, content = :name)
536
+ xml_list = REXML::Element.new list_element.to_s
537
+ item_list.each do |i|
538
+ xml_list.add_element(item_element.to_s).add_element(content.to_s).text = i[content]
539
+ end
540
+ xml_list
541
+ end
542
+
543
+ # Parse a JSS Version number into something comparable.
544
+ #
545
+ # This method returns a Hash with these keys:
546
+ # * :major => the major version, Integer
547
+ # * :minor => the minor version, Integor
548
+ # * :maint => the revision, Integer (also available as :patch and :revision)
549
+ # * :build => the revision, String
550
+ # * :version => a Gem::Version object built from :major, :minor, :revision
551
+ # which can be easily compared with other Gem::Version objects.
552
+ #
553
+ # NOTE: the :version value ignores build numbers, so comparisons
554
+ # only compare major.minor.maint
555
+ #
556
+ # @param version[String] a JSS version number from the API
557
+ #
558
+ # @return [Hash{Symbol => String, Gem::Version}] the parsed version data.
559
+ #
560
+ def parse_jss_version(version)
561
+ major, second_part, *_rest = version.split('.')
562
+ raise Jamf::InvalidDataError, 'JSS Versions must start with "x.x" where x is one or more digits' unless major =~ /\d$/ && second_part =~ /^\d/
563
+
564
+ release, build = version.split(/-/)
565
+
566
+ major, minor, revision = release.split '.'
567
+ minor ||= 0
568
+ revision ||= 0
569
+
570
+ {
571
+ major: major.to_i,
572
+ minor: minor.to_i,
573
+ revision: revision.to_i,
574
+ maint: revision.to_i,
575
+ patch: revision.to_i,
576
+ build: build,
577
+ version: Gem::Version.new("#{major}.#{minor}.#{revision}")
578
+ }
579
+ end
580
+
581
+ # @return [Boolean] is this code running as root?
582
+ #
583
+ def superuser?
584
+ Process.euid.zero?
585
+ end
586
+
587
+ # Retrive one or all lines from whatever was piped to standard input.
588
+ #
589
+ # Standard input is read completely the first time this method is called
590
+ # and the lines are stored as an Array in the module var @stdin_lines
591
+ #
592
+ # @param line[Integer] which line of stdin is being retrieved.
593
+ # The default is zero (0) which returns all of stdin as a single string.
594
+ #
595
+ # @return [String, nil] the requested ling of stdin, or nil if it doesn't exist.
596
+ #
597
+ def stdin(line = 0)
598
+ @stdin_lines ||= ($stdin.tty? ? [] : $stdin.read.lines.map { |l| l.chomp("\n") })
599
+
600
+ return @stdin_lines.join("\n") if line <= 0
601
+
602
+ idx = line - 1
603
+ @stdin_lines[idx]
604
+ end
605
+
606
+ # Prompt for a password in a terminal.
607
+ #
608
+ # @param message [String] the prompt message to display
609
+ #
610
+ # @return [String] the text typed by the user
611
+ #
612
+ def prompt_for_password(message)
613
+ begin
614
+ $stdin.reopen '/dev/tty' unless $stdin.tty?
615
+ $stderr.print "#{message} "
616
+ system '/bin/stty -echo'
617
+ pw = $stdin.gets.chomp("\n")
618
+ puts
619
+ ensure
620
+ system '/bin/stty echo'
621
+ end # begin
622
+ pw
623
+ end
624
+
625
+ # un/set devmode mode.
626
+ # Useful when coding - methods can call JSS.devmode? and then
627
+ # e.g. spit out something instead of performing some action.
628
+ #
629
+ # @param [Symbol] Set devmode :on or :off
630
+ #
631
+ # @return [Boolean] The new state of devmode
632
+ #
633
+ def devmode(setting)
634
+ @devmode = setting == :on
635
+ end
636
+
637
+ # is devmode currently on?
638
+ #
639
+ # @return [Boolean]
640
+ #
641
+ def devmode?
642
+ @devmode
643
+ end
644
+
645
+ # Very handy!
646
+ # lifted from
647
+ # http://stackoverflow.com/questions/4136248/how-to-generate-a-human-readable-time-range-using-ruby-on-rails
648
+ #
649
+ # Turns the integer 834756398 into the string "26 years 23 weeks 1 day 12 hours 46 minutes 38 seconds"
650
+ #
651
+ # @param secs [Integer] a number of seconds
652
+ #
653
+ # @return [String] a human-readable (English) version of that number of seconds.
654
+ #
655
+ def humanize_secs(secs)
656
+ [[60, :second], [60, :minute], [24, :hour], [7, :day], [52.179, :week], [1_000_000_000, :year]].map do |count, name|
657
+ next unless secs > 0
658
+
659
+ secs, n = secs.divmod(count)
660
+ n = n.to_i
661
+ "#{n} #{n == 1 ? name : (name.to_s + 's')}"
662
+ end.compact.reverse.join(' ')
663
+ end
664
+
665
+ end # module Utility
450
666
 
451
667
  end # module