ruby-jss 1.6.4 → 2.0.0a10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (705) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGES.md +40 -4
  4. data/README-2.0.0.md +316 -0
  5. data/README.md +48 -34
  6. data/bin/cgrouper +3 -3
  7. data/bin/jamfHelperBackgrounder +2 -2
  8. data/bin/netseg-update +3 -3
  9. data/data/ruby-jss.conf.example +1 -1
  10. data/lib/{jss/api_object → jamf/api/classic/api_objects}/account.rb +29 -22
  11. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_computer_search.rb +6 -6
  12. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_mobile_device_search.rb +6 -6
  13. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_user_search.rb +6 -6
  14. data/lib/{jss/api_object → jamf/api/classic/api_objects}/building.rb +6 -6
  15. data/lib/{jss/api_object → jamf/api/classic/api_objects}/categorizable.rb +10 -10
  16. data/lib/{jss/api_object → jamf/api/classic/api_objects}/category.rb +17 -15
  17. data/lib/{jss/api_object → jamf/api/classic/api_objects}/computer.rb +210 -111
  18. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/computer_extension_attribute.rb +19 -19
  19. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/computer_group.rb +8 -8
  20. data/lib/{jss/api_object → jamf/api/classic/api_objects}/computer_invitation.rb +8 -8
  21. data/lib/{jss/api_object → jamf/api/classic/api_objects}/creatable.rb +22 -24
  22. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable/criteria.rb +24 -24
  23. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable/criterion.rb +15 -15
  24. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable.rb +25 -28
  25. data/lib/{jss/api_object → jamf/api/classic/api_objects}/department.rb +7 -7
  26. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding.rb +40 -40
  27. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/active_directory.rb +47 -47
  28. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/admitmac.rb +56 -56
  29. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/centrify.rb +15 -15
  30. data/lib/{jss/api_object → jamf/api/classic/api_objects/directory_binding_type}/directory_binding_type.rb +2 -25
  31. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/open_directory.rb +19 -19
  32. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/powerbroker_identity_services.rb +1 -1
  33. data/lib/jamf/api/classic/api_objects/directory_binding_type.rb +47 -0
  34. data/lib/{jss/api_object/disk_encryption_configurations.rb → jamf/api/classic/api_objects/disk_encryption_configuration.rb} +14 -14
  35. data/lib/{jss/api_object → jamf/api/classic/api_objects}/distribution_point.rb +41 -35
  36. data/lib/{jss/api_object → jamf/api/classic/api_objects}/dock_item.rb +12 -12
  37. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ebook.rb +3 -3
  38. data/lib/{jss/api_object → jamf/api/classic/api_objects}/extendable.rb +23 -23
  39. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ibeacon.rb +15 -15
  40. data/lib/{jss/api_object/self_servable → jamf/api/classic/api_objects}/icon.rb +8 -8
  41. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ldap_server.rb +45 -34
  42. data/lib/{jss/api_object → jamf/api/classic/api_objects}/locatable.rb +6 -6
  43. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mac_application.rb +18 -18
  44. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/audit_event.rb +4 -4
  45. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/casper_imaging_log.rb +4 -5
  46. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/casper_remote_log.rb +4 -4
  47. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/computer_usage_log.rb +4 -4
  48. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/ebook.rb +7 -7
  49. data/lib/{jss/api_object/management_history/hashlike.rb → jamf/api/classic/api_objects/management_history/hash_like.rb} +3 -3
  50. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mac_app_store_app.rb +4 -4
  51. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mdm_command.rb +9 -9
  52. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mobile_device_app.rb +4 -4
  53. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/policy_log.rb +5 -5
  54. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/screen_sharing_log.rb +4 -4
  55. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/user_location_change.rb +4 -4
  56. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history.rb +226 -189
  57. data/lib/{jss/api_object → jamf/api/classic/api_objects}/matchable.rb +9 -6
  58. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mdm.rb +256 -151
  59. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mobile_device.rb +55 -39
  60. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mobile_device_application.rb +77 -35
  61. data/lib/{jss/api_object/configuration_profile → jamf/api/classic/api_objects}/mobile_device_configuration_profile.rb +7 -10
  62. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/mobile_device_extension_attribute.rb +19 -19
  63. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/mobile_device_group.rb +8 -8
  64. data/lib/{jss/api_object → jamf/api/classic/api_objects}/netboot_server.rb +6 -6
  65. data/lib/{jss/api_object → jamf/api/classic/api_objects}/network_segment.rb +75 -61
  66. data/lib/{jss/api_object/configuration_profile → jamf/api/classic/api_objects}/osx_configuration_profile.rb +7 -7
  67. data/lib/{jss/api_object → jamf/api/classic/api_objects}/package.rb +83 -74
  68. data/lib/{jss/api_object/patch_source → jamf/api/classic/api_objects}/patch_external_source.rb +9 -9
  69. data/lib/{jss/api_object/patch_source → jamf/api/classic/api_objects}/patch_internal_source.rb +5 -5
  70. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_policy.rb +70 -68
  71. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_title/version.rb +15 -15
  72. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_title.rb +76 -64
  73. data/lib/{jss/api_object → jamf/api/classic/api_objects}/peripheral.rb +24 -24
  74. data/lib/{jss/api_object → jamf/api/classic/api_objects}/peripheral_type.rb +20 -20
  75. data/lib/{jss/api_object → jamf/api/classic/api_objects}/policy.rb +113 -112
  76. data/lib/{jss/api_object → jamf/api/classic/api_objects}/printer.rb +52 -52
  77. data/lib/{jss/api_object → jamf/api/classic/api_objects}/purchasable.rb +6 -6
  78. data/lib/{jss/api_object → jamf/api/classic/api_objects}/removable_macaddr.rb +7 -7
  79. data/lib/{jss/api_object → jamf/api/classic/api_objects}/restricted_software.rb +21 -21
  80. data/lib/{jss/api_object → jamf/api/classic/api_objects}/scopable/scope.rb +69 -64
  81. data/lib/{jss/api_object → jamf/api/classic/api_objects}/scopable.rb +11 -13
  82. data/lib/{jss/api_object → jamf/api/classic/api_objects}/script.rb +22 -22
  83. data/lib/{jss/api_object → jamf/api/classic/api_objects}/self_servable.rb +49 -47
  84. data/lib/{jss/api_object → jamf/api/classic/api_objects}/sitable.rb +8 -8
  85. data/lib/{jss/api_object → jamf/api/classic/api_objects}/site.rb +6 -6
  86. data/lib/{jss/api_object → jamf/api/classic/api_objects}/software_update_server.rb +5 -5
  87. data/lib/{jss/api_object → jamf/api/classic/api_objects}/updatable.rb +13 -13
  88. data/lib/{jss/api_object → jamf/api/classic/api_objects}/uploadable.rb +71 -29
  89. data/lib/{jss/api_object → jamf/api/classic/api_objects}/user.rb +18 -18
  90. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/user_extension_attribute.rb +12 -12
  91. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/user_group.rb +7 -7
  92. data/lib/{jss/api_object → jamf/api/classic/api_objects}/vpp_account.rb +15 -15
  93. data/lib/{jss/api_object → jamf/api/classic/api_objects}/vppable.rb +5 -5
  94. data/lib/{jss/api_object/webhook.rb → jamf/api/classic/api_objects/web_hook.rb} +15 -15
  95. data/lib/{jss/api_object → jamf/api/classic/base_classes}/advanced_search.rb +36 -40
  96. data/lib/{jss → jamf/api/classic/base_classes}/api_object.rb +314 -274
  97. data/lib/{jss/api_object → jamf/api/classic/base_classes}/configuration_profile.rb +13 -16
  98. data/lib/{jss/api_object → jamf/api/classic/base_classes}/extension_attribute.rb +55 -59
  99. data/lib/{jss/api_object → jamf/api/classic/base_classes}/group.rb +45 -43
  100. data/lib/{jss/api_object → jamf/api/classic/base_classes}/patch_source.rb +107 -87
  101. data/lib/{jss → jamf/api/classic}/xml_workaround.rb +12 -12
  102. data/lib/jamf/api/connection/attributes.rb +177 -0
  103. data/lib/jamf/api/connection/cache.rb +148 -0
  104. data/lib/jamf/api/connection/classic_api.rb +287 -0
  105. data/lib/jamf/api/connection/connect.rb +491 -0
  106. data/lib/jamf/api/connection/constants.rb +106 -0
  107. data/lib/jamf/api/connection/default_connection.rb +103 -0
  108. data/lib/jamf/api/connection/jamf_pro_api.rb +170 -0
  109. data/lib/jamf/api/connection/jamf_pro_api_error.rb +109 -0
  110. data/lib/jamf/api/connection/token.rb +289 -99
  111. data/lib/jamf/api/connection.rb +186 -819
  112. data/lib/jamf/api/jamf_pro/api_objects/computer_prestage.rb +82 -0
  113. data/lib/jamf/api/jamf_pro/api_objects/device_enrollment.rb +358 -0
  114. data/lib/jamf/api/jamf_pro/api_objects/inventory_preload_record.rb +163 -0
  115. data/lib/jamf/api/jamf_pro/api_objects/jp_building.rb +116 -0
  116. data/lib/jamf/api/jamf_pro/api_objects/mobile_device_prestage.rb +87 -0
  117. data/lib/jamf/api/jamf_pro/base_classes/oapi_object.rb +602 -0
  118. data/lib/jamf/api/{mixins → jamf_pro/mixins}/bulk_deletable.rb +2 -1
  119. data/lib/jamf/api/jamf_pro/mixins/change_log.rb +246 -0
  120. data/lib/jamf/api/jamf_pro/mixins/collection_resource.rb +762 -0
  121. data/lib/jamf/api/{mixins → jamf_pro/mixins}/filterable.rb +21 -14
  122. data/lib/jamf/api/{mixins → jamf_pro/mixins}/immutable.rb +6 -8
  123. data/lib/jamf/api/jamf_pro/mixins/jpapi_resource.rb +167 -0
  124. data/lib/jamf/api/{mixins → jamf_pro/mixins}/lockable.rb +29 -3
  125. data/lib/jamf/api/jamf_pro/mixins/prestage.rb +346 -0
  126. data/lib/jamf/api/{mixins → jamf_pro/mixins}/sortable.rb +7 -17
  127. data/lib/jamf/api/{mixins → jamf_pro/mixins}/uncreatable.rb +2 -2
  128. data/lib/jamf/api/{mixins → jamf_pro/mixins}/undeletable.rb +2 -2
  129. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_preview_search_results.rb +90 -0
  130. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_search_results.rb +90 -0
  131. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_v2_search_results.rb +90 -0
  132. data/lib/jamf/api/jamf_pro/oapi_schemas/account.rb +160 -0
  133. data/lib/jamf/api/jamf_pro/oapi_schemas/account_group.rb +124 -0
  134. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences.rb +108 -0
  135. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v1.rb +106 -0
  136. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v4.rb +118 -0
  137. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_history.rb +161 -0
  138. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_history_search_results.rb +90 -0
  139. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_summary.rb +132 -0
  140. data/lib/jamf/api/jamf_pro/oapi_schemas/admin_account.rb +83 -0
  141. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search.rb +117 -0
  142. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search_criteria_choices.rb +84 -0
  143. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search_search_results.rb +90 -0
  144. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_user_content_search.rb +117 -0
  145. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_user_content_search_search_results.rb +90 -0
  146. data/lib/jamf/api/jamf_pro/oapi_schemas/android_details.rb +163 -0
  147. data/lib/jamf/api/jamf_pro/oapi_schemas/api_error.rb +90 -0
  148. data/lib/jamf/api/jamf_pro/oapi_schemas/api_error_cause.rb +107 -0
  149. data/lib/jamf/api/jamf_pro/oapi_schemas/app_analytics_setting.rb +88 -0
  150. data/lib/jamf/api/jamf_pro/oapi_schemas/app_dynamics_config.rb +134 -0
  151. data/lib/jamf/api/jamf_pro/oapi_schemas/app_path.rb +91 -0
  152. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_form_input_field.rb +115 -0
  153. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_form_input_field_search_results.rb +90 -0
  154. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_settings.rb +105 -0
  155. data/lib/jamf/api/jamf_pro/oapi_schemas/apple_tv_details.rb +133 -0
  156. data/lib/jamf/api/jamf_pro/oapi_schemas/application_attributes.rb +88 -0
  157. data/lib/jamf/api/jamf_pro/oapi_schemas/application_configuration.rb +88 -0
  158. data/lib/jamf/api/jamf_pro/oapi_schemas/assign_remove_profile_response_sync_state.rb +113 -0
  159. data/lib/jamf/api/jamf_pro/oapi_schemas/attributes.rb +101 -0
  160. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account.rb +159 -0
  161. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account_v1.rb +159 -0
  162. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_token.rb +91 -0
  163. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_token_v1.rb +91 -0
  164. data/lib/jamf/api/jamf_pro/oapi_schemas/authorization.rb +117 -0
  165. data/lib/jamf/api/jamf_pro/oapi_schemas/authorization_v1.rb +117 -0
  166. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_ad_migration_report_process_status.rb +116 -0
  167. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_ad_migration_report_request.rb +103 -0
  168. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration.rb +95 -0
  169. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration_request.rb +93 -0
  170. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration_update.rb +93 -0
  171. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_mappings.rb +158 -0
  172. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration.rb +147 -0
  173. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration_request.rb +146 -0
  174. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration_update.rb +132 -0
  175. data/lib/jamf/api/jamf_pro/oapi_schemas/branding_image_url.rb +87 -0
  176. data/lib/jamf/api/jamf_pro/oapi_schemas/building.rb +138 -0
  177. data/lib/jamf/api/jamf_pro/oapi_schemas/building_search_results.rb +90 -0
  178. data/lib/jamf/api/jamf_pro/oapi_schemas/cache_settings.rb +150 -0
  179. data/lib/jamf/api/jamf_pro/oapi_schemas/categories_search_results.rb +90 -0
  180. data/lib/jamf/api/jamf_pro/oapi_schemas/category.rb +104 -0
  181. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_details.rb +91 -0
  182. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_identity_v1.rb +102 -0
  183. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_identity_v2.rb +108 -0
  184. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_key.rb +90 -0
  185. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_record.rb +147 -0
  186. data/lib/jamf/api/jamf_pro/oapi_schemas/classic_ldap_mappings.rb +169 -0
  187. data/lib/jamf/api/jamf_pro/oapi_schemas/client_check_in_v2.rb +165 -0
  188. data/lib/jamf/api/jamf_pro/oapi_schemas/client_check_in_v3.rb +135 -0
  189. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common.rb +109 -0
  190. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common_request.rb +98 -0
  191. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common_response.rb +109 -0
  192. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_connection_pool_statistics.rb +175 -0
  193. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_connection_status.rb +84 -0
  194. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_keystore.rb +104 -0
  195. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_keystore_file.rb +106 -0
  196. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_mappings_request.rb +106 -0
  197. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_mappings_response.rb +109 -0
  198. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_request.rb +152 -0
  199. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_response.rb +149 -0
  200. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_update.rb +149 -0
  201. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_application.rb +125 -0
  202. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_attachment.rb +103 -0
  203. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_certificate.rb +128 -0
  204. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_configuration_profile.rb +119 -0
  205. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching.rb +373 -0
  206. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_alert.rb +121 -0
  207. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_cache_detail.rb +98 -0
  208. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error.rb +99 -0
  209. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error_user_info.rb +90 -0
  210. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent.rb +132 -0
  211. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_alert.rb +106 -0
  212. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_capabilities.rb +125 -0
  213. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_details.rb +119 -0
  214. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_local_network.rb +98 -0
  215. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk.rb +144 -0
  216. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk_encryption.rb +121 -0
  217. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_extension_attribute.rb +176 -0
  218. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_font.rb +94 -0
  219. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general.rb +231 -0
  220. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general_update.rb +113 -0
  221. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware.rb +265 -0
  222. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware_update.rb +107 -0
  223. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_ibeacon.rb +82 -0
  224. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_collection_preferences.rb +166 -0
  225. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_collection_settings.rb +109 -0
  226. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_recovery_lock_password_response.rb +84 -0
  227. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_response.rb +276 -0
  228. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_search_results.rb +90 -0
  229. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_update_request.rb +125 -0
  230. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_licensed_software.rb +89 -0
  231. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_local_user_account.rb +190 -0
  232. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_location.rb +94 -0
  233. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_mdm_capability.rb +89 -0
  234. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system.rb +133 -0
  235. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system_update.rb +83 -0
  236. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_overview.rb +180 -0
  237. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_package_receipts.rb +98 -0
  238. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition.rb +146 -0
  239. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_encryption.rb +94 -0
  240. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_file_vault2_state.rb +98 -0
  241. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_plugin.rb +94 -0
  242. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage.rb +107 -0
  243. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_search_results.rb +90 -0
  244. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_search_results_v2.rb +90 -0
  245. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_v2.rb +130 -0
  246. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_printer.rb +100 -0
  247. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_purchase.rb +159 -0
  248. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_remote_management.rb +95 -0
  249. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_section.rb +110 -0
  250. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_security.rb +180 -0
  251. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_service.rb +82 -0
  252. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_software_update.rb +94 -0
  253. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_storage.rb +91 -0
  254. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_user_and_location.rb +132 -0
  255. data/lib/jamf/api/jamf_pro/oapi_schemas/computers_search_results.rb +90 -0
  256. data/lib/jamf/api/jamf_pro/oapi_schemas/configuration_profile.rb +103 -0
  257. data/lib/jamf/api/jamf_pro/oapi_schemas/configuration_search_results.rb +91 -0
  258. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_candidate_request.rb +124 -0
  259. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_response.rb +123 -0
  260. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_status_response.rb +86 -0
  261. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_update_request.rb +110 -0
  262. data/lib/jamf/api/jamf_pro/oapi_schemas/country.rb +88 -0
  263. data/lib/jamf/api/jamf_pro/oapi_schemas/country_codes.rb +84 -0
  264. data/lib/jamf/api/jamf_pro/oapi_schemas/create_path.rb +98 -0
  265. data/lib/jamf/api/jamf_pro/oapi_schemas/csa_token.rb +94 -0
  266. data/lib/jamf/api/jamf_pro/oapi_schemas/current_account.rb +160 -0
  267. data/lib/jamf/api/jamf_pro/oapi_schemas/current_authorization.rb +109 -0
  268. data/lib/jamf/api/jamf_pro/oapi_schemas/data_roaming_setting.rb +88 -0
  269. data/lib/jamf/api/jamf_pro/oapi_schemas/database_password.rb +89 -0
  270. data/lib/jamf/api/jamf_pro/oapi_schemas/day_of_week.rb +93 -0
  271. data/lib/jamf/api/jamf_pro/oapi_schemas/delete_user_command.rb +94 -0
  272. data/lib/jamf/api/jamf_pro/oapi_schemas/department.rb +98 -0
  273. data/lib/jamf/api/jamf_pro/oapi_schemas/departments_search_results.rb +90 -0
  274. data/lib/jamf/api/jamf_pro/oapi_schemas/deployment_task.rb +130 -0
  275. data/lib/jamf/api/jamf_pro/oapi_schemas/deployment_task_search_results.rb +92 -0
  276. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_configuration_request.rb +92 -0
  277. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_configuration_response.rb +105 -0
  278. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_configuration_search_results.rb +91 -0
  279. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_configuration_update.rb +92 -0
  280. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_server_request.rb +166 -0
  281. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_server_response.rb +163 -0
  282. data/lib/jamf/api/jamf_pro/oapi_schemas/deprecated_server_update.rb +171 -0
  283. data/lib/jamf/api/jamf_pro/oapi_schemas/device_communication_settings.rb +129 -0
  284. data/lib/jamf/api/jamf_pro/oapi_schemas/device_compliance_information.rb +118 -0
  285. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_device.rb +163 -0
  286. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_device_search_results.rb +90 -0
  287. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_disown_body.rb +84 -0
  288. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_disown_response.rb +83 -0
  289. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance.rb +164 -0
  290. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance_search_results.rb +90 -0
  291. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance_sync_status.rb +99 -0
  292. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_prestage.rb +216 -0
  293. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_prestage_v2.rb +235 -0
  294. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_token.rb +95 -0
  295. data/lib/jamf/api/jamf_pro/oapi_schemas/diagnostic_submission_setting.rb +88 -0
  296. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook.rb +153 -0
  297. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_exclusions.rb +138 -0
  298. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_limitations.rb +98 -0
  299. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_scope.rb +171 -0
  300. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_search_results.rb +90 -0
  301. data/lib/jamf/api/jamf_pro/oapi_schemas/enable_lost_mode_command.rb +94 -0
  302. data/lib/jamf/api/jamf_pro/oapi_schemas/engage.rb +85 -0
  303. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group.rb +123 -0
  304. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group_preview.rb +135 -0
  305. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group_v2.rb +133 -0
  306. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization.rb +107 -0
  307. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_branding_settings.rb +112 -0
  308. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_dependencies.rb +84 -0
  309. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_dependency.rb +94 -0
  310. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_ldap_group_access.rb +88 -0
  311. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel.rb +90 -0
  312. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_ldap_auth.rb +122 -0
  313. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_list.rb +84 -0
  314. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_sso_auth.rb +114 -0
  315. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_text.rb +113 -0
  316. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_search_results.rb +90 -0
  317. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_search_results_v2.rb +90 -0
  318. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_v2.rb +116 -0
  319. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_method.rb +98 -0
  320. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_process_text_object.rb +347 -0
  321. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_settings.rb +264 -0
  322. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_settings_v2.rb +274 -0
  323. data/lib/jamf/api/jamf_pro/oapi_schemas/export_field.rb +92 -0
  324. data/lib/jamf/api/jamf_pro/oapi_schemas/export_parameters.rb +118 -0
  325. data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attribute.rb +116 -0
  326. data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attribute_v2.rb +117 -0
  327. data/lib/jamf/api/jamf_pro/oapi_schemas/external_recipient.rb +92 -0
  328. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment.rb +90 -0
  329. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment_delete.rb +84 -0
  330. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment_v2.rb +90 -0
  331. data/lib/jamf/api/jamf_pro/oapi_schemas/filter.rb +105 -0
  332. data/lib/jamf/api/jamf_pro/oapi_schemas/font_path.rb +91 -0
  333. data/lib/jamf/api/jamf_pro/oapi_schemas/get_computer_prestage.rb +106 -0
  334. data/lib/jamf/api/jamf_pro/oapi_schemas/get_computer_prestage_v2.rb +105 -0
  335. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization.rb +88 -0
  336. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel.rb +90 -0
  337. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_ldap_auth.rb +94 -0
  338. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_sso_auth.rb +94 -0
  339. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_text.rb +94 -0
  340. data/lib/jamf/api/jamf_pro/oapi_schemas/get_mobile_device_prestage.rb +106 -0
  341. data/lib/jamf/api/jamf_pro/oapi_schemas/get_mobile_device_prestage_v2.rb +104 -0
  342. data/lib/jamf/api/jamf_pro/oapi_schemas/group_mappings.rb +139 -0
  343. data/lib/jamf/api/jamf_pro/oapi_schemas/group_membership.rb +95 -0
  344. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search.rb +107 -0
  345. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search_request.rb +86 -0
  346. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search_response.rb +92 -0
  347. data/lib/jamf/api/jamf_pro/oapi_schemas/history_search_results.rb +142 -0
  348. data/lib/jamf/api/jamf_pro/oapi_schemas/history_search_results_v1.rb +92 -0
  349. data/lib/jamf/api/jamf_pro/oapi_schemas/href_response.rb +169 -0
  350. data/lib/jamf/api/jamf_pro/oapi_schemas/icon_response.rb +92 -0
  351. data/lib/jamf/api/jamf_pro/oapi_schemas/id_and_name.rb +93 -0
  352. data/lib/jamf/api/jamf_pro/oapi_schemas/id_and_name_v2.rb +89 -0
  353. data/lib/jamf/api/jamf_pro/oapi_schemas/ids.rb +96 -0
  354. data/lib/jamf/api/jamf_pro/oapi_schemas/initialize.rb +134 -0
  355. data/lib/jamf/api/jamf_pro/oapi_schemas/initialize_v1.rb +134 -0
  356. data/lib/jamf/api/jamf_pro/oapi_schemas/install_package.rb +104 -0
  357. data/lib/jamf/api/jamf_pro/oapi_schemas/integer_wrapper.rb +85 -0
  358. data/lib/jamf/api/jamf_pro/oapi_schemas/internal_recipient.rb +95 -0
  359. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_information.rb +114 -0
  360. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_error.rb +124 -0
  361. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_error.rb +90 -0
  362. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_error_cause.rb +106 -0
  363. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_success.rb +87 -0
  364. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute.rb +90 -0
  365. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute_column.rb +88 -0
  366. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute_column_result.rb +90 -0
  367. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_invalid_csv_response.rb +89 -0
  368. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record.rb +249 -0
  369. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_search_results.rb +92 -0
  370. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_search_results_v2.rb +90 -0
  371. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_v2.rb +264 -0
  372. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_branding_configuration.rb +130 -0
  373. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_branding_search_results.rb +90 -0
  374. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_details.rb +256 -0
  375. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_details_v2.rb +256 -0
  376. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_application_response.rb +96 -0
  377. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_nation_credentials.rb +91 -0
  378. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_package_response.rb +108 -0
  379. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_information.rb +125 -0
  380. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_server_url.rb +93 -0
  381. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_version.rb +83 -0
  382. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_protect_plan.rb +126 -0
  383. data/lib/jamf/api/jamf_pro/oapi_schemas/language_code.rb +95 -0
  384. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_request.rb +100 -0
  385. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_response.rb +102 -0
  386. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_update.rb +100 -0
  387. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_group.rb +108 -0
  388. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_group_search_results.rb +92 -0
  389. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_server.rb +95 -0
  390. data/lib/jamf/api/jamf_pro/oapi_schemas/linked_connect_profile.rb +127 -0
  391. data/lib/jamf/api/jamf_pro/oapi_schemas/linked_connect_profile_search_results.rb +90 -0
  392. data/lib/jamf/api/jamf_pro/oapi_schemas/locale.rb +89 -0
  393. data/lib/jamf/api/jamf_pro/oapi_schemas/location.rb +126 -0
  394. data/lib/jamf/api/jamf_pro/oapi_schemas/location_information.rb +147 -0
  395. data/lib/jamf/api/jamf_pro/oapi_schemas/location_information_v2.rb +147 -0
  396. data/lib/jamf/api/jamf_pro/oapi_schemas/location_v2.rb +125 -0
  397. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_branding_configuration.rb +119 -0
  398. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_branding_search_results.rb +90 -0
  399. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_managed_software_update.rb +113 -0
  400. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_managed_software_update_response.rb +92 -0
  401. data/lib/jamf/api/jamf_pro/oapi_schemas/markdown.rb +85 -0
  402. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_client_type.rb +91 -0
  403. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command.rb +110 -0
  404. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_client.rb +89 -0
  405. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_request.rb +90 -0
  406. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_state.rb +90 -0
  407. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_type.rb +173 -0
  408. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_signing_certificate.rb +102 -0
  409. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_mappings.rb +85 -0
  410. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_test_search_request.rb +93 -0
  411. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_test_search_response.rb +91 -0
  412. data/lib/jamf/api/jamf_pro/oapi_schemas/memcached_endpoints.rb +114 -0
  413. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device.rb +154 -0
  414. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_application.rb +101 -0
  415. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_attachment.rb +90 -0
  416. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_attachment_v2.rb +90 -0
  417. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_certificate_v1.rb +88 -0
  418. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_certificate_v2.rb +88 -0
  419. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details.rb +236 -0
  420. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details_get_v2.rb +84 -0
  421. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details_v2.rb +254 -0
  422. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_ebook.rb +95 -0
  423. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_extension_attribute_results.rb +84 -0
  424. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_group.rb +97 -0
  425. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage.rb +137 -0
  426. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name.rb +95 -0
  427. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name_v2.rb +95 -0
  428. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names.rb +119 -0
  429. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names_v2.rb +119 -0
  430. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_search_results.rb +90 -0
  431. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_search_results_v2.rb +90 -0
  432. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_v2.rb +176 -0
  433. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_params.rb +145 -0
  434. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_results.rb +90 -0
  435. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_results_v2.rb +90 -0
  436. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_v2.rb +159 -0
  437. data/lib/jamf/api/jamf_pro/oapi_schemas/network.rb +172 -0
  438. data/lib/jamf/api/jamf_pro/oapi_schemas/network_v2.rb +180 -0
  439. data/lib/jamf/api/jamf_pro/oapi_schemas/notification.rb +97 -0
  440. data/lib/jamf/api/jamf_pro/oapi_schemas/notification_type.rb +141 -0
  441. data/lib/jamf/api/jamf_pro/oapi_schemas/notification_v1.rb +97 -0
  442. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history.rb +138 -0
  443. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history_note.rb +138 -0
  444. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history_v1.rb +107 -0
  445. data/lib/jamf/api/jamf_pro/oapi_schemas/order_by.rb +96 -0
  446. data/lib/jamf/api/jamf_pro/oapi_schemas/package_manifest.rb +149 -0
  447. data/lib/jamf/api/jamf_pro/oapi_schemas/parent_app.rb +131 -0
  448. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_ids_on_dashboard.rb +84 -0
  449. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_attempt.rb +103 -0
  450. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_attempt_action.rb +95 -0
  451. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_log.rb +125 -0
  452. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_log_search_results.rb +90 -0
  453. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_on_dashboard.rb +83 -0
  454. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_summary.rb +147 -0
  455. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_version.rb +97 -0
  456. data/lib/jamf/api/jamf_pro/oapi_schemas/personal_hotspot_setting.rb +88 -0
  457. data/lib/jamf/api/jamf_pro/oapi_schemas/plan_search_results.rb +90 -0
  458. data/lib/jamf/api/jamf_pro/oapi_schemas/plugin_path.rb +91 -0
  459. data/lib/jamf/api/jamf_pro/oapi_schemas/policy_properties.rb +92 -0
  460. data/lib/jamf/api/jamf_pro/oapi_schemas/policy_properties_v1.rb +92 -0
  461. data/lib/jamf/api/jamf_pro/oapi_schemas/post_computer_prestage_v2.rb +86 -0
  462. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_dependencies.rb +86 -0
  463. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_dependency.rb +94 -0
  464. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_file_attachment.rb +96 -0
  465. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_file_attachment_v2.rb +96 -0
  466. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information.rb +175 -0
  467. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information_v2.rb +175 -0
  468. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope.rb +85 -0
  469. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment.rb +94 -0
  470. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment_v2.rb +95 -0
  471. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_response.rb +110 -0
  472. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_response_v2.rb +110 -0
  473. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_update.rb +114 -0
  474. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_v2.rb +85 -0
  475. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_sync_status.rb +99 -0
  476. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_sync_status_v2.rb +99 -0
  477. data/lib/jamf/api/jamf_pro/oapi_schemas/process_texts_search_results.rb +92 -0
  478. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_registration_request.rb +99 -0
  479. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_settings_response.rb +142 -0
  480. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_updatable_settings_request.rb +84 -0
  481. data/lib/jamf/api/jamf_pro/oapi_schemas/provisioning_profile.rb +96 -0
  482. data/lib/jamf/api/jamf_pro/oapi_schemas/purchasing.rb +154 -0
  483. data/lib/jamf/api/jamf_pro/oapi_schemas/purchasing_v2.rb +154 -0
  484. data/lib/jamf/api/jamf_pro/oapi_schemas/put_computer_prestage.rb +83 -0
  485. data/lib/jamf/api/jamf_pro/oapi_schemas/put_computer_prestage_v2.rb +92 -0
  486. data/lib/jamf/api/jamf_pro/oapi_schemas/put_mobile_device_prestage.rb +83 -0
  487. data/lib/jamf/api/jamf_pro/oapi_schemas/put_mobile_device_prestage_v2.rb +83 -0
  488. data/lib/jamf/api/jamf_pro/oapi_schemas/recalculation_results.rb +93 -0
  489. data/lib/jamf/api/jamf_pro/oapi_schemas/recipient.rb +95 -0
  490. data/lib/jamf/api/jamf_pro/oapi_schemas/recipients.rb +83 -0
  491. data/lib/jamf/api/jamf_pro/oapi_schemas/redeploy_jamf_management_framework_response.rb +89 -0
  492. data/lib/jamf/api/jamf_pro/oapi_schemas/reenrollment.rb +118 -0
  493. data/lib/jamf/api/jamf_pro/oapi_schemas/remote_administration_response.rb +108 -0
  494. data/lib/jamf/api/jamf_pro/oapi_schemas/remote_administration_search_results.rb +91 -0
  495. data/lib/jamf/api/jamf_pro/oapi_schemas/renew_mdm_profile_response.rb +83 -0
  496. data/lib/jamf/api/jamf_pro/oapi_schemas/restart_device_command.rb +96 -0
  497. data/lib/jamf/api/jamf_pro/oapi_schemas/retry_patch_policy_params.rb +98 -0
  498. data/lib/jamf/api/jamf_pro/oapi_schemas/safelisted_apps.rb +85 -0
  499. data/lib/jamf/api/jamf_pro/oapi_schemas/script.rb +193 -0
  500. data/lib/jamf/api/jamf_pro/oapi_schemas/scripts_search_results.rb +90 -0
  501. data/lib/jamf/api/jamf_pro/oapi_schemas/search_active_patch_history_params.rb +122 -0
  502. data/lib/jamf/api/jamf_pro/oapi_schemas/search_patch_policy_log_params.rb +122 -0
  503. data/lib/jamf/api/jamf_pro/oapi_schemas/security.rb +131 -0
  504. data/lib/jamf/api/jamf_pro/oapi_schemas/security_v2.rb +130 -0
  505. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_install_settings.rb +93 -0
  506. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_interaction_settings.rb +123 -0
  507. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_login_settings.rb +114 -0
  508. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_settings.rb +101 -0
  509. data/lib/jamf/api/jamf_pro/oapi_schemas/session.rb +83 -0
  510. data/lib/jamf/api/jamf_pro/oapi_schemas/session_candidate_request.rb +109 -0
  511. data/lib/jamf/api/jamf_pro/oapi_schemas/session_details.rb +176 -0
  512. data/lib/jamf/api/jamf_pro/oapi_schemas/session_details_search_results.rb +91 -0
  513. data/lib/jamf/api/jamf_pro/oapi_schemas/session_status.rb +99 -0
  514. data/lib/jamf/api/jamf_pro/oapi_schemas/set_recovery_lock_command.rb +83 -0
  515. data/lib/jamf/api/jamf_pro/oapi_schemas/settings_command.rb +168 -0
  516. data/lib/jamf/api/jamf_pro/oapi_schemas/shared_device_configuration.rb +88 -0
  517. data/lib/jamf/api/jamf_pro/oapi_schemas/signature.rb +94 -0
  518. data/lib/jamf/api/jamf_pro/oapi_schemas/site.rb +92 -0
  519. data/lib/jamf/api/jamf_pro/oapi_schemas/smart_search_criterion.rb +119 -0
  520. data/lib/jamf/api/jamf_pro/oapi_schemas/software_title_configuration.rb +90 -0
  521. data/lib/jamf/api/jamf_pro/oapi_schemas/software_title_patch_policy_summaries.rb +90 -0
  522. data/lib/jamf/api/jamf_pro/oapi_schemas/software_update_settings.rb +89 -0
  523. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore.rb +129 -0
  524. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_cert_parse_response.rb +131 -0
  525. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_details.rb +108 -0
  526. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_parse.rb +104 -0
  527. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_response.rb +121 -0
  528. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_response_with_details.rb +94 -0
  529. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_with_details.rb +94 -0
  530. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_metadata_url.rb +84 -0
  531. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_settings.rb +241 -0
  532. data/lib/jamf/api/jamf_pro/oapi_schemas/startup_status.rb +186 -0
  533. data/lib/jamf/api/jamf_pro/oapi_schemas/static_user_group.rb +92 -0
  534. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity.rb +108 -0
  535. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_certificate_upload.rb +100 -0
  536. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_create.rb +91 -0
  537. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_search_results.rb +90 -0
  538. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_update.rb +84 -0
  539. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_features.rb +106 -0
  540. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_settings_request.rb +108 -0
  541. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_settings_response.rb +122 -0
  542. data/lib/jamf/api/jamf_pro/oapi_schemas/time_frame.rb +88 -0
  543. data/lib/jamf/api/jamf_pro/oapi_schemas/time_zone.rb +108 -0
  544. data/lib/jamf/api/jamf_pro/oapi_schemas/tv_os_details.rb +133 -0
  545. data/lib/jamf/api/jamf_pro/oapi_schemas/udids.rb +84 -0
  546. data/lib/jamf/api/jamf_pro/oapi_schemas/update_apple_tv.rb +88 -0
  547. data/lib/jamf/api/jamf_pro/oapi_schemas/update_ios.rb +82 -0
  548. data/lib/jamf/api/jamf_pro/oapi_schemas/update_ios_v2.rb +82 -0
  549. data/lib/jamf/api/jamf_pro/oapi_schemas/update_mobile_device.rb +123 -0
  550. data/lib/jamf/api/jamf_pro/oapi_schemas/update_mobile_device_v2.rb +138 -0
  551. data/lib/jamf/api/jamf_pro/oapi_schemas/update_tv_os.rb +88 -0
  552. data/lib/jamf/api/jamf_pro/oapi_schemas/user_attributes.rb +118 -0
  553. data/lib/jamf/api/jamf_pro/oapi_schemas/user_mappings.rb +194 -0
  554. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search.rb +113 -0
  555. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search_request.rb +86 -0
  556. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search_response.rb +92 -0
  557. data/lib/jamf/api/jamf_pro/oapi_schemas/v1_site.rb +91 -0
  558. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_ca_record.rb +148 -0
  559. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_pki_payload_record.rb +88 -0
  560. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_pki_payload_record_search_results.rb +90 -0
  561. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_service_status.rb +84 -0
  562. data/lib/jamf/api/jamf_pro/oapi_schemas/verbose_package_deployment_response.rb +91 -0
  563. data/lib/jamf/api/jamf_pro/oapi_schemas/voice_roaming_setting.rb +88 -0
  564. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_content.rb +154 -0
  565. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location.rb +87 -0
  566. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_list_view.rb +172 -0
  567. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_patch.rb +112 -0
  568. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_post.rb +115 -0
  569. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_locations.rb +90 -0
  570. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscription.rb +87 -0
  571. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscription_base.rb +128 -0
  572. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscriptions.rb +90 -0
  573. data/lib/jamf/api/jamf_pro/oapi_schemas/vpp_admin_account.rb +120 -0
  574. data/lib/jamf/api/jamf_pro/oapi_schemas/vpp_token_subscription.rb +124 -0
  575. data/lib/jamf/api/jamf_pro/oapi_schemas/web_link.rb +88 -0
  576. data/lib/jamf/api/jamf_pro/oapi_schemas.rb +35 -0
  577. data/lib/{jss/ruby_extensions/string.rb → jamf/api/jamf_pro/other_classes/change_log_entry.rb} +12 -10
  578. data/lib/jamf/api/{attribute_classes → jamf_pro/other_classes}/ip_address.rb +2 -8
  579. data/lib/jamf/api/jamf_pro/other_classes/pager.rb +257 -0
  580. data/lib/jamf/api/{attribute_classes → jamf_pro/other_classes}/timestamp.rb +18 -14
  581. data/lib/jamf/{api/mixins/base_class.rb → base_class.rb} +8 -8
  582. data/lib/jamf/client/jamf_binary.rb +104 -98
  583. data/lib/jamf/client/jamf_helper.rb +263 -255
  584. data/lib/jamf/client/management_action.rb +71 -72
  585. data/lib/jamf/client.rb +15 -86
  586. data/lib/jamf/composer.rb +5 -5
  587. data/lib/jamf/configuration.rb +219 -196
  588. data/lib/jamf/{api/json_objects/prestage_sync_status.rb → constants.rb} +15 -32
  589. data/lib/{jss → jamf}/db_connection.rb +23 -31
  590. data/lib/{jpapi.rb → jamf/deprecations/deprecated_api_constant.rb} +3 -4
  591. data/lib/jamf/deprecations/deprecated_config_constant.rb +25 -0
  592. data/lib/jamf/exceptions.rb +14 -15
  593. data/lib/jamf/oapi_validate.rb +502 -0
  594. data/lib/jamf/ruby_extensions/array/predicates.rb +3 -1
  595. data/lib/jamf/ruby_extensions/array/utils.rb +2 -11
  596. data/lib/jamf/ruby_extensions/array.rb +1 -1
  597. data/lib/jamf/ruby_extensions/filetest/predicates.rb +2 -1
  598. data/lib/jamf/ruby_extensions/filetest.rb +1 -1
  599. data/lib/jamf/ruby_extensions/hash/{backports.rb → utils.rb} +53 -34
  600. data/lib/jamf/ruby_extensions/hash.rb +3 -3
  601. data/lib/jamf/ruby_extensions/ipaddr/utils.rb +7 -4
  602. data/lib/jamf/ruby_extensions/ipaddr.rb +2 -2
  603. data/lib/jamf/ruby_extensions/object/predicates.rb +3 -1
  604. data/lib/jamf/ruby_extensions/object.rb +1 -1
  605. data/lib/jamf/ruby_extensions/pathname/predicates.rb +3 -1
  606. data/lib/jamf/ruby_extensions/pathname/utils.rb +11 -5
  607. data/lib/jamf/ruby_extensions/pathname.rb +1 -1
  608. data/lib/jamf/ruby_extensions/string/conversions.rb +16 -1
  609. data/lib/jamf/ruby_extensions/string/predicates.rb +3 -1
  610. data/lib/jamf/ruby_extensions/string.rb +1 -3
  611. data/lib/{jss/ruby_extensions/time.rb → jamf/ruby_extensions/time/utils.rb} +40 -25
  612. data/lib/{jss/version.rb → jamf/ruby_extensions/time.rb} +7 -6
  613. data/lib/jamf/ruby_extensions.rb +9 -9
  614. data/lib/jamf/utility.rb +626 -410
  615. data/lib/jamf/validate.rb +86 -125
  616. data/lib/jamf/version.rb +3 -3
  617. data/lib/jamf.rb +76 -131
  618. data/lib/jss-api.rb +2 -2
  619. data/lib/jss.rb +3 -215
  620. data/lib/ruby-jss.rb +2 -2
  621. data/lib/zeitwerk_config.rb +162 -0
  622. data/test/README.md +27 -112
  623. data/test/bin/runtests +57 -130
  624. data/test/lib/jamf_test/APITest.rb +80 -0
  625. data/test/lib/jamf_test/auth.rb +267 -0
  626. data/test/lib/jamf_test/collection_tests.rb +393 -0
  627. data/test/lib/{testhelper.rb → jamf_test.rb} +8 -11
  628. data/{lib/jss/ruby_extensions/filetest.rb → test/tests/category.rb} +17 -20
  629. data/test/tests/device_enrollment.rb +101 -0
  630. data/test/tests/inventory_preload_record.rb +131 -0
  631. data/{lib/jss/ruby_extensions.rb → test/tests/jp_building.rb} +16 -12
  632. data/test/tests/policy.rb +163 -0
  633. metadata +646 -204
  634. data/lib/jamf/api/base_classes/collection_resource.rb +0 -612
  635. data/lib/jamf/api/base_classes/json_object.rb +0 -1103
  636. data/lib/jamf/api/base_classes/prestage.rb +0 -503
  637. data/lib/jamf/api/base_classes/resource.rb +0 -259
  638. data/lib/jamf/api/base_classes/singleton_resource.rb +0 -88
  639. data/lib/jamf/api/connection/api_error.rb +0 -111
  640. data/lib/jamf/api/connection/api_error_styleguide.rb +0 -96
  641. data/lib/jamf/api/json_objects/change_log_entry.rb +0 -77
  642. data/lib/jamf/api/json_objects/country.rb +0 -51
  643. data/lib/jamf/api/json_objects/device_enrollment_device.rb +0 -165
  644. data/lib/jamf/api/json_objects/device_enrollment_device_sync_state.rb +0 -81
  645. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +0 -71
  646. data/lib/jamf/api/json_objects/inventory_preload_extension_attribute.rb +0 -57
  647. data/lib/jamf/api/json_objects/locale.rb +0 -59
  648. data/lib/jamf/api/json_objects/md_prestage_name.rb +0 -57
  649. data/lib/jamf/api/json_objects/md_prestage_names.rb +0 -82
  650. data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +0 -214
  651. data/lib/jamf/api/json_objects/prestage_assignment.rb +0 -76
  652. data/lib/jamf/api/json_objects/prestage_location.rb +0 -104
  653. data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +0 -132
  654. data/lib/jamf/api/json_objects/prestage_scope.rb +0 -57
  655. data/lib/jamf/api/json_objects/time_zone.rb +0 -105
  656. data/lib/jamf/api/mixins/change_log.rb +0 -288
  657. data/lib/jamf/api/mixins/extendable.rb +0 -75
  658. data/lib/jamf/api/mixins/pageable.rb +0 -208
  659. data/lib/jamf/api/mixins/searchable.rb +0 -202
  660. data/lib/jamf/api/resources/collection_resources/building.rb +0 -121
  661. data/lib/jamf/api/resources/collection_resources/category.rb +0 -83
  662. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +0 -89
  663. data/lib/jamf/api/resources/collection_resources/department.rb +0 -78
  664. data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +0 -384
  665. data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +0 -289
  666. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +0 -143
  667. data/lib/jamf/api/resources/collection_resources/script.rb +0 -226
  668. data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +0 -141
  669. data/lib/jamf/api/resources/singleton_resources/locales.rb +0 -155
  670. data/lib/jamf/api/resources/singleton_resources/time_zones.rb +0 -213
  671. data/lib/jamf/compatibility.rb +0 -88
  672. data/lib/jamf/ruby_extensions/dig.rb +0 -52
  673. data/lib/jamf/ruby_extensions/string/backports.rb +0 -66
  674. data/lib/jss/api_connection.rb +0 -1029
  675. data/lib/jss/api_object/app_store_country_codes.rb +0 -298
  676. data/lib/jss/api_object/computer/application_installs.rb +0 -118
  677. data/lib/jss/client/jamf_binary.rb +0 -132
  678. data/lib/jss/client/jamf_helper.rb +0 -298
  679. data/lib/jss/client/management_action.rb +0 -113
  680. data/lib/jss/client.rb +0 -301
  681. data/lib/jss/compatibility.rb +0 -88
  682. data/lib/jss/composer.rb +0 -190
  683. data/lib/jss/configuration.rb +0 -319
  684. data/lib/jss/exceptions.rb +0 -115
  685. data/lib/jss/ruby_extensions/array.rb +0 -52
  686. data/lib/jss/ruby_extensions/hash.rb +0 -140
  687. data/lib/jss/ruby_extensions/ipaddr.rb +0 -92
  688. data/lib/jss/ruby_extensions/object.rb +0 -19
  689. data/lib/jss/ruby_extensions/pathname.rb +0 -78
  690. data/lib/jss/ruby_extensions/string/backports.rb +0 -68
  691. data/lib/jss/ruby_extensions/string/conversions.rb +0 -69
  692. data/lib/jss/ruby_extensions/string/predicates.rb +0 -57
  693. data/lib/jss/server.rb +0 -146
  694. data/lib/jss/utility.rb +0 -672
  695. data/lib/jss/validate.rb +0 -248
  696. data/test/lib/testhelper/auth.rb +0 -275
  697. data/test/lib/testhelper/patch_mgmt.rb +0 -123
  698. data/test/specs/api_connection_spec.rb +0 -57
  699. data/test/specs/patch01_source_spec.rb +0 -54
  700. data/test/specs/patch02_internal_source_spec.rb +0 -88
  701. data/test/specs/patch03_external_source_spec.rb +0 -120
  702. data/test/specs/patch04_titles_spec.rb +0 -207
  703. data/test/specs/patch05_policies_spec.rb +0 -119
  704. data/test/specs/patch06_cleanup_spec.rb +0 -52
  705. data/test/specs/policy_spec.rb +0 -112
