API Documentation¶
-
class
uwgroups.api.UWGroups(certfile, keyfile=None, environment='PROD', timeout=30)[source]¶ Class providing a connection to the UW groups REST API.
certfileandkeyfileare paths to files containing the certificate and private keys, respectively.timeoutis passed tohttplib.HTTPSConnection()Example:
with UWGroups(certfile='/path/to/cert.pem') as conn: conn.get_group('some_group')
-
add_members(group_name, members, batchsize=50)[source]¶ Add uwnetids in list
membersto the specified group in batches of sizebatchsize.
-
connect(timeout=None)[source]¶ Establish a connection. If the
UWGroupsobject is instantiated without a with block, must be called explicitly.timeoutoverrides the value fortimeoutin the class constructor.
-
create_group(group_name, admin_users=None)[source]¶ Create a group with name
group_name. The dns user associated with the certificate, as well as the user identified as the email contact for the cert in fieldemailAddressare always added as admins. A list of additional admin users identified by uwnetid can be provided inadmin_users.Note that the API requires that a parent group (‘root_parent’) must be created before any of its children (‘root_parent_child’). This method will recursively create parent groups if necessary.
-
delete_members(group_name, members, batchsize=50)[source]¶ Remove uwnetids in list
membersfrom the specified group in batches of sizebatchsize.
-
set_affiliate(group_name, service, active=True)[source]¶ Activate (
active=True) or inactivate (active=False) Exchange (service=exchange) or Google Apps (service=google) for the specified group.
-
sync_members(group_name, members, batchsize=50, dry_run=False)[source]¶ Add or remove users from the specified group as necessary so that the group contains
members(a list or uwnetids). Whendry_runis True, log the necessary actions but don’t modify the group. The group is created if it does not already exist.
-