Top Level Namespace

Defined Under Namespace

Modules: Synaptic4r

Constant Summary collapse

SYNLIB =

"#{File.dirname($0)}/../lib"

Instance Method Summary collapse

Instance Method Details

#acl_things_to_knowObject




586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/synaptic4r/help.rb', line 586

def acl_things_to_know
  <<-KNOW
Things to know about access control

 The only group access control list available is OTHER.

 User access control is specified with the user's UID.

 User and group access control privileges are only accepted for users with the
 same subtenant ID.

 Changing the access control list for a directory will not change the access
 control list for storage objects within the directory.

 Valid access control values are; NONE, FULL_CONTROL and READ.

 Once a user has been added to the User Access Control List it cannot be removed. Access
 can be disabled by setting the access control for he user to NONE.
  KNOW
end

#arg_name(arg_info, long = true) ⇒ Object




239
240
241
242
243
244
# File 'bin/synrest', line 239

def arg_name(arg_info, long=true)
  cli = arg_info[:cli]
  if cli.kind_of?(Array) and long
    cli.length > 1 ? "#{cli[1]} #{cli[0]}" : cli.first
  else; [cli].flatten.first; end
end

#build_banner(opts, cmd) ⇒ Object




247
248
249
250
251
252
# File 'bin/synrest', line 247

def build_banner(opts, cmd)
  exp_args = Synaptic4r::StorageRequest.required_rest_args(cmd)
  opts.banner = Synaptic4r::StorageRequest.banner(cmd) || \
                "\nUsage: synrest #{cmd.to_s.gsub(/_/,'-')} #{format_required_args(exp_args)} [options]"

end

#cmd_help(meths) ⇒ Object




264
265
266
267
268
269
270
271
272
273
274
275
# File 'bin/synrest', line 264

def cmd_help(meths) 
  puts "\nUsage: synrest command args [options]" 
  puts "\nCommands"
  meths.sort_by{|m| m.to_s}.each do |m| 
    next if m.eql?(:get_started)
    meth_str = "  %-30s" % m.to_s.gsub(/_/,'-')
    puts "#{meth_str} #{Synaptic4r::StorageRequest.desc(m)}"
  end
  puts "\nCommand args and options\n synrest command -h"
  puts "\nGet Started\n synrest get-started"
  puts "\nCommand examples\n synrest command examples\n\n"
end

#create_dir_examplesObject




76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/synaptic4r/help.rb', line 76

def create_dir_examples
  puts <<-EXAMP

 - create a directory named foo  

     synrest create-dir foo

 - create directory foo/bar automatically creating directories if not present

     synrest create-dir foo/bar

  EXAMP
end

#create_file_examplesObject




91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/synaptic4r/help.rb', line 91

def create_file_examples
  puts <<-EXAMP

File creation requires specification of either a remote file name of listable metadata tag.

 - upload a file to root directory and preserve the file name  

     synrest create-file file.txt

 - upload a file to root directory and change the file name

     synrest create-file file.txt otherfile.text

 - upload a file to directory and preserve the file name

     synrest create-file file.txt foo/

 - upload a file to directory and change the file name

     synrest create-file file.txt foo/otherfile.txt

 - upload a file to directory automatically creating 
   directories if not present

     synrest create-file foo/bar/file.txt

 - upload file in 500 byte increments.

     synrest create-file file.txt -b 0 -d 499
     synrest update file.txt -b 500  -d 999
     synrest update file.txt -b 1000 -d 1499
     synrest update file.txt -b 1500 -d 1999

 - upload a file and specify listable metadata tags instead of file name. listable
   metadata consists of a name=value pair. specification of the value is
   optional

     synrest create-file file.txt -i tagged
     synrest create-file file.txt -i tagged=yes,location

  EXAMP
end

#create_version_examplesObject




135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/synaptic4r/help.rb', line 135

def create_version_examples
  puts <<-EXAMP

#{versioning_things_to_know}

Examples

 - create a version of a file by specifying remote file path

     bin/synrest create-version file.txt

 - create a version of a directory and all contained files and directories
   by specifying remote directory path

     bin/synrest create-version foo

 - create a version of a storage object by specifying OID

     bin/synrest create-version -o 4a08bf2ea11f1e0b04a08c466666a804a806bfc20387 


  EXAMP
