@Override
  protected int doWork() throws Exception {
    try (Connection connection = ConnectionFactory.createConnection(getConf());
      Admin admin = connection.getAdmin()) {
      admin.snapshot(new SnapshotDescription(snapshotName, tableName, snapshotType));
    } catch (Exception e) {
      System.err.println("failed to take the snapshot: " + e.getMessage());
      return -1;
    }
    return 0;
  }
This is a command line class that will snapshot a given table.
hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/CreateSnapshot.java