Groups¶
Skytap API object wrapping Skytap Groups.
This roughly translates to the Skytap API call of /v2/groups REST call, but gives us better access to the bits and pieces of the groups.
Accessing via command line
If accessed via the command line this will return the environments from Skytap in a JSON format:
python -m skytap.Groups
If you know the environment you want information on, you can also specify it directly. You can search by id or by a part of the environment name:
python -m skytap.Groups 12345
python -m skytap.Groups test
Accessing via Python
You can access the Skytap environments by the skytap.Groups
object.
Example:
groups = skytap.Groups()
for g in groups:
print(g.name)
Each group has many things you can do with it - see the
skytap.models.Group
object for actions you can take on an
individual group.
On the full list of groups, you can also do a few other things:
add()
: add a new group.delete()
: delete a group.
Environments can also perform any of the actions of other
SkytapGroup
objects. See the documentation
on the skytap.models.SkytapGroup
class for
information there.
-
class
skytap.Groups.
Groups
(json_list=None)¶ Bases:
skytap.models.SkytapGroup.SkytapGroup
Set of Skytap groups.
Generally, access this through simply creating a
skytap.Groups
object.Example:
groups = skytap.Groups() for g in groups: print(g.name)
-
add
(group, description='')¶ Add one group.
Parameters: - group (str) – The group name to add.
- description (str) – The group description to add.
Returns: The new group id from Skytap.
Return type: int
Example:
groups = skytap.Groups() new_group = groups.add('muppets', 'felt covered friends') print(groups[new_group].name)
-