@@ -1,525 +1,212 @@
1
- # Copyright 2020 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.
1
+ ### Copyright 2022 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
+ ###
23
24
 
24
25
  require 'faraday' # >= 0.17.0
25
26
  require 'faraday_middleware' # >= 0.13.0
26
27
 
27
- # The module
28
+ # The main module
28
29
  module Jamf
29
30
 
30
- # Changes from classic Jamf::APIconnection
31
- # - uses Faraday as the REST engine
32
- # - accepts a url with connect/initialize
33
- # - only supports https, no http
34
- # - no xml
35
- # - tokens & keep_alive
36
- # - no object class method wrappers in connection objects,
37
- # only passing connection objects into the class methods
31
+ # Instances of this class represent a connection to a Jamf Pro server, using
32
+ # both the Classic and Jamf Pro APIs.
33
+ #
34
+ # For most cases, a single connection to a single JSS is all you need, and
35
+ # ruby-jss automatically creates and uses a default connection. See
36
+ # {JSS.connect}
37
+ #
38
+ # If needed, multiple connection objects can be made and used sequentially or
39
+ # simultaneously.
40
+ #
41
+ # NOTE: Individual connection instances are not thread-safe and should not be
42
+ # shared by multple simultaneous threads (such as with a multi-threaded http
43
+ # server like 'thin') or used for concurrent API access. In those cases, do not
44
+ # use the default connection, but be sure to design your application to create
45
+ # different API connections for each thread, and pass them into method calls as
46
+ # needed
47
+ #
48
+ # == Using the default connection
49
+ #
50
+ # When ruby-jss is loaded, a not-yet-connected default instance of
51
+ # Jamf::Connection is created and available using {JSS.cnx}.
52
+ #
53
+ # This connection is used as the initial default connection so all methods
54
+ # that make API calls will use it by default.
55
+ # For most uses where you're only going to be working with one connection to
56
+ # one JSS, the default connection is all you need.
57
+ #
58
+ # Before using it you must call its {#connect} method, passing in appropriate
59
+ # connection details and credentials.
60
+ #
61
+ # Example:
62
+ #
63
+ # require 'ruby-jss'
64
+ # JSS.cnx.connect host: 'server.address.edu', user: 'jss-api-user', pw: :prompt
65
+ # # (see {Jamf::Connection#connect} for all the connection options)
66
+ #
67
+ # a_phone = Jamf::MobileDevice.fetch id: 8743
68
+ #
69
+ # # the mobile device was fetched through the default connection
70
+ #
71
+ # If needed, you can re-login to the default connection by calling JSS.connect
72
+ # with new connection parameters. You can also call JSS.disconnect to close the
73
+ # connection
74
+ #
75
+ # == Using standalone Connections
76
+ #
77
+ # Sometimes you need to connect simultaneously to more than one JSS.
78
+ # or to the same JSS with different credentials, or you just need multiple
79
+ # concurrent connections for asyncronous, thread-safe use. ruby-jss allows you
80
+ # to create as many connections as needed, and pass them into the methods that
81
+ # communication with the API via the `cnx:` parameter (the older `api:`
82
+ # parameter is deprecated and will eventually not be recognized)
83
+ #
84
+ # Example:
85
+ # my_connection = Jamf::Connection.new(params: go, in: here)
86
+ # a_computer = Jamf::Computer.fetch id: 1234, cnx: my_connection
87
+ #
88
+ # # the Jamf::Computer with id 1234 is fetched from the connection
89
+ # # stored in the variable 'my_connection'. The computer is
90
+ # # then stored in the variable 'a_computer'
91
+ #
92
+ # NOTE:
93
+ # When an obbject is retrieved or created it stores an internal
94
+ # reference to the Connection object that it usdd, and uses that when making
95
+ # future API calls.
96
+ # So in the example above, when saving any changes to a_computer, the Connection
97
+ # object 'my_connection' will (and must) be used.
98
+ #
99
+ # Similiarly, each Connection object maintains its own caches for the data
100
+ # used by the `list` methods (e.g. Jamf::Computer.all, .all_names, and so on)
101
+ #
102
+ # == Making new APIConnection instances
103
+ #
104
+ # New connections can be created using the standard ruby 'new' method.
105
+ #
106
+ # If you provide connection details when calling 'new', they will be passed
107
+ # to the {#connect} method immediately. Otherwise you can call {#connect} later.
108
+ #
109
+ # production_api = Jamf::Connection.new(
110
+ # 'https://produser@prodserver.address.org:8443/'
111
+ # name: 'prod',
112
+ # pw: :prompt
113
+ # )
114
+ #
115
+ # # the new connection is now stored in the variable 'production_api'.
116
+ #
117
+ # == Passing an APIConnection object to API-related methods
118
+ #
119
+ # All methods that use the API can take an 'cnx:' parameter which
120
+ # takes a Connection object. When provided, that connection is
121
+ # used rather than the active connection. The older, deprecated synonym 'api:'
122
+ # will eventually be removed.
123
+ #
124
+ # For example:
125
+ #
126
+ # prod2_computer_sns = Jamf::Computer.all_serial_numbers, cnx: production_api2
127
+ #
128
+ # # the list of all computer serial numbers is read from the connection in
129
+ # # the variable 'production_api2' and stored in 'prod2_computer_sns'
130
+ #
131
+ # prod2_victim_md = Jamf::MobileDevice.fetch id: 832, cnx: production_api2
132
+ #
133
+ # # the variable 'prod2_victim_md' now contains a Jamf::MobileDevice queried
134
+ # # through the connection 'production_api2'.
135
+ #
136
+ # == Low-level use of Connection instances.
137
+ #
138
+ # For most cases, using Connection instances as mentioned above
139
+ # is all you'll need. However to access API resources that aren't yet
140
+ # implemented in other parts of ruby-jss, you can use the methods
141
+ # {#c_get}, {#c_put}, {#c_post}, {#c_delete} for accessing the Classic API
142
+ # and {#jp_get}, {#jp_post}, {#jp_put}, {#jp_patch}, {#jp_delete} for
143
+ # accessing the Jamf Pro API
144
+ #
145
+ # For even lower-level work, you can access the underlying Faraday::Connection
146
+ # objects via the connection's {#c_cnx} and {#jp_cnx}
147
+ # attributes.
148
+ #
38
149
  #
