class UpgradeRestService {

    @POST
    @Path( "/rollback" )
    public Response rollback( RollbackSpec rollbackSpec )
        throws HMSRestException
    {

        // validate rollback upgrade request
        UpgradeUtil.validateRollbackRequest( rollbackSpec );

        boolean rollbackInitiated = UpgradeUtil.rollbackUpgrade( rollbackSpec );

        if ( rollbackInitiated )
        {
            // respond as rollback request accepted
            BaseResponse response =
                new BaseResponse( Status.ACCEPTED.getStatusCode(), Status.ACCEPTED.getReasonPhrase(),
                                  "Rollback of upgrade initiated." );
            return Response.accepted().entity( response ).build();

        }
        else
        {

            throw new HMSRestException( Status.INTERNAL_SERVER_ERROR.getStatusCode(),
                                        Status.INTERNAL_SERVER_ERROR.getReasonPhrase(),
                                        "Initiating rollback of upgrade failed." );
        }
    }

}