end

#credentials_configured?Boolean


Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'bin/synrest', line 14

def credentials_configured?
  config_keys = %w(key site subtenant uid)
  status = if File.exists?(Synaptic4r::Client.config_file)
             config = File.open(Synaptic4r::Client.config_file){|yf| YAML::load(yf)}
             if config.kind_of?(Hash)
               config.keys.sort.eql?(config_keys) or config.keys.sort.eql?(config_keys.unshift('account'))
             elsif config.kind_of?(Array) 
               config_keys.unshift('account')
               config.select{|c| c.keys.sort.eql?(config_keys)}.length.eql?(config.length)
             else
               puts "#{Synaptic4r::Client.config_file} not formatted properly"
               exit
             end
           else
             puts "#{Synaptic4r::Client.config_file} not found"
             exit
           end
  unless status
    puts "#{Synaptic4r::Client.config_file} missing one of 'key', 'site', 'subtenant' or 'uid'"
    exit
  end
end

#delete_examplesObject




160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/synaptic4r/help.rb', line 160

def delete_examples
  puts <<-EXAMP

 - delete file by specifying remote file path  

     synrest delete foo/file.txt

 - delete directory by specifying remote directory path. delete of a director will fail
   unless the directory is empty.  

     synrest delete foo

 - delete storage object by specifying OID
   
     synrest delete -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#delete_user_metadata_examplesObject




180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/synaptic4r/help.rb', line 180

def 
  puts <<-EXAMP

#{}

Examples

 - delete user metadata for a file by specifying remote file path  

     synrest delete-user-metadata location foo/file.txt
     synrest delete-user-metadata location,capital foo/file.txt

 - delete user metadata for a directory by specifying remote directory path  

     synrest delete-user-metadata building foo
     synrest delete-user-metadata building,location foo

 - delete user metadata for a storage object by specifying OID
   
     synrest delete-user-metadata building -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
     synrest delete-user-metadata building,location -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#diagnostic_args(opts, input, cmd) ⇒ Object




98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'bin/synrest', line 98

def diagnostic_args(opts, input, cmd)
  if Synaptic4r::StorageRequest.diagnostics(cmd)
    opts.separator "\ndiagnostic options"
    opts.on('-q', '--dump', 'do not send request but print headers and service url to STDOUT'){|d| input[:dump] = true}
    opts.on('-p', '--payload', 'do not send request print payload to STDOUT if present'){|p| input[:payload] = true}
    opts.on('-l', '--log [file]', 'log request to file (by default file is synaptic4r.log)') do |file|
      input[:log] = true
      input[:log_file] = file
    end
  end
  opts.on_tail('-h', '--help', "this listing\n") {
    puts 
    puts opts
    puts "Examples: synrest #{cmd.to_s.gsub(/_/,'-')} examples\n\n"
    exit
  }
end

#dump(cmd, input, result) ⇒ Object




38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'bin/synrest', line 38

def dump(cmd, input, result)
  output = if input[:dump]
             <<-DUMP
COMMAND:        #{cmd}
ARGS:           #{input.inspect}
SIGNING STRING: #{result.sign.inspect}
HTTP METHOD:    #{result.http_request}
URL:            #{result.url}
HEADERS:        #{result.headers.inspect}
              DUMP
           else; ''; end
  if input[:payload] and result.payload
    output + "PAYLOAD:\n" + result.payload
  else
    output
  end
end

#extract_cmd(meths) ⇒ Object




74
75
76
77
78
79
80
81
82
83
# File 'bin/synrest', line 74

def extract_cmd(meths)
  if ARGV.first 
    if meths.include?(ARGV.first.gsub(/-/,'_').to_sym)
      ARGV.shift.gsub(/-/,'_').to_sym 
    else
      puts "Error: '#{ARGV.first}' is not a valid command"
      exit
    end
  end
end

#extract_positional_args(meths, input, cmd) ⇒ Object




174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'bin/synrest', line 174

