Orgs

class py42.services.orgs.OrgService(connection)

Bases: py42.services.BaseService

A service for interacting with Code42 organization APIs.

Use the OrgService to create and retrieve organizations. You can also use it to block and deactivate organizations.

block(org_id)

Blocks the organization with the given org ID as well as its child organizations. A blocked organization will not allow any of its users or devices to log in. New registrations will be rejected and all currently logged in clients will be logged out. Backups continue for any devices that are still active.

Parameters:org_id (int) – An ID for an organization.
Returns:py42.response.Py42Response
create_org(org_name, org_ext_ref=None, notes=None, parent_org_uid=None)

Creates a new organization.

Parameters:
  • org_name (str) – The name of the new organization.
  • org_ext_ref (str, optional) – External reference information, such as a serial number, asset tag, employee ID, or help desk issue ID. Defaults to None.
  • notes (str, optional) – Descriptive information about the organization. Defaults to None.
  • parent_org_uid (int, optional) – The org UID for the parent organization. Defaults to None.
Returns:

py42.response.Py42Response

deactivate(org_id)

Deactivates the organization with the given ID, including all users, plans, and devices. Backups stop and archives move to cold storage.

Parameters:org_id (int) – An ID for an organization.
Returns:py42.response.Py42Response
get_agent_full_disk_access_states(org_id)

Gets the full disk access status for devices in an org.

Parameters:org_id (str) – The org’s identifier.
Returns:A response containing settings information.
Return type:py42.response.Py42Response
get_agent_state(org_id, property_name)

Gets the agent state of the devices in the org.

Parameters:
  • org_id (str) – The org’s identifier.
  • property_name (str) – The name of the property to retrieve (e.g. fullDiskAccess).
Returns:

A response containing settings information.

Return type:

py42.response.Py42Response

get_all(**kwargs)

Gets all organizations.

Returns:An object that iterates over py42.response.Py42Response objects that each contain a page of organizations.
Return type:generator
get_by_id(org_id, **kwargs)

Gets the organization with the given ID.

Parameters:org_id (int) – An ID for an organization.
Returns:A response containing the organization.
Return type:py42.response.Py42Response
get_by_uid(org_uid, **kwargs)

Gets the organization with the given UID.

Parameters:org_uid (str) – A UID for an organization.
Returns:A response containing the organization.
Return type:py42.response.Py42Response
get_current(**kwargs)

Gets the organization for the currently signed-in user.

Returns:A response containing the organization for the currently signed-in user.
Return type:py42.response.Py42Response
get_page(page_num, page_size=None, **kwargs)

Gets an individual page of organizations.

Parameters:
  • page_num (int) – The page number to request.
  • page_size (int, optional) – The number of organizations to return per page. Defaults to py42.settings.items_per_page.
  • kwargs (dict, optional) – Additional advanced-user arguments. Defaults to None.
Returns:

py42.response.Py42Response

get_settings(org_id)

Gets setting data for an org and returns an OrgSettingsManager for the target org.

Parameters:org_id (int,str) – The identifier of the org.
Returns:A class to help manage org settings.
Return type:py42.clients._settings_managers.OrgSettings
reactivate(org_id)

Reactivates the organization with the given ID. Backups are not restarted automatically.

Parameters:org_id (int) – An ID for an organization.
Returns:py42.response.Py42Response
unblock(org_id)

Removes a block, if one exists, on an organization and its descendants with the given ID. All users in the organization remain blocked until they are unblocked individually.

Parameters:org_id (int) – An ID for an organization.
Returns:py42.response.Py42Response
update_settings(org_settings)

Updates an org’s settings based on changes to the passed in OrgSettings instance.

Parameters:org_settings (OrgSettings) – An OrgSettings instance with desired modifications to settings.
Returns:A namedtuple containing the result of the setting change api calls.
Return type:py42.services.orgs.OrgSettings