39
150
  class Connection
40
151
 
41
- # Class Constants
42
- #####################################
43
-
44
- # The start of the path for API resources
45
- RSRC_BASE = 'api'.freeze
46
-
47
- # The JamfPro version must be this or higher
48
- MIN_JAMF_VERSION = Gem::Version.new('10.25.0')
49
-
50
- HTTPS_SCHEME = 'https'.freeze
51
-
52
- # The https default SSL port, default for Jamf Cloud servers
53
- HTTPS_SSL_PORT = 443
54
-
55
- # The Jamf default SSL port, default for on-prem servers
56
- ON_PREM_SSL_PORT = 8443
57
-
58
- # if either of these is specified, we'll default to SSL
59
- SSL_PORTS = [ON_PREM_SSL_PORT, HTTPS_SSL_PORT].freeze
60
-
61
- # Recognize Jamf Cloud servers
62
- JAMFCLOUD_DOMAIN = '.jamfcloud.com'.freeze
63
-
64
- # JamfCloud connections default to 443, not 8443
65
- JAMFCLOUD_PORT = HTTPS_SSL_PORT
66
-
67
- # Default open-connection timeout in seconds
68
- DFT_OPEN_TIMEOUT = 60
69
-
70
- # Default response timeout in seconds
71
- DFT_TIMEOUT = 60
72
-
73
- # The Default SSL Version
74
- DFT_SSL_VERSION = 'TLSv1_2'.freeze
75
-
76
- # refresh token if less than this many seconds until
77
- # expiration. Default is 5 minutes if not specified
78
- DFT_TOKEN_REFRESH = 300
79
-
80
- # pre-existing tokens must have this many seconds before
81
- # before they expire
82
- TOKEN_REUSE_MIN_LIFE = 60
83
-
84
- HTTP_ACCEPT_HEADER = 'Accept'.freeze
85
-
86
- HTTP_CONTENT_TYPE_HEADER = 'Content-Type'.freeze
87
-
88
- MIME_JSON = 'application/json'.freeze
89
-
90
- SLASH = '/'.freeze
91
-
92
- VALID_URL_REGEX = /\A#{URI.regexp(%w[https])}\z/.freeze
93
-
94
- NOT_CONNECTED = 'Not Connected'.freeze
95
-
96
- # Only these variables are displayed with PrettyPrint
97
- # This avoids, especially, the caches, which are available
98
- # as attr_readers
99
- PP_VARS = %i[
100
- @name
101
- @connected
102
- @host
103
- @port
104
- @user
105
- @base_url
106
- @ssl_options
107
- @open_timeout
108
- @timeout
109
- @login_time
110
- @keep_alive
111
- @token_refresh
112
- @pw_fallback
113
- ].freeze
114
-
115
- # Attributes
116
- #####################################
117
-
118
- # @return [String, nil]
119
- attr_reader :name
120
-
121
- # @return [String, nil]
122
- attr_reader :host
123
-
124
- # @return [Integer, nil]
125
- attr_reader :port
126
-
127
- # @return [String, nil]
128
- attr_reader :user
129
-
130
- # @return [Integer, nil]
131
- attr_reader :timeout
132
-
133
- # @return [Jamf::Connection::Token, nil]
134
- attr_reader :token
135
-
136
- # @return [Integer] Refresh the token this many seconds before it expires
137
- attr_reader :token_refresh
138
-
139
- # @return [String, nil]
140
- attr_reader :base_url
141
-
142
- # @return [Boolean] if token refresh/keepaliave fails, try to get a new one
143
- # with the passwd used with .connect. Defaults to true
144
- attr_reader :pw_fallback
145
-
146
- # @return [Boolean]
147
- attr_reader :connected
148
- alias connected? connected
149
-
150
- # @return [RestClient::Resource] the underlying rest resource
151
- attr_reader :rest_cnx
152
-
153
- # when was this connection logged in?
154
- attr_reader :login_time
155
-
156
- # @return [Hash]
157
- # This Hash holds the most recently fetched instance of a SingletonResource
158
- # subclass, keyed by the subclass itself.
159
- #
160
- # SingletonResource.fetch will return the instance from here, if it exists,
161
- # unless the first parameter is truthy.
162
- attr_reader :singleton_cache
163
-
164
- # @return [Hash]
165
- # This Hash holds the most recent API data (an Array of Hashes) for the list
166
- # of all items in a CollectionResource subclass, keyed by the subclass itself.
167
- #
168
- # CollectionResource.all return the appropriate data from here, if it exists,
169
- #
170
- # See the CollectionResource.all class method.
171
- attr_reader :collection_cache
172
-
173
- # @return [Hash]
174
- # This hash holds ExtensionAttribute instances, which are used
175
- # for validating values passed to Extendable.set_ext_attr.
176
- attr_reader :ext_attr_cache
177
-
178
- # @return [Faraday::Response] The response object from the last API access.
179
- attr_reader :last_http_response
152
+ # the code for this class is broken into multiple files
153
+ # as modules, to play will with the zeitwerk loader
154
+ include Jamf::Connection::Constants
155
+ include Jamf::Connection::Attributes
156
+ include Jamf::Connection::Cache
157
+ include Jamf::Connection::Connect
158
+ include Jamf::Connection::ClassicAPI
159
+ include Jamf::Connection::JamfProAPI
180
160
 
