fidelius-service/src/main/java/org/finra/fidelius/services/CredentialsService.java
@PreAuthorize("@fideliusRoleService.isAuthorized(#metadata.application, #metadata.account)")
    public Metadata putMetadata(Metadata metadata) {
        setFideliusEnvironment(metadata.getAccount(), metadata.getRegion());
        String user = fideliusRoleService.getUserProfile().getUserId();

        String metadataValidation = isValidMetadata(metadata);
        if(!metadataValidation.isEmpty()){
            throw new FideliusException("Metadata source is invalid! " + metadataValidation, HttpStatus.BAD_REQUEST);
        }

        try {
            String version = fideliusService.putMetadata(metadata.getShortKey(), metadata.getApplication(),
                    metadata.getEnvironment(), metadata.getComponent(), metadata.getSourceType(),
                    metadata.getSource(), tableName, user, kmsKey);
            metadata.setLastUpdatedBy(user);
        } catch (Exception e) {
            this.logger.info("Metadata not created " + e.toString());
            return null;
        }

        return metadata;
    }
/**
     * Add new metdata or Update an existing metadata
     *
     * @param metadata Credential to be created
     * @return Credential created
     */
Add new metdata or Update an existing metadata
@param metadata Credential to be created
@return Credential created
Add new metdata or Update an existing metadata @param metadata Credential to be created @return Credential created
@PreAuthorize("@fideliusRoleService.isAuthorized(#metadata.application, #metadata.account)")
    public Metadata putMetadata(Metadata metadata) {
        setFideliusEnvironment(metadata.getAccount(), metadata.getRegion());
        String user = fideliusRoleService.getUserProfile().getUserId();
        String metadataValidation = isValidMetadata(metadata);
        if(!metadataValidation.isEmpty()){
            throw new FideliusException("Metadata source is invalid! " + metadataValidation, HttpStatus.BAD_REQUEST);
        }
        try {
            String version = fideliusService.putMetadata(metadata.getShortKey(), metadata.getApplication(),
                    metadata.getEnvironment(), metadata.getComponent(), metadata.getSourceType(),
                    metadata.getSource(), tableName, user, kmsKey);
            metadata.setLastUpdatedBy(user);
        } catch (Exception e) {
            this.logger.info("Metadata not created " + e.toString());
            return null;
        }
        return metadata;
    }
@ PreAuthorize ( "@fideliusRoleService.isAuthorized(#metadata.application, #metadata.account)" ) public Metadata putMetadata ( Metadata metadata ) { setFideliusEnvironment ( metadata . getAccount ( ) , metadata . getRegion ( ) ) ; String user = fideliusRoleService . getUserProfile ( ) . getUserId ( ) ; String metadataValidation = isValidMetadata ( metadata ) ; if ( ! metadataValidation . isEmpty ( ) ) { throw new FideliusException ( "Metadata source is invalid! " + metadataValidation , HttpStatus . BAD_REQUEST ) ; } try { String version = fideliusService . putMetadata ( metadata . getShortKey ( ) , metadata . getApplication ( ) , metadata . getEnvironment ( ) , metadata . getComponent ( ) , metadata . getSourceType ( ) , metadata . getSource ( ) , tableName , user , kmsKey ) ; metadata . setLastUpdatedBy ( user ) ; } catch ( Exception e ) { this . logger . info ( "Metadata not created " + e . toString ( ) ) ; return null ; } return metadata ; }
Add new metdata or Update an existing metadata
 @param metadata Credential to be created
 @return Credential created
Add new metdata or Update an existing metadata @param metadata Credential to be created @return Credential created