ruby-jss 0.6.5 → 0.6.6
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 +57 -5
- data/lib/jss.rb +78 -94
- data/lib/jss/api_connection.rb +8 -0
- data/lib/jss/api_object.rb +126 -102
- data/lib/jss/api_object/creatable.rb +33 -15
- data/lib/jss/api_object/distribution_point.rb +4 -1
- data/lib/jss/api_object/extension_attribute.rb +1 -1
- data/lib/jss/api_object/package.rb +121 -187
- data/lib/jss/api_object/policy.rb +590 -251
- data/lib/jss/api_object/script.rb +92 -128
- data/lib/jss/api_object/self_servable.rb +93 -117
- data/lib/jss/api_object/updatable.rb +12 -27
- data/lib/jss/api_object/uploadable.rb +12 -15
- data/lib/jss/client.rb +178 -156
- data/lib/jss/db_connection.rb +34 -49
- data/lib/jss/ruby_extensions/string.rb +25 -21
- data/lib/jss/version.rb +1 -1
- data/lib/jss/webhooks.rb +52 -0
- data/lib/jss/webhooks/README.md +269 -0
- data/lib/jss/webhooks/configuration.rb +212 -0
- data/lib/jss/webhooks/data/sample_handlers/RestAPIOperation-executable +90 -0
- data/lib/jss/webhooks/data/sample_handlers/RestAPIOperation.rb +44 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerAdded.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerCheckIn.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerInventoryCompleted.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerPolicyFinished.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerPushCapabilityChanged.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/JSSShutdown.json +14 -0
- data/lib/jss/webhooks/data/sample_jsons/JSSStartup.json +14 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceCheckIn.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceCommandCompleted.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceEnrolled.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDevicePushSent.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceUnEnrolled.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/PatchSoftwareTitleUpdated.json +14 -0
- data/lib/jss/webhooks/data/sample_jsons/PushSent.json +11 -0
- data/lib/jss/webhooks/data/sample_jsons/RestAPIOperation.json +15 -0
- data/lib/jss/webhooks/data/sample_jsons/SCEPChallenge.json +10 -0
- data/lib/jss/webhooks/data/sample_jsons/SmartGroupComputerMembershipChange.json +13 -0
- data/lib/jss/webhooks/data/sample_jsons/SmartGroupMobileDeviceMembershipChange.json +13 -0
- data/lib/jss/webhooks/event.rb +138 -0
- data/lib/jss/webhooks/event/computer_added.rb +37 -0
- data/lib/jss/webhooks/event/computer_check_in.rb +37 -0
- data/lib/jss/webhooks/event/computer_inventory_completed.rb +37 -0
- data/lib/jss/webhooks/event/computer_policy_finished.rb +37 -0
- data/lib/jss/webhooks/event/computer_push_capability_changed.rb +37 -0
- data/lib/jss/webhooks/event/handlers.rb +191 -0
- data/lib/jss/webhooks/event/jss_shutdown.rb +37 -0
- data/lib/jss/webhooks/event/jss_startup.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_check_in.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_command_completed.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_enrolled.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_push_sent.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_unenrolled.rb +37 -0
- data/lib/jss/webhooks/event/patch_software_title_updated.rb +37 -0
- data/lib/jss/webhooks/event/push_sent.rb +37 -0
- data/lib/jss/webhooks/event/rest_api_operation.rb +37 -0
- data/lib/jss/webhooks/event/scep_challenge.rb +37 -0
- data/lib/jss/webhooks/event/smart_group_computer_membership_change.rb +37 -0
- data/lib/jss/webhooks/event/smart_group_mobile_device_membership_change.rb +37 -0
- data/lib/jss/webhooks/event/webhook.rb +39 -0
- data/lib/jss/webhooks/event_objects.rb +111 -0
- data/lib/jss/webhooks/event_objects/computer.rb +48 -0
- data/lib/jss/webhooks/event_objects/jss.rb +35 -0
- data/lib/jss/webhooks/event_objects/mobile_device.rb +47 -0
- data/lib/jss/webhooks/event_objects/patch_software_title_update.rb +37 -0
- data/lib/jss/webhooks/event_objects/push.rb +32 -0
- data/lib/jss/webhooks/event_objects/rest_api_operation.rb +36 -0
- data/lib/jss/webhooks/event_objects/scep_challenge.rb +31 -0
- data/lib/jss/webhooks/event_objects/smart_group.rb +34 -0
- data/lib/jss/webhooks/server_app.rb +36 -0
- data/lib/jss/webhooks/server_app/routes.rb +26 -0
- data/lib/jss/webhooks/server_app/routes/handle_webhook_event.rb +38 -0
- data/lib/jss/webhooks/server_app/routes/home.rb +36 -0
- data/lib/jss/webhooks/server_app/self_signed_cert.rb +64 -0
- data/lib/jss/webhooks/server_app/server.rb +59 -0
- data/lib/jss/webhooks/version.rb +31 -0
- metadata +63 -4
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
### Copyright 2016 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 JSSWebHooks
|
|
26
|
+
|
|
27
|
+
### An on-the-fly generated, self-signed ssl certificate with
|
|
28
|
+
### matching private key.
|
|
29
|
+
###
|
|
30
|
+
class SelfSignedCert
|
|
31
|
+
require 'openssl'
|
|
32
|
+
DFT_C = "US"
|
|
33
|
+
DFT_ST = "California"
|
|
34
|
+
DFT_L = "Emeryville"
|
|
35
|
+
DFT_O = "Pixar"
|
|
36
|
+
DFT_OU = "MacTeam"
|
|
37
|
+
DFT_CN = "localhost"
|
|
38
|
+
|
|
39
|
+
attr_reader :private_key, :certificate
|
|
40
|
+
|
|
41
|
+
def initialize (args = {})
|
|
42
|
+
args[:c] ||= DFT_C
|
|
43
|
+
args[:st] ||= DFT_ST
|
|
44
|
+
args[:l] ||= DFT_L
|
|
45
|
+
args[:o] ||= DFT_O
|
|
46
|
+
args[:ou] ||= DFT_OU
|
|
47
|
+
args[:cn] ||= DFT_CN
|
|
48
|
+
|
|
49
|
+
name = "/C=#{args[:c]}/ST=#{args[:st]}/L=#{args[:l]}/O=#{args[:o]}/OU=#{args[:ou]}/CN=#{args[:cn]}"
|
|
50
|
+
ca = OpenSSL::X509::Name.parse(name)
|
|
51
|
+
key = OpenSSL::PKey::RSA.new(1024)
|
|
52
|
+
crt = OpenSSL::X509::Certificate.new
|
|
53
|
+
crt.version = 2
|
|
54
|
+
crt.serial = 1
|
|
55
|
+
crt.subject = ca
|
|
56
|
+
crt.issuer = ca
|
|
57
|
+
crt.public_key = key.public_key
|
|
58
|
+
crt.not_before = Time.now
|
|
59
|
+
crt.not_after = Time.now + 1 * 365 * 24 * 60 * 60 # 1 year
|
|
60
|
+
@certificate = crt
|
|
61
|
+
@private_key = key
|
|
62
|
+
end # init
|
|
63
|
+
end # class
|
|
64
|
+
end # module JSSWebHooks
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
### Copyright 2016 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 JSSWebHooks
|
|
26
|
+
|
|
27
|
+
# Sinatra Server
|
|
28
|
+
class Server < Sinatra::Base
|
|
29
|
+
|
|
30
|
+
DEFAULT_SERVER_ENGINE = :webrick
|
|
31
|
+
DEFAULT_PORT = 8443
|
|
32
|
+
|
|
33
|
+
configure do
|
|
34
|
+
server_engine = JSSWebHooks::CONFIG.server_engine || DEFAULT_SERVER_ENGINE
|
|
35
|
+
server_port = JSSWebHooks::CONFIG.server_port || DEFAULT_PORT
|
|
36
|
+
|
|
37
|
+
set :bind, '0.0.0.0'
|
|
38
|
+
set :server, server_engine
|
|
39
|
+
set :port, server_port
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# run the server doing any engine-based config along the way
|
|
43
|
+
def self.run!
|
|
44
|
+
super do |server|
|
|
45
|
+
case server
|
|
46
|
+
when WEBrick::HTTPServer
|
|
47
|
+
webrick_ssl_config server
|
|
48
|
+
end # case
|
|
49
|
+
end # do server
|
|
50
|
+
end # run!
|
|
51
|
+
|
|
52
|
+
def self.webrick_ssl_config(_server)
|
|
53
|
+
# TODO: add ssl config
|
|
54
|
+
true
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end # class
|
|
58
|
+
|
|
59
|
+
end # module
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
### Copyright 2016 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 JSSWebHooks
|
|
27
|
+
|
|
28
|
+
### The version of the JSS WebHooks framework
|
|
29
|
+
VERSION = '0.0.1'
|
|
30
|
+
|
|
31
|
+
end # module
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-jss
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Lasell
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-12-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: plist
|
|
@@ -170,6 +170,66 @@ files:
|
|
|
170
170
|
- lib/jss/server.rb
|
|
171
171
|
- lib/jss/utility.rb
|
|
172
172
|
- lib/jss/version.rb
|
|
173
|
+
- lib/jss/webhooks.rb
|
|
174
|
+
- lib/jss/webhooks/README.md
|
|
175
|
+
- lib/jss/webhooks/configuration.rb
|
|
176
|
+
- lib/jss/webhooks/data/sample_handlers/RestAPIOperation-executable
|
|
177
|
+
- lib/jss/webhooks/data/sample_handlers/RestAPIOperation.rb
|
|
178
|
+
- lib/jss/webhooks/data/sample_jsons/ComputerAdded.json
|
|
179
|
+
- lib/jss/webhooks/data/sample_jsons/ComputerCheckIn.json
|
|
180
|
+
- lib/jss/webhooks/data/sample_jsons/ComputerInventoryCompleted.json
|
|
181
|
+
- lib/jss/webhooks/data/sample_jsons/ComputerPolicyFinished.json
|
|
182
|
+
- lib/jss/webhooks/data/sample_jsons/ComputerPushCapabilityChanged.json
|
|
183
|
+
- lib/jss/webhooks/data/sample_jsons/JSSShutdown.json
|
|
184
|
+
- lib/jss/webhooks/data/sample_jsons/JSSStartup.json
|
|
185
|
+
- lib/jss/webhooks/data/sample_jsons/MobileDeviceCheckIn.json
|
|
186
|
+
- lib/jss/webhooks/data/sample_jsons/MobileDeviceCommandCompleted.json
|
|
187
|
+
- lib/jss/webhooks/data/sample_jsons/MobileDeviceEnrolled.json
|
|
188
|
+
- lib/jss/webhooks/data/sample_jsons/MobileDevicePushSent.json
|
|
189
|
+
- lib/jss/webhooks/data/sample_jsons/MobileDeviceUnEnrolled.json
|
|
190
|
+
- lib/jss/webhooks/data/sample_jsons/PatchSoftwareTitleUpdated.json
|
|
191
|
+
- lib/jss/webhooks/data/sample_jsons/PushSent.json
|
|
192
|
+
- lib/jss/webhooks/data/sample_jsons/RestAPIOperation.json
|
|
193
|
+
- lib/jss/webhooks/data/sample_jsons/SCEPChallenge.json
|
|
194
|
+
- lib/jss/webhooks/data/sample_jsons/SmartGroupComputerMembershipChange.json
|
|
195
|
+
- lib/jss/webhooks/data/sample_jsons/SmartGroupMobileDeviceMembershipChange.json
|
|
196
|
+
- lib/jss/webhooks/event.rb
|
|
197
|
+
- lib/jss/webhooks/event/computer_added.rb
|
|
198
|
+
- lib/jss/webhooks/event/computer_check_in.rb
|
|
199
|
+
- lib/jss/webhooks/event/computer_inventory_completed.rb
|
|
200
|
+
- lib/jss/webhooks/event/computer_policy_finished.rb
|
|
201
|
+
- lib/jss/webhooks/event/computer_push_capability_changed.rb
|
|
202
|
+
- lib/jss/webhooks/event/handlers.rb
|
|
203
|
+
- lib/jss/webhooks/event/jss_shutdown.rb
|
|
204
|
+
- lib/jss/webhooks/event/jss_startup.rb
|
|
205
|
+
- lib/jss/webhooks/event/mobile_device_check_in.rb
|
|
206
|
+
- lib/jss/webhooks/event/mobile_device_command_completed.rb
|
|
207
|
+
- lib/jss/webhooks/event/mobile_device_enrolled.rb
|
|
208
|
+
- lib/jss/webhooks/event/mobile_device_push_sent.rb
|
|
209
|
+
- lib/jss/webhooks/event/mobile_device_unenrolled.rb
|
|
210
|
+
- lib/jss/webhooks/event/patch_software_title_updated.rb
|
|
211
|
+
- lib/jss/webhooks/event/push_sent.rb
|
|
212
|
+
- lib/jss/webhooks/event/rest_api_operation.rb
|
|
213
|
+
- lib/jss/webhooks/event/scep_challenge.rb
|
|
214
|
+
- lib/jss/webhooks/event/smart_group_computer_membership_change.rb
|
|
215
|
+
- lib/jss/webhooks/event/smart_group_mobile_device_membership_change.rb
|
|
216
|
+
- lib/jss/webhooks/event/webhook.rb
|
|
217
|
+
- lib/jss/webhooks/event_objects.rb
|
|
218
|
+
- lib/jss/webhooks/event_objects/computer.rb
|
|
219
|
+
- lib/jss/webhooks/event_objects/jss.rb
|
|
220
|
+
- lib/jss/webhooks/event_objects/mobile_device.rb
|
|
221
|
+
- lib/jss/webhooks/event_objects/patch_software_title_update.rb
|
|
222
|
+
- lib/jss/webhooks/event_objects/push.rb
|
|
223
|
+
- lib/jss/webhooks/event_objects/rest_api_operation.rb
|
|
224
|
+
- lib/jss/webhooks/event_objects/scep_challenge.rb
|
|
225
|
+
- lib/jss/webhooks/event_objects/smart_group.rb
|
|
226
|
+
- lib/jss/webhooks/server_app.rb
|
|
227
|
+
- lib/jss/webhooks/server_app/routes.rb
|
|
228
|
+
- lib/jss/webhooks/server_app/routes/handle_webhook_event.rb
|
|
229
|
+
- lib/jss/webhooks/server_app/routes/home.rb
|
|
230
|
+
- lib/jss/webhooks/server_app/self_signed_cert.rb
|
|
231
|
+
- lib/jss/webhooks/server_app/server.rb
|
|
232
|
+
- lib/jss/webhooks/version.rb
|
|
173
233
|
- lib/ruby-jss.rb
|
|
174
234
|
homepage: http://pixaranimationstudios.github.io/ruby-jss/
|
|
175
235
|
licenses:
|
|
@@ -196,9 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
196
256
|
version: '0'
|
|
197
257
|
requirements: []
|
|
198
258
|
rubyforge_project:
|
|
199
|
-
rubygems_version: 2.6.
|
|
259
|
+
rubygems_version: 2.6.8
|
|
200
260
|
signing_key:
|
|
201
261
|
specification_version: 4
|
|
202
262
|
summary: A Ruby interface to the Casper Suite's JSS API
|
|
203
263
|
test_files: []
|
|
204
|
-
has_rdoc: true
|