hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/DeleteVolumeHandler.java
@Override
  protected void execute(CommandLine cmd)
      throws IOException, OzoneException, URISyntaxException {

    if (!cmd.hasOption(Shell.DELETE_VOLUME)) {
      throw new OzoneRestClientException(
          "Incorrect call : deleteVolume call is missing");
    }

    String ozoneURIString = cmd.getOptionValue(Shell.DELETE_VOLUME);
    URI ozoneURI = verifyURI(ozoneURIString);
    if (ozoneURI.getPath().isEmpty()) {
      throw new OzoneRestClientException(
          "Volume name is required to delete a volume");
    }

    // we need to skip the slash in the URI path
    volumeName = ozoneURI.getPath().substring(1);

    if (cmd.hasOption(Shell.VERBOSE)) {
      System.out.printf("Volume name : %s%n", volumeName);
    }

    if (cmd.hasOption(Shell.RUNAS)) {
      rootName = "hdfs";
    } else {
      rootName = System.getProperty("user.name");
    }

    client.setEndPointURI(ozoneURI);
    client.setUserAuth(rootName);
    client.deleteVolume(volumeName);

  }
/**
   * Executes the delete volume call.
   *
   * @param cmd - CommandLine
   * @throws IOException
   * @throws OzoneException
   * @throws URISyntaxException
   */
Executes the delete volume call.
Executes the delete volume call .
@Override
  protected void execute(CommandLine cmd)
      throws IOException, OzoneException, URISyntaxException {
    if (!cmd.hasOption(Shell.DELETE_VOLUME)) {
      throw new OzoneRestClientException(
          "Incorrect call : deleteVolume call is missing");
    }
    String ozoneURIString = cmd.getOptionValue(Shell.DELETE_VOLUME);
    URI ozoneURI = verifyURI(ozoneURIString);
    if (ozoneURI.getPath().isEmpty()) {
      throw new OzoneRestClientException(
          "Volume name is required to delete a volume");
    }
    volumeName = ozoneURI.getPath().substring(1);
    if (cmd.hasOption(Shell.VERBOSE)) {
      System.out.printf("Volume name : %s%n", volumeName);
    }
    if (cmd.hasOption(Shell.RUNAS)) {
      rootName = "hdfs";
    } else {
      rootName = System.getProperty("user.name");
    }
    client.setEndPointURI(ozoneURI);
    client.setUserAuth(rootName);
    client.deleteVolume(volumeName);
  }
@ Override protected void execute ( CommandLine cmd ) throws IOException , OzoneException , URISyntaxException { if ( ! cmd . hasOption ( Shell . DELETE_VOLUME ) ) { throw new OzoneRestClientException ( "Incorrect call : deleteVolume call is missing" ) ; } String ozoneURIString = cmd . getOptionValue ( Shell . DELETE_VOLUME ) ; URI ozoneURI = verifyURI ( ozoneURIString ) ; if ( ozoneURI . getPath ( ) . isEmpty ( ) ) { throw new OzoneRestClientException ( "Volume name is required to delete a volume" ) ; } volumeName = ozoneURI . getPath ( ) . substring ( 1 ) ; if ( cmd . hasOption ( Shell . VERBOSE ) ) { System . out . printf ( "Volume name : %s%n" , volumeName ) ; } if ( cmd . hasOption ( Shell . RUNAS ) ) { rootName = "hdfs" ; } else { rootName = System . getProperty ( "user.name" ) ; } client . setEndPointURI ( ozoneURI ) ; client . setUserAuth ( rootName ) ; client . deleteVolume ( volumeName ) ; }
Executes the delete volume call.
Executes the delete volume call .
// we need to skip the slash in the URI path