commonPosterUsage

in api-reference-examples/ruby/te-tag-query/TETagQuery.rb [639:738]


  def commonPosterUsage(exitCode, posterName)
    if posterName.nil?
      raise "#{$0}: internal coding error in commonPosterUsage"
    end

    stream =  exitCode == 0 ? $stdout : $stderr
    output1 = <<-EOF1
Usage: #{$0} #{@verbName} [options]
EOF1

    output2 = nil
    output3 = nil
    output4 = nil
    output5 = nil

    output2 = nil
    if posterName == POSTER_NAME_SUBMIT
      output2 = <<-EOF2s
Uploads a threat descriptor with the specified values.
On repost (with same indicator text/type and app ID), updates changed fields.

Required:
-i|--indicator {...}   The indicator text: hash/URL/etc.
-I                     Take indicator text from standard input, one per line.
Exactly one of -i or -I is required.
-t|--type {...}
EOF2s
    end
    if posterName == POSTER_NAME_UPDATE
      output2 = <<-EOF2u
Updates specified attributes on an existing threat descriptor.

Required:
-n {...}               ID of descriptor to be edited. Must already exist.
-N                     Take descriptor IDs from standard input, one per line.
Exactly one of -n or -N is required.
EOF2u
    end

    output3 = <<-EOF3
-d|--description {...}
-l|--share-level {...}
-p|--privacy-type {...}
-y|--severity {...}

Optional:
-h|--help
--dry-run
-m|--privacy-members {...} If privacy-type is HAS_WHITELIST these must be
                       comma-delimited app IDs. If privacy-type is
                       HAS_PRIVACY_GROUP these must be comma-delimited
                       privacy-group IDs.
--tags {...}           Comma-delimited. Overwrites on repost.
EOF3

    output4=nil
    if posterName == POSTER_NAME_UPDATE
      output3 = <<-EOF4u
--add-tags {...}       Comma-delimited. Adds these on repost.
--remove-tags {...}    Comma-delimited. Removes these on repost.
EOF4u
    end

    output5 = <<-EOF5
--related-ids-for-upload {...} Comma-delimited. IDs of descriptors (which must
                       already exist) to relate the new descriptor to.
--related-triples-json-for-upload {...} Alternate to --related-ids-for-upload.
                       Here you can uniquely the relate-to descriptors by their
                       owner ID / indicator-type / indicator-text, rather than
                       by their IDs. See README.md for an example.

--reactions-to-add {...}    Example for add/remove: INGESTED,IN_REVIEW
--reactions-to-remove {...}

--confidence {...}
-s|--status {...}
-r|--review-status {...}
--first-active {...}
--last-active {...}
--expired-on {...}

Please see the following for allowed values in all enumerated types except reactions:
https://developers.facebook.com/docs/threat-exchange/reference/submitting

Please also see:
https://developers.facebook.com/docs/threat-exchange/reference/editing

Please see the following for enumerated types in reactions:
See also https://developers.facebook.com/docs/threat-exchange/reference/reacting
EOF5

    stream.puts(output1)
    stream.puts(output2) unless output2.nil?
    stream.puts(output3)
    stream.puts(output4) unless output4.nil?
    stream.puts(output5)

    exit(exitCode)
  end