pyjen.view module¶
Primitives for interacting with Jenkins views
-
class
pyjen.view.
View
(api)[source]¶ Bases:
object
generic Jenkins views providing interfaces common to all view types
- Parameters
api (
/utils/jenkins_api/JenkinsAPI
) – Pre-initialized connection to the Jenkins REST API
-
clone
(new_view_name)[source]¶ Make a copy of this view with the specified name
- Parameters
new_view_name (str) – name to give the newly created view
- Returns
reference to the created view
- Return type
-
config_xml
¶ Gets the raw XML configuration for the view
Allows callers to manipulate the raw view configuration file as desired.
- Returns
the full XML tree describing this view’s configuration
- Return type
str
-
classmethod
get_supported_plugins
()[source]¶ Returns a list of PyJen plugins that derive from this class
- Return type
list
ofclass
-
static
instantiate
(json_data, rest_api)[source]¶ Factory method for finding the appropriate PyJen view object based on data loaded from the Jenkins REST API
- Parameters
json_data (dict) – data loaded from the Jenkins REST API summarizing the view to be instantiated
rest_api – PyJen REST API configured for use by the parent container. Will be used to instantiate the PyJen view that is returned.
- Returns
PyJen view object wrapping the REST API for the given Jenkins view
- Return type
-
jenkins_plugin_name
¶ Extracts the name of the Jenkins plugin associated with this View
The data returned by this helper property is extracted from the config XML that defines this job.
- Return type
str
-
jobs
¶ Gets a list of jobs associated with this view
Views are simply filters to help organize jobs on the Jenkins dashboard. This method returns the set of jobs that meet the requirements of the filter associated with this view.
- Returns
list of 0 or more jobs that are included in this view
- Return type
list
ofJob
objects
-
name
¶ Gets the display name for this view
This is the name as it appears in the tabbed view of the main Jenkins dashboard
- Returns
the name of the view
- Return type
str
-
rename
(new_view_name)[source]¶ Changes the name of this view
- Parameters
new_view_name (str) – new name for the selected source view
-
view_metrics
¶ Composes a report on the jobs contained within the view
- Returns
Dictionary containing metrics about the view
- Return type
dict