def extract_positional_args(meths, input, cmd)
  eargs = Synaptic4r::StorageRequest.required_rest_args(cmd)
  elength = eargs.length
  pvals= prep_argv.first(elength)
  nvals = if Synaptic4r::StorageRequest.map_required_args(cmd)
            Synaptic4r::StorageRequest.map_required_args(cmd)[pvals]
          else 
            {:pvals => pvals, :dlen => 0}
          end
  if pvals.include?('-h')
  elsif ARGV.first.eql?('examples')
    begin
      send("#{cmd}_examples".to_sym)
      exit
    rescue NoMethodError
      puts "'#{cmd.to_s.gsub(/_/,'-')}' examples are not availble"
      exit
    end
  elsif nvals[:pvals].length < elength
    puts "Error: expecting args '#{format_required_args(eargs)}'"
    exit
  else
    set_positional_args(input, nvals, eargs)
  end
end

#format_required_args(args) ⇒ Object




86
87
88
89
90
91
92
93
94
95
# File 'bin/synrest', line 86

def format_required_args(args)
  args.inject("") do |f,a|
    aname = lambda{|v,l| arg_name(Synaptic4r::StorageRequest.rest_arg(v),l)}
    if a.kind_of?(Array)
      f + [aname[a.first,false],a[1..-1].map{|v| aname[v,true]}].join('|') + ' '  
    else
      "#{f}#{aname[a, false]} "  
    end
  end.chomp(' ')
end

#get_acl_examplesObject




238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/synaptic4r/help.rb', line 238

def get_acl_examples
  puts <<-EXAMP

#{acl_things_to_know}

Examples

 - get access control list for a file by specifying remote file path  

     synrest get-acl foo/file.txt

 - get access control list for a directory by specifying remote directory path  

     synrest get-acl foo

 - get access control list for a storage object by specifying OID
   
     synrest get-acl -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#get_all_tags_examplesObject




261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/synaptic4r/help.rb', line 261

def get_all_tags_examples
  puts <<-EXAMP

#{}

Examples
   
 - get all listable metadata tags used by account

     synrest get-all-tags

  EXAMP
end

#get_by_tag_examplesObject




276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/synaptic4r/help.rb', line 276

def get_by_tag_examples
  puts <<-EXAMP

#{}

 - get OIDs for all objects with specified listable metadata tag. only one tag may be specified.

     synrest get-by-tag location

 - get all objects with specified listable metadata tag with extended output
   
     synrest get-by-tag location -e

  EXAMP
end

#get_examplesObject




206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/synaptic4r/help.rb', line 206

def get_examples
  puts <<-EXAMP

 - get remote root directory listing

     synrest get

 - get remote directory listing by specifying directory name
 
     synrest get foo

 - get remote directory listing by specifying OID

     synrest get -o 4a08bf2ea11f1e0b04a08c4bb666a804a7c5d32a2c63 

 - get file by remote file name

     synrest get foo/file.txt

 - get file by specifying OID

     synrest get -o 4a08bf2ea11f1e0b04a6664b3866a804a7c60fb30b30

 - get the portion of the file between bytes 50 and 150 specifying byte offsets 
   and file name

     synrest get foo/file.txt -b 50 -d 150

  EXAMP
end

#get_object_url_examplesObject




379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/synaptic4r/help.rb', line 379

def get_object_url_examples
  puts <<-EXAMP

Things to know about object urls

 Object urls have a specified lifetime.

 The default lifetime of an object url is 5 minutes

Examples

 - get object url by specifying remote file path  

     synrest get-object-url foo/file.txt

 - get object url by specifying remote file path and lifetime of 20  minutes  

     synrest get-object-url foo/file.txt -f 20

 - get object url for a storage object by specifying OID
   
     synrest get-object-url -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30


  EXAMP

end

#get_startedObject




2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/synaptic4r/help.rb', line 2

def get_started
  puts <<-EXAMP

Get Started

