ruby-jss 1.6.4 → 2.0.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (711) 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 +337 -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 +222 -120
  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 +9 -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 +288 -167
  59. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mobile_device.rb +63 -51
  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 +121 -129
  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 +320 -280
  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 +97 -78
  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 +224 -0
  103. data/lib/jamf/api/connection/cache.rb +148 -0
  104. data/lib/jamf/api/connection/classic_api.rb +288 -0
  105. data/lib/jamf/api/connection/connect.rb +538 -0
  106. data/lib/jamf/api/connection/constants.rb +112 -0
  107. data/lib/jamf/api/connection/default_connection.rb +103 -0
  108. data/lib/jamf/api/connection/jamf_pro_api.rb +174 -0
  109. data/lib/jamf/api/connection/jamf_pro_api_error.rb +109 -0
  110. data/lib/jamf/api/connection/token.rb +295 -99
  111. data/lib/jamf/api/connection.rb +189 -818
  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 +172 -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 +614 -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/macos_managed_updates.rb +168 -0
  126. data/lib/jamf/api/jamf_pro/mixins/prestage.rb +356 -0
  127. data/lib/jamf/api/{mixins → jamf_pro/mixins}/sortable.rb +7 -17
  128. data/lib/jamf/api/{mixins → jamf_pro/mixins}/uncreatable.rb +2 -2
  129. data/lib/jamf/api/{mixins → jamf_pro/mixins}/undeletable.rb +2 -2
  130. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_preview_search_results.rb +89 -0
  131. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_v2_search_results.rb +89 -0
  132. data/lib/jamf/api/jamf_pro/oapi_schemas/account.rb +159 -0
  133. data/lib/jamf/api/jamf_pro/oapi_schemas/account_driven_user_enrollment_session_token_settings.rb +90 -0
  134. data/lib/jamf/api/jamf_pro/oapi_schemas/account_group.rb +123 -0
  135. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences.rb +107 -0
  136. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v1.rb +105 -0
  137. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v4.rb +117 -0
  138. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_history.rb +160 -0
  139. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_history_search_results.rb +89 -0
  140. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_summary.rb +131 -0
  141. data/lib/jamf/api/jamf_pro/oapi_schemas/admin_account.rb +82 -0
  142. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search.rb +116 -0
  143. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search_criteria_choices.rb +83 -0
  144. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search_search_results.rb +89 -0
  145. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_user_content_search.rb +116 -0
  146. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_user_content_search_search_results.rb +89 -0
  147. data/lib/jamf/api/jamf_pro/oapi_schemas/android_details.rb +162 -0
  148. data/lib/jamf/api/jamf_pro/oapi_schemas/api_error.rb +89 -0
  149. data/lib/jamf/api/jamf_pro/oapi_schemas/api_error_cause.rb +106 -0
  150. data/lib/jamf/api/jamf_pro/oapi_schemas/app_analytics_setting.rb +87 -0
  151. data/lib/jamf/api/jamf_pro/oapi_schemas/app_dynamics_config.rb +133 -0
  152. data/lib/jamf/api/jamf_pro/oapi_schemas/app_path.rb +90 -0
  153. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_form_input_field.rb +114 -0
  154. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_form_input_field_search_results.rb +89 -0
  155. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_settings.rb +104 -0
  156. data/lib/jamf/api/jamf_pro/oapi_schemas/apple_tv_details.rb +132 -0
  157. data/lib/jamf/api/jamf_pro/oapi_schemas/application_attributes.rb +87 -0
  158. data/lib/jamf/api/jamf_pro/oapi_schemas/application_configuration.rb +87 -0
  159. data/lib/jamf/api/jamf_pro/oapi_schemas/assign_remove_profile_response_sync_state.rb +112 -0
  160. data/lib/jamf/api/jamf_pro/oapi_schemas/attributes.rb +100 -0
  161. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account.rb +158 -0
  162. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account_v1.rb +158 -0
  163. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_token.rb +90 -0
  164. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_token_v1.rb +90 -0
  165. data/lib/jamf/api/jamf_pro/oapi_schemas/authorization.rb +116 -0
  166. data/lib/jamf/api/jamf_pro/oapi_schemas/authorization_v1.rb +116 -0
  167. data/lib/jamf/api/jamf_pro/oapi_schemas/available_updates.rb +83 -0
  168. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_ad_migration_report_process_status.rb +115 -0
  169. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_ad_migration_report_request.rb +102 -0
  170. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration.rb +94 -0
  171. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration_request.rb +92 -0
  172. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration_update.rb +92 -0
  173. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_mappings.rb +157 -0
  174. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration.rb +146 -0
  175. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration_request.rb +145 -0
  176. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration_update.rb +131 -0
  177. data/lib/jamf/api/jamf_pro/oapi_schemas/branding_image_url.rb +86 -0
  178. data/lib/jamf/api/jamf_pro/oapi_schemas/building.rb +137 -0
  179. data/lib/jamf/api/jamf_pro/oapi_schemas/building_search_results.rb +89 -0
  180. data/lib/jamf/api/jamf_pro/oapi_schemas/cache_settings.rb +149 -0
  181. data/lib/jamf/api/jamf_pro/oapi_schemas/categories_search_results.rb +89 -0
  182. data/lib/jamf/api/jamf_pro/oapi_schemas/category.rb +103 -0
  183. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_details.rb +88 -0
  184. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_identity_v2.rb +107 -0
  185. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_key.rb +89 -0
  186. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_record.rb +146 -0
  187. data/lib/jamf/api/jamf_pro/oapi_schemas/classic_ldap_mappings.rb +168 -0
  188. data/lib/jamf/api/jamf_pro/oapi_schemas/client_check_in_v2.rb +164 -0
  189. data/lib/jamf/api/jamf_pro/oapi_schemas/client_check_in_v3.rb +134 -0
  190. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common.rb +108 -0
  191. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common_request.rb +97 -0
  192. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common_response.rb +108 -0
  193. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_connection_pool_statistics.rb +170 -0
  194. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_connection_status.rb +83 -0
  195. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_keystore.rb +102 -0
  196. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_keystore_file.rb +103 -0
  197. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_mappings_request.rb +101 -0
  198. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_mappings_response.rb +101 -0
  199. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_request.rb +151 -0
  200. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_response.rb +148 -0
  201. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_update.rb +148 -0
  202. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_application.rb +124 -0
  203. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_attachment.rb +102 -0
  204. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_certificate.rb +151 -0
  205. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_configuration_profile.rb +118 -0
  206. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching.rb +372 -0
  207. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_alert.rb +120 -0
  208. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_cache_detail.rb +97 -0
  209. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error.rb +98 -0
  210. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error_user_info.rb +89 -0
  211. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent.rb +131 -0
  212. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_alert.rb +105 -0
  213. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_capabilities.rb +124 -0
  214. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_details.rb +118 -0
  215. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_local_network.rb +97 -0
  216. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk.rb +143 -0
  217. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk_encryption.rb +120 -0
  218. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_extension_attribute.rb +175 -0
  219. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_font.rb +93 -0
  220. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general.rb +230 -0
  221. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general_update.rb +112 -0
  222. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_group.rb +96 -0
  223. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware.rb +264 -0
  224. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware_update.rb +106 -0
  225. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_ibeacon.rb +81 -0
  226. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory.rb +275 -0
  227. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_collection_preferences.rb +165 -0
  228. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_collection_settings.rb +108 -0
  229. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_recovery_lock_password_response.rb +83 -0
  230. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_search_results.rb +89 -0
  231. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_update_request.rb +124 -0
  232. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_licensed_software.rb +88 -0
  233. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_local_user_account.rb +189 -0
  234. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_location.rb +93 -0
  235. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_mdm_capability.rb +88 -0
  236. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system.rb +132 -0
  237. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system_update.rb +82 -0
  238. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_overview.rb +179 -0
  239. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_package_receipts.rb +97 -0
  240. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition.rb +145 -0
  241. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_encryption.rb +93 -0
  242. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_file_vault2_state.rb +97 -0
  243. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_plugin.rb +93 -0
  244. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage.rb +106 -0
  245. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_search_results.rb +89 -0
  246. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_search_results_v2.rb +89 -0
  247. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_v2.rb +129 -0
  248. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_printer.rb +99 -0
  249. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_purchase.rb +158 -0
  250. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_remote_management.rb +94 -0
  251. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_section.rb +109 -0
  252. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_security.rb +179 -0
  253. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_service.rb +81 -0
  254. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_software_update.rb +93 -0
  255. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_storage.rb +90 -0
  256. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_user_and_location.rb +131 -0
  257. data/lib/jamf/api/jamf_pro/oapi_schemas/computers_search_results.rb +89 -0
  258. data/lib/jamf/api/jamf_pro/oapi_schemas/configuration_profile.rb +102 -0
  259. data/lib/jamf/api/jamf_pro/oapi_schemas/configuration_search_results.rb +90 -0
  260. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_candidate_request.rb +123 -0
  261. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_response.rb +122 -0
  262. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_status_response.rb +85 -0
  263. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_update_request.rb +109 -0
  264. data/lib/jamf/api/jamf_pro/oapi_schemas/country.rb +87 -0
  265. data/lib/jamf/api/jamf_pro/oapi_schemas/country_codes.rb +83 -0
  266. data/lib/jamf/api/jamf_pro/oapi_schemas/create_path.rb +97 -0
  267. data/lib/jamf/api/jamf_pro/oapi_schemas/csa_token.rb +93 -0
  268. data/lib/jamf/api/jamf_pro/oapi_schemas/current_account.rb +159 -0
  269. data/lib/jamf/api/jamf_pro/oapi_schemas/current_authorization.rb +108 -0
  270. data/lib/jamf/api/jamf_pro/oapi_schemas/data_roaming_setting.rb +87 -0
  271. data/lib/jamf/api/jamf_pro/oapi_schemas/database_password.rb +88 -0
  272. data/lib/jamf/api/jamf_pro/oapi_schemas/day_of_week.rb +92 -0
  273. data/lib/jamf/api/jamf_pro/oapi_schemas/delete_user_command.rb +93 -0
  274. data/lib/jamf/api/jamf_pro/oapi_schemas/department.rb +97 -0
  275. data/lib/jamf/api/jamf_pro/oapi_schemas/departments_search_results.rb +89 -0
  276. data/lib/jamf/api/jamf_pro/oapi_schemas/deployment_task.rb +129 -0
  277. data/lib/jamf/api/jamf_pro/oapi_schemas/deployment_task_search_results.rb +91 -0
  278. data/lib/jamf/api/jamf_pro/oapi_schemas/device_communication_settings.rb +128 -0
  279. data/lib/jamf/api/jamf_pro/oapi_schemas/device_compliance_information.rb +117 -0
  280. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_device.rb +162 -0
  281. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_device_search_results.rb +89 -0
  282. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_disown_body.rb +83 -0
  283. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_disown_response.rb +82 -0
  284. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance.rb +163 -0
  285. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance_search_results.rb +89 -0
  286. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance_sync_status.rb +98 -0
  287. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_prestage.rb +215 -0
  288. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_prestage_v2.rb +234 -0
  289. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_token.rb +94 -0
  290. data/lib/jamf/api/jamf_pro/oapi_schemas/diagnostic_submission_setting.rb +87 -0
  291. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook.rb +152 -0
  292. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_exclusions.rb +137 -0
  293. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_limitations.rb +97 -0
  294. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_scope.rb +170 -0
  295. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_search_results.rb +89 -0
  296. data/lib/jamf/api/jamf_pro/oapi_schemas/enable_lost_mode_command.rb +93 -0
  297. data/lib/jamf/api/jamf_pro/oapi_schemas/engage.rb +84 -0
  298. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group_preview.rb +141 -0
  299. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group_v2.rb +132 -0
  300. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization.rb +106 -0
  301. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_branding_settings.rb +111 -0
  302. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_dependencies.rb +83 -0
  303. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_dependency.rb +93 -0
  304. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_ldap_group_access.rb +87 -0
  305. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel.rb +89 -0
  306. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_ldap_auth.rb +121 -0
  307. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_list.rb +83 -0
  308. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_sso_auth.rb +113 -0
  309. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_text.rb +112 -0
  310. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_search_results.rb +89 -0
  311. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_search_results_v2.rb +89 -0
  312. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_v2.rb +116 -0
  313. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_method.rb +97 -0
  314. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_process_text_object.rb +346 -0
  315. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_settings_v2.rb +273 -0
  316. data/lib/jamf/api/jamf_pro/oapi_schemas/export_field.rb +91 -0
  317. data/lib/jamf/api/jamf_pro/oapi_schemas/export_parameters.rb +121 -0
  318. data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attribute.rb +115 -0
  319. data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attribute_v2.rb +116 -0
  320. data/lib/jamf/api/jamf_pro/oapi_schemas/external_recipient.rb +91 -0
  321. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment.rb +89 -0
  322. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment_delete.rb +83 -0
  323. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment_v2.rb +89 -0
  324. data/lib/jamf/api/jamf_pro/oapi_schemas/filter.rb +104 -0
  325. data/lib/jamf/api/jamf_pro/oapi_schemas/font_path.rb +90 -0
  326. data/lib/jamf/api/jamf_pro/oapi_schemas/get_computer_prestage.rb +105 -0
  327. data/lib/jamf/api/jamf_pro/oapi_schemas/get_computer_prestage_v2.rb +104 -0
  328. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization.rb +87 -0
  329. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel.rb +89 -0
  330. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_ldap_auth.rb +93 -0
  331. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_sso_auth.rb +93 -0
  332. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_text.rb +93 -0
  333. data/lib/jamf/api/jamf_pro/oapi_schemas/get_mobile_device_prestage.rb +105 -0
  334. data/lib/jamf/api/jamf_pro/oapi_schemas/get_mobile_device_prestage_v2.rb +103 -0
  335. data/lib/jamf/api/jamf_pro/oapi_schemas/group_mappings.rb +138 -0
  336. data/lib/jamf/api/jamf_pro/oapi_schemas/group_membership.rb +94 -0
  337. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search.rb +106 -0
  338. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search_request.rb +83 -0
  339. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search_response.rb +89 -0
  340. data/lib/jamf/api/jamf_pro/oapi_schemas/history_search_results.rb +137 -0
  341. data/lib/jamf/api/jamf_pro/oapi_schemas/history_search_results_v1.rb +91 -0
  342. data/lib/jamf/api/jamf_pro/oapi_schemas/href_response.rb +168 -0
  343. data/lib/jamf/api/jamf_pro/oapi_schemas/icon_response.rb +91 -0
  344. data/lib/jamf/api/jamf_pro/oapi_schemas/id_and_name.rb +92 -0
  345. data/lib/jamf/api/jamf_pro/oapi_schemas/id_and_name_v2.rb +88 -0
  346. data/lib/jamf/api/jamf_pro/oapi_schemas/ids.rb +99 -0
  347. data/lib/jamf/api/jamf_pro/oapi_schemas/initialize.rb +133 -0
  348. data/lib/jamf/api/jamf_pro/oapi_schemas/initialize_v1.rb +133 -0
  349. data/lib/jamf/api/jamf_pro/oapi_schemas/install_package.rb +103 -0
  350. data/lib/jamf/api/jamf_pro/oapi_schemas/integer_wrapper.rb +84 -0
  351. data/lib/jamf/api/jamf_pro/oapi_schemas/internal_recipient.rb +94 -0
  352. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_information.rb +113 -0
  353. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_error.rb +123 -0
  354. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_error.rb +89 -0
  355. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_error_cause.rb +105 -0
  356. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_success.rb +86 -0
  357. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute.rb +89 -0
  358. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute_column.rb +87 -0
  359. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute_column_result.rb +89 -0
  360. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_invalid_csv_response.rb +88 -0
  361. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record.rb +248 -0
  362. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_search_results.rb +91 -0
  363. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_search_results_v2.rb +89 -0
  364. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_v2.rb +263 -0
  365. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_branding_configuration.rb +129 -0
  366. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_branding_search_results.rb +89 -0
  367. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_details.rb +255 -0
  368. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_details_v2.rb +255 -0
  369. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_application_response.rb +95 -0
  370. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_nation_credentials.rb +90 -0
  371. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_package_response.rb +107 -0
  372. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_information.rb +124 -0
  373. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_information_v2.rb +124 -0
  374. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_server_url.rb +92 -0
  375. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_version.rb +82 -0
  376. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_protect_plan.rb +125 -0
  377. data/lib/jamf/api/jamf_pro/oapi_schemas/language_code.rb +94 -0
  378. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_request.rb +99 -0
  379. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_response.rb +101 -0
  380. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_update.rb +99 -0
  381. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_group.rb +107 -0
  382. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_group_search_results.rb +91 -0
  383. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_server.rb +94 -0
  384. data/lib/jamf/api/jamf_pro/oapi_schemas/linked_connect_profile.rb +126 -0
  385. data/lib/jamf/api/jamf_pro/oapi_schemas/linked_connect_profile_search_results.rb +89 -0
  386. data/lib/jamf/api/jamf_pro/oapi_schemas/locale.rb +88 -0
  387. data/lib/jamf/api/jamf_pro/oapi_schemas/location.rb +125 -0
  388. data/lib/jamf/api/jamf_pro/oapi_schemas/location_information.rb +146 -0
  389. data/lib/jamf/api/jamf_pro/oapi_schemas/location_information_v2.rb +146 -0
  390. data/lib/jamf/api/jamf_pro/oapi_schemas/location_v2.rb +124 -0
  391. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_branding_configuration.rb +118 -0
  392. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_branding_search_results.rb +89 -0
  393. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_managed_software_update.rb +138 -0
  394. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_managed_software_update_response.rb +89 -0
  395. data/lib/jamf/api/jamf_pro/oapi_schemas/markdown.rb +84 -0
  396. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_client_type.rb +90 -0
  397. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command.rb +109 -0
  398. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_client.rb +88 -0
  399. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_request.rb +89 -0
  400. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_state.rb +89 -0
  401. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_type.rb +172 -0
  402. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_mappings.rb +84 -0
  403. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_test_search_request.rb +90 -0
  404. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_test_search_response.rb +88 -0
  405. data/lib/jamf/api/jamf_pro/oapi_schemas/memcached_endpoints.rb +113 -0
  406. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device.rb +153 -0
  407. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_application.rb +100 -0
  408. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_attachment.rb +89 -0
  409. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_attachment_v2.rb +89 -0
  410. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_certificate_v1.rb +87 -0
  411. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_certificate_v2.rb +146 -0
  412. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details.rb +235 -0
  413. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details_get_v2.rb +83 -0
  414. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details_v2.rb +259 -0
  415. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_ebook.rb +94 -0
  416. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_extension_attribute_results.rb +83 -0
  417. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_group.rb +96 -0
  418. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage.rb +136 -0
  419. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name.rb +94 -0
  420. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name_v2.rb +94 -0
  421. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names.rb +118 -0
  422. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names_v2.rb +118 -0
  423. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_search_results.rb +89 -0
  424. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_search_results_v2.rb +89 -0
  425. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_v2.rb +175 -0
  426. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_params.rb +144 -0
  427. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_results.rb +89 -0
  428. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_results_v2.rb +89 -0
  429. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_v2.rb +158 -0
  430. data/lib/jamf/api/jamf_pro/oapi_schemas/network.rb +171 -0
  431. data/lib/jamf/api/jamf_pro/oapi_schemas/network_v2.rb +179 -0
  432. data/lib/jamf/api/jamf_pro/oapi_schemas/notification.rb +96 -0
  433. data/lib/jamf/api/jamf_pro/oapi_schemas/notification_type.rb +141 -0
  434. data/lib/jamf/api/jamf_pro/oapi_schemas/notification_v1.rb +96 -0
  435. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history.rb +133 -0
  436. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history_note.rb +133 -0
  437. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history_v1.rb +106 -0
  438. data/lib/jamf/api/jamf_pro/oapi_schemas/order_by.rb +95 -0
  439. data/lib/jamf/api/jamf_pro/oapi_schemas/package_manifest.rb +148 -0
  440. data/lib/jamf/api/jamf_pro/oapi_schemas/parent_app.rb +131 -0
  441. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_ids_on_dashboard.rb +83 -0
  442. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_attempt.rb +102 -0
  443. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_attempt_action.rb +94 -0
  444. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_log.rb +124 -0
  445. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_log_search_results.rb +89 -0
  446. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_on_dashboard.rb +82 -0
  447. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_summary.rb +146 -0
  448. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_version.rb +96 -0
  449. data/lib/jamf/api/jamf_pro/oapi_schemas/personal_hotspot_setting.rb +87 -0
  450. data/lib/jamf/api/jamf_pro/oapi_schemas/plan_search_results.rb +89 -0
  451. data/lib/jamf/api/jamf_pro/oapi_schemas/plugin_path.rb +90 -0
  452. data/lib/jamf/api/jamf_pro/oapi_schemas/policy_properties.rb +91 -0
  453. data/lib/jamf/api/jamf_pro/oapi_schemas/policy_properties_v1.rb +91 -0
  454. data/lib/jamf/api/jamf_pro/oapi_schemas/post_computer_prestage_v2.rb +85 -0
  455. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_dependencies.rb +85 -0
  456. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_dependency.rb +93 -0
  457. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_file_attachment.rb +95 -0
  458. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_file_attachment_v2.rb +95 -0
  459. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information.rb +174 -0
  460. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information_v2.rb +174 -0
  461. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope.rb +84 -0
  462. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment.rb +93 -0
  463. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment_v2.rb +94 -0
  464. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_response.rb +109 -0
  465. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_response_v2.rb +109 -0
  466. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_update.rb +113 -0
  467. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_v2.rb +84 -0
  468. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_sync_status.rb +98 -0
  469. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_sync_status_v2.rb +98 -0
  470. data/lib/jamf/api/jamf_pro/oapi_schemas/process_texts_search_results.rb +91 -0
  471. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_registration_request.rb +98 -0
  472. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_settings_response.rb +141 -0
  473. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_updatable_settings_request.rb +83 -0
  474. data/lib/jamf/api/jamf_pro/oapi_schemas/provisioning_profile.rb +95 -0
  475. data/lib/jamf/api/jamf_pro/oapi_schemas/purchasing.rb +153 -0
  476. data/lib/jamf/api/jamf_pro/oapi_schemas/purchasing_v2.rb +153 -0
  477. data/lib/jamf/api/jamf_pro/oapi_schemas/put_computer_prestage.rb +82 -0
  478. data/lib/jamf/api/jamf_pro/oapi_schemas/put_computer_prestage_v2.rb +91 -0
  479. data/lib/jamf/api/jamf_pro/oapi_schemas/put_mobile_device_prestage.rb +82 -0
  480. data/lib/jamf/api/jamf_pro/oapi_schemas/put_mobile_device_prestage_v2.rb +82 -0
  481. data/lib/jamf/api/jamf_pro/oapi_schemas/recalculation_results.rb +92 -0
  482. data/lib/jamf/api/jamf_pro/oapi_schemas/recipient.rb +94 -0
  483. data/lib/jamf/api/jamf_pro/oapi_schemas/recipients.rb +82 -0
  484. data/lib/jamf/api/jamf_pro/oapi_schemas/redeploy_jamf_management_framework_response.rb +88 -0
  485. data/lib/jamf/api/jamf_pro/oapi_schemas/reenrollment.rb +117 -0
  486. data/lib/jamf/api/jamf_pro/oapi_schemas/remote_administration_response.rb +107 -0
  487. data/lib/jamf/api/jamf_pro/oapi_schemas/remote_administration_search_results.rb +90 -0
  488. data/lib/jamf/api/jamf_pro/oapi_schemas/renew_mdm_profile_response.rb +82 -0
  489. data/lib/jamf/api/jamf_pro/oapi_schemas/restart_device_command.rb +95 -0
  490. data/lib/jamf/api/jamf_pro/oapi_schemas/retry_patch_policy_params.rb +97 -0
  491. data/lib/jamf/api/jamf_pro/oapi_schemas/safelisted_app.rb +89 -0
  492. data/lib/jamf/api/jamf_pro/oapi_schemas/script.rb +192 -0
  493. data/lib/jamf/api/jamf_pro/oapi_schemas/scripts_search_results.rb +89 -0
  494. data/lib/jamf/api/jamf_pro/oapi_schemas/search_active_patch_history_params.rb +121 -0
  495. data/lib/jamf/api/jamf_pro/oapi_schemas/search_patch_policy_log_params.rb +121 -0
  496. data/lib/jamf/api/jamf_pro/oapi_schemas/security.rb +130 -0
  497. data/lib/jamf/api/jamf_pro/oapi_schemas/security_v2.rb +129 -0
  498. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_install_settings.rb +92 -0
  499. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_interaction_settings.rb +122 -0
  500. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_login_settings.rb +113 -0
  501. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_settings.rb +100 -0
  502. data/lib/jamf/api/jamf_pro/oapi_schemas/session.rb +82 -0
  503. data/lib/jamf/api/jamf_pro/oapi_schemas/session_candidate_request.rb +108 -0
  504. data/lib/jamf/api/jamf_pro/oapi_schemas/session_details.rb +175 -0
  505. data/lib/jamf/api/jamf_pro/oapi_schemas/session_details_search_results.rb +90 -0
  506. data/lib/jamf/api/jamf_pro/oapi_schemas/session_status.rb +98 -0
  507. data/lib/jamf/api/jamf_pro/oapi_schemas/set_recovery_lock_command.rb +82 -0
  508. data/lib/jamf/api/jamf_pro/oapi_schemas/settings_command.rb +167 -0
  509. data/lib/jamf/api/jamf_pro/oapi_schemas/shared_device_configuration.rb +87 -0
  510. data/lib/jamf/api/jamf_pro/oapi_schemas/signature.rb +93 -0
  511. data/lib/jamf/api/jamf_pro/oapi_schemas/site.rb +91 -0
  512. data/lib/jamf/api/jamf_pro/oapi_schemas/smart_search_criterion.rb +118 -0
  513. data/lib/jamf/api/jamf_pro/oapi_schemas/software_title_configuration.rb +89 -0
  514. data/lib/jamf/api/jamf_pro/oapi_schemas/software_title_patch_policy_summaries.rb +89 -0
  515. data/lib/jamf/api/jamf_pro/oapi_schemas/software_update_settings.rb +88 -0
  516. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore.rb +128 -0
  517. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_cert_parse_response.rb +130 -0
  518. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_details.rb +107 -0
  519. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_parse.rb +103 -0
  520. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_response.rb +120 -0
  521. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_response_with_details.rb +93 -0
  522. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_with_details.rb +93 -0
  523. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_metadata_url.rb +83 -0
  524. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_settings.rb +240 -0
  525. data/lib/jamf/api/jamf_pro/oapi_schemas/startup_status.rb +185 -0
  526. data/lib/jamf/api/jamf_pro/oapi_schemas/static_user_group.rb +91 -0
  527. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity.rb +107 -0
  528. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_certificate_upload.rb +99 -0
  529. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_create.rb +90 -0
  530. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_search_results.rb +89 -0
  531. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_update.rb +83 -0
  532. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_features.rb +105 -0
  533. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_settings_request.rb +108 -0
  534. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_settings_response.rb +122 -0
  535. data/lib/jamf/api/jamf_pro/oapi_schemas/time_frame.rb +87 -0
  536. data/lib/jamf/api/jamf_pro/oapi_schemas/time_zone.rb +107 -0
  537. data/lib/jamf/api/jamf_pro/oapi_schemas/tv_os_details.rb +140 -0
  538. data/lib/jamf/api/jamf_pro/oapi_schemas/udids.rb +83 -0
  539. data/lib/jamf/api/jamf_pro/oapi_schemas/update_apple_tv.rb +87 -0
  540. data/lib/jamf/api/jamf_pro/oapi_schemas/update_ios.rb +81 -0
  541. data/lib/jamf/api/jamf_pro/oapi_schemas/update_ios_v2.rb +81 -0
  542. data/lib/jamf/api/jamf_pro/oapi_schemas/update_mobile_device.rb +122 -0
  543. data/lib/jamf/api/jamf_pro/oapi_schemas/update_mobile_device_v2.rb +137 -0
  544. data/lib/jamf/api/jamf_pro/oapi_schemas/update_tv_os.rb +87 -0
  545. data/lib/jamf/api/jamf_pro/oapi_schemas/user_attributes.rb +117 -0
  546. data/lib/jamf/api/jamf_pro/oapi_schemas/user_mappings.rb +193 -0
  547. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search.rb +112 -0
  548. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search_request.rb +83 -0
  549. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search_response.rb +89 -0
  550. data/lib/jamf/api/jamf_pro/oapi_schemas/v1_site.rb +91 -0
  551. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_ca_record.rb +147 -0
  552. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_pki_payload_record.rb +87 -0
  553. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_pki_payload_record_search_results.rb +89 -0
  554. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_service_status.rb +83 -0
  555. data/lib/jamf/api/jamf_pro/oapi_schemas/verbose_package_deployment_response.rb +90 -0
  556. data/lib/jamf/api/jamf_pro/oapi_schemas/voice_roaming_setting.rb +87 -0
  557. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_content.rb +153 -0
  558. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location.rb +86 -0
  559. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_list_view.rb +171 -0
  560. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_patch.rb +111 -0
  561. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_post.rb +114 -0
  562. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_locations.rb +89 -0
  563. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscription.rb +86 -0
  564. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscription_base.rb +127 -0
  565. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscriptions.rb +89 -0
  566. data/lib/jamf/api/jamf_pro/oapi_schemas/vpp_admin_account.rb +119 -0
  567. data/lib/jamf/api/jamf_pro/oapi_schemas/vpp_token_subscription.rb +123 -0
  568. data/lib/jamf/api/jamf_pro/oapi_schemas/web_link.rb +87 -0
  569. data/lib/jamf/api/jamf_pro/oapi_schemas.rb +35 -0
  570. data/lib/jamf/api/jamf_pro/other_classes/change_log_entry.rb +37 -0
  571. data/lib/jamf/api/{attribute_classes → jamf_pro/other_classes}/ip_address.rb +2 -8
  572. data/lib/jamf/api/jamf_pro/other_classes/pager.rb +257 -0
  573. data/lib/jamf/api/{attribute_classes → jamf_pro/other_classes}/timestamp.rb +18 -14
  574. data/lib/jamf/{api/mixins/base_class.rb → base_class.rb} +8 -8
  575. data/lib/jamf/client/jamf_binary.rb +104 -99
  576. data/lib/jamf/client/jamf_helper.rb +274 -256
  577. data/lib/jamf/client/management_action.rb +84 -75
  578. data/lib/jamf/client.rb +15 -86
  579. data/lib/jamf/composer.rb +5 -5
  580. data/lib/jamf/configuration.rb +219 -196
  581. data/lib/jamf/{api/json_objects/prestage_sync_status.rb → constants.rb} +15 -32
  582. data/lib/{jss → jamf}/db_connection.rb +23 -31
  583. data/lib/{jpapi.rb → jamf/deprecations/deprecated_api_constant.rb} +5 -4
  584. data/lib/{jss/ruby_extensions/string.rb → jamf/deprecations/deprecated_config_constant.rb} +4 -12
  585. data/lib/jamf/exceptions.rb +14 -15
  586. data/lib/jamf/oapi_validate.rb +502 -0
  587. data/lib/jamf/ruby_extensions/array/predicates.rb +3 -1
  588. data/lib/jamf/ruby_extensions/array/utils.rb +2 -11
  589. data/lib/jamf/ruby_extensions/array.rb +1 -1
  590. data/lib/jamf/ruby_extensions/filetest/predicates.rb +2 -1
  591. data/lib/jamf/ruby_extensions/filetest.rb +1 -1
  592. data/lib/jamf/ruby_extensions/hash/{backports.rb → utils.rb} +53 -34
  593. data/lib/jamf/ruby_extensions/hash.rb +3 -3
  594. data/lib/jamf/ruby_extensions/ipaddr/utils.rb +7 -4
  595. data/lib/jamf/ruby_extensions/ipaddr.rb +2 -2
  596. data/lib/jamf/ruby_extensions/object/predicates.rb +3 -1
  597. data/lib/jamf/ruby_extensions/object.rb +1 -1
  598. data/lib/jamf/ruby_extensions/pathname/predicates.rb +3 -1
  599. data/lib/jamf/ruby_extensions/pathname/utils.rb +11 -5
  600. data/lib/jamf/ruby_extensions/pathname.rb +1 -1
  601. data/lib/jamf/ruby_extensions/string/conversions.rb +16 -1
  602. data/lib/jamf/ruby_extensions/string/predicates.rb +3 -1
  603. data/lib/jamf/ruby_extensions/string.rb +1 -3
  604. data/lib/{jss/ruby_extensions/time.rb → jamf/ruby_extensions/time/utils.rb} +40 -25
  605. data/lib/{jss/version.rb → jamf/ruby_extensions/time.rb} +7 -6
  606. data/lib/jamf/ruby_extensions.rb +9 -9
  607. data/lib/jamf/utility.rb +626 -410
  608. data/lib/jamf/validate.rb +86 -125
  609. data/lib/jamf/version.rb +3 -3
  610. data/lib/jamf.rb +76 -131
  611. data/lib/jss-api.rb +2 -2
  612. data/lib/jss.rb +3 -215
  613. data/lib/ruby-jss.rb +2 -2
  614. data/lib/zeitwerk_config.rb +163 -0
  615. data/test/README-TEST.md +65 -0
  616. data/test/bin/runtests +97 -130
  617. data/test/lib/jamf_test/APITest.rb +106 -0
  618. data/{lib/jss/ruby_extensions/filetest.rb → test/lib/jamf_test/advanced_search.rb} +16 -20
  619. data/test/lib/jamf_test/auth.rb +267 -0
  620. data/test/lib/jamf_test/collection_tests.rb +388 -0
  621. data/test/lib/jamf_test/prestage_tests.rb +135 -0
  622. data/test/lib/{testhelper.rb → jamf_test.rb} +15 -12
  623. data/{lib/jss/ruby_extensions.rb → test/tests/advanced_computer_search.rb} +11 -12
  624. data/test/tests/advanced_mobile_device_search.rb +36 -0
  625. data/test/tests/advanced_user_search.rb +36 -0
  626. data/test/tests/building.rb +41 -0
  627. data/test/tests/category.rb +41 -0
  628. data/test/tests/computer.rb +41 -0
  629. data/test/tests/computer_group.rb +132 -0
  630. data/test/tests/computer_prestage.rb +36 -0
  631. data/test/tests/department.rb +41 -0
  632. data/test/tests/device_enrollment.rb +101 -0
  633. data/test/tests/inventory_preload_record.rb +131 -0
  634. data/test/tests/jp_building.rb +41 -0
  635. data/test/tests/mobile_device.rb +41 -0
  636. data/test/tests/mobile_device_prestage.rb +37 -0
  637. data/test/tests/policy.rb +151 -0
  638. metadata +654 -213
  639. data/lib/jamf/api/base_classes/collection_resource.rb +0 -612
  640. data/lib/jamf/api/base_classes/json_object.rb +0 -1103
  641. data/lib/jamf/api/base_classes/prestage.rb +0 -503
  642. data/lib/jamf/api/base_classes/resource.rb +0 -259
  643. data/lib/jamf/api/base_classes/singleton_resource.rb +0 -88
  644. data/lib/jamf/api/connection/api_error.rb +0 -111
  645. data/lib/jamf/api/connection/api_error_styleguide.rb +0 -96
  646. data/lib/jamf/api/json_objects/change_log_entry.rb +0 -77
  647. data/lib/jamf/api/json_objects/country.rb +0 -51
  648. data/lib/jamf/api/json_objects/device_enrollment_device.rb +0 -165
  649. data/lib/jamf/api/json_objects/device_enrollment_device_sync_state.rb +0 -81
  650. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +0 -71
  651. data/lib/jamf/api/json_objects/inventory_preload_extension_attribute.rb +0 -57
  652. data/lib/jamf/api/json_objects/locale.rb +0 -59
  653. data/lib/jamf/api/json_objects/md_prestage_name.rb +0 -57
  654. data/lib/jamf/api/json_objects/md_prestage_names.rb +0 -82
  655. data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +0 -214
  656. data/lib/jamf/api/json_objects/prestage_assignment.rb +0 -76
  657. data/lib/jamf/api/json_objects/prestage_location.rb +0 -104
  658. data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +0 -132
  659. data/lib/jamf/api/json_objects/prestage_scope.rb +0 -57
  660. data/lib/jamf/api/json_objects/time_zone.rb +0 -105
  661. data/lib/jamf/api/mixins/change_log.rb +0 -288
  662. data/lib/jamf/api/mixins/extendable.rb +0 -75
  663. data/lib/jamf/api/mixins/pageable.rb +0 -208
  664. data/lib/jamf/api/mixins/searchable.rb +0 -202
  665. data/lib/jamf/api/resources/collection_resources/building.rb +0 -121
  666. data/lib/jamf/api/resources/collection_resources/category.rb +0 -83
  667. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +0 -89
  668. data/lib/jamf/api/resources/collection_resources/department.rb +0 -78
  669. data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +0 -384
  670. data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +0 -289
  671. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +0 -143
  672. data/lib/jamf/api/resources/collection_resources/script.rb +0 -226
  673. data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +0 -141
  674. data/lib/jamf/api/resources/singleton_resources/locales.rb +0 -155
  675. data/lib/jamf/api/resources/singleton_resources/time_zones.rb +0 -213
  676. data/lib/jamf/compatibility.rb +0 -88
  677. data/lib/jamf/ruby_extensions/dig.rb +0 -52
  678. data/lib/jamf/ruby_extensions/string/backports.rb +0 -66
  679. data/lib/jss/api_connection.rb +0 -1029
  680. data/lib/jss/api_object/app_store_country_codes.rb +0 -298
  681. data/lib/jss/api_object/computer/application_installs.rb +0 -118
  682. data/lib/jss/client/jamf_binary.rb +0 -132
  683. data/lib/jss/client/jamf_helper.rb +0 -298
  684. data/lib/jss/client/management_action.rb +0 -113
  685. data/lib/jss/client.rb +0 -301
  686. data/lib/jss/compatibility.rb +0 -88
  687. data/lib/jss/composer.rb +0 -190
  688. data/lib/jss/configuration.rb +0 -319
  689. data/lib/jss/exceptions.rb +0 -115
  690. data/lib/jss/ruby_extensions/array.rb +0 -52
  691. data/lib/jss/ruby_extensions/hash.rb +0 -140
  692. data/lib/jss/ruby_extensions/ipaddr.rb +0 -92
  693. data/lib/jss/ruby_extensions/object.rb +0 -19
  694. data/lib/jss/ruby_extensions/pathname.rb +0 -78
  695. data/lib/jss/ruby_extensions/string/backports.rb +0 -68
  696. data/lib/jss/ruby_extensions/string/conversions.rb +0 -69
  697. data/lib/jss/ruby_extensions/string/predicates.rb +0 -57
  698. data/lib/jss/server.rb +0 -146
  699. data/lib/jss/utility.rb +0 -672
  700. data/lib/jss/validate.rb +0 -248
  701. data/test/README.md +0 -147
  702. data/test/lib/testhelper/auth.rb +0 -275
  703. data/test/lib/testhelper/patch_mgmt.rb +0 -123
  704. data/test/specs/api_connection_spec.rb +0 -57
  705. data/test/specs/patch01_source_spec.rb +0 -54
  706. data/test/specs/patch02_internal_source_spec.rb +0 -88
  707. data/test/specs/patch03_external_source_spec.rb +0 -120
  708. data/test/specs/patch04_titles_spec.rb +0 -207
  709. data/test/specs/patch05_policies_spec.rb +0 -119
  710. data/test/specs/patch06_cleanup_spec.rb +0 -52
  711. data/test/specs/policy_spec.rb +0 -112
