protected static Template getSingletonTemplate ( KubernetesList resources ) { // if the list contains a single Template lets unwrap it if ( resources != null ) { List < HasMetadata > items = resources . getItems ( ) ; if ( items != null && items . size ( ) == 1 ) { HasMetadata singleEntity = items . get ( 0 ) ; if ( singleEntity instanceof Template ) { return ( Template ) singleEntity ; } } } return null ; }
Returns the Template if the list contains a single Template only otherwise returns null