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,1029 +0,0 @@
1
- ### Copyright 2020 Pixar
2
- ###
3
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
4
- ### with the following modification; you may not use this file except in
5
- ### compliance with the Apache License and the following modification to it:
6
- ### Section 6. Trademarks. is deleted and replaced with:
7
- ###
8
- ### 6. Trademarks. This License does not grant permission to use the trade
9
- ### names, trademarks, service marks, or product names of the Licensor
10
- ### and its affiliates, except as required to comply with Section 4(c) of
11
- ### the License and to reproduce the content of the NOTICE file.
12
- ###
13
- ### You may obtain a copy of the Apache License at
14
- ###
15
- ### http://www.apache.org/licenses/LICENSE-2.0
16
- ###
17
- ### Unless required by applicable law or agreed to in writing, software
18
- ### distributed under the Apache License with the above modification is
19
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20
- ### KIND, either express or implied. See the Apache License for the specific
21
- ### language governing permissions and limitations under the Apache License.
22
- ###
23
- ###
24
-
25
- ###
26
- module JSS
27
-
28
- # Instances of this class represent a REST connection to a JSS API.
29
- #
30
- # For most cases, a single connection to a single JSS is all you need, and
31
- # this is ruby-jss's default behavior.
32
- #
33
- # If needed, multiple connections can be made and used sequentially or
34
- # simultaneously.
35
- #
36
- # == Using the default connection
37
- #
38
- # When ruby-jss is loaded, a not-yet-connected default instance of
39
- # JSS::APIConnection is created and stored in the constant JSS::API.
40
- # This connection is used as the initial 'active connection' (see below)
41
- # so all methods that make API calls will use it by default. For most uses,
42
- # where you're only going to be working with one connection to one JSS, the
43
- # default connection is all you need.
44
- #
45
- # Before using it you must call its {#connect} method, passing in appropriate
46
- # connection details and credentials.
47
- #
48
- # Example:
49
- #
50
- # require 'ruby-jss'
51
- # JSS.api.connect server: 'server.address.edu', user: 'jss-api-user', pw: :prompt
52
- # # (see {JSS::APIConnection#connect} for all the connection options)
53
- #
54
- # a_phone = JSS::MobileDevice.fetch id: 8743
55
- #
56
- # # the mobile device was fetched through the default connection
57
- #
58
- # == Using Multiple Simultaneous Connections
59
- #
60
- # Sometimes you need to connect simultaneously to more than one JSS.
61
- # or to the same JSS with different credentials. ruby-jss allows you to
62
- # create as many connections as needed, and gives you three ways to use them:
63
- #
64
- # 1. Making a connection 'active', after which API calls go thru it
65
- # automatically
66
- #
67
- # Example:
68
- #
69
- # a_computer = JSS::Computer.fetch id: 1234
70
- #
71
- # # the JSS::Computer with id 1234 is fetched from the active connection
72
- # # and stored in the variable 'a_computer'
73
- #
74
- # NOTE: When ruby-jss is first loaded, the default connection (see above)
75
- # is the active connection.
76
- #
77
- # 2. Passing an APIConnection instance to methods that use the API
78
- #
79
- # Example:
80
- #
81
- # a_computer = JSS::Computer.fetch id: 1234, api: production_api
82
- #
83
- # # the JSS::Computer with id 1234 is fetched from the connection
84
- # # stored in the variable 'production_api'. The computer is
85
- # # then stored in the variable 'a_computer'
86
- #
87
- # 3. Using the APIConnection instance itself to make API calls.
88
- #
89
- # Example:
90
- #
91
- # a_computer = production_api.fetch :Computer, id: 1234
92
- #
93
- # # the JSS::Computer with id 1234 is fetched from the connection
94
- # # stored in the variable 'production_api'. The computer is
95
- # # then stored in the variable 'a_computer'
96
- #
97
- # See below for more details about the ways to use multiple connections.
98
- #
99
- # NOTE:
100
- # Objects retrieved or created through an APIConnection store an internal
101
- # reference to that APIConnection and use that when they make other API
102
- # calls, thus ensuring data consistency when using multiple connections.
103
- #
104
- # Similiarly, the data caches used by APIObject list methods (e.g.
105
- # JSS::Computer.all, .all_names, and so on) are stored in the APIConnection
106
- # instance through which they were read, so they won't be incorrect when
107
- # you use multiple connections.
108
- #
109
- # == Making new APIConnection instances
110
- #
111
- # New connections can be created using the standard ruby 'new' method.
112
- #
113
- # If you provide connection details when calling 'new', they will be passed
114
- # to the {#connect} method immediately. Otherwise you can call {#connect} later.
115
- #
116
- # production_api = JSS::APIConnection.new(
117
- # name: 'prod',
118
- # server: 'prodserver.address.org',
119
- # user: 'produser',
120
- # pw: :prompt
121
- # )
122
- #
123
- # # the new connection is now stored in the variable 'production_api'.
124
- #
125
- # == Using the 'Active' Connection
126
- #
127
- # While multiple connection instances can be created, only one at a time is
128
- # 'the active connection' and all APIObject-based access methods in ruby-jss
129
- # will use it automatically. When ruby-jss is loaded, the default connection
130
- # (see above) is the active connection.
131
- #
132
- # To use the active connection, just call a method on an APIObject subclass
133
- # that uses the API.
134
- #
135
- # For example, the various list methods:
136
- #
137
- # all_computer_sns = JSS::Computer.all_serial_numbers
138
- #
139
- # # the list of all computer serial numbers is read from the active
140
- # # connection and stored in all_computer_sns
141
- #
142
- # Fetching an object from the API:
143
- #
144
- # victim_md = JSS::MobileDevice.fetch id: 832
145
- #
146
- # # the variable 'victim_md' now contains a JSS::MobileDevice queried
147
- # # through the active connection.
148
- #
149
- # The currently-active connection instance is available from the
150
- # `JSS.api` method.
151
- #
152
- # === Making a Connection Active
153
- #
154
- # Only one connection is 'active' at a time and the currently active one is
155
- # returned when you call `JSS.api` or its alias `JSS.active_connection`
156
- #
157
- # To activate another connection just pass it to the JSS.use_api method like so:
158
- #
159
- # JSS.use_api production_api
160
- # # the connection we stored in 'production_api' is now active
161
- #
162
- # To re-activate to the default connection, just call
163
- # JSS.use_default_connection
164
- #
165
- # == Connection Names:
166
- #
167
- # As seen in the example above, you can provide a 'name:' parameter
168
- # (a String or a Symbol) when creating a new connection. The name can be
169
- # used later to identify connection objects.
170
- #
171
- # If you don't provide one, the name is ':disconnected' until you
172
- # connect, and then 'user@server:port' after connecting.
173
- #
174
- # The name of the default connection is always :default
175
- #
176
- # To see the name of the currently active connection, just use `JSS.api.name`
177
- #
178
- # JSS.use_api production_api
179
- # JSS.api.name # => 'prod'
180
- #
181
- # JSS.use_default_connection
182
- # JSS.api.name # => :default
183
- #
184
- # == Creating, Storing and Activating a connection in one step
185
- #
186
- # Both of the above steps (creating/storing a connection, and making it
187
- # active) can be performed in one step using the
188
- # `JSS.new_api_connection` method, which creates a new APIConnection, makes it
189
- # the active connection, and returns it.
190
- #
191
- # production_api2 = JSS.new_api_connection(
192
- # name: 'prod2',
193
- # server: 'prodserver.address.org',
194
- # user: 'produser',
195
- # pw: :prompt
196
- # )
197
- #
198
- # JSS.api.name # => 'prod2'
199
- #
200
- # == Passing an APIConnection object to API-related methods
201
- #
202
- # All methods that use the API can take an 'api:' parameter which
203
- # contains an APIConnection object. When provided, that APIconnection is
204
- # used rather than the active connection.
205
- #
206
- # For example:
207
- #
208
- # prod2_computer_sns = JSS::Computer.all_serial_numbers, api: production_api2
209
- #
210
- # # the list of all computer serial numbers is read from the connection in
211
- # # the variable 'production_api2' and stored in 'prod2_computer_sns'
212
- #
213
- # prod2_victim_md = JSS::MobileDevice.fetch id: 832, api: production_api2
214
- #
215
- # # the variable 'prod2_victim_md' now contains a JSS::MobileDevice queried
216
- # # through the connection 'production_api2'.
217
- #
218
- # == Low-level use of APIConnection instances.
219
- #
220
- # For most cases, using APIConnection instances as mentioned above
221
- # is all you'll need. However to access API resources that aren't yet
222
- # implemented in other parts of ruby-jss, you can use the methods
223
- # {#get_rsrc}, {#put_rsrc}, {#post_rsrc}, & {#delete_rsrc}
224
- # documented below.
225
- #
226
- # For even lower-level work, you can access the underlying Faraday::Connection
227
- # inside the APIConnection via the connection's {#cnx} attribute.
228
- #
229
- # APIConnection instances also have a {#server} attribute which contains an
230
- # instance of {JSS::Server} q.v., representing the JSS to which it's connected.
231
- #
232
- class APIConnection
233
-
234
- # Class Constants
235
- #####################################
236
-
237
- # The base API path in the jss URL
238
- RSRC_BASE = 'JSSResource'.freeze
239
-
240
- # A url path to load to see if there's an API available at a host.
241
- # This just loads the API resource docs page
242
- TEST_PATH = "#{RSRC_BASE}/accounts".freeze
243
-
244
- # If the test path loads correctly from a casper server, it'll contain
245
- # this text (this is what we get when we make an unauthenticated
246
- # API call.)
247
- TEST_CONTENT = '<p>The request requires user authentication</p>'.freeze
248
-
249
- # The Default port
250
- HTTP_PORT = 9006
251
-
252
- # The Jamf default SSL port, default for locally-hosted servers
253
- SSL_PORT = 8443
254
-
255
- # The https default SSL port, default for Jamf Cloud servers
256
- HTTPS_SSL_PORT = 443
257
-
258
- # if either of these is specified, we'll default to SSL
259
- SSL_PORTS = [SSL_PORT, HTTPS_SSL_PORT].freeze
260
-
261
- # Recognize Jamf Cloud servers
262
- JAMFCLOUD_DOMAIN = 'jamfcloud.com'.freeze
263
-
264
- # JamfCloud connections default to 443, not 8443
265
- JAMFCLOUD_PORT = HTTPS_SSL_PORT
266
-
267
- # The top line of an XML doc for submitting data via API
268
- XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.freeze
269
-
270
- # Default timeouts in seconds
271
- DFT_OPEN_TIMEOUT = 60
272
- DFT_TIMEOUT = 60
273
-
274
- # The Default SSL Version
275
- DFT_SSL_VERSION = 'TLSv1_2'.freeze
276
-
277
- RSRC_NOT_FOUND_MSG = 'The requested resource was not found'.freeze
278
-
279
- # These classes are extendable, and may need cache flushing for EA definitions
280
- EXTENDABLE_CLASSES = [JSS::Computer, JSS::MobileDevice, JSS::User].freeze
281
-
282
- # values for the format param of get_rsrc
283
- GET_FORMATS = %i[json xml].freeze
284
-
285
- HTTP_ACCEPT_HEADER = 'Accept'.freeze
286
- HTTP_CONTENT_TYPE_HEADER = 'Content-Type'.freeze
287
-
288
- MIME_JSON = 'application/json'.freeze
289
- MIME_XML = 'application/xml'.freeze
290
-
291
- # Attributes
292
- #####################################
293
-
294
- # @return [String] the username who's connected to the JSS API
295
- attr_reader :user
296
- alias jss_user user
297
-
298
- # @return [Faraday::Connection] the underlying connection resource
299
- attr_reader :cnx
300
-
301
- # @return [Boolean] are we connected right now?
302
- attr_reader :connected
303
- alias connected? connected
304
-
305
- # @return [JSS::Server] the details of the JSS to which we're connected.
306
- attr_reader :server
307
-
308
- # @return [String] the hostname of the JSS to which we're connected.
309
- attr_reader :server_host
310
-
311
- # @return [String] any path in the URL below the hostname. See {#connect}
312
- attr_reader :server_path
313
-
314
- # @return [Integer] the port used for the connection
315
- attr_reader :port
316
-
317
- # @return [String] the protocol being used: http or https
318
- attr_reader :protocol
319
-
320
- # @return [Faraday::Response] The response from the most recent API call
321
- attr_reader :last_http_response
322
-
323
- # @return [String] The base URL to to the current REST API
324
- attr_reader :rest_url
325
-
326
- # @return [String,Symbol] an arbitrary name that can be given to this
327
- # connection during initialization, using the name: parameter.
328
- # defaults to user@hostname:port
329
- attr_reader :name
330
-
331
- # @return [Hash]
332
- # This Hash caches the result of the the first API query for an APIObject
333
- # subclass's .all summary list, keyed by the subclass's RSRC_LIST_KEY.
334
- # See the APIObject.all class method.
335
- #
336
- # It also holds related data items for speedier processing:
337
- #
338
- # - The Hashes created by APIObject.map_all_ids_to(foo), keyed by
339
- # "#{RSRC_LIST_KEY}_map_#{other_key}".to_sym
340
- #
341
- # - This hash also holds a cache of the rarely-used APIObject.all_objects
342
- # hash, keyed by "#{RSRC_LIST_KEY}_objects".to_sym
343
- #
344
- #
345
- # When APIObject.all, and related methods are called without an argument,
346
- # and this hash has a matching value, the value is returned, rather than
347
- # requerying the API. The first time a class calls .all, or whnever refresh
348
- # is not false, the API is queried and the value in this hash is updated.
349
- attr_reader :object_list_cache
350
-
351
- # @return [Hash{Class: Hash{String => JSS::ExtensionAttribute}}]
352
- # This Hash caches the Extension Attribute
353
- # definition objects for the three types of ext. attribs:
354
- # ComputerExtensionAttribute, MobileDeviceExtensionAttribute, and
355
- # UserExtensionAttribute, whenever they are fetched for parsing or
356
- # validating extention attribute data.
357
- #
358
- # The top-level keys are the EA classes themselves:
359
- # - ComputerExtensionAttribute
360
- # - MobileDeviceExtensionAttribute
361
- # - UserExtensionAttribute
362
- #
363
- # These each point to a Hash of their instances, keyed by name, e.g.
364
- # {
365
- # "A Computer EA" => <JSS::ComputerExtensionAttribute...>,
366
- # "A different Computer EA" => <JSS::ComputerExtensionAttribute...>,
367
- # ...
368
- # }
369
- #
370
- attr_reader :ext_attr_definition_cache
371
-
372
- # Constructor
373
- #####################################
374
-
375
- # If name: is provided (as a String or Symbol) that will be
376
- # stored as the APIConnection's name attribute.
377
- #
378
- # For other available parameters, see {#connect}.
379
- #
380
- # If they are provided, they will be used to establish the
381
- # connection immediately.
382
- #
383
- # If not, you must call {#connect} before accessing the API.
384
- #
385
- def initialize(args = {})
386
- @name = args.delete :name
387
- @name ||= :unknown
388
- @connected = false
389
- @object_list_cache = {}
390
- connect args unless args.empty?
391
- end # init
392
-
393
- # Instance Methods
394
- #####################################
395
-
396
- # Connect to the JSS Classic API.
397
- #
398
- # @param args[Hash] the keyed arguments for connection.
399
- #
400
- # @option args :server[String] the hostname of the JSS API server, required if not defined in JSS::CONFIG
401
- #
402
- # @option args :server_path[String] If your JSS is not at the root of the server, e.g.
403
- # if it's at
404
- # https://myjss.myserver.edu:8443/dev_mgmt/jssweb
405
- # rather than
406
- # https://myjss.myserver.edu:8443/
407
- # then use this parameter to specify the path below the root e.g:
408
- # server_path: 'dev_mgmt/jssweb'
409
- #
410
- # @option args :port[Integer] the port number to connect with, defaults to 8443
411
- #
412
- # @option args :use_ssl[Boolean] should the connection be made over SSL? Defaults to true.
413
- #
414
- # @option args :verify_cert[Boolean] should HTTPS SSL certificates be verified. Defaults to true.
415
- #
416
- # @option args :user[String] a JSS user who has API privs, required if not defined in JSS::CONFIG
417
- #
418
- # @option args :pw[String,Symbol] Required, the password for that user, or :prompt, or :stdin
419
- # If :prompt, the user is promted on the commandline to enter the password for the :user.
420
- # If :stdin#, the password is read from a line of std in represented by the digit at #,
421
- # so :stdin3 reads the passwd from the third line of standard input. defaults to line 1,
422
- # if no digit is supplied. see {JSS.stdin}
423
- #
424
- # @option args :open_timeout[Integer] the number of seconds to wait for an initial response, defaults to 60
425
- #
426
- # @option args :timeout[Integer] the number of seconds before an API call times out, defaults to 60
427
- #
428
- # @return [true]
429
- #
430
- def connect(args = {})
431
- # new connections always get new caches
432
- flushcache
433
-
434
- args[:no_port_specified] = args[:port].to_s.empty?
435
- args = apply_connection_defaults args
436
- @timeout = args[:timeout]
437
- @open_timeout = args[:open_timeout]
438
-
439
- # ensure an integer
440
- args[:port] &&= args[:port].to_i
441
-
442
- # confirm we know basics
443
- verify_basic_args args
444
-
445
- # parse our ssl situation
446
- verify_ssl args
447
-
448
- @user = args[:user]
449
-
450
- @rest_url = build_rest_url args
451
-
452
- # figure out :password from :pw
453
- args[:password] = acquire_password args
454
-
455
- # heres our connection
456
- @cnx = create_connection args[:password]
457
-
458
- verify_server_version
459
-
460
- @name = "#{@user}@#{@server_host}:#{@port}" if @name.nil? || @name == :disconnected
461
- @connected ? hostname : nil
462
- end # connect
463
-
464
- # A useful string about this connection
465
- #
466
- # @return [String]
467
- #
468
- def to_s
469
- @connected ? "Using #{@rest_url} as user #{@user}" : 'not connected'
470
- end
471
-
472
- # Reset the response timeout for the rest connection
473
- #
474
- # @param timeout[Integer] the new timeout in seconds
475
- #
476
- # @return [void]
477
- #
478
- def timeout=(timeout)
479
- @cnx.options[:timeout] = timeout
480
- end
481
-
482
- # Reset the open-connection timeout for the rest connection
483
- #
484
- # @param timeout[Integer] the new timeout in seconds
485
- #
486
- # @return [void]
487
- #
488
- def open_timeout=(timeout)
489
- @cnx.options[:open_timeout] = timeout
490
- end
491
-
492
- # With a REST connection, there isn't any real "connection" to disconnect from
493
- # So to disconnect, we just unset all our credentials.
494
- #
495
- # @return [void]
496
- #
497
- def disconnect
498
- @user = nil
499
- @rest_url = nil
500
- @server_host = nil
501
- @cnx = nil
502
- @connected = false
503
- end # disconnect
504
-
505
- # Get a JSS resource
506
- # The first argument is the resource to get (the part of the API url
507
- # after the 'JSSResource/' ) The resource must be properly URL escaped
508
- # beforehand. Note: URL.encode is deprecated, use CGI.escape
509
- #
510
- # By default we get the data in JSON, and parse it into a ruby Hash
511
- # with symbolized Hash keys.
512
- #
513
- # If the second parameter is :xml then the XML version is retrieved and
514
- # returned as a String.
515
- #
516
- # To get the raw JSON string as it comes from the API, pass raw_json: true
517
- #
518
- # @param rsrc[String] the resource to get
519
- # (the part of the API url after the 'JSSResource/' )
520
- #
521
- # @param format[Symbol] either ;json or :xml
522
- # If the second argument is :xml, the XML data is returned as a String.
523
- #
524
- # @param raw_json[Boolean] When GETting JSON, return the raw unparsed string
525
- # (the XML is always returned as a raw string)
526
- #
527
- # @return [Hash,String] the result of the get
528
- #
529
- def get_rsrc(rsrc, format = :json, raw_json: false)
530
- validate_connected
531
- raise JSS::InvalidDataError, 'format must be :json or :xml' unless GET_FORMATS.include? format
532
-
533
- @last_http_response =
534
- @cnx.get(rsrc) do |req|
535
- req.headers[HTTP_ACCEPT_HEADER] = format == :json ? MIME_JSON : MIME_XML
536
- end
537
-
538
- unless @last_http_response.success?
539
- handle_http_error
540
- return
541
- end
542
-
543
- return JSON.parse(@last_http_response.body, symbolize_names: true) if format == :json && !raw_json
544
-
545
- @last_http_response.body
546
- end
547
-
548
- # Update an existing JSS resource
549
- #
550
- # @param rsrc[String] the API resource being changed, the URL part after 'JSSResource/'
551
- #
552
- # @param xml[String] the xml specifying the changes.
553
- #
554
- # @return [String] the xml response from the server.
555
- #
556
- def put_rsrc(rsrc, xml)
557
- validate_connected
558
-
559
- # convert CRs & to &#13;
560
- xml.gsub!(/\r/, '&#13;')
561
-
562
- # send the data
563
- @last_http_response =
564
- @cnx.put(rsrc) do |req|
565
- req.headers[HTTP_CONTENT_TYPE_HEADER] = MIME_XML
566
- req.headers[HTTP_ACCEPT_HEADER] = MIME_XML
567
- req.body = xml
568
- end
569
- unless @last_http_response.success?
570
- handle_http_error
571
- return
572
- end
573
-
574
- @last_http_response.body
575
- end
576
-
577
- # Create a new JSS resource
578
- #
579
- # @param rsrc[String] the API resource being created, the URL part after 'JSSResource/'
580
- #
581
- # @param xml[String] the xml specifying the new object.
582
- #
583
- # @return [String] the xml response from the server.
584
- #
585
- def post_rsrc(rsrc, xml)
586
- validate_connected
587
-
588
- # convert CRs & to &#13;
589
- xml&.gsub!(/\r/, '&#13;')
590
-
591
- # send the data
592
- @last_http_response =
593
- @cnx.post(rsrc) do |req|
594
- req.headers[HTTP_CONTENT_TYPE_HEADER] = MIME_XML
595
- req.headers[HTTP_ACCEPT_HEADER] = MIME_XML
596
- req.body = xml
597
- end
598
- unless @last_http_response.success?
599
- handle_http_error
600
- return
601
- end
602
- @last_http_response.body
603
- end # post_rsrc
604
-
605
- # Delete a resource from the JSS
606
- #
607
- # @param rsrc[String] the resource to create, the URL part after 'JSSResource/'
608
- #
609
- # @return [String] the xml response from the server.
610
- #
611
- def delete_rsrc(rsrc)
612
- validate_connected
613
- raise MissingDataError, 'Missing :rsrc' if rsrc.nil?
614
-
615
- # delete the resource
616
- @last_http_response =
617
- @cnx.delete(rsrc) do |req|
618
- req.headers[HTTP_CONTENT_TYPE_HEADER] = MIME_XML
619
- req.headers[HTTP_ACCEPT_HEADER] = MIME_XML
620
- end
621
-
622
- unless @last_http_response.success?
623
- handle_http_error
624
- return
625
- end
626
-
627
- @last_http_response.body
628
- end # delete_rsrc
629
-
630
- # Test that a given hostname & port is a JSS API server
631
- #
632
- # @param server[String] The hostname to test,
633
- #
634
- # @param port[Integer] The port to try connecting on
635
- #
636
- # @return [Boolean] does the server host a JSS API?
637
- #
638
- def valid_server?(server, port = SSL_PORT)
639
- # cheating by shelling out to curl, because getting open-uri, or even net/http to use
640
- # ssl_options like :OP_NO_SSLv2 and :OP_NO_SSLv3 will take time to figure out..
641
- return true if `/usr/bin/curl -s 'https://#{server}:#{port}/#{TEST_PATH}'`.include? TEST_CONTENT
642
- return true if `/usr/bin/curl -s 'http://#{server}:#{port}/#{TEST_PATH}'`.include? TEST_CONTENT
643
-
644
- false
645
- end
646
-
647
- # The server to which we are connected, or will
648
- # try connecting to if none is specified with the
649
- # call to #connect
650
- #
651
- # @return [String] the hostname of the server
652
- #
653
- def hostname
654
- return @server_host if @server_host
655
-
656
- srvr = JSS::CONFIG.api_server_name
657
- srvr ||= JSS::Client.jss_server
658
- srvr
659
- end
660
- alias host hostname
661
-
662
- # Empty all cached lists from this connection
663
- # then run garbage collection to clear any available memory
664
- #
665
- # If an APIObject Subclass's RSRC_LIST_KEY is specified, only the caches
666
- # for that class are flushed (e.g. :computers, :comptuer_groups)
667
- #
668
- # NOTE if you've referenced objects in these caches, those objects
669
- # won't be removed from memory, but all cached data will be recached
670
- # as needed.
671
- #
672
- # @param key[Symbol, Class] Flush only the caches for the given RSRC_LIST_KEY. or
673
- # the EAdef cache for the given extendable class. If nil (the default)
674
- # flushes all caches
675
- #
676
- # @return [void]
677
- #
678
- def flushcache(key = nil)
679
- if EXTENDABLE_CLASSES.include? key
680
- @ext_attr_definition_cache[key] = {}
681
- elsif key
682
- map_key_pfx = "#{key}_map_"
683
- @object_list_cache.delete_if do |cache_key, _cache|
684
- cache_key == key || cache_key.to_s.start_with?(map_key_pfx)
685
- end
686
- @ext_attr_definition_cache
687
- else
688
- @object_list_cache = {}
689
- @ext_attr_definition_cache = {}
690
- end
691
-
692
- GC.start
693
- end
694
-
695
- # Remove the various cached data
696
- # from the instance_variables used to create
697
- # pretty-print (pp) output.
698
- #
699
- # @return [Array] the desired instance_variables
700
- #
701
- def pretty_print_instance_variables
702
- vars = instance_variables.sort
703
- vars.delete :@object_list_cache
704
- vars.delete :@last_http_response
705
- vars.delete :@network_ranges
706
- vars.delete :@my_distribution_point
707
- vars.delete :@master_distribution_point
708
- vars.delete :@ext_attr_definition_cache
709
- vars
710
- end
711
-
712
- # Private Insance Methods
713
- ####################################
714
- private
715
-
716
- # raise exception if not connected
717
- def validate_connected
718
- raise JSS::InvalidConnectionError, "Connection '#{@name}' Not Connected. Use .connect first." unless connected?
719
- end
720
-
721
- # Apply defaults from the JSS::CONFIG,
722
- # then from the JSS::Client,
723
- # then from the module defaults
724
- # to the args for the #connect method
725
- #
726
- # @param args[Hash] The args for #connect
727
- #
728
- # @return [Hash] The args with defaults applied
729
- #
730
- def apply_connection_defaults(args)
731
- apply_defaults_from_config(args)
732
- apply_defaults_from_client(args)
733
- apply_module_defaults(args)
734
- end
735
-
736
- # Apply defaults from the JSS::CONFIG
737
- # to the args for the #connect method
738
- #
739
- # @param args[Hash] The args for #connect
740
- #
741
- # @return [Hash] The args with defaults applied
742
- #
743
- def apply_defaults_from_config(args)
744
- # settings from config if they aren't in the args
745
- args[:server] ||= JSS::CONFIG.api_server_name
746
- args[:port] ||= JSS::CONFIG.api_server_port
747
- args[:user] ||= JSS::CONFIG.api_username
748
- args[:timeout] ||= JSS::CONFIG.api_timeout
749
- args[:open_timeout] ||= JSS::CONFIG.api_timeout_open
750
- args[:ssl_version] ||= JSS::CONFIG.api_ssl_version
751
-
752
- # if verify cert was not in the args, get it from the prefs.
753
- # We can't use ||= because the desired value might be 'false'
754
- args[:verify_cert] = JSS::CONFIG.api_verify_cert if args[:verify_cert].nil?
755
- args
756
- end # apply_defaults_from_config
757
-
758
- # Apply defaults from the JSS::Client
759
- # to the args for the #connect method
760
- #
761
- # @param args[Hash] The args for #connect
762
- #
763
- # @return [Hash] The args with defaults applied
764
- #
765
- def apply_defaults_from_client(args)
766
- return unless JSS::Client.installed?
767
-
768
- # these settings can come from the jamf binary config, if this machine is a JSS client.
769
- args[:server] ||= JSS::Client.jss_server
770
- args[:port] ||= JSS::Client.jss_port.to_i
771
- args[:use_ssl] ||= JSS::Client.jss_protocol.to_s.end_with? 's'
772
- args
773
- end
774
-
775
- # Apply the module defaults to the args for the #connect method
776
- #
777
- # @param args[Hash] The args for #connect
778
- #
779
- # @return [Hash] The args with defaults applied
780
- #
781
- def apply_module_defaults(args)
782
- args[:port] = args[:server].to_s.end_with?(JAMFCLOUD_DOMAIN) ? JAMFCLOUD_PORT : SSL_PORT if args[:no_port_specified]
783
- args[:timeout] ||= DFT_TIMEOUT
784
- args[:open_timeout] ||= DFT_OPEN_TIMEOUT
785
- args[:ssl_version] ||= DFT_SSL_VERSION
786
- args
787
- end
788
-
789
- # Raise execeptions if we don't have essential data for the connection
790
- #
791
- # @param args[Hash] The args for #connect
792
- #
793
- # @return [void]
794
- #
795
- def verify_basic_args(args)
796
- # must have server, user, and pw
797
- raise JSS::MissingDataError, 'No JSS :server specified, or in configuration.' unless args[:server]
798
- raise JSS::MissingDataError, 'No JSS :user specified, or in configuration.' unless args[:user]
799
- raise JSS::MissingDataError, "Missing :pw for user '#{args[:user]}'" unless args[:pw]
800
- end
801
-
802
- # Verify that we can connect with the args provided, and that
803
- # the server version is high enough for this version of ruby-jss.
804
- #
805
- # This makes the first API GET call and will raise an exception if things
806
- # are wrong, like failed authentication. Will also raise an exception
807
- # if the JSS version is too low
808
- # (see also JSS::Server)
809
- #
810
- # @return [void]
811
- #
812
- def verify_server_version
813
- @connected = true
814
-
815
- # the jssuser resource is readable by anyone with a JSS acct
816
- # regardless of their permissions.
817
- # However, it's marked as 'deprecated'. Hopefully jamf will
818
- # keep this basic level of info available for basic authentication
819
- # and JSS version checking.
820
- begin
821
- data = get_rsrc('jssuser')
822
- rescue JSS::AuthorizationError
823
- raise JSS::AuthenticationError, "Incorrect JSS username or password for '#{@user}@#{@server_host}:#{@port}'."
824
- end
825
-
826
- @server = JSS::Server.new data[:user], self
827
-
828
- min_vers = JSS.parse_jss_version(JSS::MINIMUM_SERVER_VERSION)[:version]
829
- return if @server.version >= min_vers # we're good...
830
-
831
- err_msg = "JSS version #{@server.raw_version} to low. Must be >= #{min_vers}"
832
- @connected = false
833
- raise JSS::UnsupportedError, err_msg
834
- end
835
-
836
- # Build the base URL for the API connection
837
- #
838
- # @param args[Hash] The args for #connect
839
- #
840
- # @return [String] The URI encoded URL
841
- #
842
- def build_rest_url(args)
843
- @server_host = args[:server]
844
- @port = args[:port].to_i
845
-
846
- # trim any potential leading slash on server_path, ensure a trailing slash
847
- if args[:server_path]
848
- @server_path = args[:server_path]
849
- @server_path = @server_path[1..-1] if @server_path.start_with? '/'
850
- @server_path << '/' unless @server_path.end_with? '/'
851
- end
852
-
853
- # we're using ssl if:
854
- # 1) args[:use_ssl] is anything but false
855
- # or
856
- # 2) the port is a known ssl port.
857
- args[:use_ssl] = args[:use_ssl] != false || SSL_PORTS.include?(@port)
858
-
859
- @protocol = 'http'
860
- @protocol << 's' if args[:use_ssl]
861
- # and here's the URL
862
- "#{@protocol}://#{@server_host}:#{@port}/#{@server_path}#{RSRC_BASE}"
863
- end
864
-
865
- # From whatever was given in args[:pw], figure out the real password
866
- #
867
- # @param args[Hash] The args for #connect
868
- #
869
- # @return [String] The password for the connection
870
- #
871
- def acquire_password(args)
872
- if args[:pw] == :prompt
873
- JSS.prompt_for_password "Enter the password for JSS user #{args[:user]}@#{args[:server]}:"
874
- elsif args[:pw].is_a?(Symbol) && args[:pw].to_s.start_with?('stdin')
875
- args[:pw].to_s =~ /^stdin(\d+)$/
876
- line = Regexp.last_match(1)
877
- line ||= 1
878
- JSS.stdin line
879
- else
880
- args[:pw]
881
- end
882
- end
883
-
884
- # Get the appropriate OpenSSL::SSL constant for
885
- # certificate verification.
886
- #
887
- # @param args[Hash] The args for #connect
888
- #
889
- # @return [Type] description_of_returned_object
890
- #
891
- def verify_ssl(args)
892
- # use SSL for SSL ports unless specifically told not to
893
- if SSL_PORTS.include? args[:port]
894
- args[:use_ssl] = true unless args[:use_ssl] == false
895
- end
896
- return unless args[:use_ssl]
897
-
898
- # if verify_cert is anything but false, we will verify
899
- args[:verify_ssl] = args[:verify_cert] != false
900
-
901
- # ssl version if not specified
902
- args[:ssl_version] ||= DFT_SSL_VERSION
903
-
904
- @ssl_options = {
905
- verify: args[:verify_ssl],
906
- version: args[:ssl_version]
907
- }
908
- end
909
-
910
- # Parses the @last_http_response
911
- # and raises a JSS::APIError with a useful error message.
912
- #
913
- # @return [void]
914
- #
915
- def handle_http_error
916
- return if @last_http_response.success?
917
-
918
- case @last_http_response.status
919
- when 404
920
- err = JSS::NoSuchItemError
921
- msg = 'Not Found'
922
- when 409
923
- err = JSS::ConflictError
924
- @last_http_response.body =~ /<p>(The server has not .*?)(<|$)/m
925
- Regexp.last_match(1) || @last_http_response.body =~ %r{<p>Error: (.*?)</p>}
926
- msg = Regexp.last_match(1)
927
- when 400
928
- err = JSS::BadRequestError
929
- @last_http_response.body =~ %r{>Bad Request</p>\n<p>(.*?)</p>\n<p>You can get technical detail}m
930
- msg = Regexp.last_match(1)
931
- when 401
932
- err = JSS::AuthorizationError
933
- msg = 'You are not authorized to do that.'
934
- when (500..599)
935
- err = JSS::APIRequestError
936
- msg = 'There was an internal server error'
937
- else
938
- err = JSS::APIRequestError
939
- msg = "There was a error processing your request, status: #{@last_http_response.status}"
940
- end
941
- raise err, msg
942
- end
943
-
944
- # create the faraday connection object
945
- def create_connection(pw)
946
- Faraday.new(@rest_url, ssl: @ssl_options) do |cnx|
947
- cnx.basic_auth @user, pw
948
- cnx.options[:timeout] = @timeout
949
- cnx.options[:open_timeout] = @open_timeout
950
- cnx.adapter Faraday::Adapter::NetHttp
951
- end
952
- end
953
-
954
- end # class APIConnection
955
-
956
- # JSS MODULE METHODS
957
- ######################
958
-
959
- # Create a new APIConnection object and use it for all
960
- # future API calls. If connection options are provided,
961
- # they are passed to the connect method immediately, otherwise
962
- # JSS.api.connect must be called before attemting to use the
963
- # connection.
964
- #
965
- # @param (See JSS::APIConnection#connect)
966
- #
967
- # @return [APIConnection] the new, active connection
968
- #
969
- def self.new_api_connection(args = {})
970
- args[:name] ||= :default
971
- @api = APIConnection.new args
972
- end
973
-
974
- # Switch the connection used for all API interactions to the
975
- # one provided. See {JSS::APIConnection} for details and examples
976
- # of using multiple connections
977
- #
978
- # @param connection [APIConnection] The APIConnection to use for future
979
- # API calls. If omitted, use the default connection created when ruby-jss
980
- # was loaded (which may or may not yet be connected)
981
- #
982
- # @return [APIConnection] The connection now being used.
983
- #
984
- def self.use_api_connection(connection)
985
- raise 'API connections must be instances of JSS::APIConnection' unless connection.is_a? JSS::APIConnection
986
-
987
- @api = connection
988
- end
989
-
990
- # Make the default connection (Stored in JSS::API) active
991
- #
992
- # @return [void]
993
- #
994
- def self.use_default_connection
995
- use_api_connection @api
996
- end
997
-
998
- # The currently active JSS::APIConnection instance.
999
- #
1000
- # @return [JSS::APIConnection]
1001
- #
1002
- def self.api
1003
- @api ||= APIConnection.new name: :default
1004
- end
1005
-
1006
- # aliases of module methods
1007
- class << self
1008
-
1009
- alias api_connection api
1010
- alias connection api
1011
- alias active_connection api
1012
-
1013
- alias new_connection new_api_connection
1014
- alias new_api new_api_connection
1015
-
1016
- alias use_api use_api_connection
1017
- alias use_connection use_api_connection
1018
- alias activate_connection use_api_connection
1019
-
1020
- end
1021
-
1022
- # create the default connection
1023
- new_api_connection unless @api
1024
-
1025
- # Save the default connection in the API constant,
1026
- # mostly for backward compatibility.
1027
- API = @api unless defined? API
1028
-
1029
- end # module