aria.ops.event

 1#  Copyright 2022 VMware, Inc.
 2#  SPDX-License-Identifier: Apache-2.0
 3from dataclasses import dataclass
 4from enum import Enum
 5from typing import Optional
 6
 7
 8class Criticality(Enum):
 9    NONE = 0
10    INFO = 1
11    WARNING = 2
12    IMMEDIATE = 3
13    CRITICAL = 4
14    AUTOMATIC = 5
15
16
17@dataclass(frozen=True)
18class Event:
19    """Represents a Aria Operations Event
20
21    :param message: The message describes and identifies an event.
22    :param criticality: TODO
23    :param fault_key: TODO
24    :param auto_cancel: TODO
25    :param start_date: TODO
26    :param update_date: TODO
27    :param cancel_date: TODO
28    :param watch_wait_cycle: The number of times this event must be present in a collection before Aria Operations surfaces it
29    in the UI.
30    :param cancel_wait_cycle: The number of times this event must be absent in a collection before Aria Operations removes it
31    from the UI.
32    """
33
34    message: str
35    criticality: Criticality = Criticality.NONE
36    fault_key: Optional[str] = None
37    auto_cancel: bool = False
38    start_date: Optional[int] = None
39    update_date: Optional[int] = None
40    cancel_date: Optional[int] = None
41    watch_wait_cycle: int = 1
42    cancel_wait_cycle: int = 3
43
44    def get_json(self) -> dict:
45        """Get a JSON representation of this Event.
46
47        Returns a JSON representation of this Event in the format required by Aria Operations.
48
49        :return: A JSON representation of this Event.
50        """
51        # message is the only required field. Other fields are optional but non-nullable if present
52        json: dict = {"message": self.message}
53
54        if self.criticality is not None:
55            json["criticality"] = self.criticality.value
56        if self.message is not None:
57            json["message"] = self.message
58        if self.fault_key is not None:
59            json["faultKey"] = self.fault_key
60        if self.auto_cancel is not None:
61            json["autoCancel"] = self.auto_cancel
62        if self.start_date is not None:
63            json["startDate"] = self.start_date
64        if self.update_date is not None:
65            json["updateDate"] = self.update_date
66        if self.cancel_date is not None:
67            json["cancelDate"] = self.cancel_date
68        if self.watch_wait_cycle is not None:
69            json["watchWaitCycle"] = self.watch_wait_cycle
70        if self.cancel_wait_cycle is not None:
71            json["cancelWaitCycle"] = self.cancel_wait_cycle
72
73        return json
class Criticality(enum.Enum):
 9class Criticality(Enum):
10    NONE = 0
11    INFO = 1
12    WARNING = 2
13    IMMEDIATE = 3
14    CRITICAL = 4
15    AUTOMATIC = 5

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access::
>>> Color.RED
<Color.RED: 1>
  • value lookup:
>>> Color(1)
<Color.RED: 1>
  • name lookup:
>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details.

NONE = <Criticality.NONE: 0>
INFO = <Criticality.INFO: 1>
WARNING = <Criticality.WARNING: 2>
IMMEDIATE = <Criticality.IMMEDIATE: 3>
CRITICAL = <Criticality.CRITICAL: 4>
AUTOMATIC = <Criticality.AUTOMATIC: 5>
Inherited Members
enum.Enum
name
value
@dataclass(frozen=True)
class Event:
18@dataclass(frozen=True)
19class Event:
20    """Represents a Aria Operations Event
21
22    :param message: The message describes and identifies an event.
23    :param criticality: TODO
24    :param fault_key: TODO
25    :param auto_cancel: TODO
26    :param start_date: TODO
27    :param update_date: TODO
28    :param cancel_date: TODO
29    :param watch_wait_cycle: The number of times this event must be present in a collection before Aria Operations surfaces it
30    in the UI.
31    :param cancel_wait_cycle: The number of times this event must be absent in a collection before Aria Operations removes it
32    from the UI.
33    """
34
35    message: str
36    criticality: Criticality = Criticality.NONE
37    fault_key: Optional[str] = None
38    auto_cancel: bool = False
39    start_date: Optional[int] = None
40    update_date: Optional[int] = None
41    cancel_date: Optional[int] = None
42    watch_wait_cycle: int = 1
43    cancel_wait_cycle: int = 3
44
45    def get_json(self) -> dict:
46        """Get a JSON representation of this Event.
47
48        Returns a JSON representation of this Event in the format required by Aria Operations.
49
50        :return: A JSON representation of this Event.
51        """
52        # message is the only required field. Other fields are optional but non-nullable if present
53        json: dict = {"message": self.message}
54
55        if self.criticality is not None:
56            json["criticality"] = self.criticality.value
57        if self.message is not None:
58            json["message"] = self.message
59        if self.fault_key is not None:
60            json["faultKey"] = self.fault_key
61        if self.auto_cancel is not None:
62            json["autoCancel"] = self.auto_cancel
63        if self.start_date is not None:
64            json["startDate"] = self.start_date
65        if self.update_date is not None:
66            json["updateDate"] = self.update_date
67        if self.cancel_date is not None:
68            json["cancelDate"] = self.cancel_date
69        if self.watch_wait_cycle is not None:
70            json["watchWaitCycle"] = self.watch_wait_cycle
71        if self.cancel_wait_cycle is not None:
72            json["cancelWaitCycle"] = self.cancel_wait_cycle
73
74        return json

Represents a Aria Operations Event

Parameters
  • message: The message describes and identifies an event.
  • criticality: TODO
  • fault_key: TODO
  • auto_cancel: TODO
  • start_date: TODO
  • update_date: TODO
  • cancel_date: TODO
  • watch_wait_cycle: The number of times this event must be present in a collection before Aria Operations surfaces it in the UI.
  • cancel_wait_cycle: The number of times this event must be absent in a collection before Aria Operations removes it from the UI.
Event( message: str, criticality: aria.ops.event.Criticality = <Criticality.NONE: 0>, fault_key: Optional[str] = None, auto_cancel: bool = False, start_date: Optional[int] = None, update_date: Optional[int] = None, cancel_date: Optional[int] = None, watch_wait_cycle: int = 1, cancel_wait_cycle: int = 3)
def get_json(self) -> dict:
45    def get_json(self) -> dict:
46        """Get a JSON representation of this Event.
47
48        Returns a JSON representation of this Event in the format required by Aria Operations.
49
50        :return: A JSON representation of this Event.
51        """
52        # message is the only required field. Other fields are optional but non-nullable if present
53        json: dict = {"message": self.message}
54
55        if self.criticality is not None:
56            json["criticality"] = self.criticality.value
57        if self.message is not None:
58            json["message"] = self.message
59        if self.fault_key is not None:
60            json["faultKey"] = self.fault_key
61        if self.auto_cancel is not None:
62            json["autoCancel"] = self.auto_cancel
63        if self.start_date is not None:
64            json["startDate"] = self.start_date
65        if self.update_date is not None:
66            json["updateDate"] = self.update_date
67        if self.cancel_date is not None:
68            json["cancelDate"] = self.cancel_date
69        if self.watch_wait_cycle is not None:
70            json["watchWaitCycle"] = self.watch_wait_cycle
71        if self.cancel_wait_cycle is not None:
72            json["cancelWaitCycle"] = self.cancel_wait_cycle
73
74        return json

Get a JSON representation of this Event.

Returns a JSON representation of this Event in the format required by Aria Operations.

Returns

A JSON representation of this Event.