interfaces

Classes

ABCAccounting(id, user, application, ...)
ABCApplication(id, image) Description of an application
ABCApplicationPolicy([allow_home, ...]) Policy for an application
ABCDatabase Main accounting interface required by the single user application.


class remoteappmanager.db.interfaces.ABCAccounting(id, user, application, application_policy)[source]

Bases: object

class remoteappmanager.db.interfaces.ABCApplication(id, image)[source]

Bases: object

Description of an application

id = None

Numerical id

image = None

Name of the image

class remoteappmanager.db.interfaces.ABCApplicationPolicy(allow_home=False, allow_view=False, allow_common=False, volume_source=None, volume_target=None, volume_mode=None)[source]

Bases: object

Policy for an application

allow_common = None

Is the common data volume for the application mounted

allow_home = None

Is the home directory mounted

allow_view = None

Is the application viewable by others

volume_mode = None

Mode for read-write access (ro = Read-only. rw = Read-write)

volume_source = None

Source path for the common data volume on the host machine

volume_target = None

Target mount point of the common data volume in the application

class remoteappmanager.db.interfaces.ABCDatabase[source]

Bases: object

Main accounting interface required by the single user application.

create_application(app_name)[source]

Creates a new application with the specified name. Raises if an application with the same name already exists

Parameters:app_name (str) – The name of the application
Returns:id – The id of the created application
Return type:int
Raises:exceptions.Exists – If the application already exists.
create_user(user_name)[source]

Creates a user with the specified username, if the backend allows it.

Parameters:user_name (str) – The user name
Returns:id – The unique id of the user
Return type:int
Raises:exceptions.Exists – If the user with that name already exists.
get_accounting_for_user(user)[source]

Returns the accounting information for a given user

Parameters:user (opaque-type) – Same type as the result of get_user
Returns:each item of the list should be an instance satisfying the ABCAccounting format (duck typing)
Return type:list
get_user(*, user_name=None, id=None)[source]

Return a User for a given user_name or id, or return None if the User is not found. Only one argument is allowed.

Parameters:
  • user_name (str) – The user name
  • id (int) – An id
Returns:

user – an user object that the database understands

Return type:

opaque-type

grant_access(app_name, user_name, allow_home, allow_view, volume)[source]

Grant access for user to application.

Parameters:
  • app_name (str) – The name of the application
  • user_name (str) – The name of the user
  • allow_home (bool) – If the home workspace should be mounted.
  • allow_view (bool) – If the session should be visible by others.
  • volume (str) – A volume to mount in the format source_path:target_path:mode mode being “ro” or “rw”. (e.g. “/host/path:/container/path:ro”).
Raises:
  • exception.NotFound: – if the app or user are not found.
  • ValueError: – if the volume string is invalid.
Returns:

id – A 32 characters id (mapping_id)

Return type:

str

list_applications()[source]

List all available applications

Returns:applications – A list of the available apps.
Return type:list
list_users()[source]

Returns a list of all available users.

Returns:users – A list of users.
Return type:list
remove_application(*, app_name=None, id=None)[source]

Remove an existing application by name or id, depending what is provided. Only one argument is allowed. If the application is not present, does nothing.

Parameters:
  • app_name (str) – The name of the application
  • id (int) – The id of the application
Raises:

exception.NotFound – If the application is not found.

remove_user(*, user_name=None, id=None)[source]

Removes a user by name or id, if the backend allows it. Only one argument is allowed. If the user is not present, does nothing.

Parameters:user_name (str) – The user name
revoke_access(app_name, user_name, allow_home, allow_view, volume)[source]

Revoke access for user to application.

Parameters:
  • app_name (str) – The name of the application
  • user_name (str) – The name of the user
  • allow_home (bool) – If the home workspace should be mounted.
  • allow_view (bool) – If the session should be visible by others.
  • volume (str) – A volume to mount in the format source_path:target_path:mode mode being “ro” or “rw”. (e.g. “/host/path:/container/path:ro”).
Raises:
  • exception.NotFound: – if the app or user are not found.
  • ValueError: – if the volume string is invalid.
revoke_access_by_id(mapping_id)[source]

Like revoke_access, but uses the mapping id instead.