Sample jenkins library code which can be helpful in developing the custom functionility as required.
Refer to jenkinsfile under ./src for sample to integrate the library functions onto jenkinsfile. For more details refer to Extending with Shared Libraries