tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/IAMServiceAccountsService.java
private IAMServiceAccount constructIAMSvcAccObjectFromMetadata(Response metaResponse) {
		IAMServiceAccount iamSvcAcc = new IAMServiceAccount();

		if (metaResponse !=null && HttpStatus.OK.equals(metaResponse.getHttpstatus())) {
			try {
				JsonNode jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("ad_group");
				if (jsonNode != null) {
					iamSvcAcc.setAdSelfSupportGroup(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("userName");
				if (jsonNode != null) {
					iamSvcAcc.setUserName(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("awsAccountId");
				if (jsonNode != null) {
					iamSvcAcc.setAwsAccountId(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("awsAccountName");
				if (jsonNode != null) {
					iamSvcAcc.setAwsAccountName(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("createdAtEpoch");
				if (jsonNode != null) {
					iamSvcAcc.setCreatedAtEpoch(jsonNode.asLong());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("owner_ntid");
				if (jsonNode != null) {
					iamSvcAcc.setOwnerNtid(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("owner_email");
				if (jsonNode != null) {
					iamSvcAcc.setOwnerEmail(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("application_id");
				if (jsonNode != null) {
					iamSvcAcc.setApplicationId(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("application_name");
				if (jsonNode != null) {
					iamSvcAcc.setApplicationName(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("application_tag");
				if (jsonNode != null) {
					iamSvcAcc.setApplicationTag(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("expiryDateEpoch");
				if (jsonNode != null) {
					iamSvcAcc.setExpiryDateEpoch(jsonNode.asLong());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("expiryDuration");
				if (jsonNode != null) {
					iamSvcAcc.setExpiryDuration(jsonNode.asLong());
				}
				JsonParser jsonParser = new JsonParser();
				JsonArray dataSecret = ((JsonObject) jsonParser.parse(new ObjectMapper().readTree(metaResponse.getResponse()).get("data").toString()))
						.getAsJsonArray("secret");

				List<IAMSecrets> secrets = new ArrayList<>();
				for (int i = 0; i < dataSecret.size(); i++) {
					IAMSecrets secret = new IAMSecrets();
					JsonElement jsonElement = dataSecret.get(i);
					JsonObject jsonObject = jsonElement.getAsJsonObject();
					if (jsonObject.get("expiryDateEpoch") != null) {
						secret.setExpiryDateEpoch(jsonObject.get("expiryDateEpoch").getAsLong());
					}
					if (jsonObject.get("accessKeyId") != null) {
						secret.setAccessKeyId(jsonObject.get("accessKeyId").getAsString());
					}
					secrets.add(secret);
				}
				iamSvcAcc.setSecret(secrets);
			} catch (IOException e) {
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)).
						put(LogMessage.ACTION, "getServiceAccountMetadataDetails").
						put(LogMessage.MESSAGE, String.format("Failed to parse IAM service account metadata for [%s]", iamSvcAcc.getApplicationName())).
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).
						build()));
				return null;
			}
		}
		return iamSvcAcc;
	}
/**
	 * Constructs a new IAMServiceAccount object based on
	 * the metadata response passed in. It takes the fields
	 * from the response and maps them to the new object.
	 * @param metaResponse
	 * @return IAMServiceAccount
	 */
Constructs a new IAMServiceAccount object based on
the metadata response passed in. It takes the fields
from the response and maps them to the new object.
@param metaResponse
@return IAMServiceAccount
Constructs a new IAMServiceAccount object based on the metadata response passed in . It takes the fields from the response and maps them to the new object . @param metaResponse @return IAMServiceAccount
private IAMServiceAccount constructIAMSvcAccObjectFromMetadata(Response metaResponse) {
		IAMServiceAccount iamSvcAcc = new IAMServiceAccount();
		if (metaResponse !=null && HttpStatus.OK.equals(metaResponse.getHttpstatus())) {
			try {
				JsonNode jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("ad_group");
				if (jsonNode != null) {
					iamSvcAcc.setAdSelfSupportGroup(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("userName");
				if (jsonNode != null) {
					iamSvcAcc.setUserName(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("awsAccountId");
				if (jsonNode != null) {
					iamSvcAcc.setAwsAccountId(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("awsAccountName");
				if (jsonNode != null) {
					iamSvcAcc.setAwsAccountName(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("createdAtEpoch");
				if (jsonNode != null) {
					iamSvcAcc.setCreatedAtEpoch(jsonNode.asLong());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("owner_ntid");
				if (jsonNode != null) {
					iamSvcAcc.setOwnerNtid(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("owner_email");
				if (jsonNode != null) {
					iamSvcAcc.setOwnerEmail(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("application_id");
				if (jsonNode != null) {
					iamSvcAcc.setApplicationId(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("application_name");
				if (jsonNode != null) {
					iamSvcAcc.setApplicationName(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("application_tag");
				if (jsonNode != null) {
					iamSvcAcc.setApplicationTag(jsonNode.asText());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("expiryDateEpoch");
				if (jsonNode != null) {
					iamSvcAcc.setExpiryDateEpoch(jsonNode.asLong());
				}
				jsonNode = new ObjectMapper().readTree(metaResponse.getResponse()).get("data").get("expiryDuration");
				if (jsonNode != null) {
					iamSvcAcc.setExpiryDuration(jsonNode.asLong());
				}
				JsonParser jsonParser = new JsonParser();
				JsonArray dataSecret = ((JsonObject) jsonParser.parse(new ObjectMapper().readTree(metaResponse.getResponse()).get("data").toString()))
						.getAsJsonArray("secret");
				List<IAMSecrets> secrets = new ArrayList<>();
				for (int i = 0; i < dataSecret.size(); i++) {
					IAMSecrets secret = new IAMSecrets();
					JsonElement jsonElement = dataSecret.get(i);
					JsonObject jsonObject = jsonElement.getAsJsonObject();
					if (jsonObject.get("expiryDateEpoch") != null) {
						secret.setExpiryDateEpoch(jsonObject.get("expiryDateEpoch").getAsLong());
					}
					if (jsonObject.get("accessKeyId") != null) {
						secret.setAccessKeyId(jsonObject.get("accessKeyId").getAsString());
					}
					secrets.add(secret);
				}
				iamSvcAcc.setSecret(secrets);
			} catch (IOException e) {
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)).
						put(LogMessage.ACTION, "getServiceAccountMetadataDetails").
						put(LogMessage.MESSAGE, String.format("Failed to parse IAM service account metadata for [%s]", iamSvcAcc.getApplicationName())).
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).
						build()));
				return null;
			}
		}
		return iamSvcAcc;
	}
private IAMServiceAccount constructIAMSvcAccObjectFromMetadata ( Response metaResponse ) { IAMServiceAccount iamSvcAcc = new IAMServiceAccount ( ) ; if ( metaResponse != null && HttpStatus . OK . equals ( metaResponse . getHttpstatus ( ) ) ) { try { JsonNode jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "ad_group" ) ; if ( jsonNode != null ) { iamSvcAcc . setAdSelfSupportGroup ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "userName" ) ; if ( jsonNode != null ) { iamSvcAcc . setUserName ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "awsAccountId" ) ; if ( jsonNode != null ) { iamSvcAcc . setAwsAccountId ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "awsAccountName" ) ; if ( jsonNode != null ) { iamSvcAcc . setAwsAccountName ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "createdAtEpoch" ) ; if ( jsonNode != null ) { iamSvcAcc . setCreatedAtEpoch ( jsonNode . asLong ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "owner_ntid" ) ; if ( jsonNode != null ) { iamSvcAcc . setOwnerNtid ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "owner_email" ) ; if ( jsonNode != null ) { iamSvcAcc . setOwnerEmail ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "application_id" ) ; if ( jsonNode != null ) { iamSvcAcc . setApplicationId ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "application_name" ) ; if ( jsonNode != null ) { iamSvcAcc . setApplicationName ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "application_tag" ) ; if ( jsonNode != null ) { iamSvcAcc . setApplicationTag ( jsonNode . asText ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "expiryDateEpoch" ) ; if ( jsonNode != null ) { iamSvcAcc . setExpiryDateEpoch ( jsonNode . asLong ( ) ) ; } jsonNode = new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . get ( "expiryDuration" ) ; if ( jsonNode != null ) { iamSvcAcc . setExpiryDuration ( jsonNode . asLong ( ) ) ; } JsonParser jsonParser = new JsonParser ( ) ; JsonArray dataSecret = ( ( JsonObject ) jsonParser . parse ( new ObjectMapper ( ) . readTree ( metaResponse . getResponse ( ) ) . get ( "data" ) . toString ( ) ) ) . getAsJsonArray ( "secret" ) ; List < IAMSecrets > secrets = new ArrayList < > ( ) ; for ( int i = 0 ; i < dataSecret . size ( ) ; i ++ ) { IAMSecrets secret = new IAMSecrets ( ) ; JsonElement jsonElement = dataSecret . get ( i ) ; JsonObject jsonObject = jsonElement . getAsJsonObject ( ) ; if ( jsonObject . get ( "expiryDateEpoch" ) != null ) { secret . setExpiryDateEpoch ( jsonObject . get ( "expiryDateEpoch" ) . getAsLong ( ) ) ; } if ( jsonObject . get ( "accessKeyId" ) != null ) { secret . setAccessKeyId ( jsonObject . get ( "accessKeyId" ) . getAsString ( ) ) ; } secrets . add ( secret ) ; } iamSvcAcc . setSecret ( secrets ) ; } catch ( IOException e ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , "getServiceAccountMetadataDetails" ) . put ( LogMessage . MESSAGE , String . format ( "Failed to parse IAM service account metadata for [%s]" , iamSvcAcc . getApplicationName ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; return null ; } } return iamSvcAcc ; }
Constructs a new IAMServiceAccount object based on
 the metadata response passed in.
Constructs a new IAMServiceAccount object based on the metadata response passed in .