Class MarkerTool

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.s3a.s3guard.S3GuardTool
org.apache.hadoop.fs.s3a.tools.MarkerTool
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.conf.Configurable, org.apache.hadoop.util.Tool

@LimitedPrivate("management tools") @Unstable public final class MarkerTool extends S3GuardTool
Audit an S3 bucket for directory markers.
  • Field Details

    • MARKERS

      public static final String MARKERS
      Name of this tool: "markers".
      See Also:
    • PURPOSE

      public static final String PURPOSE
      Purpose of this tool: "View and manipulate S3 directory markers".
      See Also:
    • OPT_AUDIT

      public static final String OPT_AUDIT
      Audit sub-command: "audit".
      See Also:
    • OPT_CLEAN

      public static final String OPT_CLEAN
      Clean Sub-command: "clean".
      See Also:
    • AUDIT

      public static final String AUDIT
      Audit sub-command: "-audit".
      See Also:
    • CLEAN

      public static final String CLEAN
      Clean Sub-command: "-clean".
      See Also:
    • OPT_MIN

      public static final String OPT_MIN
      Min number of markers to find: "min".
      See Also:
    • OPT_MAX

      public static final String OPT_MAX
      Max number of markers to find: "max".
      See Also:
    • OPT_OUT

      public static final String OPT_OUT
      Name of a file to save the list of markers to: "out".
      See Also:
    • OPT_LIMIT

      public static final String OPT_LIMIT
      Limit of objects to scan: "limit".
      See Also:
    • OPT_NONAUTH

      public static final String OPT_NONAUTH
      Only consider markers found in non-authoritative paths as failures: "nonauth".
      See Also:
    • UNLIMITED_LISTING

      public static final int UNLIMITED_LISTING
      Constant to use when there is no limit on the number of objects listed: 0.

      The value is 0 and not -1 because it allows for the limit to be set on the command line -limit 0. The command line parser rejects -limit -1 as the -1 is interpreted as the (unknown) option "-1".

      See Also:
    • UNLIMITED_MIN_MARKERS

      public static final int UNLIMITED_MIN_MARKERS
      Constant to use when there is no minimum number of markers: -1.
      See Also:
  • Constructor Details

    • MarkerTool

      public MarkerTool(org.apache.hadoop.conf.Configuration conf)
      Constructor.
      Parameters:
      conf - configuration
  • Method Details

    • getUsage

      public String getUsage()
      Specified by:
      getUsage in class S3GuardTool
    • getName

      public String getName()
      Description copied from class: S3GuardTool
      Return sub-command name.
      Specified by:
      getName in class S3GuardTool
      Returns:
      sub-command name.
    • resetBindings

      public void resetBindings()
      Description copied from class: S3GuardTool
      Reset the store and filesystem bindings.
      Overrides:
      resetBindings in class S3GuardTool
    • run

      public int run(String[] args, PrintStream stream) throws org.apache.hadoop.util.ExitUtil.ExitException, Exception
      Description copied from class: S3GuardTool
      Run the tool, capturing the output (if the tool supports that). As well as returning an exit code, the implementations can choose to throw an instance of ExitUtil.ExitException with their exit code set to the desired exit value. The exit code of such an exception is used for the tool's exit code, and the stack trace only logged at debug.
      Specified by:
      run in class S3GuardTool
      Parameters:
      args - argument list
      stream - output stream
      Returns:
      the exit code to return.
      Throws:
      Exception - on any failure
      org.apache.hadoop.util.ExitUtil.ExitException
    • isVerbose

      public boolean isVerbose()
    • setVerbose

      public void setVerbose(boolean verbose)
    • execMarkerTool

      public static MarkerTool.ScanResult execMarkerTool(MarkerTool.ScanArgs scanArgs) throws IOException
      Execute the marker tool, with no checks on return codes.
      Parameters:
      scanArgs - set of args for the scanner.
      Returns:
      the result
      Throws:
      IOException - IO failure