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 (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, with the same configuration options as this one

Return type

View

property config_xml

the raw XML configuration for the view

Allows callers to manipulate the raw view configuration file as desired.

Warning

For advanced use only.

Type

str

delete()[source]

Deletes this view from the dashboard

delete_all_jobs()[source]

Batch operation that deletes all jobs found in this view

disable_all_jobs()[source]

Batch operation that disables all jobs found in this view

enable_all_jobs()[source]

Batch operation that enables all jobs found in this view

classmethod get_supported_plugins()[source]

list: list of PyJen plugin classes that may be used to instantiate views on this Jenkins instance

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 (JenkinsAPI) – 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 view

Return type

View

property 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.

Type

str

property jobs

list of 0 or more 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.

Type

list (Job)

property name

the name as it appears in the tabbed view of the main Jenkins dashboard

Type

str

rename(new_view_name)[source]

Changes the name of this view

Parameters

new_view_name (str) – new name for this view

property view_metrics

Composes a report on the jobs contained within the view

Type

dict