181
161
  # Constructor
182
162
  #####################################
183
163
 
184
- # @see #connect
185
- def initialize(url = nil, **params)
186
- @name = params.delete :name
187
- @name ||= NOT_CONNECTED
188
-
189
- @singleton_cache = {}
190
- @collection_cache = {}
191
- @ext_attr_cache = {}
192
-
193
- connect(url, params) unless params[:do_not_connect]
194
- end
195
-
196
- # Public Instance Methods
197
- #####################################
198
-
199
- # Connect this Connection object to an Jamf Pro API
200
- #
201
- # The first parameter may be a URL (must be https) from which
202
- # the host & port will be used, and if present, the user and password
203
- # E.g.
204
- # connect 'https://myuser:pass@host.domain.edu:8443'
205
- #
206
- # which is the same as:
207
- # connect host: 'host.domain.edu', port: 8443, user: 'myuser', pw: 'pass'
208
- #
209
- # When using a URL, other parameters below may be specified, however
210
- # host: and port: parameters will be ignored, since they came from the URL,
211
- # as will user: and :pw, if they are present in the URL. If the URL doesn't
212
- # contain user and pw, they can be provided via the parameters, or left
213
- # to default values.
214
- #
215
- # ### Passwords
216
- # The pw: parameter also accepts the symbols :prompt, and :stdin[X]
217
- #
218
- # If :prompt, the user is promted on the commandline to enter the password
219
- # for the :user.
220
- #
221
- # If :stdin the password is read from the first line of stdin
222
- #
223
- # If :stdinX (where X is an integer) the password is read from the Xth
224
- # line of stdin.see {Jamf.stdin}
225
- #
226
- # If omitted, and running from an interactive terminal, the user is
227
- # prompted as with :prompt
228
- #
229
- # ### Tokens
230
- # Instead of a user and password, you may specify a valid 'token:', either:
231
- #
232
- # A Jamf::Connection::Token object, which can be extracted from an active
233
- # Jamf::Connection via its #token method
234
- #
235
- # or
236
- #
237
- # A token string e.g. "eyJhdXR...6EKoo" from any source can also be used.
238
- #
239
- # Any values available via Jamf.config will be used if they are not provided
240
- # in the parameters.
241
- #
242
- # @param host: [String] The API server hostname. The param 'server:' is a
243
- # synonym
244
- #
245
- # @param port: [Integer] The API server port. If omitted, the value from
246
- # Jamf.config will be used. If no config value, defaults to 443 if the
247
- # host ends with 'jamfcloud.com' or 8443 otherwise
248
- #
249
- # @param user: [String] The username for the API connection
250
- #
251
- # @param pw: [String, Symbol] The password for the user, :prompt, or :stdin[X]
164
+ # Instantiate a connection object.
252
165
  #
