tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/IAMServiceAccountsService.java
public ResponseEntity<String> removeGroupFromIAMServiceAccount(String token, IAMServiceAccountGroup iamServiceAccountGroup, UserDetails userDetails) {
		OIDCGroup oidcGroup = new OIDCGroup();
		log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
				.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
				.put(LogMessage.ACTION, IAMServiceAccountConstants.REMOVE_GROUP_FROM_IAMSVCACC_MSG)
				.put(LogMessage.MESSAGE, "Trying to remove Group from IAM Service Account")
				.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
        if (!userDetails.isAdmin()) {
            token = tokenUtils.getSelfServiceToken();
        }

        if (!isIamSvcaccPermissionInputValid(iamServiceAccountGroup.getAccess())) {
        	log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
        			.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
        			.put(LogMessage.ACTION, IAMServiceAccountConstants.REMOVE_GROUP_FROM_IAMSVCACC_MSG)
        			.put(LogMessage.MESSAGE, "Access denied. Not authorized to remove Group from the IAM Service Accounts.")
        			.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));

        	return ResponseEntity.status(HttpStatus.BAD_REQUEST)
					.body(INVALIDVALUEERROR);
		}

        String iamSvcAccountName = iamServiceAccountGroup.getAwsAccountId() + "_" + iamServiceAccountGroup.getIamSvcAccName();

		boolean isAuthorized = isAuthorizedToAddPermissionInIAMSvcAcc(userDetails, iamSvcAccountName, token, false);
		if (isAuthorized) {
			return groupRemovalForIAMServiceAccount(token, iamServiceAccountGroup, userDetails, oidcGroup,
					iamSvcAccountName);
        }
        else {
            return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("{\"errors\":[\"Access denied: No permission to remove groups from this IAM service account\"]}");
        }

    }
/**
     * Remove Group from IAM Service Account
     *
     * @param token
     * @param iamServiceAccountGroup
     * @param userDetails
     * @return
     */
Remove Group from IAM Service Account
@param token
@param iamServiceAccountGroup
@param userDetails
@return
Remove Group from IAM Service Account @param token @param iamServiceAccountGroup @param userDetails @return
public ResponseEntity<String> removeGroupFromIAMServiceAccount(String token, IAMServiceAccountGroup iamServiceAccountGroup, UserDetails userDetails) {
		OIDCGroup oidcGroup = new OIDCGroup();
		log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
				.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
				.put(LogMessage.ACTION, IAMServiceAccountConstants.REMOVE_GROUP_FROM_IAMSVCACC_MSG)
				.put(LogMessage.MESSAGE, "Trying to remove Group from IAM Service Account")
				.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
        if (!userDetails.isAdmin()) {
            token = tokenUtils.getSelfServiceToken();
        }
        if (!isIamSvcaccPermissionInputValid(iamServiceAccountGroup.getAccess())) {
        	log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
        			.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
        			.put(LogMessage.ACTION, IAMServiceAccountConstants.REMOVE_GROUP_FROM_IAMSVCACC_MSG)
        			.put(LogMessage.MESSAGE, "Access denied. Not authorized to remove Group from the IAM Service Accounts.")
        			.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
        	return ResponseEntity.status(HttpStatus.BAD_REQUEST)
					.body(INVALIDVALUEERROR);
		}
        String iamSvcAccountName = iamServiceAccountGroup.getAwsAccountId() + "_" + iamServiceAccountGroup.getIamSvcAccName();
		boolean isAuthorized = isAuthorizedToAddPermissionInIAMSvcAcc(userDetails, iamSvcAccountName, token, false);
		if (isAuthorized) {
			return groupRemovalForIAMServiceAccount(token, iamServiceAccountGroup, userDetails, oidcGroup,
					iamSvcAccountName);
        }
        else {
            return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("{\"errors\":[\"Access denied: No permission to remove groups from this IAM service account\"]}");
        }
    }
public ResponseEntity < String > removeGroupFromIAMServiceAccount ( String token , IAMServiceAccountGroup iamServiceAccountGroup , UserDetails userDetails ) { OIDCGroup oidcGroup = new OIDCGroup ( ) ; log . debug ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , IAMServiceAccountConstants . REMOVE_GROUP_FROM_IAMSVCACC_MSG ) . put ( LogMessage . MESSAGE , "Trying to remove Group from IAM Service Account" ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; if ( ! userDetails . isAdmin ( ) ) { token = tokenUtils . getSelfServiceToken ( ) ; } if ( ! isIamSvcaccPermissionInputValid ( iamServiceAccountGroup . getAccess ( ) ) ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , IAMServiceAccountConstants . REMOVE_GROUP_FROM_IAMSVCACC_MSG ) . put ( LogMessage . MESSAGE , "Access denied. Not authorized to remove Group from the IAM Service Accounts." ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; return ResponseEntity . status ( HttpStatus . BAD_REQUEST ) . body ( INVALIDVALUEERROR ) ; } String iamSvcAccountName = iamServiceAccountGroup . getAwsAccountId ( ) + "_" + iamServiceAccountGroup . getIamSvcAccName ( ) ; boolean isAuthorized = isAuthorizedToAddPermissionInIAMSvcAcc ( userDetails , iamSvcAccountName , token , false ) ; if ( isAuthorized ) { return groupRemovalForIAMServiceAccount ( token , iamServiceAccountGroup , userDetails , oidcGroup , iamSvcAccountName ) ; } else { return ResponseEntity . status ( HttpStatus . BAD_REQUEST ) . body ( "{\"errors\":[\"Access denied: No permission to remove groups from this IAM service account\"]}" ) ; } }
Remove Group from IAM Service Account
 @param token
 @param iamServiceAccountGroup
 @param userDetails
 @return
Remove Group from IAM Service Account @param token @param iamServiceAccountGroup @param userDetails @return