Groups

The following methods allow for interaction into the Tenable Vulnerability Management groups API.

Methods available on tio.groups:

class GroupsAPI(api: APISession)[source]
add_user(group_id, user_id)[source]

Add a user to a user group.

groups: add-user

Parameters:
  • group_id (int) – The unique identifier of the group to add the user to.

  • user_id (int) – The unique identifier of the user to add.

Returns:

The user was successfully added to the group.

Return type:

None

Examples

>>> tio.groups.add_user(1, 1)
create(name)[source]

Create a new user group.

groups: create

Parameters:

name (str) – The name of the group that will be created.

Returns:

The group resource record of the newly minted group.

Return type:

dict

Examples

>>> group = tio.groups.create('Group Name')
delete(id)[source]

Delete a user group.

groups: delete

Parameters:

id (int) – The unique identifier for the group to be deleted.

Returns:

The group was successfully deleted.

Return type:

None

Examples

>>> tio.groups.delete(1)
delete_user(group_id, user_id)[source]

Delete a user from a user group.

groups: delete-user

Parameters:
  • group_id (int) – The unique identifier for the group to be modified.

  • user_id (int) – The unique identifier for the user to be removed from the group.

Returns:

The user was successfully removed from the group.

Return type:

None

Examples

>>> tio.groups.delete_user(1, 1)
edit(id, name)[source]

Edit a user group.

groups: edit

Parameters:
  • id (int) – The unique identifier for the group to be modified.

  • name (str) – The new name for the group.

Returns:

The group resource record.

Return type:

dict

Examples

>>> tio.groups.edit(1, 'Updated name')
list()[source]

Lists all of the available user groups.

groups: list

Returns:

List of the group resource records

Return type:

list

Examples

>>> for group in tio.groups.list():
...     pprint(group)
list_users(id)[source]

List the user memberships within a specific user group.

groups: list-users

Parameters:

id (int) – The unique identifier of the group requested.

Returns:

List of user resource records based on membership to the specified group.

Return type:

list

Example

>>> for user in tio.groups.list_users(1):
...     pprint(user)