Service Users

A cloud provider user within a organization service. Examples of this would be administrators and basic users. This class inherits from TopLevelResource and has direct access to the resource’s database object. The following attributes are directly accessible:

attr organization_service_id:
 The ID of the parent organization service (cloud)
attr user_id:The ID of the user
attr user_name:The user name assigned to the user
attr create_date:
 The creation date of the user
attr password_last_used:
 The date and time for when the user last logged in
attr two_factor_enabled:
 Returns a boolean whether two factor is enabled for this user
attr email:The availability zone where this instance runs
attr description:
 The additional information associated with this user
attr disabled:Returns a boolean for whether or not the user’s account is disabled
attr resource_id:
 The provider ID of the service user
class DivvyResource.Resources.serviceuser.ServiceUser(resource_id)

Bases: DivvyResource.Resources.toplevelresource.TopLevelResource

ServiceUser Operations

Delete this resource. If wrapped in a with JobQueue() block, this will queue the deletion job to the wrapped queue, otherwise it
calls immediately.

Disable the service user.


We need to extend our default dependencies to get the ServiceAccessKeys which belong to this user.

get_assigned_access_keys(*args, **kwargs)

Return a list of access keys assigned to this user account :return: list of DivvyDbObjects.ServiceAccessKey

get_assigned_policies(*args, **kwargs)

Return a list of policies assigned to this user account :return: list of DivvyDbObjects.ServicePolicy


Retrieve the time from the provider that this resource was created (if available).

static get_db_class()
static get_provider_id_field()

Returns the name of the user

static get_resource_name_field()
static get_resource_type()

Retrieve all the actions which are supported by this resource.

handle_resource_created(user_resource_id=None, project_resource_id=None)

This should be called when a resource is created/discovered after the basic data is added to the database. This gives an opportunity for post-addition hooks (assignment to groups, alerts, etc)


This should be called when a resource is destroyed before the basic data is removed from the database. This gives an opportunity for pre-destruction hooks (removal from groups, alerts, etc)

handle_resource_modified(resource, *args, **kwargs)

This should be called when a resource is modified after the new data has been updated in the DB session This gives an opportunity for post-modification hooks