tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/IAMServiceAccountsService.java
private IAMServiceAccountMetadataDetails constructIAMSvcAccMetaData(IAMServiceAccount iamServiceAccount) {

		IAMServiceAccountMetadataDetails iamServiceAccountMetadataDetails = new IAMServiceAccountMetadataDetails();
		log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
				.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
				.put(LogMessage.ACTION, "constructIAMSvcAccMetaData")
				.put(LogMessage.MESSAGE,
						String.format("Trying to populate metadata details for the IAM Service Account [%s]",
								iamServiceAccount.getUserName()))
				.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));

		List<IAMSecretsMetadata> iamSecretsMetadatas = new ArrayList<>();
		iamServiceAccountMetadataDetails.setUserName(iamServiceAccount.getUserName());
		iamServiceAccountMetadataDetails.setAwsAccountId(iamServiceAccount.getAwsAccountId());
		iamServiceAccountMetadataDetails.setAwsAccountName(iamServiceAccount.getAwsAccountName());
		iamServiceAccountMetadataDetails.setApplicationId(iamServiceAccount.getApplicationId());
		iamServiceAccountMetadataDetails.setApplicationName(iamServiceAccount.getApplicationName());
		iamServiceAccountMetadataDetails.setApplicationTag(iamServiceAccount.getApplicationTag());
		iamServiceAccountMetadataDetails.setCreatedAtEpoch(iamServiceAccount.getCreatedAtEpoch());
		iamServiceAccountMetadataDetails.setOwnerEmail(iamServiceAccount.getOwnerEmail());
		iamServiceAccountMetadataDetails.setOwnerNtid(iamServiceAccount.getOwnerNtid());
		if (iamServiceAccount.getSecret() != null) {
			for (IAMSecrets iamSecrets : iamServiceAccount.getSecret()) {
				IAMSecretsMetadata iamSecretsMetadata = new IAMSecretsMetadata();
				iamSecretsMetadata.setAccessKeyId(iamSecrets.getAccessKeyId());
				iamSecretsMetadata.setExpiryDuration(iamServiceAccount.getExpiryDateEpoch());
				iamSecretsMetadatas.add(iamSecretsMetadata);
			}
		}
		iamServiceAccountMetadataDetails.setSecret(iamSecretsMetadatas);
		// Adding self support ad group to metadata if available in request
		if (!StringUtils.isEmpty(iamServiceAccount.getAdSelfSupportGroup())) {
			iamServiceAccountMetadataDetails.setAdSelfSupportGroup(iamServiceAccount.getAdSelfSupportGroup());
		}

		// Service account level expiry duration
		iamServiceAccountMetadataDetails.setExpiryDuration(iamServiceAccount.getExpiryDuration());

		// Setting activated status to true on onboard
		iamServiceAccountMetadataDetails.setAccountActivated(true);

		// Setting the expiry date epoch to service account level
		iamServiceAccountMetadataDetails.setExpiryDateEpoch(iamServiceAccount.getExpiryDateEpoch());

		return iamServiceAccountMetadataDetails;
	}
/**
	 * Method to populate IAMServiceAccountMetadataDetails object
	 *
	 * @param iamServiceAccount
	 * @return
	 */
Method to populate IAMServiceAccountMetadataDetails object
@param iamServiceAccount
@return
Method to populate IAMServiceAccountMetadataDetails object @param iamServiceAccount @return
private IAMServiceAccountMetadataDetails constructIAMSvcAccMetaData(IAMServiceAccount iamServiceAccount) {
		IAMServiceAccountMetadataDetails iamServiceAccountMetadataDetails = new IAMServiceAccountMetadataDetails();
		log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
				.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
				.put(LogMessage.ACTION, "constructIAMSvcAccMetaData")
				.put(LogMessage.MESSAGE,
						String.format("Trying to populate metadata details for the IAM Service Account [%s]",
								iamServiceAccount.getUserName()))
				.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
		List<IAMSecretsMetadata> iamSecretsMetadatas = new ArrayList<>();
		iamServiceAccountMetadataDetails.setUserName(iamServiceAccount.getUserName());
		iamServiceAccountMetadataDetails.setAwsAccountId(iamServiceAccount.getAwsAccountId());
		iamServiceAccountMetadataDetails.setAwsAccountName(iamServiceAccount.getAwsAccountName());
		iamServiceAccountMetadataDetails.setApplicationId(iamServiceAccount.getApplicationId());
		iamServiceAccountMetadataDetails.setApplicationName(iamServiceAccount.getApplicationName());
		iamServiceAccountMetadataDetails.setApplicationTag(iamServiceAccount.getApplicationTag());
		iamServiceAccountMetadataDetails.setCreatedAtEpoch(iamServiceAccount.getCreatedAtEpoch());
		iamServiceAccountMetadataDetails.setOwnerEmail(iamServiceAccount.getOwnerEmail());
		iamServiceAccountMetadataDetails.setOwnerNtid(iamServiceAccount.getOwnerNtid());
		if (iamServiceAccount.getSecret() != null) {
			for (IAMSecrets iamSecrets : iamServiceAccount.getSecret()) {
				IAMSecretsMetadata iamSecretsMetadata = new IAMSecretsMetadata();
				iamSecretsMetadata.setAccessKeyId(iamSecrets.getAccessKeyId());
				iamSecretsMetadata.setExpiryDuration(iamServiceAccount.getExpiryDateEpoch());
				iamSecretsMetadatas.add(iamSecretsMetadata);
			}
		}
		iamServiceAccountMetadataDetails.setSecret(iamSecretsMetadatas);
		if (!StringUtils.isEmpty(iamServiceAccount.getAdSelfSupportGroup())) {
			iamServiceAccountMetadataDetails.setAdSelfSupportGroup(iamServiceAccount.getAdSelfSupportGroup());
		}
		iamServiceAccountMetadataDetails.setExpiryDuration(iamServiceAccount.getExpiryDuration());
		iamServiceAccountMetadataDetails.setAccountActivated(true);
		iamServiceAccountMetadataDetails.setExpiryDateEpoch(iamServiceAccount.getExpiryDateEpoch());
		return iamServiceAccountMetadataDetails;
	}
