public String getProjectId ( ) { try { String gcloudProject = gcloud . getConfig ( ) . getProject ( ) ; if ( gcloudProject == null || gcloudProject . trim ( ) . isEmpty ( ) ) { throw new RuntimeException ( "Project was not found in gcloud config" ) ; } return gcloudProject ; } catch ( CloudSdkNotFoundException | CloudSdkOutOfDateException | CloudSdkVersionFileException | IOException | ProcessHandlerException ex ) { throw new RuntimeException ( "Failed to read project from gcloud config" , ex ) ; } }
Return gcloud config property for project or error out if not found .