tickets package¶
Subpackages¶
Submodules¶
tickets.admin module¶
tickets.apps module¶
tickets.connectors module¶
-
class
tickets.connectors.
AlarmConnector
¶ Bases:
object
This class defines methods to communicate the Ticket app with the Alarm app
-
classmethod
acknowledge_alarms
(alarm_ids)¶ Akcnowledge Alarms based on a list of Alarm IDs
- Args:
- alarms_id (list): List of IDs of the Alarms to acknowledge
- Return:
- List of IDs of the acknowledged alarms
-
classmethod
get_alarm_ancestors
(alarm_id)¶ Get the ancestors of the specified alarm
Args: alarm_id (string): The id of the alarm to get the ancestors
-
classmethod
get_alarm_dependencies
(alarm_id)¶ Get the dependencies of the specified alarm
Args: alarm_id (string): The id of the alarm to get the dependencies
-
classmethod
shelve_alarm
(alarm_id)¶ Shelve an Alarm based on an Alarm ID
- Args:
- alarm_id (string): ID of the Alarms to shelve
-
classmethod
unshelve_alarms
(alarm_ids)¶ Unshelve Alarms based on a list of Alarm IDs
- Args:
- alarms_id (list): List of IDs of the Alarms to unshelve
-
classmethod
tickets.models module¶
-
tickets.models.
ACK_TICKET_PERMISSIONS
= ('change', 'delete', 'view', 'acknowledge')¶ Ack ticket permissions
-
tickets.models.
PERMISSIONS
= ('change', 'delete', 'view')¶ Models Permissions
-
tickets.models.
SHELVE_REGISTRY_PERMISSIONS
= ('change', 'delete', 'view', 'add', 'unshelve')¶ Shelve registry permissions
-
class
tickets.models.
ShelveRegistry
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Registry of when an alarm is shelved
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
alarm_id
¶ Reference to the related alarm
-
get_next_by_shelved_at
(*, field=<django.db.models.fields.DateTimeField: shelved_at>, is_next=True, **kwargs)¶
-
get_previous_by_shelved_at
(*, field=<django.db.models.fields.DateTimeField: shelved_at>, is_next=False, **kwargs)¶
-
get_status_display
(*, field=<django.db.models.fields.IntegerField: status>)¶
-
static
has_check_timeouts_permission
(request)¶
-
static
has_create_permission
(request)¶
-
static
has_destroy_permission
(request)¶
-
has_object_destroy_permission
(request)¶
-
has_object_read_permission
(request)¶
-
has_object_update_permission
(request)¶
-
static
has_read_permission
(request)¶
-
static
has_unshelve_permission
(request)¶
-
static
has_update_permission
(request)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
message
¶ Message posted when the ticket is closed
-
objects
= <django.db.models.manager.Manager object>¶
-
save
(*args, **kwargs)¶ Check if the message is not empty before saving
-
shelved_at
¶ Time when the alarm is shelved
-
status
¶ State of the shelve_registry, default is shelved
-
timeout
¶ Timeout after which a shelved Alarm must be unshelved
-
to_dict
()¶ Return the shelve_registry as a dictionary
-
unshelve
()¶ Unshelves the registry modifying the status and the resolution timestamp
-
unshelved_at
¶ Time when the alarm is unshelved
-
user
¶ User that shelve the alarm (create)
-
exception
-
class
tickets.models.
ShelveRegistryStatus
¶ Bases:
utils.choice_enum.ChoiceEnum
Status options of a ShelveRegistry
-
SHELVED
= 1¶ Shelved
-
UNSHELVED
= 0¶ Unshelved
-
-
class
tickets.models.
Ticket
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Ticket associated to an alarm that needs to be acknowledged
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
acknowledge
(message, user)¶ Resolves the ticket modifying the status, the resolution timestamp and the message
-
acknowledged_at
¶ Time when the ticket is updated
-
alarm_id
¶ Reference to the related alarm
-
clear
()¶ Records the time when the associated alarm was cleared and update the ticket state
-
cleared_at
¶ Time when the associated alarm is cleared
-
created_at
¶ Time when the ticket is created
-
get_next_by_created_at
(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)¶
-
get_previous_by_created_at
(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)¶
-
get_status_display
(*, field=<django.db.models.fields.IntegerField: status>)¶
-
static
has_acknowledge_permission
(request)¶
-
static
has_create_permission
(request)¶
-
has_object_read_permission
(request)¶
-
static
has_read_permission
(request)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
message
¶ Message posted when the ticket is closed
-
objects
= <django.db.models.manager.Manager object>¶
-
status
¶ State of the ticket, default is open
-
to_dict
()¶ Return the ticket as a dictionary
-
user
¶ User that closes the ticket
-
exception
tickets.serializers module¶
-
class
tickets.serializers.
ShelveRegistrySerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)¶ Bases:
rest_framework.serializers.ModelSerializer
Serializer to map the Model instance into JSON format.
-
class
Meta
¶ Bases:
object
Meta class to map serializer’s fields with the model fields.
-
fields
= '__all__'¶
-
model
¶ alias of
tickets.models.ShelveRegistry
-
-
class
-
class
tickets.serializers.
TicketSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)¶ Bases:
rest_framework.serializers.ModelSerializer
Serializer to map the Model instance into JSON format.
-
class
Meta
¶ Bases:
object
Meta class to map serializer’s fields with the model fields.
-
fields
= '__all__'¶
-
model
¶ alias of
tickets.models.Ticket
-
-
class
tickets.urls module¶
tickets.views module¶
-
class
tickets.views.
ShelveRegistryViewSet
(**kwargs)¶ Bases:
rest_framework.viewsets.ModelViewSet
List, Create, Retrieve, Update and Destroy ShelveRegistries
-
basename
= None¶
-
check_timeouts
(request)¶ Check if the timeouts of the registries are reached
-
create
(request, *args, **kwargs)¶ Redefine create method in order to notify to the alarms app
-
detail
= None¶
-
filters
(request)¶ Retrieve the list of tickets filtered by alarm and status
-
permission_classes
= (<class 'dry_rest_permissions.generics.DRYPermissions'>,)¶
-
queryset
= <QuerySet []>¶
-
serializer_class
¶
-
suffix
= None¶
-
unshelve
(request)¶ Unshelve multiple registries
-
-
class
tickets.views.
TicketViewSet
(**kwargs)¶ Bases:
rest_framework.viewsets.ModelViewSet
List, Create, Retrieve, Update and Destroy Tickets.
-
acknowledge
(request)¶ Acknowledge multiple tickets with the same message and timestamp
-
basename
= None¶
-
detail
= None¶
-
filters
(request)¶ Retrieve the list of tickets filtered by alarm and status
-
old_open_info
(request)¶ Retrieve a dictionary with information of the open tickets related with an alarm and its dependencies
-
permission_classes
= (<class 'dry_rest_permissions.generics.DRYPermissions'>,)¶
-
queryset
= <QuerySet [<Ticket: 2019-04-09 19:39:55.782528+00:00 - Alarmdummy>, <Ticket: 2019-04-09 19:39:55.821598+00:00 - Alarmdummy-21>, <Ticket: 2019-04-09 19:39:55.845113+00:00 - Alarmdummy-22>, <Ticket: 2019-04-09 19:39:55.873701+00:00 - Alarmdummy-2>, <Ticket: 2019-04-09 19:39:55.899096+00:00 - Alarmdummy-Global>, <Ticket: 2019-04-09 19:39:55.924098+00:00 - WS-Inner-Humidity>, <Ticket: 2019-04-09 19:39:55.949037+00:00 - WS-Inner-Temperature>, <Ticket: 2019-04-09 19:39:55.973517+00:00 - WS-Inner-WindSpeed>, <Ticket: 2019-04-09 19:39:55.998812+00:00 - WS-Inner-WindSpeed15>, <Ticket: 2019-04-09 19:39:56.023093+00:00 - WS-Inner-WindSpeed20>, <Ticket: 2019-04-09 19:39:56.048949+00:00 - WS-Inner-WindSpeed30>, <Ticket: 2019-04-09 19:39:56.074047+00:00 - WS-W-Humidity>, <Ticket: 2019-04-09 19:39:56.098795+00:00 - WS-W-Temperature>, <Ticket: 2019-04-09 19:39:56.123446+00:00 - WS-W-WindSpeed>, <Ticket: 2019-04-09 19:39:56.149055+00:00 - WS-W-WindSpeed15>, <Ticket: 2019-04-09 19:39:56.174061+00:00 - WS-W-WindSpeed20>, <Ticket: 2019-04-09 19:39:56.199365+00:00 - WS-W-WindSpeed30>, <Ticket: 2019-04-09 19:39:56.223156+00:00 - WS-P-Humidity>, <Ticket: 2019-04-09 19:39:56.248662+00:00 - WS-P-Temperature>, <Ticket: 2019-04-09 19:39:56.273998+00:00 - WS-P-WindSpeed>, '...(remaining elements truncated)...']>¶
-
serializer_class
¶ alias of
tickets.serializers.TicketSerializer
-
suffix
= None¶
-