253
- # @param token: [Jamf::Connection::Token, String] An existing, valid token.
254
- # When used, there's no need to provide user: or pw:.
255
- # NOTE if using pw_fallback:true (the default) while providing a token
256
- # you will also need to provide the password for the token user in the pw:
257
- # parameter, or be prompted for it. If you don't have the pw for the
258
- # token user, be sure to set pw_fallback to false.
166
+ # If name: is provided it will be stored as the Connection's name attribute.
259
167
  #
260
- # @param token_refresh: [Integer] Refresh the token this many seconds before
261
- # it expires. Must be >= DFT_TOKEN_REFRESH
168
+ # if no url is provided and params are empty, or contains only
169
+ # a :name key, then you must call #connect with all the connection
170
+ # parameters before accessing a server.
262
171
  #
263
- # @pararm pw_fallback: [Boolean] Default is true. Use the password provided
264
- # to refresh the token if regular refresh doesn't work (e.g. token is expired).
265
- # NOTE: This causes the password to be kept in memory. If you don't want
266
- # this, explicitly set pw_fallback to false, however long-running processes
267
- # may lose connection if token refresh fails for any reason.
172
+ # See {#connect} for the parameters
268
173
  #
269
- # @param open_timeout: [Integer] The number of seconds for initial contact
270
- # with the host.
271
- #
272
- # @param timeout: [Integer] The number of seconds for a full response from
273
- # the host.
274
- #
275
- # @param ssl_version: [Symbol] The SSL version, e.g. :TLSv1_2
276
- #
277
- # @param verify_cert: [Boolean] Should the SSL certificate be verified?
278
- # Default is true, should only be set to false if using a on-prem
279
- # server with a self-signed certificate, which is rare
280
- #
281
- def connect(url = nil, **params)
282
- # This sets all the instance vars to nil, and flushes/creates the caches
283
- disconnect
284
-
285
- # If there's a Token object in :token, this sets @token,
286
- # and adds host, port, user from that token
287
- parse_token params
288
-
289
- # Get host, port, user and pw from a URL, add to params if needed
290
- parse_url url, params
291
-
292
- # apply defaults from config, client, and then this class.
293
- apply_connection_defaults params
294
-
295
- # Once we're here, all params have been parsed & defaulted into the
296
- # params hash, so
297
- # make sure we have the minimum needed params for a connection
298
- verify_basic_params params
299
-
300
- # turn the params into instance vars
301
- parse_connect_params params
302
-
303
- # if no @token already, get one from from
304
- # either a token string or a pw
305
- unless @token
306
- if params[:token].is_a? String
307
- @token = token_from :token_string, params[:token]
308
- # get the user from the token
309
- @user = @toke.user
310
- # if @pw_fallback, the pw must be acquired, since it isn't in
311
- # the token
312
- @pw = acquire_password(params[:pw]) if @pw_fallback
313
- else
314
- pw = acquire_password(params[:pw])
315
- @token = token_from :pw, pw
316
- @pw = pw if @pw_fallback
317
- end
318
- end
319
-
320
- # Now get some values from our token
321
- @base_url = @token.base_url
322
- @login_time = @token.login_time
323
-
324
- # and make our actual connection
325
- @rest_cnx = create_connection
326
-
327
- # make sure versions are good
328
- validate_jamf_version
329
-
330
- @connected = true
331
-
332
- # start keepalive if needed
333
- start_keep_alive if @keep_alive
334
-
335
- # return our string output
336
- to_s
337
- end # connect
338
-
339
- # reset all values to nil or empty
340
- def disconnect
174
+ def initialize(url = nil, **params)
175
+ @name = params.delete :name
341
176
  @connected = false