Save credentials to #{ENV['HOME']}/.synaptic4r

 single account

   subtenant: SubtenantID 
   uid:       UserID
   key:       SecretKey
   site:      https://storage.synaptic.att.com/rest

 multiple accounts (the first is used by default, the dashes must 
 be included in the file)

   -
    account:   myacct
    subtenant: SubtenantID 
    uid:       UserID
    key:       SecretKey
    site:      https://storage.synaptic.att.com/rest

   -
    account:   myotheracct
    subtenant: OtherSubtenantID 
    uid:       OtherUserID
    key:       OtherSecretKey
    site:      https://storage.synaptic.att.com/rest

Basic Commands
   
 - list contents remote root directory    

     synrest get

 - create a remote directory named foo    

     synrest create-dir foo

 - upload a file to directory foo    

     synrest create-file file.txt foo/

 - list contents remote directory foo   

     synrest get foo

 - list contents remote file foo/file.txt   

     synrest get foo/file.txt

 - show more examples for a command

     synrest command examples

 - execute command for account other than default

     synrest command args [options] -u myotheracct

Diagnostic Options

 diagnostic options are supported by all commands

   -q, --dump        do not send request but print headers and service url to STDOUT
   -p, --payload     do not send request print payload to STDOUT if present
   -l, --log [file]  log request to file (by default file is synaptic4r.log)
   -h, --help        command help

  EXAMP
end

#get_system_metadata_examplesObject




293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/synaptic4r/help.rb', line 293

def 
  puts <<-EXAMP

 - get system metadata for a file by specifying remote file path  

     synrest get-system-metadata foo/file.txt

 - get  system metadata for a directory by specifying remote directory path  

     synrest get-system-metadata foo

 - get  system metadata for a storage object by specifying OID
   
     synrest get-system-metadata -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#get_tags_examplesObject




312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/synaptic4r/help.rb', line 312

def get_tags_examples
  puts <<-EXAMP

 - get listable metadata tags for a file by specifying remote file path  

     synrest get-tags foo/file.txt

 - get listable metadata tags for a directory by specifying remote directory path  

     synrest get-tags foo

 - get listable metadata tags for a storage object by specifying OID
   
     synrest get-tags -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#get_user_metadata_examplesObject




331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/synaptic4r/help.rb', line 331

def 
  puts <<-EXAMP

#{}


Examples
 
 - get user metadata for a file by specifying remote file path  

     synrest get-tags foo/file.txt

 - get listable metadata tags for a directory by specifying remote directory path  

     synrest get-tags foo

 - get listable metadata tags for a storage object by specifying OID
   
     synrest get-tags -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#get_versions_examplesObject




355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/synaptic4r/help.rb', line 355

def get_versions_examples
  puts <<-EXAMP

#{versioning_things_to_know}

Examples

 - get versions for a file by specifying remote file path  

     synrest get-versions foo/file.txt

 - get versions for a directory by specifying remote directory path  

     synrest get-versions foo

 - get versions for a storage object by specifying OID
   
     synrest get-versions -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30


  EXAMP
end

#prep_argvObject




154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'bin/synrest', line 154

def prep_argv
  add = true
  inargs = ARGV.inject([]) do |o,a|
    if /^-/.match(a)
      i = ARGV.index(a)
      n = ARGV[i+1]
      if n and not /^-/.match(n)
        add = false;  o << [a,n].join(' ')
      else
        o << a
      end
    elsif add
      o << a
    else
      add = true; o
    end
  end
end

#process_input(opts, meths, input, cmd) ⇒ Object




255
256
257
258
259
260
# File 'bin/synrest', line 255

def process_input(opts, meths, input, cmd)
  build_banner(opts, cmd)
  set_args(opts, meths, input, cmd)
  set_opts(opts, input, Synaptic4r::StorageRequest.optional_rest_args(cmd))
  diagnostic_args(opts, input, cmd)
end

#run(cmd, input) ⇒ Object




57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'bin/synrest', line 57

