Project Standards#
- class dataikuapi.dss.project_standards.DSSProjectStandards(client)#
Handle to interact with Project Standards
Warning
Do not create this class directly, use
get_project_standards()
- list_check_specs(as_type='listitems')#
Get the list of the check specs available in the DSS instance.
- Parameters:
as_type (str, optional) – How to return the check specs. Supported values are “listitems” and “objects” (defaults to objects)
- Returns:
A list of check specs. If as_type=listitems, each check spec is returned as a dict. If as_type=objects, each check spec is returned as a
DSSProjectStandardsCheckSpecInfo
.- Return type:
List[DSSProjectStandardsCheckSpecInfo | dict]
- create_checks(check_specs_element_types, as_type='listitems')#
Create new checks from check specs.
- Parameters:
check_specs_element_types (List[str]) – list of check spec element types to import
as_type (str, optional) – How to return the checks. Supported values are “listitems” and “objects” (defaults to listitems)
- Returns:
A list of checks. If as_type=listitems, each check is returned as a
DSSProjectStandardsCheckListItem
. If as_type=objects, each check is returned as aDSSProjectStandardsCheck
.- Return type:
List[DSSProjectStandardsCheck | DSSProjectStandardsCheckListItem]
- get_check(check_id, as_type='object')#
Get the check details
- Parameters:
check_id (str) – id of the check
as_type (str, optional) – How to return the check. Supported values are “dict” and “object” (defaults to object)
- Returns:
The check. If as_type=dict, check is returned as a dict. If as_type=object, check is returned as a
DSSProjectStandardsCheck
.- Return type:
(DSSProjectStandardsCheck | dict)
- list_checks(as_type='listitems')#
Get the list of the checks configured in the DSS instance.
- Parameters:
as_type (str, optional) – How to return the checks. Supported values are “listitems” and “objects” (defaults to listitems)
- Returns:
A list of checks. If as_type=listitems, each check is returned as a
DSSProjectStandardsCheckListItem
. If as_type=objects, each check is returned as aDSSProjectStandardsCheck
.- Return type:
List[DSSProjectStandardsCheck | DSSProjectStandardsCheckListItem]
- get_scope(scope_name, as_type='object')#
Get the scope details
- Parameters:
scope_name (str) – name of the scope
as_type (str, optional) – How to return the scope. Supported values are “dict” and “object” (defaults to object)
- Returns:
The scope. If as_type=dict, scope is returned as a dict. If as_type=object, scope is returned as a
DSSProjectStandardsScope
.- Return type:
(DSSProjectStandardsScope | dict)
- create_scope(name, description='', checks=[], selection_method='BY_PROJECT', items=[])#
Create a new scope
- Parameters:
name (str) – name of the scope, it cannot be changed later
description (str, optional) – description of the scope
checks (List[str], optional) – list of checks associated to the scope
selection_method (str, optional) – the kind of objects the scope will select. Supported values are “BY_PROJECT”, “BY_FOLDER”, and “BY_TAG” (defaults to “BY_PROJECT”)
items (List[str], optional) – list of object ids selected by the scope. The kind of the objects depends on selection_method. BY_PROJECT -> project keys. BY_FOLDER -> folder ids. BY_TAG -> tags.
- Returns:
The new scope returned by the backend
- Return type:
- list_scopes(as_type='listitems')#
Get the list of the scopes configured in the DSS instance.
- Parameters:
as_type (str, optional) – How to return the scopes. Supported values are “listitems” and “objects” (defaults to listitems)
- Returns:
A list of scopes. If as_type=listitems, each check is returned as a dict. If as_type=objects, each check is returned as a
DSSProjectStandardsScope
.- Return type:
List[DSSProjectStandardsScope | dict]
- get_default_scope(as_type='object')#
Get the default scope. If no existing scope is associated with one project, the default scope will be used.
- Parameters:
as_type (str, optional) – How to return the default scope. Supported values are “dict” and “object” (defaults to object)
- Returns:
The default scope. If as_type=dict,it is returned as a dict. If as_type=object, it is returned as a
DSSProjectStandardsScope
.- Return type:
(DSSProjectStandardsScope | dict)
- class dataikuapi.dss.project_standards.DSSProjectStandardsCheckSpecInfo(data)#
Info about a Project Standards check spec. Project Standards check specs can be created or imported using DSS plugin components.
- property element_type#
Element type can be considered as a unique identifier for a check spec. It’s a concatenation of the plugin id and the plugin component id.
- Returns:
The element type of the check spec
- Return type:
str
- property label#
- property description#
- property owner_plugin_id#
- class dataikuapi.dss.project_standards.DSSProjectStandardsCheck(client, data)#
A check for Project Standards
Warning
Do not create this class directly, use
get_check()
- property id#
- property name#
- property description#
- property check_element_type#
- property check_params#
- property tags#
- get_raw()#
Get the raw check
- Return type:
dict
- save()#
Save the check
- Returns:
The updated check returned by the backend
- Return type:
- delete()#
Delete the check
- class dataikuapi.dss.project_standards.DSSProjectStandardsCheckListItem(client, data)#
An item in a list of checks.
Important
Do not instantiate directly, use
list_checks()
- to_check()#
Gets a handle corresponding to this check.
- Return type:
- property id#
- property name#
- property description#
- property check_element_type#
- property check_params#
- class dataikuapi.dss.project_standards.DSSProjectStandardsScope(client, data)#
A scope for Project Standards. Use scopes to select which checks a project should run.
Warning
Do not create this class directly, use
get_scope()
orget_default_scope()
- property is_default#
- property name#
- property description#
- property selection_method#
- Returns:
The selection method.
- Return type:
str
- property selected_projects#
- property selected_folders#
- property selected_tags#
- property checks#
- get_raw()#
Get the raw scope
- Return type:
dict
- reorder(index)#
Move the scope to a new index. The index should be specified on a list that does not include the scope.
Ex: you want to move the scope ‘foo’ at the end of the list of scopes [‘foo’, ‘bar’]. The list without ‘foo’ is [‘bar’] so the new index should be 1 (and not 2)
Note
Default scope will always be the last scope, you can’t move it or put another scope after it.
- Parameters:
index (int) – the new index of the scope.
- save()#
Update the scope.
Note
Description of the default scope cannot be changed.
- Returns:
The updated scope returned by the backend
- Return type:
- delete()#
Delete the scope
- class dataikuapi.dss.project_standards.DSSProjectStandardsRunReport(client, data)#
Report containing the result of all the checks run in the project
- property checks_run_info#
- Returns:
A dict with the info of each run. The key is the check id.
- Return type:
Dict[str, DSSProjectStandardsCheckRunInfo]
- class dataikuapi.dss.project_standards.DSSProjectStandardsCheckRunInfo(client, data)#
Contains info about the run of one check
- property check#
- Returns:
the original check configuration
- Return type:
- property result#
- Returns:
the result of the run
- Return type:
- property duration_ms#
- Returns:
the duration of the check run
- Return type:
int
- property expanded_check_params#
- Returns:
the parameters that have been used when running the check
- Return type:
dict
- class dataikuapi.dss.project_standards.DSSProjectStandardsCheckRunResult(data)#
The result of the check run
- property status#
The status of the run
- Returns:
Possible values: RUN_SUCCESS, RUN_ERROR or NOT_APPLICABLE
- Return type:
str
- property severity#
Severity of a potential issue.
- Returns:
the severity, between 0 and 5. 0 means no issue, 5 means critical issue. None if the run is not a success.
- Return type:
int | None
- property severity_category#
String representation of the severity. None if there is no detected issue or if the run is not a success.
- Returns:
the severity name. Possible values: LOWEST, LOW, MEDIUM, HIGH, CRITICAL. None if the severity is not between 1 and 5.
- Return type:
str | None
- property success#
Whether the run was successful and no issue was found.
- Returns:
True if the run was successful and no issue was found, False otherwise.
- Return type:
bool
- property message#
- Returns:
A message related to the run result.
- Return type:
str
- property details#
- Returns:
Additional metadata about the run
- Return type:
dict