- 
                Notifications
    You must be signed in to change notification settings 
- Fork 79
adding monitors in region endpoint #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
c29a060
              5d883ea
              132fbf2
              487bce6
              7b9bc6c
              4c3e65f
              90518a9
              ae967c3
              126a93c
              c764906
              a45a0fa
              8bd812f
              fa01030
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|  | @@ -49,6 +49,7 @@ class ServiceType(StrEnum): | |||||||||||||||||||||||||||||||||||||||||
| firewall = "firewall" | ||||||||||||||||||||||||||||||||||||||||||
| object_storage = "object_storage" | ||||||||||||||||||||||||||||||||||||||||||
| aclb = "aclb" | ||||||||||||||||||||||||||||||||||||||||||
| net_load_balancer = "netloadbalancer" | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
| class MetricType(StrEnum): | ||||||||||||||||||||||||||||||||||||||||||
|  | @@ -82,6 +83,10 @@ class MetricUnit(StrEnum): | |||||||||||||||||||||||||||||||||||||||||
| RATIO = "ratio" | ||||||||||||||||||||||||||||||||||||||||||
| OPS_PER_SECOND = "ops_per_second" | ||||||||||||||||||||||||||||||||||||||||||
| IOPS = "iops" | ||||||||||||||||||||||||||||||||||||||||||
| KILO_BYTES_PER_SECOND = "kilo_bytes_per_second" | ||||||||||||||||||||||||||||||||||||||||||
| SESSIONS_PER_SECOND = "sessions_per_second" | ||||||||||||||||||||||||||||||||||||||||||
| PACKETS_PER_SECOND = "packets_per_second" | ||||||||||||||||||||||||||||||||||||||||||
| KILO_BITS_PER_SECOND = "kilo_bits_per_second" | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
| class DashboardType(StrEnum): | ||||||||||||||||||||||||||||||||||||||||||
|  | @@ -93,6 +98,17 @@ class DashboardType(StrEnum): | |||||||||||||||||||||||||||||||||||||||||
| custom = "custom" | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
| @dataclass | ||||||||||||||||||||||||||||||||||||||||||
| class Filter(JSONObject): | ||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||
| Represents a filter in the filters list of a dashboard widget. | ||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
| dimension_label: str = "" | ||||||||||||||||||||||||||||||||||||||||||
| operator: str = "" | ||||||||||||||||||||||||||||||||||||||||||
| value: str = "" | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
| @dataclass | ||||||||||||||||||||||||||||||||||||||||||
| class DashboardWidget(JSONObject): | ||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||
|  | @@ -107,6 +123,34 @@ class DashboardWidget(JSONObject): | |||||||||||||||||||||||||||||||||||||||||
| chart_type: ChartType = "" | ||||||||||||||||||||||||||||||||||||||||||
| y_label: str = "" | ||||||||||||||||||||||||||||||||||||||||||
| aggregate_function: AggregateFunction = "" | ||||||||||||||||||||||||||||||||||||||||||
| group_by: Optional[List[str]] = None | ||||||||||||||||||||||||||||||||||||||||||
| _filters: Optional[List[Filter]] = field( | ||||||||||||||||||||||||||||||||||||||||||
| default=None, metadata={"json_key": "filters"} | ||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
| def __getattribute__(self, name): | ||||||||||||||||||||||||||||||||||||||||||
| """Override to handle the filters attribute specifically to avoid metaclass conflict.""" | ||||||||||||||||||||||||||||||||||||||||||
| if name == "filters": | ||||||||||||||||||||||||||||||||||||||||||
| return object.__getattribute__(self, "_filters") | ||||||||||||||||||||||||||||||||||||||||||
| return object.__getattribute__(self, name) | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
| def __setattr__(self, name, value): | ||||||||||||||||||||||||||||||||||||||||||
| """Override to handle setting the filters attribute.""" | ||||||||||||||||||||||||||||||||||||||||||
| if name == "filters": | ||||||||||||||||||||||||||||||||||||||||||
| object.__setattr__(self, "_filters", value) | ||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||
| object.__setattr__(self, name, value) | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||
| 
      Comment on lines
    
      +131
     to 
      +144
    
   
     | ||||||||||||||||||||||||||||||||||||||||||
| def __getattribute__(self, name): | |
| """Override to handle the filters attribute specifically to avoid metaclass conflict.""" | |
| if name == "filters": | |
| return object.__getattribute__(self, "_filters") | |
| return object.__getattribute__(self, name) | |
| def __setattr__(self, name, value): | |
| """Override to handle setting the filters attribute.""" | |
| if name == "filters": | |
| object.__setattr__(self, "_filters", value) | |
| else: | |
| object.__setattr__(self, name, value) | |
| @property | |
| def filters(self) -> Optional[List[Filter]]: | |
| """Property to access the filters attribute mapped to _filters.""" | |
| return self._filters | |
| @filters.setter | |
| def filters(self, value: Optional[List[Filter]]): | |
| self._filters = value | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSON Metaclass creates a class attribute called filters that Python finds before our property in the attribute resolution order hence this approach does not work
    
      
    
      Copilot
AI
    
    
    
      Sep 11, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The widgets property should be a list of DashboardWidget objects, but the current implementation will only handle a single widget. This should be Property(List[DashboardWidget]) to maintain the original list functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the codebase handles all lists in this way, its specified like this and client can handle widget as list.
    
      
    
      Copilot
AI
    
    
    
      Oct 9, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The widgets property should use a list type since widgets is expected to be a list of DashboardWidget objects. This should be Property(List[DashboardWidget]) or Property(json_object=DashboardWidget, is_list=True) depending on the Property class implementation.
| "widgets": Property(json_object=DashboardWidget), | |
| "widgets": Property(json_object=DashboardWidget, is_list=True), | 
    
      
    
      Copilot
AI
    
    
    
      Oct 14, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The widgets property should handle a list of DashboardWidget objects, but the current implementation only handles a single object. This should be Property(List[DashboardWidget]) or use appropriate list handling for json_object.
| "widgets": Property(json_object=DashboardWidget), | |
| "widgets": Property(json_object=DashboardWidget, is_list=True), | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filters field should specify the Filter type properly in the DashboardWidget class. Consider adding a Property mapping in the api_spec similar to how other nested objects are handled, to ensure proper deserialization of Filter objects.