def run(cmd, input)
  begin    
    result = Synaptic4r::Client.new(input[:account].nil? ? nil : {:account => input[:account]}).send(cmd, input)
    {:out => (input[:dump] or input[:payload]) ? dump(cmd, input, result) : result.print, :logger => :info}
  rescue RestClient::RequestFailed, RestClient::ResourceNotFound, RestClient::Unauthorized, 
         RestClient::NotModified => err
    {:out => "#{err.http_code}\n#{err.message}\n" + Synaptic4r::RequestError.new(err).print, :logger => :error}
  rescue RestClient::Redirect, RestClient::ServerBrokeConnection, RestClient::RequestTimeout => err
    {:out => err.message, :logger => :error}
  rescue ArgumentError => err
    {:out => err.to_s, :logger  => :error}
  rescue Errno::ENOENT, Errno::EISDIR => err
    {:out => err.to_s, :logger  => :error}
  end
end

#set_args(opts, meths, input, cmd) ⇒ Object




133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'bin/synrest', line 133

def set_args(opts, meths, input, cmd)
  extract_positional_args(meths, input, cmd)
  all_args = Synaptic4r::StorageRequest.required_rest_args(cmd)
  fmt = "    %-32s %s"
  unless all_args.empty?
    opts.separator "\nargs"
    arg_row = lambda{|a,l| arg_info = Synaptic4r::StorageRequest.rest_arg(a)
                           opts.separator fmt % [arg_name(arg_info,l), arg_info[:desc]]}
    all_args.each do |a|
      if a.kind_of?(Array)
        opts.separator "one of"
        arg_row[a.first,false]
        a[1..-1].each{|e| arg_row[e,true]}
      else
        arg_row[a,false]
      end
    end
  end
end

#set_opts(opts, input, opt_args) ⇒ Object




117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'bin/synrest', line 117

def set_opts(opts, input, opt_args)
  opt_args = [opt_args].flatten
  unless opt_args.empty?
    opts.separator "\noptions"
    opt_args.sort_by{|m| m.to_s}.each do |a|
      arg_info = Synaptic4r::StorageRequest.rest_arg(a)
      sopt = arg_info[:cli][1]
      lopt = "--#{arg_info[:cli][0]}" + (arg_info[:cli][2].eql?(:flag) ? '' : " #{arg_info[:cli][0]}")
      opts.on(sopt, lopt, arg_info[:desc]) do |v|
        input[a] = arg_info[:map].nil? ? v : arg_info[:map][v]
      end
    end
  end
end

#set_positional_args(input, nvals, eargs) ⇒ Object




201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'bin/synrest', line 201

def set_positional_args(input, nvals, eargs)
  assign_input = lambda{|a,v| info = Synaptic4r::StorageRequest.rest_arg(a); 
                              input[a] = info[:map].nil? ? v : info[:map][v]}
  length = 0
  nvals[:pvals].each_index do |i|
    pv = nvals[:pvals][i]
    ea = eargs[i]
    if ea.kind_of?(Array)
      if /^-/.match(pv)
        matched = false
        ea[1..-1].each do |a|
          info = Synaptic4r::StorageRequest.rest_arg(a)
          flag = info[:cli][1]
          next unless flag
          if /^#{flag}/.match(pv)
            input[a] = pv.split(/\s/).last
            matched = true
            length += 2
            break
          end
        end
        unless matched
          puts "Error: expecting args '#{format_required_args(eargs)}'"
          exit
        end
      else
        length += 1
        assign_input[ea.first,pv]
      end
    else
      length += 1
      assign_input[ea,pv]
    end
  end
  ARGV.slice!(0, length - nvals[:dlen])
end

#update_acl_examplesObject




442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/synaptic4r/help.rb', line 442

def update_acl_examples
  puts <<-EXAMP

#{acl_things_to_know}

Examples

 - give another user READ access to a file by specifying remote file path  

     synrest update-acl SAM=READ foo/file.txt

 - make a file world readable by specifying remote file path  

     synrest update-acl -g OTHER=READ foo/file.txt

 - update access control list for a directory by specifying remote directory path  

     synrest update-acl SAM=READ foo

 - update access control list for a storage object by specifying OID
   
     synrest update-acl SAM=READ -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
     synrest update-acl SAM=FULL_CONTROL -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
     synrest update-acl -g OTHER=READ -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#update_examplesObject




408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/synaptic4r/help.rb', line 408

def update_examples
  puts <<-EXAMP

#{updating_things_to_know}