@@ -1,1103 +0,0 @@
1
- # Copyright 2020 Pixar
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "Apache License")
4
- # with the following modification; you may not use this file except in
5
- # compliance with the Apache License and the following modification to it:
6
- # Section 6. Trademarks. is deleted and replaced with:
7
- #
8
- # 6. Trademarks. This License does not grant permission to use the trade
9
- # names, trademarks, service marks, or product names of the Licensor
10
- # and its affiliates, except as required to comply with Section 4(c) of
11
- # the License and to reproduce the content of the NOTICE file.
12
- #
13
- # You may obtain a copy of the Apache License at
14
- #
15
- # http://www.apache.org/licenses/LICENSE-2.0
16
- #
17
- # Unless required by applicable law or agreed to in writing, software
18
- # distributed under the Apache License with the above modification is
19
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20
- # KIND, either express or implied. See the Apache License for the specific
21
- # language governing permissions and limitations under the Apache License.
22
- #
23
- #
24
-
25
- # The module
26
- module Jamf
27
-
28
- # Classes
29
- #####################################
30
-
31
- # # Jamf::JSONObject
32
- #
33
- # In JSON & Javascript, an 'object' is a data structure equivalent to a
34
- # Hash in Ruby. Much of the JSON data exchaged with the API is formatted as
35
- # these JSON objects.
36
- #
37
- # Jamf::JSONObject is a meta class that provides a way to convert those JSON
38
- # 'objects' into not just Hashes (that's done by the Jamf::Connection) but
39
- # into full-fledged ruby Classes. Once implemented in ruby-jss, all JSON
40
- # objects (Hashes) used anywhere in the Jamf Pro API have a matching Class in
41
- # ruby-jss which is a subclass of Jamf::JSONObject
42
- #
43
- # The Jamf::JSONObject class is a base class, and cannot be instantiated or used
44
- # directly. It merely provides the common functionality needed for dealing
45
- # with all JSON objects in the API.
46
- #
47
- #
48
- # ## Subclassing
49
- #
50
- # When implementing a JSON object in the API as a class in ruby-jss,
51
- # you will make a subclass of either Jamf::JSONObject, Jamf::SingletonResource
52
- # or Jamf::CollectionResource.
53
- #
54
- # Here's the relationship between these base classes:
55
- #
56
- # Jamf::JSONObject
57
- # (abstract)
58
- # |
59
- # |
60
- # -----------------------
61
- # | |
62
- # Jamf::Resource |
63
- # (abstract) |
64
- # | |
65
- # | |
66
- # | Jamf::Computer::Reference
67
- # | Jamf::Location
68
- # | Jamf::ChangeLog::Entry
69
- # | (more non-resource JSON object classes)
70
- # |
71
- # |----------------------------------------
72
- # | |
73
- # | |
74
- # Jamf::SingletonResource Jamf::CollectionResource
75
- # (abstract) (abstract)
76
- # | |
77
- # | |
78
- # Jamf::Settings::ReEnrollment Jamf::Computer
79
- # Jamf::Settings::SelfService Jamf::Building
80
- # Jamf::SystemInfo Jamf::PatchPolicy
81
- # (more singleton resource classes) (more collection resource classes)
82
- #
83
- #
84
- # Direct descendents of Jamf::JSONObject are arbitrary JSON objects that
85
- # appear inside other objects, e.g. the Location data for a computer,
86
- # or a reference to a building.
87
- #
88
- # {Jamf::Resource} classes represent direct resources of the API, i.e. items
89
- # accessible with a URL. The ability to interact with those URLs is defined in
90
- # the metaclass Jamf::Resource, and all resources must define a RSRC_VERSION
91
- # and a RSRC_PATH. See {Jamf::Resource} for more info.
92
- #
93
- # There are two kinds of resources in the API:
94
- #
95
- # {Jamf::SingletonResource} classes represent objects in the API that have
96
- # only one instance, such as various settings, or server-wide state. These
97
- # objects cannot be created or deleted, only fetched and updated.
98
- #
99
- # {Jamf::CollectionResource} classes represent collections of objects in the
100
- # API. These resources can list all of their members, and individual members
101
- # can be retrieved, updated, created and deleted.
102
- #
103
- # Subclasses need to meet the requirements for all of their ancestors,
104
- # so once you decide which one you're subclassing, be sure to read the docs
105
- # for each one. E.g. to implement Jamf::Package, it will be a
106
- # {Jamf::CollectionResource}, which is a {Jamf::Resource}, which is a
107
- # {Jamf::JSONObject}, and the requirements for all must be met.
108
- #
109
- # The remainder of this page documents the requirements and details of
110
- # Jamf::JSONObject.
111
- #
112
- #
113
- # NOTES:
114
- #
115
- # - subclasses may define more methods, include mix-ins, and if
116
- # needed can override methods defined in metaclasses. Please read the
117
- # docs before overriding.
118
- #
119
- # - Throughout the documentation 'parsed JSON object' means the result of running
120
- # a raw JSON string thru `JSON.parse raw_json, symbolize_names: true`. This
121
- # is performed in the {Jamf::Connection} methods which interact with the API:
122
- # {Jamf::Connection#get}, {Jamf::Connection#post}, {Jamf::Connection#put}
123
- # {Jamf::Connection#patch} and {Jamf::Connection#delete}.
124
- #
125
- # - Related to the above, the {Jamf::Connection} methods
126
- # {Jamf::Connection#post} and {Jamf::Connection#put} call `#to_json` on the
127
- # data passed to them, before sending it to the API. Subclasses and
128
- # application code should never call #to_json anywhere. The data passed
129
- # to put and post should be the output of `#to_jamf` on a Jamf::JSONObject,
130
- # which is handled by the the #update and #create methods as needed.
131
- #
132
- #
133
- # ###
134
- #
135
- # ### Required Constant: OBJECT_MODEL & call to parse_object_model
136
- #
137
- # Each descendent of JSONObject must define the constant OBJECT_MODEL, which
138
- # is a Hash of Hashes that collectively define the top-level keys of the JSON
139
- # object as attributes of the matching ruby class.
140
- #
141
- # Immediately after the definition of OBJECT_MODEL, the subclass *MUST* call
142
- # `self.parse_object_model` to convert the model into actual ruby attributes
143
- # with getters and setters.
144
- #
145
- # The OBJECT_MODEL Hash directly implements the matching JSON object model
146
- # defined at https://developer.jamf.com/apis/jamf-pro-api/index and is used
147
- # to automatically create attributes & accessor methods mirroring those
148
- # in the API.
149
- #
150
- # The keys of the main hash are the symbolized names of the attributes as they
151
- # come from the JSON fetched from the API.
152
- #
153
- # _ATTRIBUTE NAMES:_
154
- #
155
- # The attribute names in the Jamf Pro API JSON data are in 'lowerCamelCase'
156
- # (https://en.wikipedia.org/wiki/Camel_case), and are used that way
157
- # throughout the Jamf module in order to maintain consistency with the API
158
- # itself. This differs from the ruby standard of using 'snake_case'
159
- # (https://en.wikipedia.org/wiki/Snake_case) for attributes,
160
- # methods, & local variables. I believe that maintaining consistency with the
161
- # API we are mirroring is more important (and simpler) than conforming with
162
- # ruby's community standards. I also believe that doing so is in-line with the
163
- # ruby community's larger philosophy.
164
- #
165
- # "There's more than one way to do it" - because context matters.
166
- # If that weren't true, I'd be writing Python.
167
- #
168
- # Each attribute key has a Hash of details defining how the attribute is
169
- # used in the class. Getters and setters are created from these details, and
170
- # they are used to parse incoming, and generate outgoing JSON data
171
- #
172
- # The possible keys of the details Hash for each attribute are:
173
- #
174
- # - class:
175
- # - identfier:
176
- # - required:
177
- # - readonly:
178
- # - multi:
179
- # - enum:
180
- # - validator:
181
- # - aliases:
182
- # - filter_key:
183
- #
184
- # For an example of an OBJECT_MODEL hash, see {Jamf::MobileDeviceDetails::OBJECT_MODEL}
185
- #
186
- # The details for each key's value are as follows. Note that omitting a
187
- # boolean key is the same as setting it to false.
188
- #
189
- # class: \[Symbol or Class]
190
- # -----------------
191
- # This is the only required key for all attributes.
192
- #
193
- # ---
194
- # Symbol is one of :string, :integer, :float, :boolean, or :j_id
195
- #
196
- # The first four are the JSON data types that don't need parsing into ruby
197
- # beyond that done by `JSON.parse`. When processing an attribute with one of
198
- # these symbols as the `class:`, the JSON value is used as-is.
199
- #
200
- # The ':j_id' symbol means this value is an id used to reference an object in
201
- # a collection resource of the API - all such objects have an 'id' attribute
202
- # which is a String containing an Integer.
203
- #
204
- # These ids are used not only as the id attribute of the object itself, but
205
- # if an object contains references to one or more other objects, those
206
- # references are also ':j_id' values.
207
- # In setters and .create, :j_id values can take either an integer or an
208
- # integer-in-a-string, and are stored as integer-in-a-string/
209
- #
210
- # When 'class:' is not a Symbol, it must be an actual class, such as
211
- # Jamf::Timestamp or Jamf::PurchasingData.
212
- #
213
- # Actual classes used this way _must_:
214
- #
215
- # - Have an #initialize method that takes two parameters and performs
216
- # validation on them:
217
- #
218
- # A first positional parameter, the value used to create the instance,
219
- # which accepts, at the very least, the Parsed JSON data for the attribute.
220
- # This can be a single value (e.g. a string for Jamf::Timestamp), or a Hash
221
- # (e.g. for Jamf::Location), or whatever. Other values are
222
- # allowed if your initialize method handles them properly.
223
- #
224
- # A keyword parameter `cnx:`. This can be ignored if not needed, but
225
- # #initialize must accept it. If used, it will contain a Jamf::Connection
226
- # object, either the one from which the first param came, or the one
227
- # to which we'll be validating or creating a new object
228
- #
229
- # - Define a #to_jamf method that returns a value that can be used
230
- # in the data sent back to the API. Subclasses of JSONObject already
231
- # have this requirement, and the value is a Hash.
232
- #
233
- #
234
- # Classes used in the class: value of an attribute definition are often
235
- # also subclasses of JSONObject (e.g. Jamf::Location) but do not have to be
236
- # as long as they conform to the standards above, e.g. Jamf::Timestamp.
237
- #
238
- # See also: [Data Validation](#data_validation) below.
239
- #
240
- #
241
- # identifier: \[Boolean or Symbol :primary]
242
- # -----------------
243
- # Only applicable to descendents of Jamf::CollectionResource
244
- #
245
- # If true, this value must be unique among all members of the class in
246
- # the JAMF, and can be used to look up objects.
247
- #
248
- # If the symbol :primary, this is the primary identifier, used in API
249
- # resource paths for this particular object. Usually its the :id attribute,
250
- # but for some objects may be some other attribute, e.g. for config-
251
- # profiles, it would be a uuid.
252
- #
253
- #
254
- # required: \[Boolean]
255
- # -----------------
256
- # If true, this attribute must be provided when creating a new local instance
257
- # and cannot be set to nil or empty
258
- #
259
- #
260
- # readonly: \[Boolean]
261
- # -----------------
262
- # If true, no setter method(s) will be created, and the value is not
263
- # sent to the API with #create or #update
264
- #
265
- #
266
- # multi: \[Boolean]
267
- # -----------------
268
- # When true, this value comes as a JSON array and its items are defined by
269
- # the 'class:' setting described above. The JSON array is used
270
- # to contstruct an attribute array of the correct kind of item.
271
- #
272
- # Example:
273
- # > When `class:` is Jamf::Computer::Reference the incoming JSON array
274
- # > of Hashes (computer references) will become an array of
275
- # > Jamf::Computer::Reference instances.
276
- #
277
- # The stored array is not directly accessible, the getter will return a
278
- # frozen duplicate of it.
279
- #
280
- # If not readonly, several setters are created:
281
- #
282
- # - a direct setter which takes an Array of 'class:', replacing the original
283
- # - a <attrname>\_append method, appends a new value to the array,
284
- # aliased as `<<`
285
- # - a <attrname>\_prepend method, prepends a new value to the array
286
- # - a <attrname>\_insert method, inserts a new value to the array
287
- # at the given index
288
- # - a <attrname>\_delete\_at method, deletes a value at the given index
289
- #
290
- # This protection of the underlying array is needed for two reasons:
291
- #
292
- # 1. so ruby-jss knows when changes are made and need to be saved
293
- # 2. so that validation can be performed on values added to the array.
294
- #
295
- #
296
- # enum: \[Constant -> Array ]
297
- # -----------------
298
- # This is a constant defined somewhere in the Jamf module. The constant
299
- # must contain an Array of values, usually Strings. You may or may not choose
300
- # to define the array members as constants themselves.
301
- #
302
- # Example:
303
- # > Attribute `:type` has enum: Jamf::ExtentionAttribute::DATA_TYPES
304
- # >
305
- # > The constant Jamf::ExtentionAttribute::DATA_TYPES is defined thus:
306
- # >
307
- # > DATA_TYPE_STRING = 'STRING'.freeze
308
- # > DATA_TYPE_INTEGER = 'INTEGER'.freeze
309
- # > DATA_TYPE_DATE = 'DATE'.freeze
310
- # >
311
- # > DATA_TYPES = [
312
- # > DATA_TYPE_STRING,
313
- # > DATA_TYPE_INTEGER,
314
- # > DATA_TYPE_DATE,
315
- # > ]
316
- # >
317
- # > When setting the type attribute via `#type = newval`,
318
- # > `Jamf::ExtentionAttribute::DATA_TYPES.include? newval` must be true
319
- # >
320
- #
321
- # Setters for attributes with an enum require that the new value is
322
- # a member of the array as seen above. When using such setters, If you defined
323
- # the array members as constants themselves, it is wise to use those rather
324
- # than a different but identical string, however either will work.
325
- # In other words, this:
326
- #
327
- # my_ea.dataType = Jamf::ExtentionAttribute::DATA_TYPE_INTEGER
328
- #
329
- # is preferred over:
330
- #
331
- # my_ea.dataType = 'INTEGER'
332
- #
333
- # since the second version creates a new string in memory, but the first uses
334
- # the one already stored in a constant.
335
- #
336
- # See also: [Data Validation](#data_validation) below.
337
- #
338
- # validator: \[Symbol]
339
- # -----------------
340
- # (ignored if readonly: is true, or if enum: is set)
341
- #
342
- # The symbol is the name of a Jamf::Validators class method used in the
343
- # setter to validate new values for this attribute. It only is used when
344
- # class: is :string, :integer, :boolean, and :float
345
- #
346
- # If omitted, the setter will take any value passed to it, which is
347
- # generally unwise.
348
- #
349
- # When the class: is an actual class, the setter will instantiate a new one
350
- # with the value to be set, and validation is handled by the class itself.
351
- #
352
- # Example:
353
- # > If the `class:` for an attrib named ':releaseDate' is class: Jamf::Timestamp
354
- # > then the setter method will look like this:
355
- # >
356
- # > def releaseDate=(newval)
357
- # > newval = Jamf::Timestamp.new newval unless newval.is_a? Jamf::Timestamp
358
- # > # ^^^ This will validate newval
359
- # > return if newval == @releaseDate
360
- # > @releaseDate = newval
361
- # > @need_to_update = true
362
- # > end
363
- #
364
- # see also: [Data Validation](#data_validation) below.
365
- #
366
- #
367
- # aliases: \[Array of Symbols]
368
- # -----------------
369
- # Other names for this attribute. If provided, getters, and setters will
370
- # be made for all aliases. Should be used very sparingly.
371
- #
372
- # Attributes of class :boolean automatically have a getter alias ending with a '?'.
373
- #
374
- # filter_key: \[Boolean]
375
- # -----------------
376
- # For subclasses of CollectionResource, GETting the main endpoint will return
377
- # the entire collection. Some of these endpoints support RSQL filters to return
378
- # only those objects that match the filter. If this attribute can be used as
379
- # a field for filtering, set filter_key: to true, and filters will be used
380
- # where possible to optimize GET requests.
381
- #
382
- # Documenting your code
383
- # ---------------------
384
- # For documenting attributes with YARD, put this above each
385
- # attribute name key:
386
- #
387
- # ```
388
- # # @!attribute <attrname>
389
- # # @param [Class] <Describe setter value if needed>
390
- # # @return [Class] <Describe value if needed>
391
- # ```
392
- #
393
- # If the value is readonly, remove the @param line, and add \[r], like this:
394
- #
395
- # ```
396
- # # @!attribute [r] <attrname
397
- # ```
398
- #
399
- # for more info see https://www.rubydoc.info/gems/yard/file/docs/Tags.md#attribute
400
- #
401
- #
402
- # #### Sub-subclassing
403
- #
404
- # If you need to subclass a subclass of JSONObject, and the new subclass needs
405
- # to expand on the OBJECT_MODEL in its parent, then you must use Hash#merge
406
- # to combine them in the subclass. Here's an example of ComputerPrestage
407
- # which inherits from Prestage:
408
- #
409
- # class ComputerPrestage < Jamf::Prestage
410
- #
411
- # OBJECT_MODEL = superclass::OBJECT_MODEL.merge(
412
- #
413
- # newAttr: {
414
- # [attr details]
415
- # }
416
- #
417
- # ).freeze
418
- #
419
- #
420
- # #### Data Validation \{#data_validation}
421
- #
422
- # Attributes that are not readonly are subject to data validation when values are
423
- # assigned. How that validation happens depends on the definition of the
424
- # attribute as described above. Validation failure will raise an exception,
425
- # usually Jamf::InvalidDataError.
426
- #
427
- # Only one value-validation is applied, depending on the attribute definition:
428
- #
429
- # - If the attribute is defined with a specific validator, the value is passed
430
- # to that validator, and other validators are ignored
431
- #
432
- # - If the attribute is defined with an enum, the value must be
433
- # a value of the enum.
434
- #
435
- # - If the attribute is defined as a :string, :integer, :float or :bool
436
- # without an enum or validator, it is confirmed to be the correct type
437
- #
438
- # - If the attribute is defined to hold a :j_id, the Validate.j_id method
439
- # is used, it must be an integer or integer-in-string
440
- #
441
- # - If the attribute is defined to hold a JAMF class, (e.g. Jamf::Timestamp)
442
- # the class itself performs validation on the value when instantiated
443
- # with the value.
444
- #
445
- # - Otherwise, the value is used unchanged with no validation
446
- #
447
- # Additionally:
448
- #
449
- # - If an attribute is an identifier, it must be unique in its class and
450
- # API connection.
451
- #
452
- # - If an attribute is required, it may not be nil or empty
453
- #
454
- # - If an attribute is :multi, the value must be an array and each member
455
- # value is validated individually
456
- #
457
- # ### Constructor / Instantiation {#constructor}
458
- #
459
- # The .new method should rarely (never?) be called directly for any JSONObject
460
- # class.
461
- #
462
- # The Resource classes are instantiated via the .fetch and .create methods.
463
- #
464
- # Other JSONObject classes are embedded inside the Resource classes
465
- # and are instantiated while parsing data from the API or by the setters for
466
- # the attributes holding them.
467
- #
468
- # When subclassing JSONObject, you can often just use the #initialize defined
469
- # here. You may want to override #initialize to accept different kinds of data
470
- # and if you do, you _must_:
471
- #
472
- # - Have an #initialize method that takes two parameters and performs
473
- # validation using them:
474
- #
475
- # 1. A positional first parameter: the value used to create the instance
476
- # Your method may accept any kind of value, as long as it can use it
477
- # to create a valid object. At the very least it _must_ accept a Hash
478
- # that comes from the API for this object. If you call `super` then
479
- # that Hash must be passed.
480
- #
481
- # For example, Jamf::GenericReference, which defines references to
482
- # other resources, such as Buildings, can take a Hash containing the
483
- # name: and id: of the building (as provided by the API), or can take
484
- # just a name or id, or can take a Jamf::Building object.
485
- #
486
- # The initialize method must perform validation as necessary and raise
487
- # an exception if the data provided is not acceptable.
488
- #
489
- # 2. A keyword parameter `cnx:` containing a Jamf::Connection instance.
490
- # This is the API connection through which this JSON object interacts
491
- # with the appropriate Jamf Pro server. Usually this is used to validate
492
- # the data recieved in the first positional parameter.
493
- #
494
- # ### Required Instance Methods
495
- #
496
- # Subclasses of JSONObject must have a #to_jamf method.
497
- # For most simple objects, the one defined in JSONObject will work as is.
498
- #
499
- # If you need to override it, it _must_
500
- #
501
- # - Return a Hash that can be used in the data sent back to the API.
502
- # - Not call #.to_json. All conversion to and from JSON happens in the
503
- # Jamf::Connection class.
504
- #
505
- # @abstract
506
- #
507
- class JSONObject
508
-
509
- extend Jamf::BaseClass
510
-
511
- # Constants
512
- #####################################
513
-
514
- # These classes are used from JSON in the raw
515
- JSON_TYPE_CLASSES = %i[string integer float boolean].freeze
516
-
517
- # Public Class Methods
518
- #####################################
519
-
520
- # By default, JSONObjects (as a whole) are mutable,
521
- # although some attributes may not be (see OBJECT_MODEL in the JSONObject
522
- # docs)
523
- #
524
- # When an entire sublcass of JSONObject is read-only/immutable,
525
- # `extend Jamf::Immutable`, which will override this to return false.
526
- # Doing so will prevent any setters from being created for the subclass
527
- # and will cause Jamf::Resource.save to raise an error
528
- #
529
- def self.mutable?
530
- true
531
- end
532
-
533
- # An array of attribute names that are required when
534
- # making new instances
535
- # See the OBJECT_MODEL documentation in {Jamf::JSONObject}
536
- def self.required_attributes
537
- self::OBJECT_MODEL.select { |_attr, deets| deets[:required] }.keys
538
- end
539
-
540
- # Given a Symbol that might be an alias of a key fron OBJECT_MODEL
541
- # return the real key
542
- #
543
- # e.g. if OBJECT_MODEL has an entry like this:
544
- # displayName: { aliases: [:name, :display_name] }
545
- # Then
546
- # attr_key_for_alias(:name) and attr_key_for_alias(:display_name)
547
- # will return :displayName
548
- #
549
- # Returns nil if no such alias exists.
550
- #
551
- # @param als [Symbol] the alias to look up
552
- #
553
- # @return [Symbol, nil] The real object model key for the alias
554
- #
555
- def self.attr_key_for_alias(als)
556
- stop_if_base_class
557
- self::OBJECT_MODEL.each { |k, deets| return k if k == als || deets[:aliases].to_a.include?(als) }
558
- nil
559
- end
560
-
561
- # Private Class Methods
562
- #####################################
563
-
564
- # create getters and setters for subclasses of APIObject
565
- # based on their OBJECT_MODEL Hash.
566
- #
567
- ##############################
568
- def self.parse_object_model
569
- return if @object_model_parsed
570
-
571
- got_primary = false
572
- need_list_methods = ancestors.include?(Jamf::CollectionResource)
573
-
574
- self::OBJECT_MODEL.each do |attr_name, attr_def|
575
-
576
- # don't make one for :id, that one's hard-coded into CollectionResource
577
- create_list_methods(attr_name, attr_def) if need_list_methods && attr_def[:identifier] && attr_name != :id
578
-
579
- # there can be only one (primary ident)
580
- if attr_def[:identifier] == :primary
581
- raise Jamf::UnsupportedError, 'Two identifiers marked as :primary' if got_primary
582
-
583
- got_primary = true
584
- end
585
-
586
- create_getters attr_name, attr_def
587
- next if attr_def[:readonly]
588
-
589
- create_setters attr_name, attr_def if mutable?
590
- end # do |attr_name, attr_def|
591
-
592
- @object_model_parsed = true
593
- end # parse_object_model
594
- private_class_method :parse_object_model
595
-
596
- # create a getter for an attribute, and any aliases needed
597
- ##############################
598
- def self.create_getters(attr_name, attr_def)
599
- # multi_value - only return a frozen dup, no direct editing of Array
600
- if attr_def[:multi]
601
- define_method(attr_name) do
602
- instance_variable_set("@#{attr_name}", []) unless instance_variable_get("@#{attr_name}").is_a?(Array)
603
- instance_variable_get("@#{attr_name}").dup.freeze
604
- end
605
-
606
- # single value
607
- else
608
- define_method(attr_name) { instance_variable_get("@#{attr_name}") }
609
-
610
- end
611
-
612
- # all booleans get predicate aliases
613
- define_predicates(attr_name) if attr_def[:class] == :boolean
614
-
615
- return unless attr_def[:aliases]
616
-
617
- # aliases
618
- attr_def[:aliases].each { |a| alias_method a, attr_name }
619
- end # create getters
620
- private_class_method :create_getters
621
-
622
- # create the default aliases for booleans
623
- ##############################
624
- def self.define_predicates(attr_name)
625
- alias_method("#{attr_name}?", attr_name)
626
- end
627
-
628
- # create setter(s) for an attribute, and any aliases needed
629
- ##############################
630
- def self.create_setters(attr_name, attr_def)
631
- # multi_value
632
- if attr_def[:multi]
633
- create_array_setters(attr_name, attr_def)
634
- return
635
- end
636
-
637
- # single value
638
- define_method("#{attr_name}=") do |new_value|
639
- new_value = validate_attr attr_name, new_value
640
- old_value = instance_variable_get("@#{attr_name}")
641
- return if new_value == old_value
642
-
643
- instance_variable_set("@#{attr_name}", new_value)
644
- note_unsaved_change attr_name, old_value
645
- end # define method
646
-
647
- return unless attr_def[:aliases]
648
-
649
- # setter aliases
650
- attr_def[:aliases].each { |a| alias_method "#{a}=", "#{attr_name}=" }
651
- end # create_setters
652
- private_class_method :create_setters
653
-
654
- ##############################
655
- def self.create_array_setters(attr_name, attr_def)
656
- create_full_array_setters(attr_name, attr_def)
657
- create_append_setters(attr_name, attr_def)
658
- create_prepend_setters(attr_name, attr_def)
659
- create_insert_setters(attr_name, attr_def)
660
- create_delete_at_setters(attr_name, attr_def)
661
- create_delete_if_setters(attr_name, attr_def)
662
- end # def create_multi_setters
663
- private_class_method :create_array_setters
664
-
665
- # The attr=(newval) setter method for array values
666
- ##############################
667
- def self.create_full_array_setters(attr_name, attr_def)
668
- define_method("#{attr_name}=") do |new_value|
669
- instance_variable_set("@#{attr_name}", []) unless instance_variable_get("@#{attr_name}").is_a?(Array)
670
- raise Jamf::InvalidDataError, 'Value must be an Array' unless new_value.is_a? Array
671
-
672
- new_value.map! { |item| validate_attr attr_name, item }
673
- old_value = instance_variable_get("@#{attr_name}")
674
- return if new_value == old_value
675
-
676
- instance_variable_set("@#{attr_name}", new_value)
677
- note_unsaved_change attr_name, old_value
678
- end # define method
679
-
680
- return unless attr_def[:aliases]
681
-
682
- attr_def[:aliases].each { |al| alias_method "#{al}=", "#{attr_name}=" }
683
- end # create_full_array_setter
684
- private_class_method :create_full_array_setters
685
-
686
- # The attr_append(newval) setter method for array values
687
- ##############################
688
- def self.create_append_setters(attr_name, attr_def)
689
- define_method("#{attr_name}_append") do |new_value|
690
- instance_variable_set("@#{attr_name}", []) unless instance_variable_get("@#{attr_name}").is_a?(Array)
691
- new_value = validate_attr attr_name, new_value
692
- old_array = instance_variable_get("@#{attr_name}").dup
693
- instance_variable_get("@#{attr_name}") << new_value
694
- note_unsaved_change attr_name, old_array
695
- end # define method
696
-
697
- # always have a << alias
698
- alias_method "#{attr_name}<<", "#{attr_name}_append"
699
-
700
- return unless attr_def[:aliases]
701
-
702
- attr_def[:aliases].each do |al|
703
- alias_method "#{al}_append", "#{attr_name}_append"
704
- alias_method "#{al}<<", "#{attr_name}_append"
705
- end
706
- end # create_append_setters
707
- private_class_method :create_append_setters
708
-
709
- # The attr_prepend(newval) setter method for array values
710
- ##############################
711
- def self.create_prepend_setters(attr_name, attr_def)
712
- define_method("#{attr_name}_prepend") do |new_value|
713
- instance_variable_set("@#{attr_name}", []) unless instance_variable_get("@#{attr_name}").is_a?(Array)
714
- new_value = validate_attr attr_name, new_value
715
- old_array = instance_variable_get("@#{attr_name}").dup
716
- instance_variable_get("@#{attr_name}").unshift new_value
717
- note_unsaved_change attr_name, old_array
718
- end # define method
719
-
720
- return unless attr_def[:aliases]
721
-
722
- attr_def[:aliases].each { |al| alias_method "#{al}_prepend", "#{attr_name}_prepend" }
723
- end # create_prepend_setters
724
- private_class_method :create_prepend_setters
725
-
726
- # The attr_insert(index, newval) setter method for array values
727
- def self.create_insert_setters(attr_name, attr_def)
728
- define_method("#{attr_name}_insert") do |index, new_value|
729
- instance_variable_set("@#{attr_name}", []) unless instance_variable_get("@#{attr_name}").is_a?(Array)
730
- new_value = validate_attr attr_name, new_value
731
- old_array = instance_variable_get("@#{attr_name}").dup
732
- instance_variable_get("@#{attr_name}").insert index, new_value
733
- note_unsaved_change attr_name, old_array
734
- end # define method
735
-
736
- return unless attr_def[:aliases]
737
-
738
- attr_def[:aliases].each { |al| alias_method "#{al}_insert", "#{attr_name}_insert" }
739
- end # create_insert_setters
740
- private_class_method :create_insert_setters
741
-
742
- # The attr_delete_at(index) setter method for array values
743
- ##############################
744
- def self.create_delete_at_setters(attr_name, attr_def)
745
- define_method("#{attr_name}_delete_at") do |index|
746
- instance_variable_set("@#{attr_name}", []) unless instance_variable_get("@#{attr_name}").is_a?(Array)
747
- old_array = instance_variable_get("@#{attr_name}").dup
748
- deleted = instance_variable_get("@#{attr_name}").delete_at index
749
- note_unsaved_change attr_name, old_array if deleted
750
- end # define method
751
-
752
- return unless attr_def[:aliases]
753
-
754
- attr_def[:aliases].each { |al| alias_method "#{al}_delete_at", "#{attr_name}_delete_at" }
755
- end # create_insert_setters
756
- private_class_method :create_delete_at_setters
757
-
758
- # The attr_delete_at(index) setter method for array values
759
- ##############################
760
- def self.create_delete_if_setters(attr_name, attr_def)
761
- define_method("#{attr_name}_delete_if") do |index, &block|
762
- instance_variable_set("@#{attr_name}", []) unless instance_variable_get("@#{attr_name}").is_a?(Array)
763
- old_array = instance_variable_get("@#{attr_name}").dup
764
- instance_variable_get("@#{attr_name}").delete_if &block
765
- note_unsaved_change attr_name, old_array if old_array != instance_variable_get("@#{attr_name}")
766
- end # define method
767
-
768
- return unless attr_def[:aliases]
769
-
770
- attr_def[:aliases].each { |al| alias_method "#{al}_delete_if", "#{attr_name}_delete_if" }
771
- end # create_insert_setters
772
- private_class_method :create_delete_if_setters
773
-
774
- # Used by auto-generated setters and .create to validate new values.
775
- #
776
- # returns a valid value or raises an exception
777
- #
778
- # This method only validates single values. When called from multi-value
779
- # setters, it is used for each value individually.
780
- #
781
- # @param attr_name[Symbol], a top-level key from OBJECT_MODEL for this class
782
- #
783
- # @param value [Object] the value to validate for that attribute.
784
- #
785
- # @return [Object] The validated, possibly converted, value.
786
- #
787
- def self.validate_attr(attr_name, value, cnx: Jamf.cnx)
788
- attr_def = self::OBJECT_MODEL[attr_name]
789
- raise ArgumentError, "Unknown attribute: #{attr_name} for #{self} objects" unless attr_def
790
-
791
- # validate our value, which will raise an error or
792
- # convert the value to the required type.
793
- value = validate_attr_value(attr_def, value, cnx: Jamf.cnx)
794
-
795
- # if this is required, it can't be nil or empty
796
- if attr_def[:required]
797
- raise Jamf::MissingDataError, "Required attribute '#{attr_name}:' may not be nil or empty" if value.to_s.empty?
798
- end
799
-
800
- # if this is an identifier, it must be unique
801
- Jamf::Validate.doesnt_exist(value, self, attr_name, cnx: cnx) if attr_def[:identifier] && superclass == Jamf::CollectionResource
802
-
803
- value
804
- end # validate_attr(attr_name, value)
805
- private_class_method :validate_attr
806
-
807
- # Validate an attribute value itself, as part of validating the attribute
808
- # as a whole. Only one validation is applied, which one is
809
- # determined in the order described in the #### Data Validation section
810
- # of the JSONObject class comments
811
- #
812
- # See .validate_attr, which calls this
813
- def self.validate_attr_value(attr_def, value, cnx: Jamf.cnx)
814
- # by specified Validate method
815
- if attr_def[:validator]
816
- Jamf::Validate.send attr_def[:validator], value
817
-
818
- # by enum, must be a value of the enum
819
- elsif attr_def[:enum]
820
- Jamf::Validate.in_enum(value, attr_def[:enum])
821
-
822
- # By json primative type - pass to the matching validate method
823
- elsif JSON_TYPE_CLASSES.include? attr_def[:class]
824
- Jamf::Validate.send attr_def[:class], value
825
-
826
- # a JPAPI id?
827
- elsif attr_def[:class] == :j_id
828
- Jamf::Validate.j_id value
829
-
830
- # by Class, the class validates the value passed with .new
831
- elsif attr_def[:class].is_a? Class
832
- klass = attr_def[:class]
833
- value.is_a?(klass) ? value : klass.new(value, cnx: cnx)
834
-
835
- # raw, no validation, should be rare
836
- else
837
- value
838
- end # if
839
- end
840
- private_class_method :validate_attr_value
841
-
842
- # Constructor
843
- #####################################
844
-
845
- # Make an instance. Data comes from the API
846
- #
847
- # @param data[Hash] the data for constructing a new object.
848
- # @param cnx[Jamf::Connection] the API connection for the object
849
- #
850
- def initialize(data, cnx: Jamf.cnx)
851
- raise Jamf::InvalidDataError, 'Invalid JSONObject data - must be a Hash' unless data.is_a? Hash
852
-
853
- @cnx = cnx
854
- @unsaved_changes = {} if self.class.mutable?
855
-
856
- creating = data.delete :creating_from_create
857
-
858
- if creating
859
- self.class::OBJECT_MODEL.keys.each do |attr_name|
860
- next unless data.key? attr_name
861
- # use our setters for each value so that they are in the unsaved changes
862
- send "#{attr_name}=", data[attr_name]
863
- end
864
- return
865
- end
866
-
867
- parse_init_data data
868
- end # init
869
-
870
- # Instance Methods
871
- #####################################
872
-
873
- # a hash of all unsaved changes, including embedded JSONObjects
874
- #
875
- def unsaved_changes
876
- return {} unless self.class.mutable?
877
-
878
- changes = @unsaved_changes.dup
879
-
880
- self.class::OBJECT_MODEL.each do |attr_name, attr_def|
881
- # skip non-Class attrs
882
- next unless attr_def[:class].is_a? Class
883
-
884
- # the current value of the thing, e.g. a Location
885
- # which may have unsaved changes
886
- value = instance_variable_get "@#{attr_name}"
887
-
888
- # skip those that don't have any changes
889
- next unless value.respond_to? :unsaved_changes?
890
- attr_changes = value.unsaved_changes
891
- next if attr_changes.empty?
892
-
893
- # add the sub-changes to ours
894
- changes[attr_name] = attr_changes
895
- end
896
- changes[:ext_attrs] = ext_attrs_unsaved_changes if self.class.include? Jamf::Extendable
897
- changes
898
- end
899
-
900
- # return true if we or any of our attributes have unsaved changes
901
- #
902
- def unsaved_changes?
903
- return false unless self.class.mutable?
904
-
905
- !unsaved_changes.empty?
906
- end
907
-
908
- def clear_unsaved_changes
909
- return unless self.class.mutable?
910
-
911
- unsaved_changes.keys.each do |attr_name|
912
- attrib_val = instance_variable_get "@#{attr_name}"
913
- if self.class::OBJECT_MODEL[attr_name][:multi]
914
- attrib_val.each { |item| item.send :clear_unsaved_changes if item.respond_to? :clear_unsaved_changes }
915
- elsif attrib_val.respond_to? :clear_unsaved_changes
916
- attrib_val.send :clear_unsaved_changes
917
- end
918
- end
919
- ext_attrs_clear_unsaved_changes if self.class.include? Jamf::Extendable
920
- @unsaved_changes = {}
921
- end
922
-
923
- # @return [Hash] The data to be sent to the API, as a Hash
924
- # to be converted to JSON by the Jamf::Connection
925
- #
926
- def to_jamf
927
- data = {}
928
- self.class::OBJECT_MODEL.each do |attr_name, attr_def|
929
-
930
- raw_value = instance_variable_get "@#{attr_name}"
931
-
932
- # If its a multi-value attribute, process it and go on
933
- if attr_def[:multi]
934
- data[attr_name] = multi_to_jamf(raw_value, attr_def)
935
- next
936
- end
937
-
938
- # if its a single-value object, process it and go on.
939
- cooked_value = single_to_jamf(raw_value, attr_def)
940
- # next if cooked_value.nil? # ignore nil
941
- data[attr_name] = cooked_value
942
- end # unsaved_changes.each
943
- data
944
- end
945
-
946
- # Only works for PATCH endpoints.
947
- #
948
- # @return [Hash] The changes that need to be sent to the API, as a Hash
949
- # to be converted to JSON by the Jamf::Connection
950
- #
951
- def to_jamf_changes_only
952
- return unless self.class.mutable?
953
-
954
- data = {}
955
- unsaved_changes.each do |attr_name, changes|
956
- attr_def = self.class::OBJECT_MODEL[attr_name]
957
-
958
- # readonly attributes can't be changed
959
- next if attr_def[:readonly]
960
-
961
- # here's the new value for this attribute
962
- raw_value = changes[:new]
963
-
964
- # If its a multi-value attribute, process it and go on
965
- if attr_def[:multi]
966
- data[attr_name] = multi_to_jamf(raw_value, attr_def)
967
- next
968
- end
969
-
970
- # if its a single-value object, process it and go on.
971
- cooked_value = single_to_jamf(raw_value, attr_def)
972
- next if cooked_value.nil? # ignore nil
973
-
974
- data[attr_name] = cooked_value
975
- end # unsaved_changes.each
976
- data
977
- end
978
-
979
- # Print the JSON version of the to_jamf outout
980
- # mostly for debugging/troubleshooting
981
- def pretty_jamf_json
982
- puts JSON.pretty_generate(to_jamf)
983
- end
984
-
985
- # Remove large cached items from
986
- # the instance_variables used to create
987
- # pretty-print (pp) output.
988
- #
989
- # @return [Array] the desired instance_variables
990
- #
991
- def pretty_print_instance_variables
992
- vars = super.sort
993
- vars.delete :@cnx
994
- vars
995
- end
996
-
997
- # Private Instance Methods
998
- #####################################
999
- private
1000
-
1001
- def note_unsaved_change(attr_name, old_value)
1002
- return unless self.class.mutable?
1003
-
1004
- new_val = instance_variable_get "@#{attr_name}"
1005
- if @unsaved_changes[attr_name]
1006
- @unsaved_changes[attr_name][:new] = new_val
1007
- else
1008
- @unsaved_changes[attr_name] = { old: old_value, new: new_val }
1009
- end
1010
- end
1011
-
1012
- # take data from the API and populate an our instance attributes
1013
- #
1014
- # @param data[Hash] The parsed API JSON data for this instance
1015
- #
1016
- # @return [void]
1017
- #
1018
- def parse_init_data(data)
1019
- self.class::OBJECT_MODEL.each do |attr_name, attr_def|
1020
- value =
1021
- if attr_def[:multi]
1022
- raw_array = data[attr_name] || []
1023
- raw_array.map { |v| parse_single_init_value v, attr_name, attr_def }
1024
- else
1025
- parse_single_init_value data[attr_name], attr_name, attr_def
1026
- end
1027
- instance_variable_set "@#{attr_name}", value
1028
- end # OBJECT_MODEL.each
1029
- end # parse_init_data(data)
1030
-
1031
- # Parse an individual value from the API into an
1032
- # attribute or a member of a multi attribute
1033
- # Description of #parse_single_init_value
1034
- #
1035
- # @param api_value [Object] The parsed JSON value from the API
1036
- # @param attr_name [Symbol] The attribute we're processing
1037
- # @param attr_def [Hash] The attribute definition
1038
- #
1039
- # @return [Object] The storable value.
1040
- #
1041
- def parse_single_init_value(api_value, attr_name, attr_def)
1042
- # we do get nils from the API, and they should stay nil
1043
- return nil if api_value.nil?
1044
-
1045
- # an enum value
1046
- if attr_def[:enum]
1047
- parse_enum_value(api_value, attr_name, attr_def)
1048
-
1049
- # a Class value
1050
- elsif attr_def[:class].class == Class
1051
- attr_def[:class].new api_value, cnx: @cnx
1052
-
1053
- # a :j_id value. See the docs for OBJECT_MODEL in Jamf::JSONObject
1054
- elsif attr_def[:class] == :j_id
1055
- api_value.to_s
1056
-
1057
- # a JSON value
1058
- else
1059
- api_value
1060
- end # if attr_def[:class].class
1061
- end
1062
-
1063
- # Parse an api value into an attribute with an enum
1064
- #
1065
- # @param (see parse_single_init_value)
1066
- # @return (see parse_single_init_value)
1067
- #
1068
- def parse_enum_value(api_value, attr_name, attr_def)
1069
- raise Jamf::InvalidDataError, "#{api_value} is not in the enum for attribute #{attr_name}" unless attr_def[:enum].include? api_value
1070
-
1071
- api_value
1072
- end
1073
-
1074
- # call to_jamf on a single value
1075
- #
1076
- def single_to_jamf(raw_value, attr_def)
1077
- # if the attrib class is a Class,
1078
- # call its changes_to_jamf or to_jamf method
1079
- if attr_def[:class].is_a? Class
1080
- data = raw_value.to_jamf
1081
- data.is_a?(Hash) && data.empty? ? nil : data
1082
-
1083
- # otherwise, use the value as-is
1084
- else
1085
- raw_value
1086
- end
1087
- end
1088
-
1089
- # Call to_jamf on an array value
1090
- #
1091
- def multi_to_jamf(raw_array, attr_def)
1092
- raw_array ||= []
1093
- raw_array.map { |raw_value| single_to_jamf(raw_value, attr_def) }.compact
1094
- end
1095
-
1096
- # wrapper for class method
1097
- def validate_attr(attr_name, value)
1098
- self.class.send :validate_attr, attr_name, value, cnx: @cnx
1099
- end
1100
-
1101
- end # class JSONObject
1102
-
1103
- end # module JAMF