synaptic4r 0.1.5

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.
@@ -0,0 +1,605 @@
1
+ ####---------------------------------------------------------------------------------------------------------
2
+ def get_started
3
+ puts <<-EXAMP
4
+
5
+ Get Started
6
+
7
+ Save credentials to #{ENV['HOME']}/.synaptic4r
8
+
9
+ single account
10
+
11
+ subtenant: SubtenantID
12
+ uid: UserID
13
+ key: SecretKey
14
+ site: https://storage.synaptic.att.com/rest
15
+
16
+ multiple accounts (the first is used by default, the dashes must
17
+ be included in the file)
18
+
19
+ -
20
+ account: myacct
21
+ subtenant: SubtenantID
22
+ uid: UserID
23
+ key: SecretKey
24
+ site: https://storage.synaptic.att.com/rest
25
+
26
+ -
27
+ account: myotheracct
28
+ subtenant: OtherSubtenantID
29
+ uid: OtherUserID
30
+ key: OtherSecretKey
31
+ site: https://storage.synaptic.att.com/rest
32
+
33
+ Basic Commands
34
+
35
+ - list contents remote root directory
36
+
37
+ synrest get
38
+
39
+ - create a remote directory named foo
40
+
41
+ synrest create-dir foo
42
+
43
+ - upload a file to directory foo
44
+
45
+ synrest create-file file.txt foo/
46
+
47
+ - list contents remote directory foo
48
+
49
+ synrest get foo
50
+
51
+ - list contents remote file foo/file.txt
52
+
53
+ synrest get foo/file.txt
54
+
55
+ - show more examples for a command
56
+
57
+ synrest command examples
58
+
59
+ - execute command for account other than default
60
+
61
+ synrest command args [options] -u myotheracct
62
+
63
+ Diagnostic Options
64
+
65
+ diagnostic options are supported by all commands
66
+
67
+ -q, --dump do not send request but print headers and service url to STDOUT
68
+ -p, --payload do not send request print payload to STDOUT if present
69
+ -l, --log [file] log request to file (by default file is synaptic4r.log)
70
+ -h, --help command help
71
+
72
+ EXAMP
73
+ end
74
+
75
+ ####---------------------------------------------------------------------------------------------------------
76
+ def create_dir_examples
77
+ puts <<-EXAMP
78
+
79
+ - create a directory named foo
80
+
81
+ synrest create-dir foo
82
+
83
+ - create directory foo/bar automatically creating directories if not present
84
+
85
+ synrest create-dir foo/bar
86
+
87
+ EXAMP
88
+ end
89
+
90
+ ####---------------------------------------------------------------------------------------------------------
91
+ def create_file_examples
92
+ puts <<-EXAMP
93
+
94
+ File creation requires specification of either a remote file name of listable metadata tag.
95
+
96
+ - upload a file to root directory and preserve the file name
97
+
98
+ synrest create-file file.txt
99
+
100
+ - upload a file to root directory and change the file name
101
+
102
+ synrest create-file file.txt otherfile.text
103
+
104
+ - upload a file to directory and preserve the file name
105
+
106
+ synrest create-file file.txt foo/
107
+
108
+ - upload a file to directory and change the file name
109
+
110
+ synrest create-file file.txt foo/otherfile.txt
111
+
112
+ - upload a file to directory automatically creating
113
+ directories if not present
114
+
115
+ synrest create-file foo/bar/file.txt
116
+
117
+ - upload file in 500 byte increments.
118
+
119
+ synrest create-file file.txt -b 0 -d 499
120
+ synrest update file.txt -b 500 -d 999
121
+ synrest update file.txt -b 1000 -d 1499
122
+ synrest update file.txt -b 1500 -d 1999
123
+
124
+ - upload a file and specify listable metadata tags instead of file name. listable
125
+ metadata consists of a name=value pair. specification of the value is
126
+ optional
127
+
128
+ synrest create-file file.txt -i tagged
129
+ synrest create-file file.txt -i tagged=yes,location
130
+
131
+ EXAMP
132
+ end
133
+
134
+ ####---------------------------------------------------------------------------------------------------------
135
+ def create_version_examples
136
+ puts <<-EXAMP
137
+
138
+ #{versioning_things_to_know}
139
+
140
+ Examples
141
+
142
+ - create a version of a file by specifying remote file path
143
+
144
+ bin/synrest create-version file.txt
145
+
146
+ - create a version of a directory and all contained files and directories
147
+ by specifying remote directory path
148
+
149
+ bin/synrest create-version foo
150
+
151
+ - create a version of a storage object by specifying OID
152
+
153
+ bin/synrest create-version -o 4a08bf2ea11f1e0b04a08c466666a804a806bfc20387
154
+
155
+
156
+ EXAMP
157
+ end
158
+
159
+ ####---------------------------------------------------------------------------------------------------------
160
+ def delete_examples
161
+ puts <<-EXAMP
162
+
163
+ - delete file by specifying remote file path
164
+
165
+ synrest delete foo/file.txt
166
+
167
+ - delete directory by specifying remote directory path. delete of a director will fail
168
+ unless the directory is empty.
169
+
170
+ synrest delete foo
171
+
172
+ - delete storage object by specifying OID
173
+
174
+ synrest delete -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
175
+
176
+ EXAMP
177
+ end
178
+
179
+ ####---------------------------------------------------------------------------------------------------------
180
+ def delete_user_metadata_examples
181
+ puts <<-EXAMP
182
+
183
+ #{user_metadata_things_to_know}
184
+
185
+ Examples
186
+
187
+ - delete user metadata for a file by specifying remote file path
188
+
189
+ synrest delete-user-metadata location foo/file.txt
190
+ synrest delete-user-metadata location,capital foo/file.txt
191
+
192
+ - delete user metadata for a directory by specifying remote directory path
193
+
194
+ synrest delete-user-metadata building foo
195
+ synrest delete-user-metadata building,location foo
196
+
197
+ - delete user metadata for a storage object by specifying OID
198
+
199
+ synrest delete-user-metadata building -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
200
+ synrest delete-user-metadata building,location -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
201
+
202
+ EXAMP
203
+ end
204
+
205
+ ####---------------------------------------------------------------------------------------------------------
206
+ def get_examples
207
+ puts <<-EXAMP
208
+
209
+ - get remote root directory listing
210
+
211
+ synrest get
212
+
213
+ - get remote directory listing by specifying directory name
214
+
215
+ synrest get foo
216
+
217
+ - get remote directory listing by specifying OID
218
+
219
+ synrest get -o 4a08bf2ea11f1e0b04a08c4bb666a804a7c5d32a2c63
220
+
221
+ - get file by remote file name
222
+
223
+ synrest get foo/file.txt
224
+
225
+ - get file by specifying OID
226
+
227
+ synrest get -o 4a08bf2ea11f1e0b04a6664b3866a804a7c60fb30b30
228
+
229
+ - get the portion of the file between bytes 50 and 150 specifying byte offsets
230
+ and file name
231
+
232
+ synrest get foo/file.txt -b 50 -d 150
233
+
234
+ EXAMP
235
+ end
236
+
237
+ ####---------------------------------------------------------------------------------------------------------
238
+ def get_acl_examples
239
+ puts <<-EXAMP
240
+
241
+ #{acl_things_to_know}
242
+
243
+ Examples
244
+
245
+ - get access control list for a file by specifying remote file path
246
+
247
+ synrest get-acl foo/file.txt
248
+
249
+ - get access control list for a directory by specifying remote directory path
250
+
251
+ synrest get-acl foo
252
+
253
+ - get access control list for a storage object by specifying OID
254
+
255
+ synrest get-acl -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
256
+
257
+ EXAMP
258
+ end
259
+
260
+ ####---------------------------------------------------------------------------------------------------------
261
+ def get_all_tags_examples
262
+ puts <<-EXAMP
263
+
264
+ #{user_metadata_things_to_know}
265
+
266
+ Examples
267
+
268
+ - get all listable metadata tags used by account
269
+
270
+ synrest get-all-tags
271
+
272
+ EXAMP
273
+ end
274
+
275
+ ####---------------------------------------------------------------------------------------------------------
276
+ def get_by_tag_examples
277
+ puts <<-EXAMP
278
+
279
+ #{user_metadata_things_to_know}
280
+
281
+ - get OIDs for all objects with specified listable metadata tag. only one tag may be specified.
282
+
283
+ synrest get-by-tag location
284
+
285
+ - get all objects with specified listable metadata tag with extended output
286
+
287
+ synrest get-by-tag location -e
288
+
289
+ EXAMP
290
+ end
291
+
292
+ ####---------------------------------------------------------------------------------------------------------
293
+ def get_system_metadata_examples
294
+ puts <<-EXAMP
295
+
296
+ - get system metadata for a file by specifying remote file path
297
+
298
+ synrest get-system-metadata foo/file.txt
299
+
300
+ - get system metadata for a directory by specifying remote directory path
301
+
302
+ synrest get-system-metadata foo
303
+
304
+ - get system metadata for a storage object by specifying OID
305
+
306
+ synrest get-system-metadata -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
307
+
308
+ EXAMP
309
+ end
310
+
311
+ ####---------------------------------------------------------------------------------------------------------
312
+ def get_tags_examples
313
+ puts <<-EXAMP
314
+
315
+ - get listable metadata tags for a file by specifying remote file path
316
+
317
+ synrest get-tags foo/file.txt
318
+
319
+ - get listable metadata tags for a directory by specifying remote directory path
320
+
321
+ synrest get-tags foo
322
+
323
+ - get listable metadata tags for a storage object by specifying OID
324
+
325
+ synrest get-tags -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
326
+
327
+ EXAMP
328
+ end
329
+
330
+ ####---------------------------------------------------------------------------------------------------------
331
+ def get_user_metadata_examples
332
+ puts <<-EXAMP
333
+
334
+ #{user_metadata_things_to_know}
335
+
336
+
337
+ Examples
338
+
339
+ - get user metadata for a file by specifying remote file path
340
+
341
+ synrest get-tags foo/file.txt
342
+
343
+ - get listable metadata tags for a directory by specifying remote directory path
344
+
345
+ synrest get-tags foo
346
+
347
+ - get listable metadata tags for a storage object by specifying OID
348
+
349
+ synrest get-tags -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
350
+
351
+ EXAMP
352
+ end
353
+
354
+ ####---------------------------------------------------------------------------------------------------------
355
+ def get_versions_examples
356
+ puts <<-EXAMP
357
+
358
+ #{versioning_things_to_know}
359
+
360
+ Examples
361
+
362
+ - get versions for a file by specifying remote file path
363
+
364
+ synrest get-versions foo/file.txt
365
+
366
+ - get versions for a directory by specifying remote directory path
367
+
368
+ synrest get-versions foo
369
+
370
+ - get versions for a storage object by specifying OID
371
+
372
+ synrest get-versions -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
373
+
374
+
375
+ EXAMP
376
+ end
377
+
378
+ ####---------------------------------------------------------------------------------------------------------
379
+ def get_object_url_examples
380
+ puts <<-EXAMP
381
+
382
+ Things to know about object urls
383
+
384
+ Object urls have a specified lifetime.
385
+
386
+ The default lifetime of an object url is 5 minutes
387
+
388
+ Examples
389
+
390
+ - get object url by specifying remote file path
391
+
392
+ synrest get-object-url foo/file.txt
393
+
394
+ - get object url by specifying remote file path and lifetime of 20 minutes
395
+
396
+ synrest get-object-url foo/file.txt -f 20
397
+
398
+ - get object url for a storage object by specifying OID
399
+
400
+ synrest get-object-url -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
401
+
402
+
403
+ EXAMP
404
+
405
+ end
406
+
407
+ ####---------------------------------------------------------------------------------------------------------
408
+ def update_examples
409
+ puts <<-EXAMP
410
+
411
+ #{updating_things_to_know}
412
+
413
+ Examples
414
+
415
+ - update a file in root directory of the same name as the file.
416
+
417
+ synrest update file.txt
418
+
419
+ - update a file in the root directory with a different from source file.
420
+
421
+ synrest update file.txt otherfile.text
422
+
423
+ - update a file in directory 'foo' with same name as source file.
424
+
425
+ synrest update file.txt foo/
426
+
427
+ - update a file in directory 'foo' with a name different from source file
428
+
429
+ synrest update file.txt foo/otherfile.txt
430
+
431
+ - upload file in 500 byte increments.
432
+
433
+ synrest create-file file.txt -b 0 -d 499
434
+ synrest update file.txt -b 500 -d 999
435
+ synrest update file.txt -b 1000 -d 1499
436
+ synrest update file.txt -b 1500 -d 1999
437
+
438
+ EXAMP
439
+ end
440
+
441
+ ####---------------------------------------------------------------------------------------------------------
442
+ def update_acl_examples
443
+ puts <<-EXAMP
444
+
445
+ #{acl_things_to_know}
446
+
447
+ Examples
448
+
449
+ - give another user READ access to a file by specifying remote file path
450
+
451
+ synrest update-acl SAM=READ foo/file.txt
452
+
453
+ - make a file world readable by specifying remote file path
454
+
455
+ synrest update-acl -g OTHER=READ foo/file.txt
456
+
457
+ - update access control list for a directory by specifying remote directory path
458
+
459
+ synrest update-acl SAM=READ foo
460
+
461
+ - update access control list for a storage object by specifying OID
462
+
463
+ synrest update-acl SAM=READ -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
464
+ synrest update-acl SAM=FULL_CONTROL -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
465
+ synrest update-acl -g OTHER=READ -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
466
+
467
+ EXAMP
468
+ end
469
+
470
+ ####---------------------------------------------------------------------------------------------------------
471
+ def update_listable_metadata_examples
472
+ puts <<-EXAMP
473
+
474
+ #{user_metadata_things_to_know}
475
+
476
+ Examples
477
+
478
+ - update listable metadata for a file by specifying remote file path
479
+
480
+ synrest update-listbale-metadata town foo/file.txt
481
+ synrest update-listbale-metadata town=annapolis foo/file.txt
482
+ synrest update-listbale-metadata town=annapolis,capital=yes foo/file.txt
483
+
484
+ - update listable metadata for a directory by specifying remote directory path
485
+
486
+ synrest update-listbale-metadata town foo
487
+ synrest update-listbale-metadata town=baltimore foo
488
+ synrest update-listbale-metadata town=baltimore,capital=yes foo
489
+
490
+ - update listable metadata tags for a storage object by specifying OID
491
+
492
+ synrest update-listbale-metadata town -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
493
+ synrest update-listbale-metadata town=columbia -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
494
+ synrest update-listbale-metadata town=columbia,capital=yes -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
495
+
496
+ EXAMP
497
+ end
498
+
499
+ ####---------------------------------------------------------------------------------------------------------
500
+ def update_nonlistable_metadata_examples
501
+ <<-EXAMP
502
+
503
+ #{user_metadata_things_to_know}
504
+
505
+ Examples
506
+
507
+ - update nonlistable metadata for a file by specifying remote file path
508
+
509
+ synrest update-nonlistbale-metadata building foo/file.txt
510
+ synrest update-nonlistbale-metadata building=house foo/file.txt
511
+ synrest update-nonlistbale-metadata building=house,public=no foo/file.txt
512
+
513
+ - update nonlistable metadata for a directory by specifying remote directory path
514
+
515
+ synrest update-nonlistbale-metadata building foo
516
+ synrest update-nonlistbale-metadata building=store foo
517
+ synrest update-nonlistbale-metadata building=store,public=yes foo
518
+
519
+ - update nonlistable metadata tags for a storage object by specifying OID
520
+
521
+ synrest update-nonlistbale-metadata building -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
522
+ synrest update-nonlistbale-metadata building=bar -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
523
+ synrest update-nonlistbale-metadata building=bar,public=yes foo -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
524
+
525
+ EXAMP
526
+ end
527
+
528
+ ####---------------------------------------------------------------------------------------------------------
529
+ def versioning_things_to_know
530
+ <<-KNOW
531
+ Things to know about versioning
532
+
533
+ File or directory versions can only be accessed by OID.
534
+
535
+ Deleting a file or directory will not delete its versions.
536
+
537
+ Creating a version of a directory will create a version of all objects
538
+ in the directory
539
+
540
+ Creating a version of a previous file or directory version will create a version of the
541
+ current file or directory not the version on which the command was executed.
542
+
543
+ Metadata cannot be modified on file or directory versions.
544
+
545
+ Metadata queries ignore meta-data assigned to file of directory versions.
546
+ KNOW
547
+ end
548
+
549
+ ####---------------------------------------------------------------------------------------------------------
550
+ def user_metadata_things_to_know
551
+ <<-KNOW
552
+ Things to know about meta-data
553
+
554
+ Metadata comes in two forms listable and nonlistable. Listable metadata is queryable
555
+ with 'get-by-tab' and nonlistable metadata is not queryable.
556
+
557
+ Files may be discovered by specifying either a name, listable meta tags or both.
558
+
559
+ File creation requires specification of either a remote file name of listable metadata tag.
560
+
561
+ The tag is the name part of the listable metadata name=value pair.
562
+
563
+ The value is not required when specifying a listable metadata for object creation.
564
+
565
+ Queries are only possible for metadata names (i.e queries for name=value are not supported).
566
+
567
+ Meta-data tags cannot be removed from the global tag index.
568
+ KNOW
569
+ end
570
+
571
+ ####---------------------------------------------------------------------------------------------------------
572
+ def updating_things_to_know
573
+ <<-KNOW
574
+ Things to know about updating
575
+
576
+ Update does not delete storage objects before overwriting.
577
+
578
+ Update will acquire new storage space as required but will not release storage space.
579
+
580
+ Management of a file pointer would be required to know the end of a file if the update
581
+ decreases the size of the file.
582
+ KNOW
583
+ end
584
+
585
+ ####---------------------------------------------------------------------------------------------------------
586
+ def acl_things_to_know
587
+ <<-KNOW
588
+ Things to know about access control
589
+
590
+ The only group access control list available is OTHER.
591
+
592
+ User access control is specified with the user's UID.
593
+
594
+ User and group access control privileges are only accepted for users with the
595
+ same subtenant ID.
596
+
597
+ Changing the access control list for a directory will not change the access
598
+ control list for storage objects within the directory.
599
+
600
+ Valid access control values are; NONE, FULL_CONTROL and READ.
601
+
602
+ Once a user has been added to the User Access Control List it cannot be removed. Access
603
+ can be disabled by setting the access control for he user to NONE.
604
+ KNOW
605
+ end