private IAMServiceAccountMetadataDetails constructIAMSvcAccMetaData ( IAMServiceAccount iamServiceAccount ) { IAMServiceAccountMetadataDetails iamServiceAccountMetadataDetails = new IAMServiceAccountMetadataDetails ( ) ; log . debug ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , "constructIAMSvcAccMetaData" ) . put ( LogMessage . MESSAGE , String . format ( "Trying to populate metadata details for the IAM Service Account [%s]" , iamServiceAccount . getUserName ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; List < IAMSecretsMetadata > iamSecretsMetadatas = new ArrayList < > ( ) ; iamServiceAccountMetadataDetails . setUserName ( iamServiceAccount . getUserName ( ) ) ; iamServiceAccountMetadataDetails . setAwsAccountId ( iamServiceAccount . getAwsAccountId ( ) ) ; iamServiceAccountMetadataDetails . setAwsAccountName ( iamServiceAccount . getAwsAccountName ( ) ) ; iamServiceAccountMetadataDetails . setApplicationId ( iamServiceAccount . getApplicationId ( ) ) ; iamServiceAccountMetadataDetails . setApplicationName ( iamServiceAccount . getApplicationName ( ) ) ; iamServiceAccountMetadataDetails . setApplicationTag ( iamServiceAccount . getApplicationTag ( ) ) ; iamServiceAccountMetadataDetails . setCreatedAtEpoch ( iamServiceAccount . getCreatedAtEpoch ( ) ) ; iamServiceAccountMetadataDetails . setOwnerEmail ( iamServiceAccount . getOwnerEmail ( ) ) ; iamServiceAccountMetadataDetails . setOwnerNtid ( iamServiceAccount . getOwnerNtid ( ) ) ; if ( iamServiceAccount . getSecret ( ) != null ) { for ( IAMSecrets iamSecrets : iamServiceAccount . getSecret ( ) ) { IAMSecretsMetadata iamSecretsMetadata = new IAMSecretsMetadata ( ) ; iamSecretsMetadata . setAccessKeyId ( iamSecrets . getAccessKeyId ( ) ) ; iamSecretsMetadata . setExpiryDuration ( iamServiceAccount . getExpiryDateEpoch ( ) ) ; iamSecretsMetadatas . add ( iamSecretsMetadata ) ; } } iamServiceAccountMetadataDetails . setSecret ( iamSecretsMetadatas ) ; if ( ! StringUtils . isEmpty ( iamServiceAccount . getAdSelfSupportGroup ( ) ) ) { iamServiceAccountMetadataDetails . setAdSelfSupportGroup ( iamServiceAccount . getAdSelfSupportGroup ( ) ) ; } iamServiceAccountMetadataDetails . setExpiryDuration ( iamServiceAccount . getExpiryDuration ( ) ) ; iamServiceAccountMetadataDetails . setAccountActivated ( true ) ; iamServiceAccountMetadataDetails . setExpiryDateEpoch ( iamServiceAccount . getExpiryDateEpoch ( ) ) ; return iamServiceAccountMetadataDetails ; }
Method to populate IAMServiceAccountMetadataDetails object
 @param iamServiceAccount
 @return
Method to populate IAMServiceAccountMetadataDetails object @param iamServiceAccount @return
// Adding self support ad group to metadata if available in request // Service account level expiry duration // Setting activated status to true on onboard // Setting the expiry date epoch to service account level