Skip to content

Commit

Permalink
added plugin disable and enable methods (#1393)
Browse files Browse the repository at this point in the history
Co-authored-by: Piotr <peternuker@gmail.com>
  • Loading branch information
gonchik and Deno226 authored May 21, 2024
1 parent 3de300c commit 743971b
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
28 changes: 28 additions & 0 deletions atlassian/bamboo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,34 @@ def upload_plugin(self, plugin_path):
).headers["upm-token"]
url = "rest/plugins/1.0/?token={upm_token}".format(upm_token=upm_token)
return self.post(url, files=files, headers=self.no_check_headers)

def disable_plugin(self,plugin_key):
"""
Disable a plugin
:param plugin_key:
:return:
"""
app_headers = {
"X-Atlassian-Token": "nocheck",
"Content-Type": "application/vnd.atl.plugins+json",
}
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
data = {"status": "disabled"}
return self.put(url, data=data, headers=app_headers)

def enable_plugin(self,plugin_key):
"""
Enable a plugin
:param plugin_key:
:return:
"""
app_headers = {
"X-Atlassian-Token": "nocheck",
"Content-Type": "application/vnd.atl.plugins+json",
}
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
data = {"status": "enabled"}
return self.put(url, data=data, headers=app_headers)

def delete_plugin(self, plugin_key):
"""
Expand Down
28 changes: 28 additions & 0 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -2722,6 +2722,34 @@ def upload_plugin(self, plugin_path):
).headers["upm-token"]
url = "rest/plugins/1.0/?token={upm_token}".format(upm_token=upm_token)
return self.post(url, files=files, headers=self.no_check_headers)

def disable_plugin(self,plugin_key):
"""
Disable a plugin
:param plugin_key:
:return:
"""
app_headers = {
"X-Atlassian-Token": "nocheck",
"Content-Type": "application/vnd.atl.plugins+json",
}
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
data = {"status": "disabled"}
return self.put(url, data=data, headers=app_headers)

def enable_plugin(self,plugin_key):
"""
Enable a plugin
:param plugin_key:
:return:
"""
app_headers = {
"X-Atlassian-Token": "nocheck",
"Content-Type": "application/vnd.atl.plugins+json",
}
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
data = {"status": "enabled"}
return self.put(url, data=data, headers=app_headers)

def delete_plugin(self, plugin_key):
"""
Expand Down
28 changes: 28 additions & 0 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -3665,6 +3665,34 @@ def update_plugin_license(self, plugin_key, raw_license):
url = "/plugins/1.0/{plugin_key}/license".format(plugin_key=plugin_key)
data = {"rawLicense": raw_license}
return self.put(url, data=data, headers=app_headers)

def disable_plugin(self,plugin_key):
"""
Disable a plugin
:param plugin_key:
:return:
"""
app_headers = {
"X-Atlassian-Token": "nocheck",
"Content-Type": "application/vnd.atl.plugins+json",
}
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
data = {"status": "disabled"}
return self.put(url, data=data, headers=app_headers)

def enable_plugin(self,plugin_key):
"""
Enable a plugin
:param plugin_key:
:return:
"""
app_headers = {
"X-Atlassian-Token": "nocheck",
"Content-Type": "application/vnd.atl.plugins+json",
}
url = "rest/plugins/1.0/{plugin_key}-key".format(plugin_key=plugin_key)
data = {"status": "enabled"}
return self.put(url, data=data, headers=app_headers)

def get_all_permissionschemes(self, expand=None):
"""
Expand Down

0 comments on commit 743971b

Please sign in to comment.