Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
df3923f
GMIM-553: Add List all alerts
yashdattsawant Jan 29, 2025
73fab87
GMIM-553: restructure the folder
yashdattsawant Jan 29, 2025
d7c2015
GMIM-553: restructure the folder
yashdattsawant Jan 29, 2025
8745f60
GMIM-553: handle kwargs issue
yashdattsawant Jan 29, 2025
10d6658
GMIM-553: handle kwargs issue
yashdattsawant Jan 29, 2025
7c44ac1
GMIM-553: handle kwargs issue
yashdattsawant Jan 29, 2025
f7c8907
GMIM-553: handle kwargs issue
yashdattsawant Jan 29, 2025
972e006
GMIM-553: handle kwargs issue
yashdattsawant Jan 29, 2025
b67ba1d
GMIM-553: handle kwargs issue
yashdattsawant Jan 29, 2025
51ec203
GMIM-553: handle kwargs issue
yashdattsawant Jan 29, 2025
6b6fa34
GMIM-553: add list alert by type flag and delete method
yashdattsawant Jan 30, 2025
6c8015c
GMIM-553: default value to empty string
yashdattsawant Jan 30, 2025
2c97494
GMIM-553: default value to empty string
yashdattsawant Jan 30, 2025
ecf5186
GMIM-553: add logs
yashdattsawant Jan 30, 2025
9105d64
GMIM-553: add support to create new alert from data frame. add suppor…
yashdattsawant Feb 11, 2025
5e78c6e
GMIM-553: add support to delete alert group
yashdattsawant Feb 12, 2025
93295c8
GMIM-553: Add support to update alert group
yashdattsawant Feb 12, 2025
2ce5dda
GMIM-553: Black format the files
yashdattsawant Feb 12, 2025
59269cb
GMIM-553: Update dataframe normalize at diff depths
yashdattsawant Feb 24, 2025
67c7a6a
GMIM-553: black formatting
yashdattsawant Feb 24, 2025
83eb53d
GMIM-553: handle bug in updation
yashdattsawant Feb 26, 2025
17dae76
GMIM-553: unit tests draft 1 testing
yashdattsawant Mar 3, 2025
7876a69
GMIM-553: unit tests draft 2 testing
yashdattsawant Mar 3, 2025
13d8b77
GMIM-553: unit tests draft 3 testing
yashdattsawant Mar 3, 2025
5a6ec7c
GMIM-553: unit tests draft 4 testing
yashdattsawant Mar 3, 2025
ea1e5c1
GMIM-553: unit tests draft 5 testing
yashdattsawant Mar 3, 2025
0e0c4d8
GMIM-553: unit tests draft 6 testing
yashdattsawant Mar 3, 2025
1261ae5
GMIM-553: First working draft of test
yashdattsawant Mar 6, 2025
3981022
GMIM-553: Add alerts
yashdattsawant Mar 6, 2025
68edb45
Black formatting files
yashdattsawant Mar 6, 2025
0a46702
Mytype formating
yashdattsawant Mar 6, 2025
1cfadcc
GMIM-553: Mytype formating
yashdattsawant Mar 6, 2025
2571c12
Mytype formating
yashdattsawant Mar 6, 2025
b2b2157
GMIM-553: Mytype formating
yashdattsawant Mar 6, 2025
51b2d58
GMIM-553: Mytype formating
yashdattsawant Mar 6, 2025
291d23d
GMIM-553: Mytype formating
yashdattsawant Mar 6, 2025
fa62c96
GMIM-553: Mytype formating
yashdattsawant Mar 7, 2025
5fe2ee3
GMIM-553: Mytype formating
yashdattsawant Mar 7, 2025
fe46b67
GMIM-553: Mytype formating
yashdattsawant Mar 7, 2025
4344d3f
GMIM-553: Mytype formating
yashdattsawant Mar 7, 2025
576e2ef
GMIM-553: Mytype formating
yashdattsawant Mar 7, 2025
7a8473b
GMIM-553: Mytype formating
yashdattsawant Mar 7, 2025
6cbcdd1
GMIM-553: Mytype formating for test alerts
yashdattsawant Mar 7, 2025
277ef0f
GMIM-553: Mytype formating for test alerts
yashdattsawant Mar 7, 2025
5fa3f12
GMIM-553: Mytype formating for test alerts
yashdattsawant Mar 7, 2025
cb474cf
GMIM-553: Black formating for test_alerts and alerts file
yashdattsawant Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions smsdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,116 @@ def get_data_v1(self, ename, util_name, normalize=True, *args, **kwargs):