342
- @name = NOT_CONNECTED
343
- @login_time = nil
344
177
 
345
- stop_keep_alive
178
+ # initialize the data caches
179
+ # see cache.rb
180
+ @c_object_list_cache = {}
181
+ @c_ext_attr_definition_cache = {}
182
+ # @jp_singleton_cache = {}
183
+ # @jp_collection_cache = {}
184
+ # @jp_ext_attr_cache = {}
346
185
 
347
- @host = nil
348
- @port = nil
349
- @user = nil
350
- @timeout = nil
351
- @open_timeout = nil
352
- @base_url = nil
353
- @token = nil
354
- @rest_cnx = nil
355
- @ssl_options = {}
356
- @keep_alive = nil
357
- @token_refresh = nil
358
- @pw_fallback = nil
359
- @pw = nil
360
-
361
- flushcache
362
- end
186
+ return if url.nil? && params.empty?
363
187
 
364
- # Same as disconnect, but invalidates the token on the server first
365
- def logout
366
- @token.destroy
367
- disconnect
368
- end
369
-
370
- # Get a resource
371
- def get(rsrc)
372
- validate_connected
373
- resp = @rest_cnx.get rsrc
374
- @last_http_response = resp
375
- return resp.body if resp.success?
376
-
377
- raise Jamf::Connection::APIError, resp
378
- end
188
+ connect url, **params
189
+ end # init
379
190
 
