UWIT-IAM / iam-resttools

Apache License 2.0
3 stars 1 forks source link

docs or example code? #46

Open nhoffman opened 7 years ago

nhoffman commented 7 years ago

UW user here - thanks a lot for making this public. I'm wondering if you might be willing to share some examples of basic usage, particularly for group creation. It's pretty easy to find the GWS.create_group() method, but not how to instantiate a Group object to provide as an argument.

jeffFranklin commented 7 years ago

Hi - all of the utilities I know of use the gws client for membership checks, so you might be the first to use create_group(). As such, I couldn't point you to a good example of group creation. A lot of this inherits from https://github.com/uw-it-aca/uw-restclients-gws so there might be a better example there. As far as instantiating a Group object, the constructor we provide looks incorrect, but a lot of create_group's usefulness is in GWS._xml_from_group. I personally would instantiate a Group object and add attributes till you get the desired outcome, like the following...

from resttools.models.gws import Group

config = {}
group = Group()
group.name = 'uw_blah_blah'
group.description = 'Group description goes here'
group.admins = [{'user_type': 'uwnetid', 'name': my_uwnetid}]
group_xml = GWS(config)._xml_from_group(group)