ruby_aem 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4d453de388f2dc00342d36f11040e2dff294a4dc
4
+ data.tar.gz: b60ea29a13c060f5ff2cb4d7dfa6d2c774bfe68b
5
+ SHA512:
6
+ metadata.gz: 1e3f54abe4d1764f61a1eddb6dc8450f6b907b264c4bb23a62b077a7f30ccd4720c8e2438edfa748854ed6305a4be7127d55e6e54caf8b5b6a33c7aa1d93ec68
7
+ data.tar.gz: 0147ebd982bb243ba129958f588d4a9ddc89c788c2591f2750416b1152f6818566d8d54ab6e42f5709166dd1a15e8c632af23d259887e47b801dae98e5afb047
data/conf/spec.yaml ADDED
@@ -0,0 +1,581 @@
1
+ bundle:
2
+ responses:
3
+ 404:
4
+ status: failure
5
+ handler: simple
6
+ message: 'Bundle %{name} not found'
7
+ actions:
8
+ start:
9
+ api: console
10
+ operation: postBundle
11
+ params:
12
+ required:
13
+ name: '%{name}'
14
+ action: start
15
+ responses:
16
+ 200:
17
+ status: success
18
+ handler: simple
19
+ message: 'Bundle %{name} started'
20
+ stop:
21
+ api: console
22
+ operation: postBundle
23
+ params:
24
+ required:
25
+ name: '%{name}'
26
+ action: stop
27
+ responses:
28
+ 200:
29
+ status: success
30
+ handler: simple
31
+ message: 'Bundle %{name} stopped'
32
+ flushagent:
33
+ responses:
34
+ 404:
35
+ status: failure
36
+ handler: simple
37
+ message: 'Flush agent %{name} not found on %{run_mode}'
38
+ actions:
39
+ create_update:
40
+ api: sling
41
+ operation: postAgent
42
+ params:
43
+ required:
44
+ runmode: '%{run_mode}'
45
+ name: '%{name}'
46
+ optional:
47
+ jcrprimary_type: cq:Page
48
+ jcrcontentcqname: '%{name}'
49
+ jcrcontentjcrtitle: '%{title}'
50
+ jcrcontentjcrdescription: '%{description}'
51
+ jcrcontentslingresource_type: /libs/cq/replication/components/agent
52
+ jcrcontenttransport_uri: '%{dest_base_url}/dispatcher/invalidate.cache'
53
+ jcrcontentlog_level: error
54
+ jcrcontentno_versioning: true
55
+ jcrcontentprotocol_http_headers:
56
+ - 'CQ-Action:{action}'
57
+ - 'CQ-Handle:{path}'
58
+ - 'CQ-Path:{path}'
59
+ jcrcontentprotocol_http_headers_type_hint: String[]
60
+ jcrcontentprotocol_http_method: GET
61
+ jcrcontentretry_delay: 30000
62
+ jcrcontentserialization_type: flush
63
+ jcrcontentjcrmixin_types: cq:ReplicationStatus
64
+ jcrcontenttrigger_receive: true
65
+ jcrcontenttrigger_specific: true
66
+ jcrcontentcqtemplate: /libs/cq/replication/templates/agent
67
+ jcrcontentenabled: true
68
+ responses:
69
+ 200:
70
+ status: success
71
+ handler: simple
72
+ message: 'Flush agent %{name} updated on %{run_mode}'
73
+ 201:
74
+ status: success
75
+ handler: simple
76
+ message: 'Flush agent %{name} created on %{run_mode}'
77
+ delete:
78
+ api: sling
79
+ operation: deleteAgent
80
+ params:
81
+ required:
82
+ runmode: '%{run_mode}'
83
+ name: '%{name}'
84
+ responses:
85
+ 204:
86
+ status: success
87
+ handler: simple
88
+ message: 'Flush agent %{name} deleted on %{run_mode}'
89
+ exists:
90
+ api: sling
91
+ operation: getAgent
92
+ params:
93
+ required:
94
+ runmode: '%{run_mode}'
95
+ name: '%{name}'
96
+ responses:
97
+ 302:
98
+ status: success
99
+ handler: simple
100
+ message: 'Flush agent %{name} exists on %{run_mode}'
101
+ group:
102
+ responses:
103
+ 404:
104
+ status: failure
105
+ handler: simple
106
+ message: 'Group %{name} not found'
107
+ actions:
108
+ create:
109
+ api: sling
110
+ operation: postAuthorizables
111
+ params:
112
+ required:
113
+ authorizable_id: '%{name}'
114
+ intermediate_path: '%{path}'
115
+ optional:
116
+ create_group: ''
117
+ profilegiven_name: '%{name}'
118
+ responses:
119
+ 201:
120
+ status: success
121
+ handler: html_authorizable_id
122
+ message: 'Group %{name} created at %{path}/%{authorizable_id}'
123
+ find_authorizable_id:
124
+ api: sling
125
+ operation: postQuery
126
+ params:
127
+ required:
128
+ path: '%{path}'
129
+ p_limit: '-1'
130
+ _1_property: rep:authorizableId
131
+ _1_property_value: '%{name}'
132
+ responses:
133
+ 200:
134
+ status: success
135
+ handler: json_authorizable_id
136
+ message: 'Found group %{name} authorizable ID %{authorizable_id}'
137
+ delete:
138
+ api: sling
139
+ operation: deleteNode
140
+ params:
141
+ required:
142
+ path: '%{path}'
143
+ name: '%{authorizable_id}'
144
+ responses:
145
+ 204:
146
+ status: success
147
+ handler: simple
148
+ message: 'Group %{name} deleted at /%{path}/%{authorizable_id}'
149
+ exists:
150
+ api: sling
151
+ operation: getNode
152
+ params:
153
+ required:
154
+ path: '%{path}'
155
+ name: '%{authorizable_id}'
156
+ responses:
157
+ 302:
158
+ status: success
159
+ handler: simple
160
+ message: 'Group %{name} exists at /%{path}/%{authorizable_id}'
161
+ set_permission:
162
+ api: cq
163
+ operation: postCqActions
164
+ params:
165
+ required:
166
+ authorizable_id: '%{name}'
167
+ changelog: 'path:%{permission_path},%{permission_csv}'
168
+ responses:
169
+ 200:
170
+ status: success
171
+ handler: simple
172
+ message: 'Permission %{permission_csv} on path %{permission_path} set for group %{name}'
173
+ add_member:
174
+ api: sling
175
+ operation: postNodeRw
176
+ params:
177
+ required:
178
+ path: '%{path}'
179
+ name: '%{authorizable_id}'
180
+ optional:
181
+ add_members: '%{member}'
182
+ responses:
183
+ 200:
184
+ status: success
185
+ handler: simple
186
+ message: 'User/group %{member} added to group %{name}'
187
+ node:
188
+ responses:
189
+ 404:
190
+ status: failure
191
+ handler: simple
192
+ message: 'Node %{path}/%{name} not found'
193
+ actions:
194
+ create:
195
+ api: sling
196
+ operation: postPath
197
+ params:
198
+ required:
199
+ path: '%{path}'
200
+ jcrprimary_type: '%{type}'
201
+ name: '%{name}'
202
+ responses:
203
+ 201:
204
+ status: success
205
+ handler: simple
206
+ message: 'Node %{path}/%{name} created'
207
+ delete:
208
+ api: sling
209
+ operation: deleteNode
210
+ params:
211
+ required:
212
+ path: '%{path}'
213
+ name: '%{name}'
214
+ responses:
215
+ 204:
216
+ status: success
217
+ handler: simple
218
+ message: 'Node %{path}/%{name} deleted'
219
+ exists:
220
+ api: sling
221
+ operation: getNode
222
+ params:
223
+ required:
224
+ path: '%{path}'
225
+ name: '%{name}'
226
+ responses:
227
+ 302:
228
+ status: success
229
+ handler: simple
230
+ message: 'Node %{path}/%{name} exists'
231
+ package:
232
+ actions:
233
+ create:
234
+ api: crx
235
+ operation: postPackageServiceJson
236
+ params:
237
+ required:
238
+ path: 'etc/packages/%{group_name}'
239
+ cmd: create
240
+ optional:
241
+ group_name: '%{group_name}'
242
+ package_name: '%{package_name}'
243
+ package_version: '%{package_version}'
244
+ charset: utf-8
245
+ responses:
246
+ 200:
247
+ status: success
248
+ handler: json_package_service
249
+ update:
250
+ api: crx
251
+ operation: postPackageUpdate
252
+ params:
253
+ required:
254
+ groupName: '%{group_name}'
255
+ packageName: '%{package_name}'
256
+ version: '%{package_version}'
257
+ path: '/etc/packages/%{group_name}/%{package_name}-%{package_version}.zip'
258
+ optional:
259
+ filter: '%{filter}'
260
+ charset: utf-8
261
+ responses:
262
+ 200:
263
+ status: success
264
+ handler: json_package_service
265
+ delete:
266
+ api: crx
267
+ operation: postPackageServiceJson
268
+ params:
269
+ required:
270
+ path: 'etc/packages/%{group_name}/%{package_name}-%{package_version}.zip'
271
+ cmd: delete
272
+ responses:
273
+ 200:
274
+ status: success
275
+ handler: json_package_service
276
+ build:
277
+ api: crx
278
+ operation: postPackageServiceJson
279
+ params:
280
+ required:
281
+ path: 'etc/packages/%{group_name}/%{package_name}-%{package_version}.zip'
282
+ cmd: build
283
+ responses:
284
+ 200:
285
+ status: success
286
+ handler: json_package_service
287
+ install:
288
+ api: crx
289
+ operation: postPackageServiceJson
290
+ params:
291
+ required:
292
+ path: 'etc/packages/%{group_name}/%{package_name}-%{package_version}.zip'
293
+ cmd: install
294
+ responses:
295
+ 200:
296
+ status: success
297
+ handler: json_package_service
298
+ replicate:
299
+ api: crx
300
+ operation: postPackageServiceJson
301
+ params:
302
+ required:
303
+ path: 'etc/packages/%{group_name}/%{package_name}-%{package_version}.zip'
304
+ cmd: replicate
305
+ responses:
306
+ 200:
307
+ status: success
308
+ handler: json_package_service
309
+ download:
310
+ api: sling
311
+ operation: getPackage
312
+ params:
313
+ required:
314
+ group: '%{group_name}'
315
+ name: '%{package_name}'
316
+ version: '%{package_version}'
317
+ responses:
318
+ 200:
319
+ status: success
320
+ handler: file_download
321
+ message: 'Package downloaded to %{file_path}/%{package_name}-%{package_version}.zip'
322
+ upload:
323
+ api: crx
324
+ operation: postPackageServiceJson
325
+ params:
326
+ required:
327
+ path: ''
328
+ cmd: upload
329
+ optional:
330
+ force: '%{force}'
331
+ package: __FILE__
332
+ responses:
333
+ 200:
334
+ status: success
335
+ handler: json_package_service
336
+ get_filter:
337
+ api: sling
338
+ operation: getPackageFilter
339
+ params:
340
+ required:
341
+ group: '%{group_name}'
342
+ name: '%{package_name}'
343
+ version: '%{package_version}'
344
+ responses:
345
+ 200:
346
+ status: success
347
+ handler: json_package_filter
348
+ message: 'Filter retrieved successfully'
349
+ list_all:
350
+ api: crx
351
+ operation: postPackageService
352
+ params:
353
+ required:
354
+ cmd: ls
355
+ responses:
356
+ 200:
357
+ status: success
358
+ handler: xml_package_list
359
+ message: 'Package list retrieved successfully'
360
+ path:
361
+ actions:
362
+ activate:
363
+ api: sling
364
+ operation: postTreeActivation
365
+ params:
366
+ required:
367
+ ignoredeactivated: '%{ignoredeactivated}'
368
+ onlymodified: '%{onlymodified}'
369
+ path: '%{name}'
370
+ responses:
371
+ 200:
372
+ status: success
373
+ handler: simple
374
+ message: 'Path %{name} activated'
375
+ configproperty:
376
+ actions:
377
+ create:
378
+ api: sling
379
+ operation: postPath
380
+ params:
381
+ required:
382
+ runmode: '%{run_mode}'
383
+ name: '%{name}'
384
+ optional:
385
+ - org_apache_felix_https_nio
386
+ - org_apache_felix_https_nio_type_hint
387
+ - org_apache_felix_https_keystore
388
+ - org_apache_felix_https_keystore_type_hint
389
+ - org_apache_felix_https_keystore_password
390
+ - org_apache_felix_https_keystore_password_type_hint
391
+ - org_apache_felix_https_keystore_key
392
+ - org_apache_felix_https_keystore_key_type_hint
393
+ - org_apache_felix_https_keystore_key_password
394
+ - org_apache_felix_https_keystore_key_password_type_hint
395
+ - org_apache_felix_https_truststore
396
+ - org_apache_felix_https_truststore_key_type_hint
397
+ - org_apache_felix_https_truststore_password
398
+ - org_apache_felix_https_truststore_password_type_hint
399
+ - org_apache_felix_https_clientcertificate
400
+ - org_apache_felix_https_clientcertificate_type_hint
401
+ - org_apache_felix_https_enable
402
+ - org_apache_felix_https_enable_type_hint
403
+ - org_osgi_service_http_port_secure
404
+ - org_osgi_service_http_port_secure_type_hint
405
+ responses:
406
+ 200:
407
+ status: success
408
+ handler: simple
409
+ message: 'Set %{run_mode} config %{type} property %{name}=%{value}'
410
+ 201:
411
+ status: success
412
+ handler: simple
413
+ message: 'Set %{run_mode} config %{type} property %{name}=%{value}'
414
+ replicationagent:
415
+ responses:
416
+ 404:
417
+ status: failure
418
+ handler: simple
419
+ message: 'Replication agent %{name} not found on %{run_mode}'
420
+ actions:
421
+ create_update:
422
+ api: sling
423
+ operation: postAgent
424
+ params:
425
+ required:
426
+ runmode: '%{run_mode}'
427
+ name: '%{name}'
428
+ optional:
429
+ jcrprimary_type: cq:Page
430
+ jcrcontentcqname: '%{name}'
431
+ jcrcontentjcrtitle: '%{title}'
432
+ jcrcontentjcrdescription: '%{description}'
433
+ jcrcontentslingresource_type: /libs/cq/replication/components/agent
434
+ jcrcontentserialization_type: durbo
435
+ jcrcontenttransport_uri: '%{dest_base_url}/bin/receive?sling:authRequestLogin=1'
436
+ jcrcontentlog_level: error
437
+ jcrcontentretry_delay: 30000
438
+ jcrcontentcqtemplate: /libs/cq/replication/templates/agent
439
+ jcrcontentenabled: true
440
+ responses:
441
+ 200:
442
+ status: success
443
+ handler: simple
444
+ message: 'Replication agent %{name} updated on %{run_mode}'
445
+ 201:
446
+ status: success
447
+ handler: simple
448
+ message: 'Replication agent %{name} created on %{run_mode}'
449
+ delete:
450
+ api: sling
451
+ operation: deleteAgent
452
+ params:
453
+ required:
454
+ runmode: '%{run_mode}'
455
+ name: '%{name}'
456
+ responses:
457
+ 204:
458
+ status: success
459
+ handler: simple
460
+ message: 'Replication agent %{name} deleted on %{run_mode}'
461
+ exists:
462
+ api: sling
463
+ operation: getAgent
464
+ params:
465
+ required:
466
+ runmode: '%{run_mode}'
467
+ name: '%{name}'
468
+ responses:
469
+ 302:
470
+ status: success
471
+ handler: simple
472
+ message: 'Replication agent %{name} exists on %{run_mode}'
473
+ repository:
474
+ actions:
475
+ block_writes:
476
+ api: console
477
+ operation: postJmxRepository
478
+ params:
479
+ required:
480
+ action: blockRepositoryWrites
481
+ responses:
482
+ 200:
483
+ status: success
484
+ handler: simple
485
+ message: 'Repository writes blocked'
486
+ unblock_writes:
487
+ api: console
488
+ operation: postJmxRepository
489
+ params:
490
+ required:
491
+ action: unblockRepositoryWrites
492
+ responses:
493
+ 200:
494
+ status: success
495
+ handler: simple
496
+ message: 'Repository writes unblocked'
497
+ user:
498
+ responses:
499
+ 404:
500
+ status: failure
501
+ handler: simple
502
+ message: 'User %{name} not found'
503
+ actions:
504
+ create:
505
+ api: sling
506
+ operation: postAuthorizables
507
+ params:
508
+ required:
509
+ authorizable_id: '%{name}'
510
+ intermediate_path: '%{path}'
511
+ optional:
512
+ create_user: ''
513
+ reppassword: '%{password}'
514
+ responses:
515
+ 201:
516
+ status: success
517
+ handler: html_authorizable_id
518
+ message: 'User %{name} created at %{path}/%{authorizable_id}'
519
+ find_authorizable_id:
520
+ api: sling
521
+ operation: postQuery
522
+ params:
523
+ required:
524
+ path: '%{path}'
525
+ p_limit: '-1'
526
+ _1_property: rep:authorizableId
527
+ _1_property_value: '%{name}'
528
+ responses:
529
+ 200:
530
+ status: success
531
+ handler: json_authorizable_id
532
+ message: 'Found user %{name} authorizable ID %{authorizable_id}'
533
+ delete:
534
+ api: sling
535
+ operation: deleteNode
536
+ params:
537
+ required:
538
+ path: '%{path}'
539
+ name: '%{authorizable_id}'
540
+ responses:
541
+ 204:
542
+ status: success
543
+ handler: simple
544
+ message: 'User %{name} deleted at /%{path}/%{authorizable_id}'
545
+ exists:
546
+ api: sling
547
+ operation: getNode
548
+ params:
549
+ required:
550
+ path: '%{path}'
551
+ name: '%{authorizable_id}'
552
+ responses:
553
+ 302:
554
+ status: success
555
+ handler: simple
556
+ message: 'User %{name} exists at /%{path}/%{authorizable_id}'
557
+ set_permission:
558
+ api: cq
559
+ operation: postCqActions
560
+ params:
561
+ required:
562
+ authorizable_id: '%{name}'
563
+ changelog: 'path:%{permission_path},%{permission_csv}'
564
+ responses:
565
+ 200:
566
+ status: success
567
+ handler: simple
568
+ message: 'Permission %{permission_csv} on path %{permission_path} set for user %{name}'
569
+ change_password:
570
+ api: crx
571
+ operation: postSetPassword
572
+ params:
573
+ required:
574
+ old: '%{old_password}'
575
+ plain: '%{new_password}'
576
+ verify: '%{new_password}'
577
+ responses:
578
+ 200:
579
+ status: success
580
+ handler: simple
581
+ message: 'Logged in user password changed'
@@ -0,0 +1,48 @@
1
+ =begin
2
+ Copyright 2016 Shine Solutions
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ module RubyAem
18
+ # Bundle class contains API calls related to managing an AEM bundle.
19
+ class Bundle
20
+
21
+ # Initialise a bundle.
22
+ #
23
+ # @param client RubyAem::Client
24
+ # @param name the bundle's name, e.g. com.adobe.cq.social.cq-social-forum
25
+ # @return new RubyAem::Bundle instance
26
+ def initialize(client, name)
27
+ @client = client
28
+ @info = {
29
+ name: name
30
+ }
31
+ end
32
+
33
+ # Start a bundle.
34
+ #
35
+ # @return RubyAem::Result
36
+ def start
37
+ @client.call(self.class, __callee__.to_s, @info)
38
+ end
39
+
40
+ # Stop a bundle.
41
+ #
42
+ # @return RubyAem::Result
43
+ def stop
44
+ @client.call(self.class, __callee__.to_s, @info)
45
+ end
46
+
47
+ end
48
+ end