return data

@version_check_decorator
def list_alerts(self, alert_type=""):
"""
Main data fetching function for all the entities. Note this is the general data fetch function. You probably want to use the model-specific functions such as get_cycles().
:param ename: Name of the entities
:param util_name: Name of the utility function
:param normalize: Flatten nested data structures
:return: pandas dataframe
"""
base_url = get_url(
self.config["protocol"],
self.tenant,
self.config["site.domain"],
self.config["port"],
)

cls = smsdkentities.get("alert")(self.session, base_url)
alert_info = getattr(cls, "list_alerts")(alert_type)
return alert_info

@version_check_decorator
def get_alert_dataframe(self, alert_type=""):
"""
Main data fetching function for all the entities. Note this is the general data fetch function. You probably want to use the model-specific functions such as get_cycles().
:param ename: Name of the entities
:param util_name: Name of the utility function
:param normalize: Flatten nested data structures
:return: pandas dataframe
"""
base_url = get_url(
self.config["protocol"],
self.tenant,
self.config["site.domain"],
self.config["port"],
)

cls = smsdkentities.get("alert")(self.session, base_url)
alert_dataframe = getattr(cls, "get_alert_dataframe")(alert_type)
return alert_dataframe

def update_alert(self, alert_id, params):
base_url = get_url(
self.config["protocol"],
self.tenant,
self.config["site.domain"],
self.config["port"],
)
cls = smsdkentities.get("alert")(self.session, base_url)
getattr(cls, "update_alert")(alert_id, params)

def delete_alert(self, alert_id=None, delete_all=False, alert_group=""):
"""
Main data fetching function for all the entities. Note this is the general data fetch function. You probably want to use the model-specific functions such as get_cycles().
:param ename: Name of the entities
:param util_name: Name of the utility function
:param normalize: Flatten nested data structures
:return: pandas dataframe
"""
base_url = get_url(
self.config["protocol"],
self.tenant,
self.config["site.domain"],
self.config["port"],
)
if alert_id is None and not delete_all and not alert_group:
print(
"Invalid input please provide alert group or alert id or delete_all flag as true if you want to delete all the alerts."
)
return
cls = smsdkentities.get("alert")(self.session, base_url)
getattr(cls, "delete_alert")(alert_id, delete_all, alert_group)

@version_check_decorator
def create_alerts(self, dataframe, alert_type=""):
"""
Main data fetching function for all the entities. Note this is the general data fetch function. You probably want to use the model-specific functions such as get_cycles().
:param ename: Name of the entities
:param util_name: Name of the utility function
:param normalize: Flatten nested data structures
:return: pandas dataframe
"""
base_url = get_url(
self.config["protocol"],
self.tenant,
self.config["site.domain"],
self.config["port"],
)

cls = smsdkentities.get("alert")(self.session, base_url)
getattr(cls, "create_alert")(alert_type, dataframe)

@version_check_decorator
def update_alert_group(self, dataframe):
"""
Main data fetching function for all the entities. Note this is the general data fetch function. You probably want to use the model-specific functions such as get_cycles().
:param ename: Name of the entities
:param util_name: Name of the utility function
:param normalize: Flatten nested data structures
:return: pandas dataframe
"""
base_url = get_url(
self.config["protocol"],
self.tenant,
self.config["site.domain"],
self.config["port"],
)

cls = smsdkentities.get("alert")(self.session, base_url)
getattr(cls, "update_alert_group")(dataframe)

@version_check_decorator
@ClientV0.validate_input
@ClientV0.cycle_decorator
Expand Down
3 changes: 3 additions & 0 deletions smsdk/config/api_endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"Auth": {
"url": "/auth/password/login"
},
"Alert": {
"url": "/v1/obj/alert_config"
},
"Cycle": {
"url_v1": "/v1/datatab/cycle",
"url": "/api/cycle",
Expand Down
Empty file.
Loading