pyCSM 1.0.4__tar.gz → 1.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {pyCSM-1.0.4/pyCSM.egg-info → pyCSM-1.0.6}/PKG-INFO +1 -1
  2. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/clients/session_client.py +42 -0
  3. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/session_service/schedule_service.py +69 -0
  4. {pyCSM-1.0.4 → pyCSM-1.0.6/pyCSM.egg-info}/PKG-INFO +1 -1
  5. {pyCSM-1.0.4 → pyCSM-1.0.6}/setup.py +1 -1
  6. {pyCSM-1.0.4 → pyCSM-1.0.6}/LICENSE +0 -0
  7. {pyCSM-1.0.4 → pyCSM-1.0.6}/README.md +0 -0
  8. {pyCSM-1.0.4 → pyCSM-1.0.6}/docs/__init__.py +0 -0
  9. {pyCSM-1.0.4 → pyCSM-1.0.6}/docs/conf.py +0 -0
  10. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/__init__.py +0 -0
  11. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/authorization/__init__.py +0 -0
  12. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/authorization/auth.py +0 -0
  13. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/clients/__init__.py +0 -0
  14. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/clients/hardware_client.py +0 -0
  15. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/clients/system_client.py +0 -0
  16. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/__init__.py +0 -0
  17. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/hardware_service/__init__.py +0 -0
  18. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/hardware_service/hardware_service.py +0 -0
  19. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/session_service/__init__.py +0 -0
  20. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/session_service/copyset_service.py +0 -0
  21. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/session_service/session_service.py +0 -0
  22. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/system_service/__init__.py +0 -0
  23. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/services/system_service/system_service.py +0 -0
  24. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/util/__init__.py +0 -0
  25. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM/util/utility.py +0 -0
  26. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM.egg-info/SOURCES.txt +0 -0
  27. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM.egg-info/dependency_links.txt +0 -0
  28. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM.egg-info/requires.txt +0 -0
  29. {pyCSM-1.0.4 → pyCSM-1.0.6}/pyCSM.egg-info/top_level.txt +0 -0
  30. {pyCSM-1.0.4 → pyCSM-1.0.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyCSM
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: CSM Python Client
5
5
  Home-page: UNKNOWN
6
6
  Author: Dominic Blea
@@ -318,6 +318,48 @@ class sessionClient:
318
318
  return schedule_service.get_scheduled_tasks(self.base_url, self.tk)
319
319
  return resp
320
320
 
321
+ def get_scheduled_task(self, taskid):
322
+ """
323
+ Returns the scheduled task info of a given task id
324
+
325
+ Returns:
326
+ JSON String representing the result of the command.
327
+ 'I' = successful, 'W' = warning, 'E' = error.
328
+ """
329
+ resp = schedule_service.get_scheduled_task(self.base_url, self.tk, taskid)
330
+ if resp.status_code == 401:
331
+ self.tk = auth.get_token(self.base_url, self.username, self.password)
332
+ return schedule_service.get_scheduled_task(self.base_url, self.tk, taskid)
333
+ return resp
334
+
335
+ def create_scheduled_task(self, json):
336
+ """
337
+ Creates a new task with given task info
338
+
339
+ Returns:
340
+ JSON String representing the result of the command.
341
+ 'I' = successful, 'W' = warning, 'E' = error.
342
+ """
343
+ resp = schedule_service.create_scheduled_task(self.base_url, self.tk, json)
344
+ if resp.status_code == 401:
345
+ self.tk = auth.get_token(self.base_url, self.username, self.password)
346
+ return schedule_service.create_scheduled_task(self.base_url, self.tk, json)
347
+ return resp
348
+
349
+ def duplicate_scheduled_task(self, taskid):
350
+ """
351
+ Duplicates scheduled task of a given id
352
+
353
+ Returns:
354
+ JSON String representing the result of the command.
355
+ 'I' = successful, 'W' = warning, 'E' = error.
356
+ """
357
+ resp = schedule_service.duplicate_scheduled_task(self.base_url, self.tk, taskid)
358
+ if resp.status_code == 401:
359
+ self.tk = auth.get_token(self.base_url, self.username, self.password)
360
+ return schedule_service.duplicate_scheduled_task(self.base_url, self.tk, taskid)
361
+ return resp
362
+
321
363
  @staticmethod
322
364
  def get_properties():
323
365
  """
@@ -57,6 +57,75 @@ def get_scheduled_tasks(url, tk):
57
57
  return requests.get(getst_url, headers=headers, verify=properties["verify"], cert=properties["cert"])
58
58
 
59
59
 
60
+ def get_scheduled_task(url, tk, taskid):
61
+ """
62
+ Returns the scheduled task info of a given task id
63
+
64
+ Args:
65
+ url (str): Base url of csm server. ex. https://servername:port/CSM/web.
66
+ tk (str): Rest token for the CSM server.
67
+
68
+ Returns:
69
+ JSON String representing the result of the command.
70
+ 'I' = successful, 'W' = warning, 'E' = error.
71
+ """
72
+ getst_url = f"{url}/sessions/scheduledtasks/{taskid}"
73
+ headers = {
74
+ "Accept-Language": properties["language"],
75
+ "X-Auth-Token": str(tk),
76
+ "Content-Type": "application/x-www-form-urlencoded"
77
+ }
78
+ return requests.get(getst_url, headers=headers, verify=properties["verify"], cert=properties["cert"])
79
+
80
+
81
+ def create_scheduled_task(url, tk, json):
82
+ """
83
+ Creates a new task with given task info
84
+
85
+ Args:
86
+ url (str): Base url of csm server. ex. https://servername:port/CSM/web.
87
+ tk (str): Rest token for the CSM server.
88
+ json (str): json string of scheduled task info used to create new scheduled task
89
+
90
+ Returns:
91
+ JSON String representing the result of the command.
92
+ 'I' = successful, 'W' = warning, 'E' = error.
93
+ """
94
+ put_url = f"{url}/sessions/scheduledtasks"
95
+ headers = {
96
+ "Accept-Language": properties["language"],
97
+ "X-Auth-Token": str(tk),
98
+ "Content-Type": "application/x-www-form-urlencoded"
99
+ }
100
+ params = {
101
+ "json": json
102
+ }
103
+
104
+ return requests.put(put_url, headers=headers, verify=properties["verify"], cert=properties["cert"], data=params)
105
+
106
+
107
+ def duplicate_scheduled_task(url, tk, taskid):
108
+ """
109
+ Duplicates scheduled task of a given id
110
+
111
+ Args:
112
+ url (str): Base url of csm server. ex. https://servername:port/CSM/web.
113
+ tk (str): Rest token for the CSM server.
114
+
115
+ Returns:
116
+ JSON String representing the result of the command.
117
+ 'I' = successful, 'W' = warning, 'E' = error.
118
+ """
119
+ put_url = f"{url}/sessions/scheduledtasks/duplicate/{taskid}"
120
+ headers = {
121
+ "Accept-Language": properties["language"],
122
+ "X-Auth-Token": str(tk),
123
+ "Content-Type": "application/x-www-form-urlencoded"
124
+ }
125
+
126
+ return requests.put(put_url, headers=headers, verify=properties["verify"], cert=properties["cert"])
127
+
128
+
60
129
  def enable_scheduled_task(url, tk, taskid):
61
130
  """
62
131
  Enable a scheduled task to run based off the schedule defined on the task.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyCSM
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: CSM Python Client
5
5
  Home-page: UNKNOWN
6
6
  Author: Dominic Blea
@@ -9,7 +9,7 @@ setup(
9
9
  description="CSM Python Client",
10
10
  long_description="CSM RESTful API Python Client.",
11
11
  author="Dominic Blea",
12
- version='1.0.4',
12
+ version='1.0.6',
13
13
  author_email="dblea00@ibm.com",
14
14
  maintainer="Dominic Blea",
15
15
  keywords=["IBM", "CSM Storage"],
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes