tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/IAMServiceAccountsService.java
public ResponseEntity<String> deleteIAMServiceAccountCreds(UserDetails userDetails, String token, IAMServiceAccountAccessKey iamServiceAccountAccessKey) {
		log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
				put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)).
				put(LogMessage.ACTION, IAMServiceAccountConstants.DELETE_IAMSVCACC_ACCESSKEY_MSG).
				put(LogMessage.MESSAGE, String.format ("Trying to delete access key and secret for the IAM Service account [%s] " +
						"access key id: [%s]", iamServiceAccountAccessKey.getUserName(),
						iamServiceAccountAccessKey.getAccessKeyId())).
				put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).
				build()));
		String accessKeyId = iamServiceAccountAccessKey.getAccessKeyId();
		String awsAccountId = iamServiceAccountAccessKey.getAccountId();
		String iamSvcName = iamServiceAccountAccessKey.getUserName().toLowerCase();
		String uniqueIAMSvcaccName = awsAccountId + "_" + iamSvcName;

		if (!hasResetPermissionForIAMServiceAccount(token, uniqueIAMSvcaccName, userDetails)) {
			log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
					put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)).
					put(LogMessage.ACTION, IAMServiceAccountConstants.DELETE_IAMSVCACC_ACCESSKEY_MSG).
					put(LogMessage.MESSAGE, String.format("Access denited. No permisison to delete IAM service account access key for [%s].", uniqueIAMSvcaccName)).
					put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).
					build()));
			return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{\"errors\":[\"Access denied: No permission to delete this IAM service account access key\"]}");
		}
		if (userDetails.isAdmin()) {
			token = userDetails.getSelfSupportToken();
		}
		return processRequestAndDeleteIAMSvcAccAccessKey(token, uniqueIAMSvcaccName, awsAccountId, iamSvcName, accessKeyId);
	}
/**
	 * Delete IAM Service Account access key and secret.
	 * @param token
	 * @param userDetails
	 * @param iamServiceAccountName
	 * @param awsAccountId
	 * @return
	 */
Delete IAM Service Account access key and secret.
Delete IAM Service Account access key and secret .
public ResponseEntity<String> deleteIAMServiceAccountCreds(UserDetails userDetails, String token, IAMServiceAccountAccessKey iamServiceAccountAccessKey) {
		log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
				put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)).
				put(LogMessage.ACTION, IAMServiceAccountConstants.DELETE_IAMSVCACC_ACCESSKEY_MSG).
				put(LogMessage.MESSAGE, String.format ("Trying to delete access key and secret for the IAM Service account [%s] " +
						"access key id: [%s]", iamServiceAccountAccessKey.getUserName(),
						iamServiceAccountAccessKey.getAccessKeyId())).
				put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).
				build()));
		String accessKeyId = iamServiceAccountAccessKey.getAccessKeyId();
		String awsAccountId = iamServiceAccountAccessKey.getAccountId();
		String iamSvcName = iamServiceAccountAccessKey.getUserName().toLowerCase();
		String uniqueIAMSvcaccName = awsAccountId + "_" + iamSvcName;
		if (!hasResetPermissionForIAMServiceAccount(token, uniqueIAMSvcaccName, userDetails)) {
			log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
					put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)).
					put(LogMessage.ACTION, IAMServiceAccountConstants.DELETE_IAMSVCACC_ACCESSKEY_MSG).
					put(LogMessage.MESSAGE, String.format("Access denited. No permisison to delete IAM service account access key for [%s].", uniqueIAMSvcaccName)).
					put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).
					build()));
			return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{\"errors\":[\"Access denied: No permission to delete this IAM service account access key\"]}");
		}
		if (userDetails.isAdmin()) {
			token = userDetails.getSelfSupportToken();
		}
		return processRequestAndDeleteIAMSvcAccAccessKey(token, uniqueIAMSvcaccName, awsAccountId, iamSvcName, accessKeyId);
	}
public ResponseEntity < String > deleteIAMServiceAccountCreds ( UserDetails userDetails , String token , IAMServiceAccountAccessKey iamServiceAccountAccessKey ) { log . debug ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , IAMServiceAccountConstants . DELETE_IAMSVCACC_ACCESSKEY_MSG ) . put ( LogMessage . MESSAGE , String . format ( "Trying to delete access key and secret for the IAM Service account [%s] " + "access key id: [%s]" , iamServiceAccountAccessKey . getUserName ( ) , iamServiceAccountAccessKey . getAccessKeyId ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; String accessKeyId = iamServiceAccountAccessKey . getAccessKeyId ( ) ; String awsAccountId = iamServiceAccountAccessKey . getAccountId ( ) ; String iamSvcName = iamServiceAccountAccessKey . getUserName ( ) . toLowerCase ( ) ; String uniqueIAMSvcaccName = awsAccountId + "_" + iamSvcName ; if ( ! hasResetPermissionForIAMServiceAccount ( token , uniqueIAMSvcaccName , userDetails ) ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , IAMServiceAccountConstants . DELETE_IAMSVCACC_ACCESSKEY_MSG ) . put ( LogMessage . MESSAGE , String . format ( "Access denited. No permisison to delete IAM service account access key for [%s]." , uniqueIAMSvcaccName ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; return ResponseEntity . status ( HttpStatus . FORBIDDEN ) . body ( "{\"errors\":[\"Access denied: No permission to delete this IAM service account access key\"]}" ) ; } if ( userDetails . isAdmin ( ) ) { token = userDetails . getSelfSupportToken ( ) ; } return processRequestAndDeleteIAMSvcAccAccessKey ( token , uniqueIAMSvcaccName , awsAccountId , iamSvcName , accessKeyId ) ; }
Delete IAM Service Account access key and secret.
Delete IAM Service Account access key and secret .