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
@@ -0,0 +1,762 @@
1
+ # Copyright 2022 Pixar
2
+
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "Apache License")
5
+ # with the following modification; you may not use this file except in
6
+ # compliance with the Apache License and the following modification to it:
7
+ # Section 6. Trademarks. is deleted and replaced with:
8
+ #
9
+ # 6. Trademarks. This License does not grant permission to use the trade
10
+ # names, trademarks, service marks, or product names of the Licensor
11
+ # and its affiliates, except as required to comply with Section 4(c) of
12
+ # the License and to reproduce the content of the NOTICE file.
13
+ #
14
+ # You may obtain a copy of the Apache License at
15
+ #
16
+ # http://www.apache.org/licenses/LICENSE-2.0
17
+ #
18
+ # Unless required by applicable law or agreed to in writing, software
19
+ # distributed under the Apache License with the above modification is
20
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
+ # KIND, either express or implied. See the Apache License for the specific
22
+ # language governing permissions and limitations under the Apache License.
23
+ #
24
+ #
25
+
26
+ module Jamf
27
+ # A Collection Resource in Jamf Pro
28
+ #
29
+ # See {Jamf::Resource} for general info about API resources.
30
+ #
31
+ # Collection resources have more than one resource within them, and those
32
+ # can (usually) be created and deleted as well as fetched and updated.
33
+ # The entire collection (or a part of it) can also be retrieved as an Array.
34
+ # When the whole collection is retrieved, the result may be cached for future
35
+ # use.
36
+ #
37
+ # # Subclassing
38
+ #
39
+ # ## Creatability, & Deletability
40
+ #
41
+ # Sometimes the API doesn't support creation of new members of the collection.
42
+ # If that's the case, just extend the subclass with Jamf::Uncreatable
43
+ # and the '.create' class method will raise an error.
44
+ #
45
+ # Similarly for deletion of members: if the API doesn't have a way to delete
46
+ # them, extend the subclass with Jamf::Undeletable
47
+ #
48
+ # See also Jamf::JSONObject, which talks about extending subclasses
49
+ # with Jamf::Immutable
50
+ #
51
+ # ## Bulk Deletion
52
+ #
53
+ # Some collection resources have a resource for bulk deletion, passing in
54
+ # a JSON array of ids to delete.
55
+ #
56
+ # If so, just define a BULK_DELETE_RSRC, and the .delete class method
57
+ # will use it, rather than making multiple calls to delete individual
58
+ # items. See Jamf::Category::BULK_DELETE_RSRC for an example
59
+ #
60
+ # @abstract
61
+ ######################################
62
+ module CollectionResource
63
+ include Jamf::JPAPIResource
64
+
65
+ # when this module is included, also extend our Class Methods
66
+ def self.included(includer)
67
+ Jamf.load_msg "--> #{includer} is including Jamf::CollectionResource"
68
+ includer.extend(ClassMethods)
69
+ end
70
+
71
+ # Class Methods
72
+ #####################################
73
+ module ClassMethods
74
+ # 'include' all of these, so their methods become defined in this
75
+ # module, and will become Class Methods when this module
76
+ # is extended.
77
+ # since this module will be extended into a class
78
+
79
+ # It seems that all current collections are pageable and sortable
80
+ #
81
+ # Filterable must be extended as needed in Colection Resources
82
+
83
+ include Jamf::JPAPIResource::ClassMethods
84
+
85
+ # when this module is included, also extend our 'parent' class methods
86
+ ######################################
87
+ def self.extended(extender)
88
+ Jamf.load_msg "--> #{extender} is extending Jamf::CollectionResource::ClassMethods"
89
+ end
90
+
91
+ # All Classes including CollectionResource MUST define 'LIST_PATH', which
92
+ # is the URL path for GETting the list of all objects in the collection,
93
+ # possibly filtered, sorted, and/or paged
94
+
95
+ # The path for GETting a single object. The desired object id will be appended
96
+ # to the end, e.g. if this value is 'v1/buildings' and you want to GET the
97
+ # record for building id 23, then we will GET from 'v1/buildings/23'
98
+ #
99
+ # Classes including CollectionResource really need to define GET_PATH if it
100
+ # is not the same as the LIST_PATH.
101
+ # rubocop:disable Naming/AccessorMethodName
102
+ ######################################
103
+ def get_path
104
+ @get_path ||= defined?(self::GET_PATH) ? self::GET_PATH : self::LIST_PATH
105
+ end
106
+ # rubocop:enable Naming/AccessorMethodName
107
+
108
+ # The path for PUTting (replacing) a single object. The desired object id will
109
+ # be appended to the end, e.g. if this value is 'v1/buildings' and you want
110
+ # to PUT the record for building id 23, then we will PUT to 'v1/buildings/23'
111
+ #
112
+ # Classes including CollectionResource really need to define PUT_PATH if it
113
+ # is not the same as the LIST_PATH.
114
+ ######################################
115
+ def put_path
116
+ @put_path ||= defined?(self::PUT_PATH) ? self::PUT_PATH : self::LIST_PATH
117
+ end
118
+
119
+ # The path for PATCHing (updating in-place) a single object. The desired
120
+ # object id will be appended to the end, e.g. if this value is 'v1/buildings'
121
+ # and you want to PATCH the record for building id 23, then we will PATCH to
122
+ # 'v1/buildings/23'
123
+ #
124
+ # Classes including CollectionResource really need to define PATCH_PATH if it
125
+ # is not the same as the LIST_PATH.
126
+ ######################################
127
+ def patch_path
128
+ @patch_path ||= defined?(self::PATCH_PATH) ? self::PATCH_PATH : self::LIST_PATH
129
+ end
130
+
131
+
132
+ # The path for POSTing to create a single object in the collection.
133
+ #
134
+ # Classes including CollectionResource really need to define POST_PATH if it
135
+ # is not the same as the LIST_PATH.
136
+ ######################################
137
+ def post_path
138
+ @post_path ||= defined?(self::POST_PATH) ? self::POST_PATH : self::LIST_PATH
139
+ end
140
+
141
+ # The path for DELETEing a single object from the collection.
142
+ #
143
+ # Classes including CollectionResource really need to define DELETE_PATH if it
144
+ # is not the same as the LIST_PATH.
145
+ ######################################
146
+ def delete_path
147
+ @delete_path ||= defined?(self::DELETE_PATH) ? self::DELETE_PATH : self::LIST_PATH
148
+ end
149
+
150
+ # @return [Array<Symbol>] the attribute names that are marked as identifiers
151
+ #
152
+ ######################################
153
+ def identifiers
154
+ idents = self::OAPI_PROPERTIES.select { |_attr, deets| deets[:identifier] }.keys
155
+ idents += self::ALT_IDENTIFIERS if defined? self::ALT_IDENTIFIERS
156
+ idents += self::NON_UNIQUE_IDENTIFIERS if defined? self::NON_UNIQUE_IDENTIFIERS
157
+ idents.delete_if { |i| !self::OAPI_PROPERTIES.key?(i) }
158
+ idents
159
+ end
160
+
161
+ # Get all instances of a CollectionResource, possibly sorted or limited by
162
+ # a filter.
163
+ #
164
+ # By default, this method will return a single Array data about all items
165
+ # in the CollectionResouce, in the server's default sort order, or a sort
166
+ # order you specify.
167
+ # As long as you don't request a filtered result, this full list is cached
168
+ # for future use (see Caching, below)
169
+ #
170
+ # If you specify a filter, the Array returned by the server will contain
171
+ # only matching objects, and it will not be cached.
172
+ #
173
+ # #### Server-side Sorting
174
+ #
175
+ # Sorting criteria can be provided using the 'sort:' parameter, which is
176
+ # a String of the format 'property:direction',
177
+ # where direction is 'asc' or 'desc' E.g.
178
+ # "username:asc"
179
+ #
180
+ # Multiple properties are supported, either as separate strings in an Array,
181
+ # or a single string, comma separated. E.g.
182
+ #
183
+ # "username:asc,timestamp:desc"
184
+ # is the same as
185
+ # ["username:asc", "timestamp:desc"]
186
+ #
187
+ # which will sort by username alphabetically, and within each username,
188
+ # sort by timestamp newest first.
189
+ #
190
+ # Please see the JamfPro API documentation for the resource for details
191
+ # about available sorting properties and default sorting criteria
192
+ #
193
+ # When the sort: param is provided, the server is always queried, and
194
+ # the results will be cached, as long as the results were not filtered.
195
+ # See Caching, below.
196
+ #
197
+ # #### Filtering
198
+ #
199
+ # Some CollectionResouces support RSQL filters to limit which objects
200
+ # are returned by the server. These filters can be applied using the filter:
201
+ # parameter, in which case this `all` method will return "all that match
202
+ # the filter".
203
+ #
204
+ # The filter parameter is a string, as it would be provided in the API URL
205
+ # manually, e.g. 'categoryName=="Category"' (be careful about inner quoting)
206
+ #
207
+ # If the resource doesn't support filters, the filter parameter is ignored.
208
+ #
209
+ # Please see the JamfPro API documentation for the resource to see if
210
+ # filters are supported, and a list of available fields.
211
+ # See also https://developer.jamf.com/jamf-pro/docs/filtering-with-rsql
212
+ #
213
+ # #### Instantiation
214
+ #
215
+ # All data from the API comes from the server in JSON format, mostly as
216
+ # JSON 'objects', which are the equivalent of ruby Hashes.
217
+ # When fetching an individual instance of an object from the API, ruby-jss
218
+ # uses the JSON Hash to create the ruby object, i.e. to 'instantiate' it as
219
+ # an instance of its ruby class. Doing this for many objects can slow
220
+ # things down.
221
+ #
222
+ # Because of this, the 'all' method defaults to returning an Array of the
223
+ # minimally-processed JSON Hashes it gets from the API. If you can get your
224
+ # desired data from these Hashes, it may be more efficient to do so.
225
+ #
226
+ # However sometimes you really need the fully instantiated ruby objects for
227
+ # all items returned - especially if you're using filters and not actually
228
+ # processing all items of the class. In such cases you can pass a truthy
229
+ # value to the instantiate: parameter, and the Array will contain fully
230
+ # instantiated ruby objects, not Hashes of API data.
231
+ #
232
+ # #### Caching - none for Jamf Pro API objects.
233
+ #
234
+ # Unlike the Classic APIObjects, Objects from the Jamf Pro API
235
+ # are not cached and any call to 'all' or methods that use it, will
236
+ # always query the API. If you need to use the resulting array for multiple
237
+ # tasks, save it into a variable and use that.
238
+ #
239
+ #######
240
+ #
241
+ # @param sort [String, Array<String>] Server-side sorting criteria in the
242
+ # format: property:direction, where direction is 'asc' or 'desc'. Multiple
243
+ # properties are supported, either as separate strings in an Array, or
244
+ # a single string, comma separated.
245
+ #
246
+ # @param filter [String] An RSQL filter string. Not all collection resources
247
+ # currently support filters, and if they don't, this will be ignored.
248
+ #
249
+ # @param instantiate [Boolean] Defaults to false. Should the items in the
250
+ # returned Array be ruby instances of the CollectionObject subclass, or
251
+ # plain Hashes of data as returned by the API?
252
+ #
253
+ # @param cnx [Jamf::Connection] The API connection to use, default: Jamf.cnx
254
+ #
255
+ # @return [Array<Hash, Jamf::CollectionResource>] The objects in the collection
256
+ #
257
+ ######################################
258
+ def all(sort: nil, filter: nil, instantiate: false, cnx: Jamf.cnx, refresh: nil)
259
+
260
+ # if we are here, we need to query for all items, possibly filtered and
261
+ # sorted
262
+ sort = Jamf::Sortable.parse_url_sort_param(sort)
263
+ filter = filterable? ? Jamf::Filterable.parse_url_filter_param(filter) : nil
264
+ instantiate &&= self
265
+
266
+ # always use a pager to get all pages, because even if you don't ask for
267
+ # paged data, it comes in pages or 2000
268
+ Jamf::Pager.all_pages(
269
+ list_path: self::LIST_PATH,
270
+ sort: sort,
271
+ filter: filter,
272
+ instantiate: instantiate,
273
+ cnx: cnx
274
+ )
275
+ end
276
+
277
+ # Return a Jamf::Pager object for retrieving all collection items in smaller
278
+ # groups.
279
+ #
280
+ # For other parameters, see CollectionResource.all
281
+ #
282
+ # @param page_size [Integer] The pager object returns results in groups of
283
+ # this many items. Minimum is 1, maximum is 2000, default is 100
284
+ # Note: the final page of data may contain fewer items than the page_size
285
+ #
286
+ # @return [Jamf::Pager] An object from which you can retrieve sequential or
287
+ # arbitrary pages from the collection.
288
+ #
289
+ def pager(page_size: Jamf::Pager::DEFAULT_PAGE_SIZE, sort: nil, filter: nil, instantiate: false, cnx: Jamf.cnx)
290
+
291
+ sort = Jamf::Sortable.parse_url_sort_param(sort)
292
+ filter = filterable? ? Jamf::Filterable.parse_url_filter_param(filter) : nil
293
+
294
+ Jamf::Pager.new(
295
+ page_size: page_size,
296
+ list_path: self::LIST_PATH,
297
+ sort: sort,
298
+ filter: filter,
299
+ instantiate: instantiate,
300
+ cnx: cnx
301
+ )
302
+ end
303
+
304
+ # A Hash of all members of this collection where the keys are some
305
+ # identifier and values are any other attribute.
306
+ #
307
+ # @param ident [Symbol] An identifier of this Class, used as the key
308
+ # for the mapping Hash. Aliases are acceptable, e.g. :sn for :serialNumber
309
+ #
310
+ # @param to [Symbol] The attribute to which the ident will be mapped.
311
+ # Aliases are acceptable, e.g. :name for :displayName
312
+ #
313
+ # @param cached_list [Array<Hash>] The result of a previous call to .all
314
+ # can be passed in here, to prevent calling .all again to generate a
315
+ # fresh list.
316
+ #
317
+ # @param cnx (see .all)
318
+ #
319
+ # @return [Hash {Symbol: Object}] A Hash of identifier mapped to attribute
320
+ #
321
+ ######################################
322
+ def map_all(ident, to:, cnx: Jamf.cnx, cached_list: nil, refresh: nil)
323
+ raise Jamf::InvalidDataError, "No identifier :#{ident} for class #{self}" unless
324
+ identifiers.include? ident
325
+
326
+ raise Jamf::NoSuchItemError, "No attribute :#{to} for class #{self}" unless self::OAPI_PROPERTIES.key? to
327
+
328
+
329
+ list = cached_list || all(cnx: cnx)
330
+ to_class = self::OAPI_PROPERTIES[to][:class]
331
+ to_multi = self::OAPI_PROPERTIES[to][:multi]
332
+ mapped = list.map do |i|
333
+ mapped_val =
334
+ if to_class.is_a?(Symbol)
335
+ i[to]
336
+ elsif to_multi
337
+ i[to].map { |sub_i| to_class.new(sub_i) }
338
+ else
339
+ to_class.new(i[to])
340
+ end
341
+
342
+ [i[ident], mapped_val]
343
+ end # do i
344
+ mapped.to_h
345
+ end
346
+
347
+ # Given a key (identifier) and value for this collection, return the raw data
348
+ # Hash (the JSON object) for the matching API object or nil if there's no
349
+ # match for the given value.
350
+ #
351
+ # In general you should use this if the form:
352
+ #
353
+ # raw_data identifier: value
354
+ #
355
+ # where identifier is one of the available identifiers for this class
356
+ # like id:, name:, serialNumber: etc.
357
+ #
358
+ # In the unlikely event that you dont know which identifier a value is for
359
+ # or want to be able to take any of them without specifying, then
360
+ # you can use
361
+ #
362
+ # raw_data some_value
363
+ #
364
+ # If some_value is an integer or a string containing an integer, it
365
+ # is assumed to be an :id otherwise all the available identifers
366
+ # are searched, in the order you see them when you call <class>.identifiers
367
+ #
368
+ # If no matching object is found, nil is returned.
369
+ #
370
+ # Everything except :id is treated as a case-insensitive String
371
+ #
372
+ # @param value [String, Integer] The identifier value to search fors
373
+ #
374
+ # @param key: [Symbol] The identifier being used for the search.
375
+ # E.g. if :serialNumber, then the value must be a known serial number, it
376
+ # is not checked against other identifiers. Defaults to :id
377
+ #
378
+ # @param cnx: (see .all)
379
+ #
380
+ # @return [Hash, nil] the basic dataset of the matching object,
381
+ # or nil if it doesn't exist
382
+ #
383
+ ######################################
384
+ def raw_data(searchterm = nil, ident: nil, value: nil, cnx: Jamf.cnx)
385
+
386
+
387
+ # given a value with no ident key
388
+ return raw_data_by_searchterm_only(searchterm, cnx: cnx) if searchterm
389
+
390
+ # if we're here, we should know our ident key and value
391
+ raise ArgumentError, 'Required parameter "identifier: value", where identifier is id:, name: etc.' unless ident && value
392
+
393
+ return raw_data_by_id(value, cnx: cnx) if ident == :id
394
+ return unless identifiers.include? ident
395
+
396
+ raw_data_by_other_identifier(ident, value, cnx: cnx)
397
+ end
398
+
399
+ # Match the given value in all possibly identifiers
400
+ def raw_data_by_searchterm_only(searchterm, cnx: Jamf.cnx)
401
+ # if this is an integer or j_integer, assume its an ID
402
+ return raw_data_by_id(searchterm, cnx: cnx) if searchterm.to_s.j_integer?
403
+
404
+ identifiers.each do |ident|
405
+ next if ident == :id
406
+
407
+ data = raw_data_by_other_identifier(ident, searchterm, cnx: cnx)
408
+ return data if data
409
+ end # identifiers.each
410
+
411
+ nil
412
+ end
413
+
414
+ # get the basic dataset by id, with optional
415
+ # request params to get more than basic data
416
+ ######################################
417
+ def raw_data_by_id(id, cnx: Jamf.cnx)
418
+ cnx.jp_get "#{get_path}/#{id}"
419
+ rescue Jamf::Connection::JamfProAPIError => e
420
+ return nil if e.errors.any? { |err| err.code == 'INVALID_ID' }
421
+
422
+ raise e
423
+ end
424
+
425
+ # Given an indentier attr. key, and a value,
426
+ # return the raw data where that ident has that value, or nil
427
+ #
428
+ ######################################
429
+ def raw_data_by_other_identifier(identifier, value, cnx: Jamf.cnx)
430
+ # if the API supports filtering by this identifier, just use that
431
+ return pager(filter: "#{identifier}==\"#{value}\"", page_size: 1, cnx: cnx).page(:first).first if filterable? && filter_keys.include?(identifier)
432
+
433
+ # otherwise we have to loop thru all the objects looking for the value
434
+ cmp_val = value.to_s
435
+ all(cnx: cnx).each do |data|
436
+ return data if data[identifier].to_s.casecmp? cmp_val
437
+ end
438
+
439
+ nil
440
+ end
441
+
442
+ # Look up the valid ID for any arbitrary identifier.
443
+ # In general you should use this if the form:
444
+ #
445
+ # valid_id identifier: value
446
+ #
447
+ # where identifier is one of the available identifiers for this class
448
+ # like id:, name:, serialNumber: etc.
449
+ #
450
+ # In the unlikely event that you dont know which identifier a value is for
451
+ # or want to be able to take any of them without specifying, then
452
+ # you can use
453
+ #
454
+ # valid_id some_value
455
+ #
456
+ # If some_value is an integer or a string containing an integer, it
457
+ # is assumed to be an id: otherwise all the available identifers
458
+ # are searched, in the order you see them when you call <class>.identifiers
459
+ #
460
+ # If no matching object is found, nil is returned.
461
+ #
462
+ # WARNING: Do not use this to look up ids for getting the
463
+ # raw API data for an object. Since this calls .raw_data
464
+ # itself, it is redundant to use .valid_id to get an id
465
+ # to then pass on to .raw_data
466
+ # Use raw_data directly like this:
467
+ # data = raw_data(ident: val)
468
+ #
469
+ #
470
+ # @param value [String,Integer] A value for an arbitrary identifier
471
+ #
472
+ # @param cnx [Jamf::Connection] The connection to use. default: Jamf.cnx
473
+ #
474
+ # @param ident_and_val [Hash{Symbol: String}] The identifier key and the value
475
+ # to look for in that key, e.g. name: 'foo' or serialNumber: 'ASDFGH'
476
+ #
477
+ # @return [String, nil] The id (integer-in-string) of the object, or nil
478
+ # if no match found
479
+ #
480
+ ######################################
481
+ def valid_id(searchterm = nil, cnx: Jamf.cnx, **ident_and_val)
482
+ raw_data(searchterm, cnx: cnx, **ident_and_val)&.dig(:id)
483
+ end
484
+
485
+ # By default, Collection Resources are creatable,
486
+ # i.e. new instances can be created
487
+ # with .create, and added to the JSS with .save
488
+ # If a subclass is NOT creatble for any reason, just add
489
+ # extend Jamf::Uncreatable
490
+ # and this method will return false
491
+ #
492
+ # @return [Boolean]
493
+ ######################################
494
+ def creatable?
495
+ true
496
+ end
497
+
498
+ # Make a new thing to be added to the API
499
+ ######################################
500
+ def create(**params)
501
+
502
+
503
+ # no such animal when .creating
504
+ params.delete :id
505
+
506
+ # Which connection to use
507
+ params[:cnx] ||= Jamf.cnx
508
+
509
+ # So the super constructor knows we are instantiating an object that
510
+ # isn't from the API, and will do validation on all params.
511
+ params[:creating_from_create] = true
512
+
513
+ new(**params)
514
+ end
515
+
516
+ # Retrieve a member of a CollectionResource from the API
517
+ #
518
+ # To create new members to be added to the JSS, use
519
+ # {Jamf::CollectionResource.create}
520
+ #
521
+ # You must know the specific identifier attribute you're looking up, e.g.
522
+ # :id or :name or :udid, (or an aliase thereof) then you can specify it like
523
+ # `.fetch name: 'somename'`, or `.fetch udid: 'someudid'`
524
+ #
525
+ # @param cnx[Jamf::Connection] the connection to use to fetch the object
526
+ #
527
+ # @param ident_and_val[Hash] an identifier attribute key and a search value
528
+ #
529
+ # @return [CollectionResource] The ruby-instance of a Jamf object
530
+ #
531
+ ######################################
532
+ def fetch(searchterm = nil, random: false, cnx: Jamf.cnx, **ident_and_val)
533
+ if searchterm == :random
534
+ random = true
535
+ searchterm = nil
536
+ end
537
+
538
+ data =
539
+ if searchterm
540
+ raw_data searchterm, cnx: cnx
541
+ elsif random
542
+ all.sample
543
+ else
544
+ ident, value = ident_and_val.first
545
+ ident && value ? raw_data(ident: ident, value: value, cnx: cnx) : nil
546
+ end
547
+
548
+ raise Jamf::NoSuchItemError, "No matching #{self}" unless data
549
+
550
+ data[:cnx] = cnx
551
+ new(**data)
552
+ end # fetch
553
+
554
+ # By default, CollectionResource instances are deletable.
555
+ # If not, just extend the subclass with Jamf::Undeletable, and this
556
+ # will return false, and .delete & #delete will raise errors
557
+ ######################################
558
+ def deletable?
559
+ true
560
+ end
561
+
562
+ def filterable?
563
+ singleton_class.ancestors.include? Jamf::Filterable
564
+ end
565
+
566
+ def bulk_deletable?
567
+ singleton_class.ancestors.include? Jamf::BulkDeletable
568
+ end
569
+
570
+ # Delete one or more objects by id
571
+ # TODO: fix this return value, no more ErrorInfo
572
+ #
573
+ # @param ids [Array<String,Integer>] The ids to delete
574
+ #
575
+ # @param cnx [Jamf::Connection] The connection to use, default: Jamf.cnx
576
+ #
577
+ #
578
+ # @return [Array<Jamf::Connection::APIError::ErrorInfo] Info about any ids
579
+ # that failed to be deleted.
580
+ #
581
+ ######################################
582
+ def delete(*ids, cnx: Jamf.cnx)
583
+ raise Jamf::UnsupportedError, "Deleting #{self} objects is not currently supported" unless deletable?
584
+
585
+ return bulk_delete(ids, cnx: Jamf.cnx) if self.bulk_deletable?
586
+
587
+ errs = []
588
+ ids.each do |id_to_delete|
589
+ cnx.jp_delete "#{delete_path}/#{id_to_delete}"
590
+ rescue Jamf::Connection::JamfProAPIError => e
591
+ raise e unless e.http_response.status == 404
592
+
593
+ errs += e.errors
594
+ end # ids.each
595
+ errs
596
+ end
597
+
598
+ # Dynamically create_identifier_list_methods
599
+ # when one is called.
600
+ def method_missing(method, *args, &block)
601
+ if available_list_methods.key? method.to_s
602
+ attr_name = available_list_methods[method.to_s]
603
+ create_identifier_list_method attr_name.to_sym, method
604
+ send method, *args
605
+ else
606
+ super
607
+ end
608
+ end
609
+
610
+ # this is needed to prevent problems with method_missing!
611
+ def respond_to_missing?(method, *)
612
+ available_list_methods.key?(method.to_s) || super
613
+ end
614
+
615
+ # @return [Hash{String: Symbol}] Method name to matching attribute name for
616
+ # all identifiers
617
+ def available_list_methods
618
+ return @available_list_methods if @available_list_methods
619
+
620
+ @available_list_methods = {}
621
+
622
+ identifiers.each do |i|
623
+ meth_name = i.to_s.end_with?('s') ? "all_#{i}es" : "all_#{i}s"
624
+ @available_list_methods[meth_name] = i
625
+ end
626
+ @available_list_methods
627
+ end
628
+
629
+ # called from method_missing to create
630
+ # identifier lists on the fly. No filtering or sorting of these lists.
631
+ ######################################
632
+ def create_identifier_list_method(attr_name, list_method_name)
633
+ # only if the attr_name exists in the OAPI_PROPERTIES _and_
634
+ # is listed as an identifier for this class.
635
+ if defined?(self::OAPI_PROPERTIES) && self::OAPI_PROPERTIES.key?(attr_name) && identifiers.include?(attr_name)
636
+ attr_def = self::OAPI_PROPERTIES[attr_name]
637
+
638
+ define_singleton_method(list_method_name) do |_refresh = nil, cnx: Jamf.cnx, cached_list: nil|
639
+ all_list = cached_list || all(cnx: cnx)
640
+ if attr_def[:class].is_a? Symbol
641
+ all_list.map { |i| i[attr_name] }
642
+ else
643
+ all_list.map { |i| attr_def[:class].new i[attr_name] }
644
+ end
645
+ end # define_singleton_method
646
+ Jamf.load_msg "Defined method #{self}##{list_method_name}"
647
+ else
648
+
649
+ define_singleton_method(list_method_name) do |*|
650
+ raise NoMethodError, "no method '#{list_method_name}': '#{attr_name}' is not an indentifier for #{self}"
651
+ end
652
+ end
653
+
654
+ end # create_identifier_list_method
655
+ private :create_identifier_list_method
656
+
657
+ end # Module ClassMethods
658
+
659
+ # Attributes
660
+ #####################################
661
+
662
+ # @return [String] The path for creating a new item in the collection
663
+ # in the JPAPI
664
+ #
665
+ attr_reader :post_path
666
+
667
+ # @return [String] The path for deleting a this item from the collection
668
+ # in the JPAPI
669
+ #
670
+ attr_reader :delete_path
671
+
672
+ # Constructor
673
+ #####################################
674
+ def initialize(**data)
675
+ super
676
+ set_api_paths
677
+ end
678
+
679
+ # Instance Methods
680
+ #####################################
681
+
682
+ #####################################
683
+ def exist?
684
+ !@id.nil?
685
+ end
686
+
687
+ #####################################
688
+ def delete
689
+ raise Jamf::UnsupportedError, "Deleting #{self} objects is not currently supported" unless self.class.deletable?
690
+
691
+ @cnx.jp_delete delete_path
692
+ end
693
+
694
+ # A meaningful string representation of this object
695
+ #
696
+ # @return [String]
697
+ #
698
+ def to_s
699
+ "#{self.class}@#{cnx.host}, id: #{@id}"
700
+ end
701
+
702
+ # Private Instance Methods
703
+ ############################################
704
+ private
705
+
706
+ ############################################
707
+ def set_api_paths
708
+ if exist?
709
+ @get_path = "#{self.class.get_path}/#{id}"
710
+
711
+ @update_path =
712
+ if defined?(self.class::PUT_PATH)
713
+ "#{self.class::PUT_PATH}/#{id}"
714
+ elsif defined?(self.class::PATCH_PATH)
715
+ "#{self.class::PATCH_PATH}/#{id}"
716
+ else
717
+ "#{self.class::LIST_PATH}/#{id}"
718
+ end
719
+
720
+ @delete_path = defined?(self.class::DELETE_PATH) ? "#{self.class::DELETE_PATH}/#{id}" : "#{self.class::LIST_PATH}/#{id}"
721
+
722
+ @post_path = nil
723
+
724
+ else
725
+ @post_path = defined?(self.class::POST_PATH) ? self.class::POST_PATH : self.class::LIST_PATH
726
+ end
727
+ end
728
+
729
+ ############################################
730
+ def create_in_jamf
731
+ unless defined?(self.class::POST_OBJECT)
732
+ raise Jamf::MissingDataError,
733
+ "Class #{self.class} has not defined a POST_OBJECT"
734
+ end
735
+
736
+ validate_for_create
737
+
738
+ post_object = self.class::POST_OBJECT.new(to_jamf)
739
+
740
+ result = @cnx.jp_post post_path, post_object.to_jamf
741
+
742
+ @id = result[:id]
743
+
744
+ # reset the API paths now that we exist
745
+ set_api_paths
746
+
747
+ # return the id
748
+ @id
749
+ end
750
+
751
+ # make sure that required values are not nil
752
+ ############################################
753
+ def validate_for_create
754
+ self.class::OAPI_PROPERTIES.each do |attr_name, attr_def|
755
+ next unless attr_def[:required]
756
+ next unless send(attr_name).nil?
757
+
758
+ raise Jamf::MissingDataError, "Attribute '#{attr_name}' cannot be nil, must be a #{attr_def[:class]}"
759
+ end
760
+ end
761
+ end # class CollectionResource
762
+ end # module JAMF