Detection Lists¶
-
class
py42.clients.detectionlists.
DetectionListsClient
(user_profile_service, departing_employee_service, high_risk_employee_service)¶ Bases:
object
-
add_user_cloud_alias
(user_id, alias)¶ Add a cloud alias to a user.
Parameters: - user_id (str or int) – The userUid of the user whose alias you want to update.
- alias (str) – The alias to be added.
Returns:
Add one or more risk factor tags.
Parameters: - user_id (str or int) – The userUid of the user whose risk factor tag(s) you want to update.
- tags (str or list of str) – A single tag or multiple tags in a list to be added. For
example:
"tag1"
or["tag1", "tag2"]
. For python version 2.X, passu"str"
instead of"str"
.
Returns:
-
create_user
(username)¶ Create a detection list profile for a user.
Parameters: username (str) – The Code42 username of the user. Returns: py42.response.Py42Response
-
get_user
(username)¶ Get user details by username.
Parameters: username (str) – The Code42 username of the user. Returns: py42.response.Py42Response
-
get_user_by_id
(user_id)¶ Get user details by user_id.
Parameters: user_id (str or int) – The Code42 userId of the user. Returns: py42.response.Py42Response
-
refresh_user_scim_attributes
(user_id)¶ Refresh SCIM attributes of a user. REST documentation
Parameters: user_id (str or int) – The userUid of the user whose attributes you wish to refresh. Returns: py42.response.Py42Response
-
remove_user_cloud_alias
(user_id, alias)¶ Remove a cloud alias from a user.
Parameters: - user_id (str or int) – The userUid of the user whose alias needs to be removed.
- alias (str) – The alias to be removed.
Returns:
Remove one or more risk factor tags.
Parameters: - user_id (str or int) – The userUid of the user whose risk factor tag(s) needs you want to remove.
- tags (str or list of str) – A single tag or multiple tags in a list to be removed. For
example:
"tag1"
or["tag1", "tag2"]
. For python version 2.X, passu"str"
instead of"str"
.
Returns:
-
update_user_notes
(user_id, notes)¶ Add or update notes related to the user.
Parameters: - user_id (str or int) – The userUid of the user whose notes you want to update.
- notes (str) – User profile notes.
Returns:
-
Departing Employees¶
-
class
py42.services.detectionlists.departing_employee.
DepartingEmployeeFilters
¶ Bases:
py42.services.detectionlists._DetectionListFilters
Constants available for filtering Departing Employee search results.
-
class
py42.services.detectionlists.departing_employee.
DepartingEmployeeService
(session, user_context, user_profile_service)¶ Bases:
py42.services.BaseService
A service for interacting with Code42 Departing Employee APIs.
-
add
(user_id, departure_date=None)¶ Adds a user to the Departing Employees list. Creates a detection list user profile if one didn’t already exist. REST Documentation
Raises a
Py42BadRequestError
when a user already exists in the Departing Employee detection list.Parameters: - user_id (str or int) – The Code42 userUid of the user you want to add to the departing employees list.
- departure_date (str, optional) – Date in yyyy-MM-dd format. Date is treated as UTC. Defaults to None.
Returns:
-
get
(user_id)¶ Gets departing employee data of a user. REST Documentation
Parameters: user_id (str or int) – The Code42 userUid of the user. Returns: py42.sdk.response.Py42Response
-
get_all
(filter_type='OPEN', sort_key='CREATED_AT', sort_direction='DESC', page_size=100)¶ Gets all Departing Employees.
Parameters: - filter_type (str, optional) –
EXFILTRATION_30_DAYS
,EXFILTRATION_24_HOURS
,OPEN
, orLEAVING_TODAY
. Constants are available atpy42.services.detectionlists.departing_employee.DepartingEmployeeFilters
. Defaults to “OPEN”. - sort_key (str, optional) – Sort results based by field. Defaults to “CREATED_AT”.
- sort_direction (str, optional) –
ASC
orDESC
. Defaults to “DESC”. - page_size (int, optional) – The number of departing employees to return per page. Defaults to 100.
Returns: An object that iterates over
py42.response.Py42Response
objects that each contain a page of departing employees.Return type: generator
- filter_type (str, optional) –
-
get_page
(page_num, filter_type='OPEN', sort_key='CREATED_AT', sort_direction='DESC', page_size=100)¶ Gets a single page of Departing Employees.
Parameters: - page_num (int) – The page number to request.
- filter_type (str, optional) –
EXFILTRATION_30_DAYS
,EXFILTRATION_24_HOURS
,OPEN
, orLEAVING_TODAY
. Constants are available atpy42.services.detectionlists.departing_employee.DepartingEmployeeFilters
. Defaults to “OPEN”. - sort_key (str, optional) – Sort results based by field. Defaults to “CREATED_AT”.
- sort_direction (str. optional) –
ASC
orDESC
. Defaults to “DESC”. - page_size (int, optional) – The number of departing employees to return per page. Defaults to 100.
Returns:
-
remove
(user_id)¶ Removes a user from the Departing Employees list. REST Documentation
Parameters: user_id (str or int) – The Code42 userUid of the user. Returns: py42.response.Py42Response
-
set_alerts_enabled
(alerts_enabled=True)¶ Enable or disable email alerting on Departing Employee exposure events. REST Documentation
Parameters: alerts_enabled (bool) – Set alerting to on (True) or off (False). Defaults to True. Returns: py42.response.Py42Response
-
update_departure_date
(user_id, departure_date)¶ Add or modify details of an existing Departing Employee case. REST Documentation
Parameters: - user_id (str) – The Code42 userUid of the user.
- departure_date (date) – Date in yyyy-MM-dd format. Date is treated as UTC.
Returns: py42.sdk.response.Py42Response
-
High Risk Employee¶
-
class
py42.services.detectionlists.high_risk_employee.
HighRiskEmployeeFilters
¶ Bases:
py42.services.detectionlists._DetectionListFilters
Constants available for filtering High Risk Employee search results.
-
class
py42.services.detectionlists.high_risk_employee.
HighRiskEmployeeService
(connection, user_context, user_profile_service)¶ Bases:
py42.services.BaseService
A service for interacting with High Risk Employee APIs.
-
add
(user_id)¶ Adds a user to the High Risk Employee detection list. Creates a detection list user profile if one didn’t already exist.
Raises a
Py42BadRequestError
when a user already exists in the High Risk Employee detection list.Parameters: user_id (str or int) – The Code42 userUid of the user you want to add to the High Risk Employee detection list. Returns: py42.response.Py42Response
-
get
(user_id)¶ Gets user information.
Parameters: user_id (str or int) – The Code42 userUid of the user has been added to the High Risk Employee detection list. Returns: py42.response.Py42Response
-
get_all
(filter_type='OPEN', sort_key=None, sort_direction=None, page_size=100)¶ Searches High Risk Employee list. Filter results by filter_type.
Parameters: - filter_type (str, optional) –
EXFILTRATION_30_DAYS
,EXFILTRATION_24_HOURS
, orOPEN
. Constants are available atpy42.services.detectionlists.high_risk_employee.HighRiskEmployeeFilters
. Defaults to “OPEN”. - sort_key (str, optional) – Sort results based by field. Defaults to None.
- sort_direction (str, optional) –
ASC
orDESC
. Constants available atpy42.constants.SortDirection
. Defaults to None. - page_size (int, optional) – The number of high risk employees to return per page. Defaults to 100.
Returns: An object that iterates over
py42.response.Py42Response
objects that each contain a page of users.Return type: generator
- filter_type (str, optional) –
-
get_page
(page_num, filter_type='OPEN', sort_key=None, sort_direction=None, page_size=100)¶ Gets a single page of High Risk Employees.
Parameters: - page_num (int) – The page number to request.
- filter_type (str, optional) –
EXFILTRATION_30_DAYS
,EXFILTRATION_24_HOURS
, orOPEN
. Constants are available atpy42.services.detectionlists.high_risk_employee.HighRiskEmployeeFilters
. Defaults to “OPEN”. - sort_key (str, optional) – Sort results based by field. Defaults to None.
- sort_direction (str. optional) –
ASC
orDESC
. Constants available atpy42.constants.SortDirection
. Defaults to None. - page_size (int, optional) – The number of high risk employees to return per page. Defaults to 100.
Returns:
-
remove
(user_id)¶ Removes a user from the High Risk Employee detection list.
Parameters: user_id (str or int) – The Code42 userUid of the user you want to add to the High Risk Employee detection list. Returns: py42.response.Py42Response
-
set_alerts_enabled
(enabled=True)¶ Enables alerts.
Parameters: enabled (bool) – Whether to enable alerts for all users. Returns: py42.response.Py42Response
-