Roles

Retrieving role objects

class RoleMixin

This class defines all functions related to BlueConic roles.

get_role(role_id)

Gets the role with the role ID and returns it as a BlueConic role.

Raises:

HTTPError: Request fails

Returns:

Role

Return type:

Role

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> role = bc.get_role("2a96cf98-af85-40b8-966e-bccbaaa12cf3")
>>> print(role.name)
"Audit User"
get_roles(start=0, count=10000000)

Gets all roles and returns them in a generator with all BlueConic roles.

Parameters:
  • start (int, optional) – The role to start from. Defaults to 0.

  • count (int, optional) – The number of roles to retrieve. Defaults to 10000000.

Returns:

Iterator with Role

Return type:

Iterator[Role]

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> for roles in bc.get_roles():
>>>  print(roles.id)
"a22ffd5b-7e2d-469c-9ef1-68bb5a64de18"
"2a96cf98-af85-40b8-966e-bccbaaa12cf3"

Using role objects

class Role
__init__(role_id, name, description, creator_username, creation_date, last_modified_username, last_modified_date, labels, permissions)

This class represents a BlueConic role.

Parameters:
  • role_id (str) – The ID of the role

  • name (str) – The name of the role

  • description (Optional[str]) – The description of the role

  • creator_username (Optional[str]) – The username that created the role

  • creation_date (Optional[datetime]) – The creation date of the role

  • last_modified_username (Optional[str]) – The username that last modified the role

  • last_modified_date (Optional[datetime]) – The last modified date of the role

  • labels (Optional[Sequence[str]]) – The labels of the role

  • permissions (Optional[Sequence[str]]) – The list of permissions the role has

property creation_date
Returns:

The creation date of this object.

Return type:

Optional[datetime]

property creator_username
Returns:

The username that created this object.

Return type:

Optional[str]

property description
Returns:

Description of this object.

Return type:

Optional[str]

property id
Returns:

ID of this object.

Return type:

str

property labels
Returns:

The labels this object.

Return type:

Optional[Sequence[str]

property last_modified_date
Returns:

The last modified date of this object.

Return type:

Optional[datetime]

property last_modified_username
Returns:

The last modified username of this object.

Return type:

Optional[str]

property name
Returns:

Name of this object.

Return type:

Optional[str]

property permissions
Returns:

Returns the permissions of this role.

Return type:

Sequence[str]