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
- 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
- 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
- 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
- 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
- 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
- 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
- get_current(**kwargs)
Gets the organization for the currently signed-in user.
WARNING: This method is incompatible with api client authentication.
- Returns
A response containing the organization for the currently signed-in user.
- Return type
- get_page(page_num=1, 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
- 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
- property org_id_map
Map org guids to ids.
- 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
- 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
- update_org(org_id, name=None, notes=None, ext_ref=None)
Updates an org. Only fields associated with passed parameters will be updated.
- Parameters
org_id (str) – The org’s identifier.
name (str, optional) – The updated name for the org.
notes (str, optional) – The updated notes for the org.
ext_ref (str, optional) – The updated external reference for the org.
- Return type
- 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