csv_db¶
Classes
CSVAccounting (id, user, application, ...) |
|
CSVApplication (id, image) |
|
CSVApplicationPolicy ([allow_home, ...]) |
|
CSVDatabase (csv_file_path, **kwargs) |
Database class that reads a CSV file and is used by the remoteappmanager. |
CSVUser (id, name) |
-
class
remoteappmanager.db.csv_db.
CSVApplicationPolicy
(allow_home=False, allow_view=False, allow_common=False, volume_source=None, volume_target=None, volume_mode=None)[source]¶
-
class
remoteappmanager.db.csv_db.
CSVDatabase
(csv_file_path, **kwargs)[source]¶ Bases:
remoteappmanager.db.interfaces.ABCDatabase
Database class that reads a CSV file and is used by the remoteappmanager. Currently only accepts one csv file.
Initialiser
Parameters: - csv_file_path (str) – File path for the CSV file
- **kwargs – optional keyword arguments for open(csv_file_path)
-
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: 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:
-
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: 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.