ruby-jss 5.0.2 → 5.1.0b1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +15 -0
- data/lib/jamf/api/classic/api_objects/scopable/scope.rb +1 -1
- data/lib/jamf/api/jamf_pro/api_objects/j_category.rb +98 -0
- data/lib/jamf/api/jamf_pro/api_objects/j_computer_extension_attribute.rb +102 -0
- data/lib/jamf/api/jamf_pro/api_objects/j_mobile_device_extension_attribute.rb +101 -0
- data/lib/jamf/api/jamf_pro/api_objects/j_script.rb +101 -0
- data/lib/jamf/api/jamf_pro/mixins/bulk_deletable.rb +5 -3
- data/lib/jamf/api/jamf_pro/mixins/collection_resource.rb +5 -2
- data/lib/jamf/api/jamf_pro/mixins/data_dependency.rb +63 -0
- data/lib/jamf/api/jamf_pro/mixins/sortable.rb +2 -2
- data/lib/jamf/api/jamf_pro/oapi_schemas/categories_search_results.rb +91 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/category.rb +104 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_extension_attribute_search_results.rb +91 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/computer_extension_attributes.rb +149 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attributes.rb +114 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_protect_plan.rb +125 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_extension_attribute.rb +125 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_extension_attribute_results.rb +79 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/script.rb +193 -0
- data/lib/jamf/api/jamf_pro/oapi_schemas/scripts_search_results.rb +91 -0
- data/lib/jamf/version.rb +1 -1
- metadata +19 -5
- data/lib/jamf/api/classic/api_objects/mdm_classic.rb +0 -1416
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4beb91ca79699491fc5868a5e4b2e22f57048df817bca7207d65574eb94227c
|
|
4
|
+
data.tar.gz: b31adf1c1cbcd419656aa4eeb58e70ed21147a79b3bd45730e5301b39e0acd7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcc17975fefc7e5f7d5f9830827dac4997af144817364ae866b796a4b634188f34a0dd553675e64a34aca9d53223e5e55a0dad2ed821eb135ffe91a206fdd566
|
|
7
|
+
data.tar.gz: 721e2d5981fbc3f8123e821a9f2a9cf8507dab9889ad2723cb4a77f68a6af313bad0e2e50ad6613314baa8e6111413b4b169fe739d199b5d223d350a2594393c
|
data/CHANGES.md
CHANGED
|
@@ -14,6 +14,21 @@ __Please update all installations of ruby-jss to at least v1.6.0.__
|
|
|
14
14
|
|
|
15
15
|
Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue and providing examples of how it could be exploited.
|
|
16
16
|
|
|
17
|
+
--------
|
|
18
|
+
## \[5.1.0] Unreleased
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `Jamf::JCategory`, `Jamf::JScript`, `Jamf::JComputerExtensionAttribute`, `Jamf::JMobilDeviceExtensionAttribute` These classes are currently implemented only as presented in the Jamf Pro API. Some of the convenience features available in the Classic API implementations may or may not eventually be added. (e.g. for EAs: `#all_with_result`, `#latest_values`, `#from_ldap?` etc.)
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Use `#pix_empty?` to better catch nils when expecting empty strings
|
|
27
|
+
- When using Zeitwerk's 'eager loading' to load the whole gem, no longer fails when it finds the unused/archived 'mdm_classic.rb' file. Thanks to @rorra for reporting this issue.
|
|
28
|
+
- When using Zeitwerk's 'eager loading' to load the whole gem, no longer fails looking for the JamfProtectPlan OAPISchema, referenced by other schemas
|
|
29
|
+
- Fixed occasional arg-parsing errors with `.all_names` API object class method.
|
|
30
|
+
|
|
31
|
+
|
|
17
32
|
--------
|
|
18
33
|
## \[5.0.2] 2026-01-24
|
|
19
34
|
|
|
@@ -1309,7 +1309,7 @@ module Jamf
|
|
|
1309
1309
|
scope_list = part == :limitation ? @limitations[:jamf_ldap_users] : @exclusions[:jamf_ldap_users]
|
|
1310
1310
|
|
|
1311
1311
|
# nil if the list is empty
|
|
1312
|
-
return if scope_list.
|
|
1312
|
+
return if scope_list.pix_empty?
|
|
1313
1313
|
|
|
1314
1314
|
scope_list.include? machine_data[:location][:username]
|
|
1315
1315
|
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# The Module
|
|
9
|
+
module Jamf
|
|
10
|
+
|
|
11
|
+
# Classes
|
|
12
|
+
#####################################
|
|
13
|
+
|
|
14
|
+
# A building in the Jamf Pro API
|
|
15
|
+
#
|
|
16
|
+
# Alas we can't migrate Jamf::Building to use the JPAPI - it must stay in the
|
|
17
|
+
# classic API because of how it interacts Scopes in scopable objects over there.
|
|
18
|
+
#
|
|
19
|
+
# The parent class is the OAPI object representing a single member of the
|
|
20
|
+
# collection, i.e. the 'GET_OBJECT' similar to the POST_OBJECT defined in the
|
|
21
|
+
# class below.
|
|
22
|
+
#
|
|
23
|
+
class JCategory < Jamf::OAPISchemas::Category
|
|
24
|
+
|
|
25
|
+
include Jamf::CollectionResource
|
|
26
|
+
extend Jamf::Filterable
|
|
27
|
+
include Jamf::ChangeLog
|
|
28
|
+
|
|
29
|
+
########### RELATED OAPI OBJECTS
|
|
30
|
+
# These objects should be OAPIObjects, NOT subclasses of them and
|
|
31
|
+
# not Collection or Singleton resources.
|
|
32
|
+
#
|
|
33
|
+
# TODO: See if these constants can be auto-generated from the
|
|
34
|
+
# OAPI schema and baked into the parent class
|
|
35
|
+
|
|
36
|
+
# The OAPI object class we get back from a 'list' query to get the
|
|
37
|
+
# whole collection, or a subset of it. It contains a :results key
|
|
38
|
+
# which is an array of data for objects of the parent class.
|
|
39
|
+
SEARCH_RESULT_OBJECT = Jamf::OAPISchemas::CategoriesSearchResults
|
|
40
|
+
|
|
41
|
+
# The OAPI object class we send with a POST request to make a new member of
|
|
42
|
+
# the collection in Jamf. This is usually the same as the parent class.
|
|
43
|
+
POST_OBJECT = Jamf::OAPISchemas::Category
|
|
44
|
+
|
|
45
|
+
# The OAPI object class we send with a PUT request to change an object in
|
|
46
|
+
# Jamf by specifying all its values. Most updates happen this way,
|
|
47
|
+
# and this is usually the same as the parent class
|
|
48
|
+
PUT_OBJECT = Jamf::OAPISchemas::Category
|
|
49
|
+
|
|
50
|
+
# The OAPI object we send with a PATCH request to change an object in
|
|
51
|
+
# Jamf by replacing only some of its values. This is never the same as the
|
|
52
|
+
# parent class, and is usually used when many or most of the data about an
|
|
53
|
+
# object cannot be changed via the API.
|
|
54
|
+
# PATCH_OBJECT = Jamf::OAPISchemas::Building
|
|
55
|
+
|
|
56
|
+
############# API PATHS
|
|
57
|
+
# TODO: See if these paths can be auto-generated from the
|
|
58
|
+
# OAPI schema and baked into the parent class
|
|
59
|
+
|
|
60
|
+
# The path for GETting the list of all objects in the collection, possibly
|
|
61
|
+
# filtered, sorted, and/or paged
|
|
62
|
+
# REQUIRED for all collection resources
|
|
63
|
+
#
|
|
64
|
+
# GET_PATH, POST_PATH, PUT_PATH, PATCH_PATH, and DELETE_PATH are automatically
|
|
65
|
+
# assumed from the LIST_PATH if they follow the standards:
|
|
66
|
+
# - GET_PATH = "#{LIST_PATH}/id"
|
|
67
|
+
# - fetch an object from the collection
|
|
68
|
+
# - POST_PATH = LIST_PATH
|
|
69
|
+
# - create a new object in the collection
|
|
70
|
+
# - PUT_PATH = "#{LIST_PATH}/id"
|
|
71
|
+
# - update an object passing all its values back.
|
|
72
|
+
# Most objects use this or PATCH but not both
|
|
73
|
+
# - PATCH_PATH = "#{LIST_PATH}/id"
|
|
74
|
+
# - update an object passing some of its values back
|
|
75
|
+
# Most objects use this or PUT but not both
|
|
76
|
+
# - DELETE_PATH = "#{LIST_PATH}/id"
|
|
77
|
+
# - delete an object from the collection
|
|
78
|
+
#
|
|
79
|
+
# If those paths differ from the standards, the constants must be defined
|
|
80
|
+
# here
|
|
81
|
+
#
|
|
82
|
+
LIST_PATH = 'v1/categories'.freeze
|
|
83
|
+
|
|
84
|
+
# See Jamf::CollectionResource::ClassMethods#get_path
|
|
85
|
+
GET_PATH = LIST_PATH
|
|
86
|
+
|
|
87
|
+
# Identifiers not marked in the superclass's OAPI_PROPERTIES constant
|
|
88
|
+
# which usually only identifies ':id'
|
|
89
|
+
ALT_IDENTIFIERS = %i[name].freeze
|
|
90
|
+
|
|
91
|
+
# Must define this when extending Filterable
|
|
92
|
+
FILTER_KEYS = %i[
|
|
93
|
+
name priority
|
|
94
|
+
].freeze
|
|
95
|
+
|
|
96
|
+
end # class
|
|
97
|
+
|
|
98
|
+
end # module
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# The Module
|
|
9
|
+
module Jamf
|
|
10
|
+
|
|
11
|
+
# Classes
|
|
12
|
+
#####################################
|
|
13
|
+
|
|
14
|
+
# A Mobile Device Extension Attribute Definition in the Jamf Pro API
|
|
15
|
+
#
|
|
16
|
+
# Alas we can't migrate Jamf::Building to use the JPAPI - it must stay in the
|
|
17
|
+
# classic API because of how it interacts Scopes in scopable objects over there.
|
|
18
|
+
#
|
|
19
|
+
# The parent class is the OAPI object representing a single member of the
|
|
20
|
+
# collection, i.e. the 'GET_OBJECT' similar to the POST_OBJECT defined in the
|
|
21
|
+
# class below.
|
|
22
|
+
#
|
|
23
|
+
class JComputerExtensionAttribute < Jamf::OAPISchemas::ComputerExtensionAttributes
|
|
24
|
+
|
|
25
|
+
include Jamf::CollectionResource
|
|
26
|
+
include Jamf::ChangeLog
|
|
27
|
+
include Jamf::DataDependency
|
|
28
|
+
|
|
29
|
+
extend Jamf::Filterable
|
|
30
|
+
extend Jamf::BulkDeletable
|
|
31
|
+
|
|
32
|
+
########### RELATED OAPI OBJECTS
|
|
33
|
+
# These objects should be OAPIObjects, NOT subclasses of them and
|
|
34
|
+
# not Collection or Singleton resources.
|
|
35
|
+
#
|
|
36
|
+
# TODO: See if these constants can be auto-generated from the
|
|
37
|
+
# OAPI schema and baked into the parent class
|
|
38
|
+
|
|
39
|
+
# The OAPI object class we get back from a 'list' query to get the
|
|
40
|
+
# whole collection, or a subset of it. It contains a :results key
|
|
41
|
+
# which is an array of data for objects of the parent class.
|
|
42
|
+
SEARCH_RESULT_OBJECT = Jamf::OAPISchemas::ComputerExtensionAttributeSearchResults
|
|
43
|
+
|
|
44
|
+
# The OAPI object class we send with a POST request to make a new member of
|
|
45
|
+
# the collection in Jamf. This is usually the same as the parent class.
|
|
46
|
+
POST_OBJECT = Jamf::OAPISchemas::ComputerExtensionAttribute
|
|
47
|
+
|
|
48
|
+
# The OAPI object class we send with a PUT request to change an object in
|
|
49
|
+
# Jamf by specifying all its values. Most updates happen this way,
|
|
50
|
+
# and this is usually the same as the parent class
|
|
51
|
+
PUT_OBJECT = Jamf::OAPISchemas::ComputerExtensionAttribute
|
|
52
|
+
|
|
53
|
+
# The OAPI object we send with a PATCH request to change an object in
|
|
54
|
+
# Jamf by replacing only some of its values. This is never the same as the
|
|
55
|
+
# parent class, and is usually used when many or most of the data about an
|
|
56
|
+
# object cannot be changed via the API.
|
|
57
|
+
# PATCH_OBJECT = Jamf::OAPISchemas::Building
|
|
58
|
+
|
|
59
|
+
############# API PATHS
|
|
60
|
+
# TODO: See if these paths can be auto-generated from the
|
|
61
|
+
# OAPI schema and baked into the parent class
|
|
62
|
+
|
|
63
|
+
# LIST_PATH
|
|
64
|
+
# The path for GETting the list of all objects in the collection, possibly
|
|
65
|
+
# filtered, sorted, and/or paged
|
|
66
|
+
# REQUIRED for all collection resources
|
|
67
|
+
#
|
|
68
|
+
# GET_PATH, POST_PATH, PUT_PATH, PATCH_PATH, and DELETE_PATH are automatically
|
|
69
|
+
# assumed from the LIST_PATH if they follow the standards:
|
|
70
|
+
# - GET_PATH = "#{LIST_PATH}/id"
|
|
71
|
+
# - fetch an object from the collection
|
|
72
|
+
# - POST_PATH = LIST_PATH
|
|
73
|
+
# - create a new object in the collection
|
|
74
|
+
# - PUT_PATH = "#{LIST_PATH}/id"
|
|
75
|
+
# - update an object passing all its values back.
|
|
76
|
+
# Most objects use this or PATCH but not both
|
|
77
|
+
# - PATCH_PATH = "#{LIST_PATH}/id"
|
|
78
|
+
# - update an object passing some of its values back
|
|
79
|
+
# Most objects use this or PUT but not both
|
|
80
|
+
# - DELETE_PATH = "#{LIST_PATH}/id"
|
|
81
|
+
# - delete an object from the collection
|
|
82
|
+
#
|
|
83
|
+
# If those paths differ from the standards, the constants must be defined
|
|
84
|
+
# here
|
|
85
|
+
#
|
|
86
|
+
LIST_PATH = 'v1/computer-extension-attributes'.freeze
|
|
87
|
+
|
|
88
|
+
# See Jamf::CollectionResource::ClassMethods#get_path
|
|
89
|
+
GET_PATH = LIST_PATH
|
|
90
|
+
|
|
91
|
+
# Identifiers not marked in the superclass's OAPI_PROPERTIES constant
|
|
92
|
+
# which usually only identifies ':id'
|
|
93
|
+
ALT_IDENTIFIERS = %i[name].freeze
|
|
94
|
+
|
|
95
|
+
# Must define this when extending Filterable
|
|
96
|
+
FILTER_KEYS = %i[
|
|
97
|
+
id name
|
|
98
|
+
].freeze
|
|
99
|
+
|
|
100
|
+
end # class
|
|
101
|
+
|
|
102
|
+
end # module
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# The Module
|
|
9
|
+
module Jamf
|
|
10
|
+
|
|
11
|
+
# Classes
|
|
12
|
+
#####################################
|
|
13
|
+
|
|
14
|
+
# A Mobile Device Extension Attribute Definition in the Jamf Pro API
|
|
15
|
+
#
|
|
16
|
+
# Alas we can't migrate Jamf::Building to use the JPAPI - it must stay in the
|
|
17
|
+
# classic API because of how it interacts Scopes in scopable objects over there.
|
|
18
|
+
#
|
|
19
|
+
# The parent class is the OAPI object representing a single member of the
|
|
20
|
+
# collection, i.e. the 'GET_OBJECT' similar to the POST_OBJECT defined in the
|
|
21
|
+
# class below.
|
|
22
|
+
#
|
|
23
|
+
class JMobileDeviceExtensionAttribute < Jamf::OAPISchemas::MobileDeviceExtensionAttribute
|
|
24
|
+
|
|
25
|
+
include Jamf::CollectionResource
|
|
26
|
+
include Jamf::ChangeLog
|
|
27
|
+
include Jamf::DataDependency
|
|
28
|
+
|
|
29
|
+
extend Jamf::Filterable
|
|
30
|
+
|
|
31
|
+
########### RELATED OAPI OBJECTS
|
|
32
|
+
# These objects should be OAPIObjects, NOT subclasses of them and
|
|
33
|
+
# not Collection or Singleton resources.
|
|
34
|
+
#
|
|
35
|
+
# TODO: See if these constants can be auto-generated from the
|
|
36
|
+
# OAPI schema and baked into the parent class
|
|
37
|
+
|
|
38
|
+
# The OAPI object class we get back from a 'list' query to get the
|
|
39
|
+
# whole collection, or a subset of it. It contains a :results key
|
|
40
|
+
# which is an array of data for objects of the parent class.
|
|
41
|
+
SEARCH_RESULT_OBJECT = Jamf::OAPISchemas::MobileDeviceExtensionAttributeResults
|
|
42
|
+
|
|
43
|
+
# The OAPI object class we send with a POST request to make a new member of
|
|
44
|
+
# the collection in Jamf. This is usually the same as the parent class.
|
|
45
|
+
POST_OBJECT = Jamf::OAPISchemas::MobileDeviceExtensionAttribute
|
|
46
|
+
|
|
47
|
+
# The OAPI object class we send with a PUT request to change an object in
|
|
48
|
+
# Jamf by specifying all its values. Most updates happen this way,
|
|
49
|
+
# and this is usually the same as the parent class
|
|
50
|
+
PUT_OBJECT = Jamf::OAPISchemas::MobileDeviceExtensionAttribute
|
|
51
|
+
|
|
52
|
+
# The OAPI object we send with a PATCH request to change an object in
|
|
53
|
+
# Jamf by replacing only some of its values. This is never the same as the
|
|
54
|
+
# parent class, and is usually used when many or most of the data about an
|
|
55
|
+
# object cannot be changed via the API.
|
|
56
|
+
# PATCH_OBJECT = Jamf::OAPISchemas::Building
|
|
57
|
+
|
|
58
|
+
############# API PATHS
|
|
59
|
+
# TODO: See if these paths can be auto-generated from the
|
|
60
|
+
# OAPI schema and baked into the parent class
|
|
61
|
+
|
|
62
|
+
# LIST_PATH
|
|
63
|
+
# The path for GETting the list of all objects in the collection, possibly
|
|
64
|
+
# filtered, sorted, and/or paged
|
|
65
|
+
# REQUIRED for all collection resources
|
|
66
|
+
#
|
|
67
|
+
# GET_PATH, POST_PATH, PUT_PATH, PATCH_PATH, and DELETE_PATH are automatically
|
|
68
|
+
# assumed from the LIST_PATH if they follow the standards:
|
|
69
|
+
# - GET_PATH = "#{LIST_PATH}/id"
|
|
70
|
+
# - fetch an object from the collection
|
|
71
|
+
# - POST_PATH = LIST_PATH
|
|
72
|
+
# - create a new object in the collection
|
|
73
|
+
# - PUT_PATH = "#{LIST_PATH}/id"
|
|
74
|
+
# - update an object passing all its values back.
|
|
75
|
+
# Most objects use this or PATCH but not both
|
|
76
|
+
# - PATCH_PATH = "#{LIST_PATH}/id"
|
|
77
|
+
# - update an object passing some of its values back
|
|
78
|
+
# Most objects use this or PUT but not both
|
|
79
|
+
# - DELETE_PATH = "#{LIST_PATH}/id"
|
|
80
|
+
# - delete an object from the collection
|
|
81
|
+
#
|
|
82
|
+
# If those paths differ from the standards, the constants must be defined
|
|
83
|
+
# here
|
|
84
|
+
#
|
|
85
|
+
LIST_PATH = 'v1/mobile-device-extension-attributes'.freeze
|
|
86
|
+
|
|
87
|
+
# See Jamf::CollectionResource::ClassMethods#get_path
|
|
88
|
+
GET_PATH = LIST_PATH
|
|
89
|
+
|
|
90
|
+
# Identifiers not marked in the superclass's OAPI_PROPERTIES constant
|
|
91
|
+
# which usually only identifies ':id'
|
|
92
|
+
ALT_IDENTIFIERS = %i[name].freeze
|
|
93
|
+
|
|
94
|
+
# Must define this when extending Filterable
|
|
95
|
+
FILTER_KEYS = %i[
|
|
96
|
+
id name
|
|
97
|
+
].freeze
|
|
98
|
+
|
|
99
|
+
end # class
|
|
100
|
+
|
|
101
|
+
end # module
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# frozen_string_literal: true
|
|
9
|
+
|
|
10
|
+
# The Module
|
|
11
|
+
module Jamf
|
|
12
|
+
|
|
13
|
+
# Classes
|
|
14
|
+
#####################################
|
|
15
|
+
|
|
16
|
+
# A building in the Jamf Pro API
|
|
17
|
+
#
|
|
18
|
+
# Alas we can't migrate Jamf::Building to use the JPAPI - it must stay in the
|
|
19
|
+
# classic API because of how it interacts Scopes in scopable objects over there.
|
|
20
|
+
#
|
|
21
|
+
# The parent class is the OAPI object representing a single member of the
|
|
22
|
+
# collection, i.e. the 'GET_OBJECT' similar to the POST_OBJECT defined in the
|
|
23
|
+
# class below.
|
|
24
|
+
#
|
|
25
|
+
class JScript < Jamf::OAPISchemas::Script
|
|
26
|
+
|
|
27
|
+
include Jamf::CollectionResource
|
|
28
|
+
include Jamf::ChangeLog
|
|
29
|
+
|
|
30
|
+
extend Jamf::Filterable
|
|
31
|
+
|
|
32
|
+
########### RELATED OAPI OBJECTS
|
|
33
|
+
# These objects should be OAPIObjects, NOT subclasses of them and
|
|
34
|
+
# not Collection or Singleton resources.
|
|
35
|
+
#
|
|
36
|
+
# TODO: See if these constants can be auto-generated from the
|
|
37
|
+
# OAPI schema and baked into the parent class
|
|
38
|
+
|
|
39
|
+
# The OAPI object class we get back from a 'list' query to get the
|
|
40
|
+
# whole collection, or a subset of it. It contains a :results key
|
|
41
|
+
# which is an array of data for objects of the parent class.
|
|
42
|
+
SEARCH_RESULT_OBJECT = Jamf::OAPISchemas::ScriptsSearchResults
|
|
43
|
+
|
|
44
|
+
# The OAPI object class we send with a POST request to make a new member of
|
|
45
|
+
# the collection in Jamf. This is usually the same as the parent class.
|
|
46
|
+
POST_OBJECT = Jamf::OAPISchemas::Script
|
|
47
|
+
|
|
48
|
+
# The OAPI object class we send with a PUT request to change an object in
|
|
49
|
+
# Jamf by specifying all its values. Most updates happen this way,
|
|
50
|
+
# and this is usually the same as the parent class
|
|
51
|
+
PUT_OBJECT = Jamf::OAPISchemas::Script
|
|
52
|
+
|
|
53
|
+
# The OAPI object we send with a PATCH request to change an object in
|
|
54
|
+
# Jamf by replacing only some of its values. This is never the same as the
|
|
55
|
+
# parent class, and is usually used when many or most of the data about an
|
|
56
|
+
# object cannot be changed via the API.
|
|
57
|
+
# PATCH_OBJECT = Jamf::OAPISchemas::Building
|
|
58
|
+
|
|
59
|
+
############# API PATHS
|
|
60
|
+
# TODO: See if these paths can be auto-generated from the
|
|
61
|
+
# OAPI schema and baked into the parent class
|
|
62
|
+
|
|
63
|
+
# The path for GETting the list of all objects in the collection, possibly
|
|
64
|
+
# filtered, sorted, and/or paged
|
|
65
|
+
# REQUIRED for all collection resources
|
|
66
|
+
#
|
|
67
|
+
# GET_PATH, POST_PATH, PUT_PATH, PATCH_PATH, and DELETE_PATH are automatically
|
|
68
|
+
# assumed from the LIST_PATH if they follow the standards:
|
|
69
|
+
# - GET_PATH = "#{LIST_PATH}/id"
|
|
70
|
+
# - fetch an object from the collection
|
|
71
|
+
# - POST_PATH = LIST_PATH
|
|
72
|
+
# - create a new object in the collection
|
|
73
|
+
# - PUT_PATH = "#{LIST_PATH}/id"
|
|
74
|
+
# - update an object passing all its values back.
|
|
75
|
+
# Most objects use this or PATCH but not both
|
|
76
|
+
# - PATCH_PATH = "#{LIST_PATH}/id"
|
|
77
|
+
# - update an object passing some of its values back
|
|
78
|
+
# Most objects use this or PUT but not both
|
|
79
|
+
# - DELETE_PATH = "#{LIST_PATH}/id"
|
|
80
|
+
# - delete an object from the collection
|
|
81
|
+
#
|
|
82
|
+
# If those paths differ from the standards, the constants must be defined
|
|
83
|
+
# here
|
|
84
|
+
#
|
|
85
|
+
LIST_PATH = 'v1/scripts'
|
|
86
|
+
|
|
87
|
+
# See Jamf::CollectionResource::ClassMethods#get_path
|
|
88
|
+
GET_PATH = LIST_PATH
|
|
89
|
+
|
|
90
|
+
# Identifiers not marked in the superclass's OAPI_PROPERTIES constant
|
|
91
|
+
# which usually only identifies ':id'
|
|
92
|
+
ALT_IDENTIFIERS = %i[name].freeze
|
|
93
|
+
|
|
94
|
+
# Must define this when extending Filterable
|
|
95
|
+
FILTER_KEYS = %i[
|
|
96
|
+
id name info notes priority categoryId categoryName scriptContents parameter4 parameter5 parameter6 parameter7 parameter8 parameter9 parameter10 parameter11 osRequirements
|
|
97
|
+
].freeze
|
|
98
|
+
|
|
99
|
+
end # class
|
|
100
|
+
|
|
101
|
+
end # module
|
|
@@ -15,7 +15,7 @@ module Jamf
|
|
|
15
15
|
|
|
16
16
|
DELETE_MULTIPLE_ENDPOINT = 'delete-multiple'.freeze
|
|
17
17
|
|
|
18
|
-
# Delete multiple objects by providing an array of their
|
|
18
|
+
# Delete multiple objects by providing an array of their ids
|
|
19
19
|
#
|
|
20
20
|
# @param ids [Array<String,Integer>] The ids to delete
|
|
21
21
|
#
|
|
@@ -25,7 +25,7 @@ module Jamf
|
|
|
25
25
|
# @return [Array<Jamf::Connection::JamfProAPIError::ErrorInfo] Info about any ids
|
|
26
26
|
# that failed to be deleted.
|
|
27
27
|
#
|
|
28
|
-
def
|
|
28
|
+
def delete_multiple(ids, cnx: Jamf.cnx)
|
|
29
29
|
ids = [ids] unless ids.is_a? Array
|
|
30
30
|
request_body = { ids: ids.map(&:to_s) }
|
|
31
31
|
|
|
@@ -39,6 +39,8 @@ module Jamf
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
alias bulk_delete delete_multiple
|
|
43
|
+
|
|
44
|
+
end # BulkDeletable
|
|
43
45
|
|
|
44
46
|
end # Jamf
|
|
@@ -587,8 +587,10 @@ module Jamf
|
|
|
587
587
|
create_identifier_list_method attr_name.to_sym, method
|
|
588
588
|
send method, *args
|
|
589
589
|
elsif method.to_s == 'all_names' && defined?(self::OBJECT_NAME_ATTR)
|
|
590
|
-
define_singleton_method(:all_names) do |_refresh = nil, cnx: Jamf.cnx, cached_list: nil|
|
|
591
|
-
|
|
590
|
+
# define_singleton_method(:all_names) do |_refresh = nil, cnx: Jamf.cnx, cached_list: nil|
|
|
591
|
+
# send "all_#{self::OBJECT_NAME_ATTR}s", *args
|
|
592
|
+
define_singleton_method(:all_names) do |refresh = nil, cnx: Jamf.cnx, cached_list: nil|
|
|
593
|
+
send "all_#{self::OBJECT_NAME_ATTR}s", refresh, cnx: cnx, cached_list: cached_list
|
|
592
594
|
end
|
|
593
595
|
send method, *args
|
|
594
596
|
else
|
|
@@ -634,6 +636,7 @@ module Jamf
|
|
|
634
636
|
end
|
|
635
637
|
end # define_singleton_method
|
|
636
638
|
Jamf.load_msg "Defined method #{self}##{list_method_name}"
|
|
639
|
+
|
|
637
640
|
else
|
|
638
641
|
|
|
639
642
|
define_singleton_method(list_method_name) do |*|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
module Jamf
|
|
9
|
+
|
|
10
|
+
# This mixin implements the .../data-dependency endpoints that
|
|
11
|
+
# some collection resources have (and eventually all will??)
|
|
12
|
+
# It should be included into classes representing those resources
|
|
13
|
+
#
|
|
14
|
+
# data-dependencies list other Jamf Pro objects that use the current object,
|
|
15
|
+
# e.g. Advanced Searches or Smart Groups that use an Extension Attribute in their
|
|
16
|
+
# criteria.
|
|
17
|
+
#
|
|
18
|
+
module DataDependency
|
|
19
|
+
|
|
20
|
+
DATA_DEPENDENCY_ENDPOINT = 'data-dependency'.freeze
|
|
21
|
+
|
|
22
|
+
# when this module is included, also extend our Class Methods
|
|
23
|
+
def self.included(includer)
|
|
24
|
+
Jamf.load_msg "--> #{includer} is including Jamf::DataDependency"
|
|
25
|
+
includer.extend(ClassMethods)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Get the dependencies for the current object. This is a list of objects that use this object
|
|
29
|
+
# and would prevent if from being deleted
|
|
30
|
+
#
|
|
31
|
+
# @return [Array<Hash>] Info about any objects that would prevent deletion of the specified object(s).
|
|
32
|
+
#
|
|
33
|
+
def data_dependency
|
|
34
|
+
self.class.data_dependency(id, cnx: @cnx)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Class Methods
|
|
38
|
+
#####################################
|
|
39
|
+
module ClassMethods
|
|
40
|
+
|
|
41
|
+
def self.extended(extender)
|
|
42
|
+
Jamf.load_msg "--> #{extender} is extending Jamf::DataDependency::ClassMethods"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Get the dependencies for the specified id. This is a list of objects that use this object
|
|
46
|
+
# and would prevent if from being deleted
|
|
47
|
+
#
|
|
48
|
+
# @param ident [String,Integer] The name, id or other identifier to get dependencies for.
|
|
49
|
+
#
|
|
50
|
+
# @param cnx [Jamf::Connection] The connection to use, default: Jamf.cnx
|
|
51
|
+
#
|
|
52
|
+
# @return [Array<Hash>] Info about any objects that would prevent deletion of the specified object(s).
|
|
53
|
+
#
|
|
54
|
+
def data_dependency(ident, cnx: Jamf.cnx)
|
|
55
|
+
id = valid_id(ident)
|
|
56
|
+
cnx.jp_get("#{self::LIST_PATH}/#{id}/#{DATA_DEPENDENCY_ENDPOINT}")[:results]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end # ClassMethods
|
|
60
|
+
|
|
61
|
+
end # DataDependency
|
|
62
|
+
|
|
63
|
+
end # Jamf
|
|
@@ -19,9 +19,9 @@ module Jamf
|
|
|
19
19
|
|
|
20
20
|
case sort
|
|
21
21
|
when String
|
|
22
|
-
"
|
|
22
|
+
"#{SORT_PARAM_PREFIX}#{CGI.escape sort}"
|
|
23
23
|
when Array
|
|
24
|
-
"
|
|
24
|
+
"#{SORT_PARAM_PREFIX}#{CGI.escape sort.join(',')}"
|
|
25
25
|
else
|
|
26
26
|
raise ArgumentError, 'sort criteria must be a String or Array of Strings'
|
|
27
27
|
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Copyright 2025 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
|
+
module Jamf
|
|
26
|
+
|
|
27
|
+
# This module is the namespace for all objects defined
|
|
28
|
+
# in the OAPI JSON schema under the components => schemas key
|
|
29
|
+
#
|
|
30
|
+
module OAPISchemas
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# OAPI Object Model and Enums for: CategoriesSearchResults
|
|
34
|
+
#
|
|
35
|
+
#
|
|
36
|
+
#
|
|
37
|
+
# This class was automatically generated from the api/schema
|
|
38
|
+
# URL path on a Jamf Pro server version 11.9.2-t1726753918
|
|
39
|
+
#
|
|
40
|
+
# This class may be used directly, e.g instances of other classes may
|
|
41
|
+
# use instances of this class as one of their own properties/attributes.
|
|
42
|
+
#
|
|
43
|
+
# It may also be used as a superclass when implementing Jamf Pro API
|
|
44
|
+
# Resources in ruby-jss. The subclasses include appropriate mixins, and
|
|
45
|
+
# should expand on the basic functionality provided here.
|
|
46
|
+
#
|
|
47
|
+
#
|
|
48
|
+
# Container Objects:
|
|
49
|
+
# Other object models that use this model as the value in one
|
|
50
|
+
# of their attributes.
|
|
51
|
+
#
|
|
52
|
+
#
|
|
53
|
+
# Sub Objects:
|
|
54
|
+
# Other object models used by this model's attributes.
|
|
55
|
+
# - Jamf::OAPISchemas::Category
|
|
56
|
+
#
|
|
57
|
+
# Endpoints and Privileges:
|
|
58
|
+
# API endpoints and HTTP operations that use this object
|
|
59
|
+
# model, and the Jamf Pro privileges needed to access them.
|
|
60
|
+
# - '/v1/categories:GET' needs permissions:
|
|
61
|
+
# - Read Categories
|
|
62
|
+
#
|
|
63
|
+
#
|
|
64
|
+
class CategoriesSearchResults < Jamf::OAPIObject
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
OAPI_PROPERTIES = {
|
|
69
|
+
|
|
70
|
+
# @!attribute totalCount
|
|
71
|
+
# @return [Integer]
|
|
72
|
+
totalCount: {
|
|
73
|
+
class: :integer,
|
|
74
|
+
minimum: 0
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
# @!attribute results
|
|
78
|
+
# @return [Array<Jamf::OAPISchemas::Category>]
|
|
79
|
+
results: {
|
|
80
|
+
class: Jamf::OAPISchemas::Category,
|
|
81
|
+
multi: true,
|
|
82
|
+
min_items: 0
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
} # end OAPI_PROPERTIES
|
|
86
|
+
|
|
87
|
+
end # class CategoriesSearchResults
|
|
88
|
+
|
|
89
|
+
end # module OAPISchemas
|
|
90
|
+
|
|
91
|
+
end # module Jamf
|