Examples

 - update a file in root directory of the same name as the file. 

     synrest update file.txt

 - update a file in the root directory with a different from source file.

     synrest update file.txt otherfile.text

 - update a file in directory 'foo' with same name as source file.

     synrest update file.txt foo/

 - update a file in directory 'foo' with a name different from source file

     synrest update file.txt foo/otherfile.txt

 - upload file in 500 byte increments.

     synrest create-file file.txt -b 0 -d 499
     synrest update file.txt -b 500  -d 999
     synrest update file.txt -b 1000 -d 1499
     synrest update file.txt -b 1500 -d 1999

  EXAMP
end

#update_listable_metadata_examplesObject




471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# File 'lib/synaptic4r/help.rb', line 471

def 
  puts <<-EXAMP

#{}

Examples
 
 - update listable metadata for a file by specifying remote file path  

     synrest update-listbale-metadata town foo/file.txt
     synrest update-listbale-metadata town=annapolis foo/file.txt
     synrest update-listbale-metadata town=annapolis,capital=yes foo/file.txt

 -  update listable metadata for a directory by specifying remote directory path  

     synrest update-listbale-metadata town foo
     synrest update-listbale-metadata town=baltimore foo
     synrest update-listbale-metadata town=baltimore,capital=yes foo

 - update listable metadata tags for a storage object by specifying OID
   
     synrest update-listbale-metadata town -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
     synrest update-listbale-metadata town=columbia -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
     synrest update-listbale-metadata town=columbia,capital=yes -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#update_nonlistable_metadata_examplesObject




500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/synaptic4r/help.rb', line 500

def 
  <<-EXAMP

#{}

Examples

 - update nonlistable metadata for a file by specifying remote file path  

     synrest update-nonlistbale-metadata building foo/file.txt
     synrest update-nonlistbale-metadata building=house foo/file.txt
     synrest update-nonlistbale-metadata building=house,public=no foo/file.txt

 -  update nonlistable metadata for a directory by specifying remote directory path  

     synrest update-nonlistbale-metadata building foo
     synrest update-nonlistbale-metadata building=store foo
     synrest update-nonlistbale-metadata building=store,public=yes foo

 - update nonlistable metadata tags for a storage object by specifying OID
   
     synrest update-nonlistbale-metadata building -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
     synrest update-nonlistbale-metadata building=bar -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30
     synrest update-nonlistbale-metadata building=bar,public=yes foo -o 4a08bf2ea11f1e0b04a086663866a804a7c60fb30b30

  EXAMP
end

#updating_things_to_knowObject




572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/synaptic4r/help.rb', line 572

def updating_things_to_know
  <<-KNOW
Things to know about updating

 Update does not delete storage objects before overwriting. 

 Update will acquire new storage space as required but will not release storage space.

 Management of a file pointer would be required to know the end of a file if the update 
 decreases the size of the file.
  KNOW
end

#user_metadata_things_to_knowObject




550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/synaptic4r/help.rb', line 550

def 
  <<-KNOW
Things to know about meta-data

 Metadata comes in two forms listable and nonlistable. Listable metadata is queryable
 with 'get-by-tab' and nonlistable metadata is not queryable.

 Files may be discovered by specifying either a name, listable meta tags or both. 

 File creation requires specification of either a remote file name of listable metadata tag.
 
 The tag is the name part of the listable metadata name=value pair. 

 The value is not required when specifying a listable metadata for object creation.

 Queries are only possible for metadata names (i.e queries for name=value are not supported).

 Meta-data tags cannot be removed from the global tag index.
  KNOW
end

#versioning_things_to_knowObject




529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/synaptic4r/help.rb', line 529

def versioning_things_to_know
   <<-KNOW
Things to know about versioning

 File or directory versions can only be accessed by OID.

 Deleting a file or directory will not delete its versions.

 Creating a version of a directory will create a version of all objects 
 in the directory 

 Creating a version of a previous file or directory version will create a version of the 
 current file or directory not the version on which the command was executed. 

 Metadata cannot be modified on file or directory versions.

 Metadata queries ignore meta-data assigned to file of directory versions.
  KNOW
end