380
- # GET a rsrc without doing any JSON parsing, using
381
- # a temporary Faraday connection object
382
- def download(rsrc)
383
- temp_cnx = create_connection(false)
384
- resp = temp_cnx.get rsrc
385
- @last_http_response = resp
386
- return resp.body if resp.success?
387
-
388
- raise Jamf::Connection::APIError, resp
389
- end
390
-
391
- def post(rsrc, data)
392
- validate_connected
393
- resp = @rest_cnx.post(rsrc) do |req|
394
- req.body = data
395
- end
396
- @last_http_response = resp
397
- return resp.body if resp.success?
398
-
399
- raise Jamf::Connection::APIError, resp
400
- end
401
-
402
- def put(rsrc, data)
403
- validate_connected
404
- resp = @rest_cnx.put(rsrc) do |req|
405
- req.body = data
406
- end
407
- @last_http_response = resp
408
- return resp.body if resp.success?
409
-
410
- raise Jamf::Connection::APIError, resp
411
- end
412
-
413
- def patch(rsrc, data)
414
- validate_connected
415
- resp = @rest_cnx.patch(rsrc) do |req|
416
- req.body = data
417
- end
418
- @last_http_response = resp
419
- return resp.body if resp.success?
420
-
421
- raise Jamf::Connection::APIError, resp
422
- end
423
-
424
- def delete(rsrc)
425
- validate_connected
426
- resp = @rest_cnx.delete rsrc
427
- @last_http_response = resp
428
- return resp.body if resp.success?
429
-
430
- raise Jamf::Connection::APIError, resp
431
- end
191
+ # Instance methods
192
+ #####################################
432
193
 
433
194
  # A useful string about this connection
434
195
  #
435
196
  # @return [String]
436
197
  #
437
198
  def to_s
438
- str =
439
- if connected?
440
- "#{@base_url}, Token expires: #{@token ? @token.expires : '<token missing>'}"
441
- else
442
- NOT_CONNECTED
443
- end
444
- "Jamf::Connection '#{@name == NOT_CONNECTED ? object_id : @name}': #{str}"
445
- end
446
-
447
- # Reset the name
448
- def name=(new_name)
449
- @name = new_name.to_s
450
- end
451
-
452
- # Are we keeping the connection alive?
453
- def keep_alive?
454
- return false unless @keep_alive_thread
455
-
456
- @keep_alive_thread.alive?
457
- end
458
-
459
- # @return [Jamf::Timestamp, nil]
460
- def next_refresh
461
- return unless keep_alive?
462
-
463
- @token.expires - @token_refresh
464
- end
465
-
466
- # @return [Float, nil]
467
- def secs_to_refresh
468
- return unless keep_alive?
469
-
470
- next_refresh - Time.now
471
- end
472
-
473
- # @return [String, nil] e.g. "1 week 6 days 23 hours 49 minutes 56 seconds"
474
- def time_to_refresh
475
- return unless keep_alive?
476
- return 0 if secs_to_refresh.negative?
477
-
478
- Jamf.humanize_secs secs_to_refresh
479
- end
480
-
481
- # Turn keepalive on or offs
482
- def keep_alive=(bool)
483
- bool ? start_keep_alive : stop_keep_alive
484
- end
485
-
486
- # This should take effect even if we're already running the keep_alive thread
487
- #
488
- def token_refresh=(secs)
489
- raise ArgumentError, 'Value must be an Integer number of seconds' unless secs.is_a? Integer
490
-
491
- @token_refresh = secs
492
- end
199
+ return 'not connected' unless connected?
493
200
 
494
- def jamf_version
495
- @token.jamf_version
496
- end
497
-
498
- def jamf_build
499
- @token.jamf_build
500
- end
501
-
502
- # Flush the collection and/or ea cache for the given class,
503
- # or all cached data
504
- # @param klass[Class] the class of cache to flush
505
- #
506
- # @return [void]
507
- #
508
- def flushcache(klass = nil)
509
- if klass
510
- @collection_cache.delete klass
511
- @singleton_cache.delete klass
512
- @ext_attr_cache.delete klass
201
+ if name.start_with? "#{user}@"
202
+ name
513
203
  else
514
- @collection_cache = {}
515
- @singleton_cache = {}
516
- @ext_attr_cache = {}
204
+ "#{user}@#{host}:#{port}, name: #{name}"
517
205
  end
518
206
  end
519
207
 
520
- # Remove large cached items from
521
- # the instance_variables used to create
522
- # pretty-print (pp) output.
208
+ # Only selected items are displayed with prettyprint
209
+ # otherwise its too much data in irb.
523
210
  #
524
211
  # @return [Array] the desired instance_variables
525
212
  #
@@ -527,341 +214,21 @@ module Jamf
527
214
  PP_VARS
528
215
  end
529
216
 
