jss-api 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/lib/jss-api.rb +1 -191
  2. metadata +16 -146
  3. data/.yardopts +0 -7
  4. data/CHANGES.md +0 -88
  5. data/LICENSE.txt +0 -174
  6. data/README.md +0 -396
  7. data/THANKS.md +0 -6
  8. data/bin/cgrouper +0 -485
  9. data/bin/subnet-update +0 -400
  10. data/lib/jss-api/api_connection.rb +0 -400
  11. data/lib/jss-api/api_object.rb +0 -616
  12. data/lib/jss-api/api_object/advanced_search.rb +0 -389
  13. data/lib/jss-api/api_object/advanced_search/advanced_computer_search.rb +0 -95
  14. data/lib/jss-api/api_object/advanced_search/advanced_mobile_device_search.rb +0 -96
  15. data/lib/jss-api/api_object/advanced_search/advanced_user_search.rb +0 -95
  16. data/lib/jss-api/api_object/building.rb +0 -92
  17. data/lib/jss-api/api_object/category.rb +0 -147
  18. data/lib/jss-api/api_object/computer.rb +0 -852
  19. data/lib/jss-api/api_object/creatable.rb +0 -98
  20. data/lib/jss-api/api_object/criteriable.rb +0 -189
  21. data/lib/jss-api/api_object/criteriable/criteria.rb +0 -231
  22. data/lib/jss-api/api_object/criteriable/criterion.rb +0 -228
  23. data/lib/jss-api/api_object/department.rb +0 -93
  24. data/lib/jss-api/api_object/distribution_point.rb +0 -560
  25. data/lib/jss-api/api_object/extendable.rb +0 -221
  26. data/lib/jss-api/api_object/extension_attribute.rb +0 -457
  27. data/lib/jss-api/api_object/extension_attribute/computer_extension_attribute.rb +0 -362
  28. data/lib/jss-api/api_object/extension_attribute/mobile_device_extension_attribute.rb +0 -189
  29. data/lib/jss-api/api_object/extension_attribute/user_extension_attribute.rb +0 -117
  30. data/lib/jss-api/api_object/group.rb +0 -380
  31. data/lib/jss-api/api_object/group/computer_group.rb +0 -124
  32. data/lib/jss-api/api_object/group/mobile_device_group.rb +0 -139
  33. data/lib/jss-api/api_object/group/user_group.rb +0 -139
  34. data/lib/jss-api/api_object/ldap_server.rb +0 -535
  35. data/lib/jss-api/api_object/locatable.rb +0 -286
  36. data/lib/jss-api/api_object/matchable.rb +0 -97
  37. data/lib/jss-api/api_object/mobile_device.rb +0 -556
  38. data/lib/jss-api/api_object/netboot_server.rb +0 -148
  39. data/lib/jss-api/api_object/network_segment.rb +0 -414
  40. data/lib/jss-api/api_object/osx_configuration_profile.rb +0 -261
  41. data/lib/jss-api/api_object/package.rb +0 -812
  42. data/lib/jss-api/api_object/peripheral.rb +0 -335
  43. data/lib/jss-api/api_object/peripheral_type.rb +0 -295
  44. data/lib/jss-api/api_object/policy.rb +0 -898
  45. data/lib/jss-api/api_object/purchasable.rb +0 -316
  46. data/lib/jss-api/api_object/removable_macaddr.rb +0 -98
  47. data/lib/jss-api/api_object/scopable.rb +0 -136
  48. data/lib/jss-api/api_object/scopable/scope.rb +0 -621
  49. data/lib/jss-api/api_object/script.rb +0 -631
  50. data/lib/jss-api/api_object/self_servable.rb +0 -355
  51. data/lib/jss-api/api_object/site.rb +0 -93
  52. data/lib/jss-api/api_object/software_update_server.rb +0 -109
  53. data/lib/jss-api/api_object/updatable.rb +0 -117
  54. data/lib/jss-api/api_object/uploadable.rb +0 -138
  55. data/lib/jss-api/api_object/user.rb +0 -272
  56. data/lib/jss-api/client.rb +0 -504
  57. data/lib/jss-api/compatibility.rb +0 -66
  58. data/lib/jss-api/composer.rb +0 -171
  59. data/lib/jss-api/configuration.rb +0 -306
  60. data/lib/jss-api/db_connection.rb +0 -298
  61. data/lib/jss-api/exceptions.rb +0 -95
  62. data/lib/jss-api/ruby_extensions.rb +0 -35
  63. data/lib/jss-api/ruby_extensions/filetest.rb +0 -43
  64. data/lib/jss-api/ruby_extensions/hash.rb +0 -79
  65. data/lib/jss-api/ruby_extensions/ipaddr.rb +0 -91
  66. data/lib/jss-api/ruby_extensions/pathname.rb +0 -77
  67. data/lib/jss-api/ruby_extensions/string.rb +0 -59
  68. data/lib/jss-api/ruby_extensions/time.rb +0 -63
  69. data/lib/jss-api/server.rb +0 -108
  70. data/lib/jss-api/utility.rb +0 -416
  71. data/lib/jss-api/version.rb +0 -31
