A function that triggers passed shell commands using withCredentials in Jenkins. For example instead of doing this

```
 withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'amazon',
                        usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
            //Shell commands block
            sh """
            echo 'hello world'
            echo 'Good bye'
            """
        }

```

Trigger it like that

```
def performWithCredentials(command_block){
    withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'amazon',
                        usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
            //Passed command_block
        }
}

```

What will be the propper way to call it inside a job step in Jenkins?

Thanks and cheers