530
- # Private Insance Methods
531
- ####################################
532
- private
533
-
534
- # raise exception if not connected
535
- def validate_connected
536
- raise Jamf::InvalidConnectionError, 'Not Connected. Use .connect first.' unless connected?
537
- end
538
-
539
- # raise exception if API version is too low.
540
- def validate_jamf_version
541
- vers = jamf_version
542
- return if Gem::Version.new(vers) >= MIN_JAMF_VERSION
543
-
544
- raise Jamf::InvalidConnectionError, "API version '#{vers}' too low, must be >= '#{MIN_JAMF_VERSION}'"
545
- end
546
-
547
- ##### Parse Params
548
- ###################################
549
-
550
- # Get host, port, & user from a Token object
551
- # or just the user from a token string.
552
- def parse_token(params)
553
- return unless params[:token].is_a? self.class::Token
554
-
555
- verify_token params[:token]
556
- @token = params[:token]
557
- params[:host] = @token.host
558
- params[:port] = @token.port
559
- params[:user] = @token.user
560
- end
561
-
562
- # Raise execeptions if we were given an unusable token object
563
- #
564
- # @param params[Hash] The params for #connect
565
- #
566
- # @return [void]
567
- #
568
- def verify_token(token)
569
- raise 'Cannot use token: it has expired' if token.expired?
570
- raise 'Cannot use token: it is invalid' unless token.valid?
571
- raise "Cannot use token: it expires in less than #{TOKEN_REUSE_MIN_LIFE} seconds" if token.secs_remaining < TOKEN_REUSE_MIN_LIFE
572
- end
573
-
574
- # Get host, port, user and pw from a URL, overriding any already in the params
575
- #
576
- # @return [String, nil] the pw if present
577
- #
578
- def parse_url(url, params)
579
- return unless url
580
-
581
- url = URI.parse url.to_s
582
- raise ArgumentError, 'Invalid url, scheme must be https' unless url.scheme == HTTPS_SCHEME
583
-
584
- params[:host] = url.host
585
- params[:port] = url.port
586
- params[:user] = url.user if url.user
587
- params[:pw] = url.password if url.password
588
- end
589
-
590
- # Apply defaults to the unset params for the #connect method
591
- # First apply them from from the Jamf.config,
592
- # then from the Jamf::Client (read from the jamf binary config),
593
- # then from the Jamf module defaults
594
- #
595
- # @param params[Hash] The params for #connect
596
- #
597
- # @return [Hash] The params with defaults applied
598
- #
599
- def apply_connection_defaults(params)
600
- # must have a host, but accept legacy :server as well as :host
601
- params[:host] ||= params[:server]
602
-
603
- # if we have no port set by this point, set to cloud port
604
- # if host is a cloud host. But leave port nil for other hosts
605
- # (will be set via client defaults or module defaults)
606
- params[:port] ||= JAMFCLOUD_PORT if params[:host].to_s.end_with?(JAMFCLOUD_DOMAIN)
607
-
608
- apply_defaults_from_config(params)
609
-
610
- # TODO: when clients are moved over to Jamf module
611
- # apply_defaults_from_client(params)
612
-
613
- apply_module_defaults(params)
614
- end
615
-
616
- # Apply defaults from the Jamf.config
617
- # to the params for the #connect method
618
- #
619
- # @param params[Hash] The params for #connect
620
- #
621
- # @return [Hash] The params with defaults applied
622
- #
623
- def apply_defaults_from_config(params)
624
- # settings from config if they aren't in the params
625
- params[:host] ||= Jamf.config.api_server_name
626
- params[:port] ||= Jamf.config.api_server_port
627
- params[:user] ||= Jamf.config.api_username
628
- params[:timeout] ||= Jamf.config.api_timeout
629
- params[:open_timeout] ||= Jamf.config.api_timeout_open
630
- params[:ssl_version] ||= Jamf.config.api_ssl_version
631
-
632
- # if verify cert was not in the params, get it from the prefs.
633
- # We can't use ||= because the desired value might be 'false'
634
- params[:verify_cert] = Jamf.config.api_verify_cert if params[:verify_cert].nil?
635
- end # apply_defaults_from_config
636
-
637
- # Apply defaults from the Jamf::Client
638
- # to the params for the #connect method
639
- #
640
- # @param params[Hash] The params for #connect
641
- #
642
- # @return [Hash] The params with defaults applied
643
- #
644
- def apply_defaults_from_client(params)
645
- return unless Jamf::Client.installed?
646
-
647
- # these settings can come from the jamf binary config,
648
- # if this machine is a Jamf client.
649
- params[:host] ||= Jamf::Client.jss_server
650
- params[:port] ||= Jamf::Client.jss_port.to_i
651
- end
652
-
653
- # Apply the module defaults to the params for the #connect method
654
- #
655
- # @param params[Hash] The params for #connect
656
- #
657
- # @return [Hash] The params with defaults applied
658
- #
659
- def apply_module_defaults(params)
660
- # if we have no port set by this point, assume on-prem.
661
- params[:port] ||= ON_PREM_SSL_PORT
662
- params[:timeout] ||= DFT_TIMEOUT
663
- params[:open_timeout] ||= DFT_OPEN_TIMEOUT
664
- params[:ssl_version] ||= DFT_SSL_VERSION
665
- params[:token_refresh] ||= DFT_TOKEN_REFRESH
666
- # if we have a TTY, pw defaults to :prompt
667
- params[:pw] ||= :prompt if STDIN.tty?
668
- end
669
-
670
- # Raise execeptions if we don't have essential data for a new connection
671
- # namely a host, user, and pw
672
- # @param params[Hash] The params for #connect
673
- #
674
- # @return [void]
675
- #
676
- def verify_basic_params(params)
677
- # if given a Token object, it has host, port, user, and base_url
678
- # and is already parsed
679
- return if @token
680
-
681
- # must have a host
682
- raise Jamf::MissingDataError, 'No Jamf :host specified, or in configuration.' unless params[:host]
683
-
684
- # no need for user or pass if using a token string
685
- return if params[:token].is_a? String
686
-
687
- # must have user and pw
688
- raise Jamf::MissingDataError, 'No Jamf :user specified, or in configuration.' unless params[:user]
689
- raise Jamf::MissingDataError, "No :pw specified for user '#{params[:user]}'" unless params[:pw]
690
- end
691
-
692
- # Turn the connection parameters into instance vars
693
- def parse_connect_params(params)
694
- @host = params[:host]
695
- @port = params[:port]
696
- @user = params[:user]
697
-
698
- @keep_alive = params[:keep_alive].nil? ? false : params[:keep_alive]
699
- @pw_fallback = params[:pw_fallback].nil? ? true : params[:pw_fallback]
700
- @token_refresh = params[:token_refresh].to_i
701
-
702
- @timeout = params[:timeout]
703
- @open_timeout = params[:open_timeout]
704
-
705
- # TEMPORARY ? the tryitout host still uses `uapi` rather than the
706
- # new `api` for regular servers
707
- rsrc_base = @host == Token::JAMF_TRYITOUT_HOST ? 'uapi' : RSRC_BASE
708
- @base_url = URI.parse "https://#{@host}:#{@port}/#{rsrc_base}"
709
-
710
- # ssl opts for faraday
711
- # TODO: implement all of faraday's options
712
- @ssl_options = {
713
- verify: params[:verify_cert],
714
- version: params[:ssl_version]
715
- }
716
-
717
- @name = "#{@user}@#{@host}:#{@port}" if @name == NOT_CONNECTED
718
- end
719
-
720
- # given a token string or a password, get a valid token
721
- # Token.new will raise an exception if the token string or
722
- # credentials are invalid
723
- def token_from(type, data)
724
- token_params = {
725
- user: @user,
726
- base_url: @base_url,
727
- timeout: @timeout,
728
- ssl_options: @ssl_options
729
- }
730
-
731
- case type
732
- when :token_string
733
- token_params[:token_string] = data
734
- when :pw
735
- token_params[:pw] = data
736
- end
737
- self.class::Token.new token_params
738
- end
739
-
740
- # From whatever was given in params[:pw], figure out the password to use
741
- #
742
- # @param params[Hash] The params for #connect
743
- #
744
- # @return [String] The password for the connection
745
- #
746
- def acquire_password(param_pw)
747
- pw =
748
- if param_pw == :prompt
749
- Jamf.prompt_for_password "Enter the password for Jamf user #{@user}@#{@host}:"
750
- elsif param_pw.is_a?(Symbol) && param_pw.to_s.start_with?('stdin')
751
- param_pw.to_s =~ /^stdin(\d+)$/
752
- line = Regexp.last_match(1)
753
- line ||= 1
754
- Jamf.stdin line
755
- else
756
- param_pw
757
- end # if
758
- pw
759
- end # acquire pw
760
-
761
- # create the faraday connection object
762
- def create_connection(parse_json = true)
763
- Faraday.new(@base_url, ssl: @ssl_options) do |cnx|
764
- cnx.headers[HTTP_ACCEPT_HEADER] = MIME_JSON
765
- cnx.headers[:authorization] = @token.auth_token
766
- cnx.request :json if parse_json
767
- cnx.response :json, parser_options: { symbolize_names: true } if parse_json
768
- cnx.options[:timeout] = @timeout
769
- cnx.options[:open_timeout] = @open_timeout
770
- cnx.adapter Faraday::Adapter::NetHttp
771
- end
217
+ # @deprecated, use .token.next_refresh
218
+ def next_refresh
219
+ @token.next_refresh
772
220
  end
773
221
 
774
- # creates a thread that loops forever, sleeping most of the time, but
775
- # waking up every 60 seconds to see if the token is expiring in the
776
- # next @token_refresh seconds.
777
- #
778
- # If so, the token is refreshed, and we keep looping and sleeping.
779
- #
780
- # Sets @keep_alive_thread to the Thread object
781
- #
782
- # @return [void]
783
- #
784
- def start_keep_alive
785
- return if @keep_alive_thread
786
- raise 'Token expired' if @token.expired?
787
-
788
- @keep_alive_thread =
789
- Thread.new do
790
- loop do
791
- sleep 60
792
- begin
793
- next if @token.secs_remaining > @token_refresh
794
-
795
- @token.refresh @pw
796
- # make sure faraday uses the new token
797
- @rest_cnx.headers[:authorization] = @token.auth_token
798
- rescue
799
- # TODO: Some kind of error reporting
800
- next
801
- end
802
- end # loop
803
- end # thread
222
+ # @deprecated, use .token.secs_to_refresh
223
+ def secs_to_refresh
224
+ @token.secs_to_refresh
804
225
  end
805
226
 
806
- # Kills the @keep_alive_thread, if it exists, and sets
807
- # @keep_alive_thread to nil
808
- #
809
- # @return [void]
810
- #
811
- def stop_keep_alive
812
- return unless @keep_alive_thread
813
-
814
- @keep_alive_thread.kill if @keep_alive_thread.alive?
815
- @keep_alive_thread = nil
227
+ # @deprecated, use .token.time_to_refresh
228
+ def time_to_refresh
229
+ @token.time_to_refresh
816
230
  end
817
231
 
818
232
  end # class Connection
819
233
 
820
- # Jamf module methods dealing with the active connection
821
- ########################################################
822
-
823
- # @return [Jamf::Connection] the active connection
824
- #
825
- def self.cnx
826
- @active_connection ||= Connection.new do_not_connect: true
827
- end
828
-
829
- # Create a new Connection object and use it as the active_connection,
830
- # replacing the current active_connection. If connection options are provided,
831
- # they are passed to the connect method immediately, otherwise
832
- # Jamf.cnx.connect must be called before attemting to use the
833
- # connection.
834
- #
835
- # @param (See Jamf::Connection#connect)
836
- #
837
- # @return [APIConnection] the new, active connection
838
- #
839
- def self.connect(url = nil, **params)
840
- @active_connection = Connection.new url, params
841
- @active_connection.to_s
842
- end
843
-
844
- # Switch the connection used for all API interactions to the
845
- # one provided. See {Jamf::APIConnection} for details and examples
846
- # of using multiple connections
847
- #
848
- # @param connection [APIConnection] The APIConnection to use for future
849
- # API calls. If omitted, use the default connection created when ruby-jss
850
- # was loaded (which may or may not yet be connected)
851
- #
852
- # @return [APIConnection] The connection now being used.
853
- #
854
- def self.cnx=(connection)
855
- raise 'API connections must be instances of Jamf::Connection' unless connection.is_a? Jamf::Connection
856
-
857
- @active_connection = connection
858
- end
859
-
860
- def self.disconnect
861
- @active_connection.disconnect if @active_connection
862
- end
863
-
864
- end # module Jamf
865
-
866
- require 'jamf/api/connection/token'
867
- require 'jamf/api/connection/api_error'
234
+ end # module