@@ -1,174 +0,0 @@
1
-
2
- Modified Apache 2.0 License
3
-
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor
140
- and its affiliates, except as required to comply with Section 4(c) of
141
- the License and to reproduce the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
data/README.md DELETED
@@ -1,396 +0,0 @@
1
- # The JSS API Ruby Gem - access to the Casper Suite from Ruby
2
- [![Gem Version](https://badge.fury.io/rb/jss-api.svg)](http://badge.fury.io/rb/jss-api)
3
-
4
- ## DESCRIPTION
5
-
6
- The jss-api gem provides a Ruby module called JSS, which is used for accessing the REST API of the JAMF Software Server (JSS), the core of the Casper Suite, an enterprise-level management tool for Apple devices from [JAMF Software, LLC](http://www.jamfsoftware.com/).
7
-
8
- The module abstracts API resources as Ruby objects, and provides methods for interacting with those resources. It also provides some features that aren't a part of the API itself, but come with other Casper-related tools, such as uploading .pkg and .dmg {JSS::Package} data to the master distribution point, and the installation of {JSS::Package} objects on client machines. (See BEYOND THE API)
9
-
10
- The module is not a complete implementation of the Casper API. Only some API objects are modeled, some only minimally. Of
11
- those, some are read-only, some partially writable, some fully read-write (all implemented objects can be deleted)
12
- See OBJECTS IMPLEMENTED for a list.
13
-
14
- We've implemented the things we need in our environment, and as our needs grow, we'll add more.
15
- Hopefully others will find it useful, and add more to it as well.
16
-
17
- [Full technical documentation can be found here.](http://www.rubydoc.info/gems/jss-api/)
18
-
19
-
20
- ## SYNOPSIS
21
-
22
- ```ruby
23
- # you may need to require 'rubygems' first if you're using Ruby 1.8
24
- require 'jss-api'
25
-
26
- JSS::API.connect(
27
- :user => jss_user,
28
- :pw => jss_user_pw,
29
- :server => jss_server_hostname
30
- )
31
-
32
- # get an array of data about all JSS::Package objects in the JSS:
33
- JSS::Package.all
34
-
35
- # get an array of names of all JSS::Package objects in the JSS:
36
- JSS::Package.all_names
37
-
38
- # Get a static computer group
39
- mg = JSS::ComputerGroup.new :name => "Macs of interest"
40
-
41
- # Add a computer to the group
42
- mg.add_member "pricklepants"
43
-
44
- # save my changes
45
- mg.update
46
-
47
- # Create a new network segment to store in the JSS
48
- ns = JSS::NetworkSegment.new(
49
- :id => :new,
50
- :name => 'Private Class C',
51
- :starting_address => '192.168.0.0',
52
- :ending_address => '192.168.0.255'
53
- )
54
-
55
- # Associate this network segment with a specific building,
56
- # which must exist in the JSS, and be listed in JSS::Building.all_names
57
- ns.building = "Main Office"
58
-
59
- # Associate this network segment with a specific software update server,
60
- # which must exist in the JSS, and be listed in JSS::SoftwareUpdateServer.all_names
61
- ns.swu_server = "Main SWU Server"
62
-
63
- # Create the new network segment in the JSS
64
- ns.create
65
- ```
66
-
67
- ## USAGE
68
-
69
- ### Connecting to the API
70
-
71
- Before you can work with JSS Objects via the API, you have to connect to it.
72
-
73
- The constant {JSS::API} contains the connection to the API (a singleton instance of {JSS::APIConnection}). When the JSS Module is first loaded, it isn't
74
- connected. To remedy that, use JSS::API.connect, passing it values for :user, :pw, and :server:
75
-
76
- ```ruby
77
- JSS::API.connect :user => jss_user, :pw => jss_user_pw, :server => jss_server_hostname
78
- ```
79
-
80
- Make sure the user has privileges in the JSS to do things with API Objects.
81
-
82
- The {JSS::API#connect} method also accepts the symbols :stdin and :prompt as values for :pw, which will cause it to read the
83
- password from stdin, or prompt for it in the shell. See the JSS::APIConnection class for more connection options and details about its methods.
84
-
85
- Also see {JSS::Configuration}, and the CONFIGURATION section below, for how to store
86
- server connection parameters in a simple config file.
87
-
88
- ### Working with JSS Objects (a.k.a REST Resources)
89
-
90
- All API Object classes are subclasses of JSS::APIObject and share methods for listing, retrieving, and deleting from the JSS. All supported objects can be listed, retrieved and deleted, but only some can be updated or created. Those classes do so by mixing in the JSS::Creatable and/or JSS::Updateable modules. See below for the level of implementation of each class.
91
-
92
- --------
93
-
94
- #### Listing Objects
95
-
96
- To get an Array of every object in the JSS of some Class, call that Class's .all method:
97
-
98
- ```ruby
99
- JSS::Computer.all # => [{:name=>"cephei", :id=>1122},{:name=>"peterparker", :id=>1218}, {:name=>"rowdy", :id=>931}, ...]
100
- ```
101
-
102
- The Array will contain a Hash for each item, with at least a :name and an :id. Some classes provide more data for each item.
103
- To get just the names or just the ids in an Array, use the .all\_names or .all\_ids Class method
104
-
105
- ```ruby
106
- JSS::Computer.all_names # => ["cephei", "peterparker", "rowdy", ...]
107
- JSS::Computer.all_ids # => [1122, 1218, 931, ...]
108
- ```
109
-
110
- Some Classes provide other ways to list objects, depending on the data available, e.g. JSS::MobileDevice.all\_udids
111
-
112
- --------
113
-
114
- #### Retrieving Objects
115
-
116
- To retrieve a single object call the object's constructor (.new) and provide either :name or :id or :data.
117
-
118
- * :name or :id will be looked up via the API
119
-
120
- ```ruby
121
- a_dept = JSS::Department.new :name => "Payroll" # => #<JSS::Department:0x10b4c0818...
122
- ```
123
-
124
- * :data must be the parsed JSON output of a separate API query (a hash with symbolized keys)
125
-
126
- ```ruby
127
- dept_data = JSS::API.get_rsrc("departments/name/Payroll")[:department] # => {:name=>"Payroll", :id=>42}
128
- a_dept = JSS::Department.new :data => dept_data # => #<JSS::Department:0x10b4a83f8...
129
- ```
130
-
131
- Some subclasses can use more than just the :id and :name keys for lookups, e.g. computers can be looked up with :udid, :serial_number, or :mac_address.
132
-
133
- --------
134
-
135
- #### Creating Objects
136
-
137
- Some Objects can be created anew in the JSS. To make a new object, first instantiate one using :id => :new, and provide a unique :name.
138
-
139
- ```ruby
140
- new_pkg = JSS::Package.new :id => :new, :name => "transmogrifier-2.3-1.pkg"
141
- ```
142
-
143
- Then set the attributes of the new object as needed
144
-
145
- ```ruby
146
- new_pkg.reboot_required = false
147
- new_pkg.category = "CoolTools"
148
- # etc..
149
- ```
150
-
151
- Then use the #create method to create it in the JSS.
152
-
153
- ```ruby
154
- new_pkg.create # => 453 # the id number of the object just created
155
- ```
156
-
157
- *NOTE* some subclasses require more data than just a :name when instantiating with :id => :new.
158
-
159
- --------
160
-
161
- #### Updating Objects
162
-
163
- Some objects can be modified in the JSS.
164
-
165
- ```ruby
166
- existing_script = JSS::Script.new :id => 321
167
- existing_script.name = "transmogrifier-2.3-1.post-install"
168
- ```
169
-
170
- After changing any attributes, use the #update method (also aliased to #save) to push the changes to the JSS.
171
-
172
- ```ruby
173
- existing_script.update # or existing_script.save => true # the update was successful
174
- ```
175
-
176
- --------
177
-
178
- #### Deleting Objects
179
-
180
- To delete an object, just call its #delete method
181
-
182
- ```ruby
183
- existing_script = JSS::Script.new :id => 321
184
- existing_script.delete # => true # the delete was successful
185
- ```
186
-
187
- See JSS::APIObject, the parent class of all API resources, for general information about creating, reading, updating/saving, and deleting resources.
188
-
189
- See the individual subclasses for any details specific to them.
190
-
191
- ## OBJECTS IMPLEMENTED
192
-
193
- See each Class's documentation for details.
194
-
195
- ### Creatable and Updatable
196
-
197
- * {JSS::AdvancedComputerSearch}
198
- * {JSS::AdvancedMobileDeviceSearch}
199
- * {JSS::AdvancedUserSearch}
200
- * {JSS::Building}
201
- * {JSS::Category}
202
- * {JSS::ComputerExtensionAttribute}
203
- * {JSS::ComputerGroup}
204
- * {JSS::Department}
205
- * {JSS::MobileDeviceExtensionAttribute}
206
- * {JSS::MobileDeviceGroup}
207
- * {JSS::NetworkSegment}
208
- * {JSS::Package}
209
- * {JSS::Peripheral}
210
- * {JSS::PeripheralType}
211
- * {JSS::RemovableMacAddress}
212
- * {JSS::Script}
213
- * {JSS::User}
214
- * {JSS::UserExtensionAttribute}
215
- * {JSS::UserGroup}
216
-
217
- ### Updatable but not Creatable
218
-
219
- * {JSS::Computer} - limited to modifying
220
- * name
221
- * barcodes
222
- * asset tag
223
- * ip address
224
- * location data
225
- * purchasing data
226
- * editable extension attributes
227
- * {JSS::MobileDevice} - limited to modifying
228
- * asset tag
229
- * location data
230
- * purchasing data
231
- * editable extension attributes
232
- * {JSS::Policy} - limited to modifying
233
- * scope (see {JSS::Scopable::Scope})
234
- * name
235
- * enabled
236
- * category
237
- * triggers
238
- * file & process actions
239
-
240
- **NOTE** Even in the API and the WebApp, Computer and Mobile Device data gathered by an Inventory Upate (a.k.a. 'recon') is not editable.
241
-
242
- ### Read-Only
243
-
244
- These must be created and edited via the JSS WebApp
245
-
246
- * {JSS::DistributionPoint}
247
- * {JSS::LDAPServer}
248
- * {JSS::NetBootServer}
249
- * {JSS::SoftwareUpdateServer}
250
-
251
- ### Deletable
252
-
253
- All supported API Objects can be deleted
254
-
255
- Other useful classes:
256
-
257
- * {JSS::Server} - An encapsulation of some info about the server, such as the JSS version and license. An instance is available as an attribute of the {JSS::APIConnection} singleton.
258
- * {JSS::Client} - An object representing the local machine as a Casper-managed client, and JAMF-related info and methods
259
-
260
- ## CONFIGURATION
261
-
262
- The {JSS::Configuration} singleton class is used to read, write, and use site-specific defaults for the JSS module. When the Module is required, the single instance of {JSS::Configuration} is created and stored in the constant {JSS::CONFIG}. At that time the system-wide file /etc/jss_gem.conf is examined if it exists, and the items in it are loaded into the attributes of {JSS::CONFIG}. The user-specific file ~/.jss_gem.conf then is examined if it exists, and any items defined there will override those values from the system-wide file.
263
-
264
- The values defined in those files are used as defaults throughout the module. Currently, those values are only related to establishing the API connection. For example, if a server name is defined, then a :server does not have to be specified when calling {JSS::API#connect}. Values provided explicitly when calling JSS::API.connect will override the config values.
265
-
266
- While the {JSS::Configuration} class provides methods for changing the values, saving the files, and re-reading them, or reading an arbitrary file, the files are text files with a simple format, and can be created by any means desired. The file format is one attribute per line, thus:
267
-
268
- attr_name: value
269
-
270
- Lines that don’t start with a known attribute name followed by a colon are ignored. If an attribute is defined more than once, the last one wins.
271
-
272
- The currently known attributes are:
273
-
274
- * api_server_name [String] the hostname of the JSS API server
275
- * api_server_port [Integer] the port number for the API connection
276
- * api_verify_cert [Boolean] 'true' or 'false' - if SSL is used, should the certificate be verified? (usually false for a self-signed cert)
277
- * api_username [String] the JSS username for connecting to the API
278
- * api_timeout_open [Integer] the number of seconds for the open-connection timeout
279
- * api_timeout [Integer] the number of seconds for the response timeout
280
-
281
- To put a standard server & username on all client machines, and auto-accept the JSS's self-signed https certificate, create the file /etc/jss_gem.conf containing three lines like this:
282
-
283
- ```
284
- api_server_name: casper.myschool.edu
285
- api_username: readonly-api-user
286
- api_verify_cert: false
287
- ```
288
-
289
- and then any calls to {JSS::API.connect} will assume that server and username, and won't complain about the self-signed certificate.
290
-
291
- ### Passwords
292
-
293
- The config files don't store passwords and the {JSS::Configuration} instance doesn't work with them. You'll have to use your own methods for acquiring the password for the JSS::API.connect call.
294
-
295
- The {JSS::API#connect} method also accepts the symbols :stdin# and :prompt as values for the :pw argument, which will cause it to read the password from a line of stdin, or prompt for it in the shell.
296
-
297
- If you must store a password in a file, or retrieve it from the network, make sure it's stored securely, and that the JSS user has limited permissions.
298
-
299
- Here's an example of how to use a password stored in a file:
300
-
301
- ```ruby
302
- password = File.read "/path/to/secure/password/file" # read the password from a file
303
- JSS::API.connect :pw => password # other arguments used from the config settings
304
- ```
305
-
306
- And here's an example of how to read a password from a web server and use it.
307
-
308
- ```ruby
309
- require 'open-uri'
310
- password = open('http://server.org.org/path/to/password').read
311
- JSS::API.connect :pw => password # other arguments used from the config settings
312
- ```
313
-
314
- ## BEYOND THE API
315
-
316
- While the Casper API provides access to object data in the JSS, this gem tries to use that data to provide more than just information exchange. Here are some examples of how we use the API data to provide functionality found in various Casper tools:
317
-
318
- * Client Machine Access
319
- * The {JSS::Client} module provides the ability to run jamf binary commands, and access the local cache of package receipts
320
- * Package Installation
321
- * {JSS::Package} objects can be installed on the local machine, from the appropriate distribution point
322
- * Script Execution
323
- * {JSS::Script} objects can be executed locally on demand
324
- * Package Creation
325
- * The {JSS::Composer} module provides creation of very simple .pkg and .dmg packages
326
- * {JSS::Package} objects can upload their .pkg or .dmg files to the master distribution point ({JSS::Script} objects can also if you store them there.)
327
- * Reporting/AdvancedSearch exporting
328
- * {JSS::AdvancedSearch} subclasses can export their results to csv, tab, and xml files.
329
- * LDAP Access
330
- * {JSS::LDAPServer} objects can query the LDAP servers for user, group, and membership data.
331
- * MDM Commands
332
- * {JSS::MobileDevice}s (and eventually {JSS::Computer}s) can be sent MDM commands
333
- * Extension Attributes
334
- * {JSS::ExtensionAttribute} work with {JSS::AdvancedSearch} subclasses to provide extra reporting about Ext. Attrib. values.
335
-
336
- ## REQUIREMENTS
337
-
338
- the JSS gem was written for:
339
-
340
- * Mac OS X 10.8 and higher
341
- * Casper Suite version 9.4 or higher
342
- * Casper 9.4 - 9.6 require Ruby 1.8.7 and higher
343
- * Casper >= 9.61 require Ruby 1.9.3 and higher
344
-
345
- It also requires these gems, which will be installed automatically if you install JSS with `gem install jss`
346
-
347
- * rest-client >=1.6.7 ( >= 1.7.0 with Casper >= 9.6.1) http://rubygems.org/gems/rest-client
348
- * json or json\_pure >= 1.6.5 http://rubygems.org/gems/json or http://rubygems.org/gems/json_pure
349
- * (only in ruby 1.8.7. Ruby >= 1.9 has json in its standard library)
350
- * ruby-mysql >= 2.9.12 http://rubygems.org/gems/ruby-mysql
351
- * (only for a few things that still require direct SQL access to the JSS database)
352
- * plist =3.1.0 http://rubygems.org/gems/plist
353
- * for the {JSS::Composer} module and {JSS::Client} class
354
- * net-ldap >= 0.3.1 http://rubygems.org/gems/net-ldap
355
- * for accessing the LDAP servers defined in the JSS, to check for user and group info.
356
-
357
- ## INSTALL
358
-
359
- NOTE: You may need to install XCode, and it's CLI tools, in order to install the required gems.
360
-
361
- In general, you can install the JSS Gem with this command:
362
-
363
- `gem install jss-api`
364
-
365
- If you're using Ruby 1.8.7 (Casper 9.4 - 9.6 only), install the following gems manually first, since the JSS gem will try to install newer, incompatible versions if they aren't pre-installed.
366
-
367
- `gem install json -v 1.6.5`
368
-
369
- `gem install mime-types -v 1.25.1`
370
-
371
- `gem install rest-client -v 1.6.8`
372
-
373
- ## LICENSE
374
-
375
- Copyright 2016 Pixar
376
-
377
- Licensed under the Apache License, Version 2.0 (the "Apache License")
378
- with the following modification; you may not use this file except in
379
- compliance with the Apache License and the following modification to it:
380
-
381
- Section 6. Trademarks. is deleted and replaced with:
382
-
383
- 6\. Trademarks. This License does not grant permission to use the trade
384
- names, trademarks, service marks, or product names of the Licensor
385
- and its affiliates, except as required to comply with Section 4(c) of
386
- the License and to reproduce the content of the NOTICE file.
387
-
388
- You may obtain a copy of the Apache License at
389
-
390
- http://www.apache.org/licenses/LICENSE-2.0
391
-
392
- Unless required by applicable law or agreed to in writing, software
393
- distributed under the Apache License with the above modification is
394
- distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
395
- KIND, either express or implied. See the Apache License for the specific
396
- language governing permissions and limitations under the Apache License.