fidelius-service/src/main/java/org/finra/fidelius/services/CredentialsService.java
@PreAuthorize("@fideliusRoleService.isAuthorized(#metadata.application, #metadata.account)")
    public Metadata createMetadata(Metadata metadata) {

        // Check if the credential to be created already has a history
        List<HistoryEntry> existingCredentials = getCredentialHistory(tableName,
                metadata.getAccount(), metadata.getRegion(), metadata.getApplication(), metadata.getEnvironment(),
                metadata.getComponent(), metadata.getShortKey(), true);
        if (!existingCredentials.isEmpty()) {
            throw new FideliusException("Metadata already exists!", HttpStatus.BAD_REQUEST);
        }

        // Add the new credential
        return putMetadata(metadata);
    }
/**
     * Wrapper for putMetdata used for creating new Metdata
     *
     * @param metadata Metadata to be created
     * @return Metadata created
     */
Wrapper for putMetdata used for creating new Metdata
@param metadata Metadata to be created
@return Metadata created
Wrapper for putMetdata used for creating new Metdata @param metadata Metadata to be created @return Metadata created
@PreAuthorize("@fideliusRoleService.isAuthorized(#metadata.application, #metadata.account)")
    public Metadata createMetadata(Metadata metadata) {
        List<HistoryEntry> existingCredentials = getCredentialHistory(tableName,
                metadata.getAccount(), metadata.getRegion(), metadata.getApplication(), metadata.getEnvironment(),
                metadata.getComponent(), metadata.getShortKey(), true);
        if (!existingCredentials.isEmpty()) {
            throw new FideliusException("Metadata already exists!", HttpStatus.BAD_REQUEST);
        }
        return putMetadata(metadata);
    }
@ PreAuthorize ( "@fideliusRoleService.isAuthorized(#metadata.application, #metadata.account)" ) public Metadata createMetadata ( Metadata metadata ) { List < HistoryEntry > existingCredentials = getCredentialHistory ( tableName , metadata . getAccount ( ) , metadata . getRegion ( ) , metadata . getApplication ( ) , metadata . getEnvironment ( ) , metadata . getComponent ( ) , metadata . getShortKey ( ) , true ) ; if ( ! existingCredentials . isEmpty ( ) ) { throw new FideliusException ( "Metadata already exists!" , HttpStatus . BAD_REQUEST ) ; } return putMetadata ( metadata ) ; }
Wrapper for putMetdata used for creating new Metdata
 @param metadata Metadata to be created
 @return Metadata created
Wrapper for putMetdata used for creating new Metdata @param metadata Metadata to be created @return Metadata created
// Check if the credential to be created already has a history // Add the new credential