tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/IAMServiceAccountsService.java
public ResponseEntity<String> readFolders(String token, String path) throws IOException {
		Response response = new Response();
		ObjectMapper objMapper = new ObjectMapper();
		Response lisresp = reqProcessor.process("/iam/list", PATHSTR + path + "\"}", token);
		if(lisresp.getHttpstatus().equals(HttpStatus.OK)){
			List<String> foldersList = new ArrayList<>();
			IAMServiceAccountNode iamServiceAccountNode = new IAMServiceAccountNode();
			JsonNode folders = objMapper.readTree(lisresp.getResponse()).get("keys");
			for (JsonNode node : folders) {
				foldersList.add(node.textValue());
			}
			iamServiceAccountNode.setFolders(foldersList);
			iamServiceAccountNode.setPath(path.substring(10));
			String separator = "_";
			int sepPos = path.indexOf(separator);
			iamServiceAccountNode.setIamsvcaccName(path.substring(sepPos + separator.length()));
			response.setSuccess(true);
			response.setHttpstatus(HttpStatus.OK);
			String res = objMapper.writeValueAsString(iamServiceAccountNode);
			return ResponseEntity.status(response.getHttpstatus()).body(res);
		}else if (lisresp.getHttpstatus().equals(HttpStatus.FORBIDDEN)){
			log.error(JSONUtil.getJSON(ImmutableMap.<String, String> builder()
					.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
					.put(LogMessage.ACTION, "readFolders")
					.put(LogMessage.MESSAGE, "No permission to access the folder")
					.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
			response.setSuccess(false);
			response.setHttpstatus(HttpStatus.FORBIDDEN);
			response.setResponse("{\"errors\":[\"Unable to read the given path :" + path + "\"]}");
			return ResponseEntity.status(response.getHttpstatus()).body(response.getResponse());
		} else if (lisresp.getHttpstatus().equals(HttpStatus.NOT_FOUND)){
			log.error(JSONUtil.getJSON(ImmutableMap.<String, String> builder()
					.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
					.put(LogMessage.ACTION, "readFolders")
					.put(LogMessage.MESSAGE, "No access keys/secrets available for this IAM Service account")
					.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
			response.setSuccess(false);
			response.setHttpstatus(HttpStatus.NOT_FOUND);
			response.setResponse("{\"errors\":[\"No access keys/secrets available for this IAM Service account\"]}");
			return ResponseEntity.status(response.getHttpstatus()).body(response.getResponse());
		} else{
			log.error(JSONUtil.getJSON(ImmutableMap.<String, String> builder()
					.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
					.put(LogMessage.ACTION, "readFolders")
					.put(LogMessage.MESSAGE, "Unable to readFolders")
					.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
			response.setSuccess(false);
			response.setHttpstatus(HttpStatus.INTERNAL_SERVER_ERROR);
			response.setResponse("{\"errors\":[\"Unexpected error :" + path + "\"]}");
			return ResponseEntity.status(response.getHttpstatus()).body(response.getResponse());
		} 
	}
/**
	 * Read Folder details for a given iamsvcacc
	 *
	 * @param token
	 * @param path
	 * @return
	 * @throws IOException 
	 */
Read Folder details for a given iamsvcacc
@param token
@param path
@return
@throws IOException
Read Folder details for a given iamsvcacc @param token @param path @return @throws IOException
public ResponseEntity<String> readFolders(String token, String path) throws IOException {
		Response response = new Response();
		ObjectMapper objMapper = new ObjectMapper();
		Response lisresp = reqProcessor.process("/iam/list", PATHSTR + path + "\"}", token);
		if(lisresp.getHttpstatus().equals(HttpStatus.OK)){
			List<String> foldersList = new ArrayList<>();
			IAMServiceAccountNode iamServiceAccountNode = new IAMServiceAccountNode();
			JsonNode folders = objMapper.readTree(lisresp.getResponse()).get("keys");
			for (JsonNode node : folders) {
				foldersList.add(node.textValue());
			}
			iamServiceAccountNode.setFolders(foldersList);
			iamServiceAccountNode.setPath(path.substring(10));
			String separator = "_";
			int sepPos = path.indexOf(separator);
			iamServiceAccountNode.setIamsvcaccName(path.substring(sepPos + separator.length()));
			response.setSuccess(true);
			response.setHttpstatus(HttpStatus.OK);
			String res = objMapper.writeValueAsString(iamServiceAccountNode);
			return ResponseEntity.status(response.getHttpstatus()).body(res);
		}else if (lisresp.getHttpstatus().equals(HttpStatus.FORBIDDEN)){
			log.error(JSONUtil.getJSON(ImmutableMap.<String, String> builder()
					.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
					.put(LogMessage.ACTION, "readFolders")
					.put(LogMessage.MESSAGE, "No permission to access the folder")
					.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
			response.setSuccess(false);
			response.setHttpstatus(HttpStatus.FORBIDDEN);
			response.setResponse("{\"errors\":[\"Unable to read the given path :" + path + "\"]}");
			return ResponseEntity.status(response.getHttpstatus()).body(response.getResponse());
		} else if (lisresp.getHttpstatus().equals(HttpStatus.NOT_FOUND)){
			log.error(JSONUtil.getJSON(ImmutableMap.<String, String> builder()
					.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
					.put(LogMessage.ACTION, "readFolders")
					.put(LogMessage.MESSAGE, "No access keys/secrets available for this IAM Service account")
					.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
			response.setSuccess(false);
			response.setHttpstatus(HttpStatus.NOT_FOUND);
			response.setResponse("{\"errors\":[\"No access keys/secrets available for this IAM Service account\"]}");
			return ResponseEntity.status(response.getHttpstatus()).body(response.getResponse());
		} else{
			log.error(JSONUtil.getJSON(ImmutableMap.<String, String> builder()
					.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
					.put(LogMessage.ACTION, "readFolders")
					.put(LogMessage.MESSAGE, "Unable to readFolders")
					.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
			response.setSuccess(false);
			response.setHttpstatus(HttpStatus.INTERNAL_SERVER_ERROR);
			response.setResponse("{\"errors\":[\"Unexpected error :" + path + "\"]}");
			return ResponseEntity.status(response.getHttpstatus()).body(response.getResponse());
		} 
	}
public ResponseEntity < String > readFolders ( String token , String path ) throws IOException { Response response = new Response ( ) ; ObjectMapper objMapper = new ObjectMapper ( ) ; Response lisresp = reqProcessor . process ( "/iam/list" , PATHSTR + path + "\"}" , token ) ; if ( lisresp . getHttpstatus ( ) . equals ( HttpStatus . OK ) ) { List < String > foldersList = new ArrayList < > ( ) ; IAMServiceAccountNode iamServiceAccountNode = new IAMServiceAccountNode ( ) ; JsonNode folders = objMapper . readTree ( lisresp . getResponse ( ) ) . get ( "keys" ) ; for ( JsonNode node : folders ) { foldersList . add ( node . textValue ( ) ) ; } iamServiceAccountNode . setFolders ( foldersList ) ; iamServiceAccountNode . setPath ( path . substring ( 10 ) ) ; String separator = "_" ; int sepPos = path . indexOf ( separator ) ; iamServiceAccountNode . setIamsvcaccName ( path . substring ( sepPos + separator . length ( ) ) ) ; response . setSuccess ( true ) ; response . setHttpstatus ( HttpStatus . OK ) ; String res = objMapper . writeValueAsString ( iamServiceAccountNode ) ; return ResponseEntity . status ( response . getHttpstatus ( ) ) . body ( res ) ; } else if ( lisresp . getHttpstatus ( ) . equals ( HttpStatus . FORBIDDEN ) ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , "readFolders" ) . put ( LogMessage . MESSAGE , "No permission to access the folder" ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; response . setSuccess ( false ) ; response . setHttpstatus ( HttpStatus . FORBIDDEN ) ; response . setResponse ( "{\"errors\":[\"Unable to read the given path :" + path + "\"]}" ) ; return ResponseEntity . status ( response . getHttpstatus ( ) ) . body ( response . getResponse ( ) ) ; } else if ( lisresp . getHttpstatus ( ) . equals ( HttpStatus . NOT_FOUND ) ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , "readFolders" ) . put ( LogMessage . MESSAGE , "No access keys/secrets available for this IAM Service account" ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; response . setSuccess ( false ) ; response . setHttpstatus ( HttpStatus . NOT_FOUND ) ; response . setResponse ( "{\"errors\":[\"No access keys/secrets available for this IAM Service account\"]}" ) ; return ResponseEntity . status ( response . getHttpstatus ( ) ) . body ( response . getResponse ( ) ) ; } else { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , "readFolders" ) . put ( LogMessage . MESSAGE , "Unable to readFolders" ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; response . setSuccess ( false ) ; response . setHttpstatus ( HttpStatus . INTERNAL_SERVER_ERROR ) ; response . setResponse ( "{\"errors\":[\"Unexpected error :" + path + "\"]}" ) ; return ResponseEntity . status ( response . getHttpstatus ( ) ) . body ( response . getResponse ( ) ) ; } }
Read Folder details for a given iamsvcacc
 @param token
 @param path
 @return
 @throws IOException
Read Folder details for a given iamsvcacc @param token @param path @return @throws IOException