Skip to content

Commit

Permalink
[Bamboo] Elastic Bamboo Support (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
infame-io authored Aug 21, 2022
1 parent 541a949 commit f23320e
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ Using Xray (Test Management tool for Jira):
data = xr.get_tests('TEST-001')
print(data)
Using Bamboo:

.. code-block:: python
from atlassian import Bamboo
bamboo = Bamboo(
url='http://localhost:6990/bamboo/',
token="<TOKEN>")
data = bamboo.get_elastic_configurations()
print(data)
If you want to see the response in pretty print format JSON. Feel free for use construction like:

.. code-block:: python
Expand Down
57 changes: 57 additions & 0 deletions atlassian/bamboo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,3 +1115,60 @@ 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 get_elastic_instance_logs(self, instance_id):
"""
Get logs from an EC2 instance
:param instance_id:
:return:
"""
resource = "/elasticInstances/instance/{instance_id}/logs".format(instance_id=instance_id)
return self.get(self.resource_url(resource))

def get_elastic_configurations(self):
"""
Get list of all elastic configurations
:return:
"""
resource = "elasticConfiguration"
return self.get(self.resource_url(resource))

def create_elastic_configuration(self, json):
"""
Create an elastic configuration
:param json:
:return:
"""
resource = "elasticConfiguration"
return self.post(self.resource_url(resource), json=json)

def get_elastic_configuration(self, configuration_id):
"""
Get informatin of an elastic configuration
:param configuration_id:
:return:
"""

resource = "elasticConfiguration/{configuration_id}".format(configuration_id=configuration_id)
return self.get(self.resource_url(resource))

def update_elastic_configuration(self, configuration_id, data):
"""
Update an elastic configuration
:param configuration_id:
:param data:
:return:
"""

resource = "elasticConfiguration/{configuration_id}".format(configuration_id=configuration_id)
return self.put(self.resource_url(resource), data=data)

def delete_elastic_configuration(self, configuration_id):
"""
Delete an elastic configuration
:param configuration_id:
:return:
"""

resource = "elasticConfiguration/{configuration_id}".format(configuration_id=configuration_id)
return self.delete(self.resource_url(resource))
23 changes: 23 additions & 0 deletions docs/bamboo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,26 @@ Other actions
# Upload plugin
upload_plugin(plugin_path)
Elastic Bamboo
--------------

.. code-block:: python
# Get elastic bamboo instance logs
get_elastic_instance_logs('i-12ab34cd56ef')
# Get elastic bamboo configurations
get_elastic_configurations()
# Create elastic bamboo configuration
create_elastic_configuration({"name": "value"})
# Get elastic bamboo configuration
get_elastic_configuration('123456')
# Update elastic bamboo configuration
update_elastic_configuration('123456')
# Delete elastic bamboo configuration
delete_elastic_configuration('123456')

0 comments on commit f23320e

Please sign in to comment.