Skip to content

Commit 743971b

Browse files
gonchikDeno226
andauthored
added plugin disable and enable methods (#1393)
Co-authored-by: Piotr <peternuker@gmail.com>
1 parent 3de300c commit 743971b

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

atlassian/bamboo.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,34 @@ def upload_plugin(self, plugin_path):
12851285
).headers["upm-token"]
12861286
url = "rest/plugins/1.0/?token={upm_token}".format(upm_token=upm_token)
12871287
return self.post(url, files=files, headers=self.no_check_headers)
1288+
1289+
def disable_plugin(self,plugin_key):
1290+
"""
1291+
Disable a plugin
1292+
:param plugin_key:
1293+
:return:
1294+
"""
1295+
app_headers = {
1296+
"X-Atlassian-Token": "nocheck",
1297+
"Content-Type": "application/vnd.atl.plugins+json",
1298+
}
1299+
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
1300+
data = {"status": "disabled"}
1301+
return self.put(url, data=data, headers=app_headers)
1302+
1303+
def enable_plugin(self,plugin_key):
1304+
"""
1305+
Enable a plugin
1306+
:param plugin_key:
1307+
:return:
1308+
"""
1309+
app_headers = {
1310+
"X-Atlassian-Token": "nocheck",
1311+
"Content-Type": "application/vnd.atl.plugins+json",
1312+
}
1313+
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
1314+
data = {"status": "enabled"}
1315+
return self.put(url, data=data, headers=app_headers)
12881316

12891317
def delete_plugin(self, plugin_key):
12901318
"""

atlassian/confluence.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2722,6 +2722,34 @@ def upload_plugin(self, plugin_path):
27222722
).headers["upm-token"]
27232723
url = "rest/plugins/1.0/?token={upm_token}".format(upm_token=upm_token)
27242724
return self.post(url, files=files, headers=self.no_check_headers)
2725+
2726+
def disable_plugin(self,plugin_key):
2727+
"""
2728+
Disable a plugin
2729+
:param plugin_key:
2730+
:return:
2731+
"""
2732+
app_headers = {
2733+
"X-Atlassian-Token": "nocheck",
2734+
"Content-Type": "application/vnd.atl.plugins+json",
2735+
}
2736+
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
2737+
data = {"status": "disabled"}
2738+
return self.put(url, data=data, headers=app_headers)
2739+
2740+
def enable_plugin(self,plugin_key):
2741+
"""
2742+
Enable a plugin
2743+
:param plugin_key:
2744+
:return:
2745+
"""
2746+
app_headers = {
2747+
"X-Atlassian-Token": "nocheck",
2748+
"Content-Type": "application/vnd.atl.plugins+json",
2749+
}
2750+
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
2751+
data = {"status": "enabled"}
2752+
return self.put(url, data=data, headers=app_headers)
27252753

27262754
def delete_plugin(self, plugin_key):
27272755
"""

atlassian/jira.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3665,6 +3665,34 @@ def update_plugin_license(self, plugin_key, raw_license):
36653665
url = "/plugins/1.0/{plugin_key}/license".format(plugin_key=plugin_key)
36663666
data = {"rawLicense": raw_license}
36673667
return self.put(url, data=data, headers=app_headers)
3668+
3669+
def disable_plugin(self,plugin_key):
3670+
"""
3671+
Disable a plugin
3672+
:param plugin_key:
3673+
:return:
3674+
"""
3675+
app_headers = {
3676+
"X-Atlassian-Token": "nocheck",
3677+
"Content-Type": "application/vnd.atl.plugins+json",
3678+
}
3679+
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
3680+
data = {"status": "disabled"}
3681+
return self.put(url, data=data, headers=app_headers)
3682+
3683+
def enable_plugin(self,plugin_key):
3684+
"""
3685+
Enable a plugin
3686+
:param plugin_key:
3687+
:return:
3688+
"""
3689+
app_headers = {
3690+
"X-Atlassian-Token": "nocheck",
3691+
"Content-Type": "application/vnd.atl.plugins+json",
3692+
}
3693+
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
3694+
data = {"status": "enabled"}
3695+
return self.put(url, data=data, headers=app_headers)
36683696

36693697
def get_all_permissionschemes(self, expand=None):
36703698
"""

0 commit comments

Comments
 (0)