Orgs

class py42.clients.orgs.OrgClient(session)

Bases: py42.clients.BaseClient

A client for interacting with Code42 organization APIs.

Use the OrgClient 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. Rest Documentation

Parameters

org_id (int) – An ID for an organization.

Returns

py42.sdk.response.Py42Response

create_org(org_name, org_ext_ref=None, notes=None, parent_org_uid=None)

Creates a new organization. REST Documentation

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.sdk.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. REST Documentation

Parameters

org_id (int) – An ID for an organization.

Returns

py42.sdk.response.Py42Response

get_all(**kwargs)

Gets all organizations. REST Documentation

Returns

An object that iterates over py42.sdk.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. REST Documentation

Parameters

org_id (int) – An ID for an organization.

Returns

A response containing the organization.

Return type

py42.sdk.response.Py42Response

get_by_name(org_name, **kwargs)

Gets the organization with the given name. REST Documentation

Parameters

org_name (str) – A name of an organization.

Returns

A list of py42.sdk.response.Py42Response objects each containing an organization that has the given name.

Return type

list

get_by_uid(org_uid, **kwargs)

Gets the organization with the given UID. REST Documentation

Parameters

org_uid (str) – A UID for an organization.

Returns

A response containing the organization.

Return type

py42.sdk.response.Py42Response

get_current(**kwargs)

Gets the organization for the currently signed-in user. REST Documentation

Returns

A response containing the organization for the currently signed-in user.

Return type

py42.sdk.response.Py42Response

reactivate(org_id)

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

Parameters

org_id (int) – An ID for an organization.

Returns

py42.sdk.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. REST Documentation

Parameters

org_id (int) – An ID for an organization.

Returns

py42.sdk.response.Py42Response