atlassian-python-api 5.0.3__py3-none-any.whl → 5.0.5__py3-none-any.whl
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.
- atlassian/VERSION +1 -1
- atlassian/__init__.py +2 -0
- atlassian/bamboo.py +850 -14
- atlassian/bitbucket/__init__.py +60 -0
- atlassian/bitbucket/cloud/repositories/__init__.py +3 -3
- atlassian/bitbucket/cloud/workspaces/projects.py +1 -1
- atlassian/bitbucket/server/common/permissions.py +1 -1
- atlassian/bitbucket/server/globalPermissions.py +1 -1
- atlassian/bitbucket/server/projects/__init__.py +1 -1
- atlassian/bitbucket/server/projects/repos/__init__.py +2 -2
- atlassian/company_calendar.py +215 -0
- atlassian/confluence/cloud/cloud.py +38 -3
- atlassian/confluence/server/__init__.py +353 -117
- atlassian/confluence_base.py +1 -1
- atlassian/crowd.py +1204 -6
- atlassian/jira/jira_server.py +10 -0
- atlassian/rest_client.py +30 -0
- {atlassian_python_api-5.0.3.dist-info → atlassian_python_api-5.0.5.dist-info}/METADATA +2 -8
- {atlassian_python_api-5.0.3.dist-info → atlassian_python_api-5.0.5.dist-info}/RECORD +22 -21
- {atlassian_python_api-5.0.3.dist-info → atlassian_python_api-5.0.5.dist-info}/WHEEL +0 -0
- {atlassian_python_api-5.0.3.dist-info → atlassian_python_api-5.0.5.dist-info}/licenses/LICENSE +0 -0
- {atlassian_python_api-5.0.3.dist-info → atlassian_python_api-5.0.5.dist-info}/top_level.txt +0 -0
atlassian/bamboo.py
CHANGED
|
@@ -49,13 +49,16 @@ class Bamboo(AtlassianRestAPI):
|
|
|
49
49
|
except HTTPError as e:
|
|
50
50
|
logging.error(f"Broken response: {e}")
|
|
51
51
|
yield e
|
|
52
|
+
return
|
|
52
53
|
try:
|
|
53
54
|
results = response[elements_key]
|
|
54
55
|
size = 0
|
|
55
56
|
# Check if we still can get results
|
|
56
|
-
if
|
|
57
|
+
if results["size"] == 0:
|
|
57
58
|
return
|
|
58
59
|
for r in results[element_key]:
|
|
60
|
+
if max_results is not None and size >= max_results:
|
|
61
|
+
return
|
|
59
62
|
size += 1
|
|
60
63
|
yield r
|
|
61
64
|
except TypeError:
|
|
@@ -87,16 +90,18 @@ class Bamboo(AtlassianRestAPI):
|
|
|
87
90
|
# API representation for filtering by multiple labels.
|
|
88
91
|
params["label"] = label if isinstance(label, str) else list(label)
|
|
89
92
|
params.update(kwargs)
|
|
90
|
-
|
|
93
|
+
params["start-index"] = start_index
|
|
94
|
+
elements_key = params.pop("elements_key", None)
|
|
95
|
+
element_key = params.pop("element_key", None)
|
|
96
|
+
if elements_key and element_key:
|
|
91
97
|
return self._get_generator(
|
|
92
98
|
self.resource_url(resource),
|
|
93
99
|
flags=flags,
|
|
94
100
|
params=params,
|
|
95
|
-
elements_key=
|
|
96
|
-
element_key=
|
|
101
|
+
elements_key=elements_key,
|
|
102
|
+
element_key=element_key,
|
|
97
103
|
max_results=max_results,
|
|
98
104
|
)
|
|
99
|
-
params["start-index"] = start_index
|
|
100
105
|
return self.get(self.resource_url(resource), flags=flags, params=params)
|
|
101
106
|
|
|
102
107
|
""" Projects & Plans """
|
|
@@ -347,9 +352,12 @@ class Bamboo(AtlassianRestAPI):
|
|
|
347
352
|
while params["start-index"] < size:
|
|
348
353
|
results = self.get(self.resource_url("search/branches"), params=params)
|
|
349
354
|
size = results["size"]
|
|
355
|
+
page_size = results["max-result"]
|
|
356
|
+
if page_size <= 0:
|
|
357
|
+
break
|
|
350
358
|
for r in results["searchResults"]:
|
|
351
359
|
yield r
|
|
352
|
-
params["start-index"] +=
|
|
360
|
+
params["start-index"] += page_size
|
|
353
361
|
|
|
354
362
|
def plan_branches(
|
|
355
363
|
self,
|
|
@@ -454,6 +462,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
454
462
|
max_results=25,
|
|
455
463
|
include_all_states=False,
|
|
456
464
|
build_state=None,
|
|
465
|
+
**kwargs,
|
|
457
466
|
):
|
|
458
467
|
"""
|
|
459
468
|
Get results as generic method
|
|
@@ -471,6 +480,8 @@ class Bamboo(AtlassianRestAPI):
|
|
|
471
480
|
:param include_all_states:
|
|
472
481
|
:param build_state: Optional Bamboo result state, such as
|
|
473
482
|
``Successful`` or ``Failed``.
|
|
483
|
+
:param kwargs: Additional query parameters forwarded to the Bamboo
|
|
484
|
+
REST API.
|
|
474
485
|
:return:
|
|
475
486
|
"""
|
|
476
487
|
resource = "result"
|
|
@@ -500,7 +511,8 @@ class Bamboo(AtlassianRestAPI):
|
|
|
500
511
|
elements_key="results",
|
|
501
512
|
element_key="result",
|
|
502
513
|
label=label,
|
|
503
|
-
**
|
|
514
|
+
**kwargs,
|
|
515
|
+
**params,
|
|
504
516
|
) # fmt: skip
|
|
505
517
|
|
|
506
518
|
def latest_results(
|
|
@@ -587,6 +599,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
587
599
|
max_results=25,
|
|
588
600
|
include_all_states=False,
|
|
589
601
|
build_state=None,
|
|
602
|
+
**kwargs,
|
|
590
603
|
):
|
|
591
604
|
"""
|
|
592
605
|
Get Plan results
|
|
@@ -602,6 +615,8 @@ class Bamboo(AtlassianRestAPI):
|
|
|
602
615
|
:param include_all_states:
|
|
603
616
|
:param build_state: Optional Bamboo result state, such as
|
|
604
617
|
``Successful`` or ``Failed``.
|
|
618
|
+
:param kwargs: Additional query parameters passed to the Bamboo REST
|
|
619
|
+
API (for example ``issueStatus`` or ``jobKey`` filters).
|
|
605
620
|
:return:
|
|
606
621
|
"""
|
|
607
622
|
return self.results(
|
|
@@ -616,6 +631,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
616
631
|
max_results=max_results,
|
|
617
632
|
include_all_states=include_all_states,
|
|
618
633
|
build_state=build_state,
|
|
634
|
+
**kwargs,
|
|
619
635
|
)
|
|
620
636
|
|
|
621
637
|
def ordered_plan_results(
|
|
@@ -960,9 +976,12 @@ class Bamboo(AtlassianRestAPI):
|
|
|
960
976
|
while params["start-index"] < size:
|
|
961
977
|
results = self.get(self.resource_url(resource), params=params)
|
|
962
978
|
size = results["size"]
|
|
979
|
+
page_size = results["max-result"]
|
|
980
|
+
if page_size <= 0:
|
|
981
|
+
break
|
|
963
982
|
for r in results["results"]:
|
|
964
983
|
yield r
|
|
965
|
-
params["start-index"] +=
|
|
984
|
+
params["start-index"] += page_size
|
|
966
985
|
|
|
967
986
|
def deployment_dashboard(self, project_id=None):
|
|
968
987
|
"""
|
|
@@ -1076,7 +1095,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
1076
1095
|
"""
|
|
1077
1096
|
params = {"limit": limit, "start": start}
|
|
1078
1097
|
if filter_users:
|
|
1079
|
-
params
|
|
1098
|
+
params["filter"] = filter_users
|
|
1080
1099
|
url = f"rest/api/latest/admin/groups/{group_name}/more-members"
|
|
1081
1100
|
return self.get(url, params=params)
|
|
1082
1101
|
|
|
@@ -1092,7 +1111,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
1092
1111
|
"""
|
|
1093
1112
|
params = {"limit": limit, "start": start}
|
|
1094
1113
|
if filter_users:
|
|
1095
|
-
params
|
|
1114
|
+
params["filter"] = filter_users
|
|
1096
1115
|
|
|
1097
1116
|
url = f"rest/api/latest/admin/groups/{group_name}/more-non-members"
|
|
1098
1117
|
return self.get(url, params=params)
|
|
@@ -1110,7 +1129,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
1110
1129
|
"""
|
|
1111
1130
|
params = {"limit": limit, "start": start}
|
|
1112
1131
|
if filter_name:
|
|
1113
|
-
params
|
|
1132
|
+
params["name"] = filter_name
|
|
1114
1133
|
resource = f"permissions/deployment/{deployment_id}/users"
|
|
1115
1134
|
return self.get(self.resource_url(resource), params=params)
|
|
1116
1135
|
|
|
@@ -1149,7 +1168,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
1149
1168
|
"""
|
|
1150
1169
|
params = {"limit": limit, "start": start}
|
|
1151
1170
|
if filter_name:
|
|
1152
|
-
params
|
|
1171
|
+
params["name"] = filter_name
|
|
1153
1172
|
resource = f"permissions/deployment/{deployment_id}/groups"
|
|
1154
1173
|
return self.get(self.resource_url(resource), params=params)
|
|
1155
1174
|
|
|
@@ -1188,7 +1207,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
1188
1207
|
"""
|
|
1189
1208
|
params = {"limit": limit, "start": start}
|
|
1190
1209
|
if filter_name:
|
|
1191
|
-
params
|
|
1210
|
+
params["name"] = filter_name
|
|
1192
1211
|
resource = f"permissions/environment/{environment_id}/users"
|
|
1193
1212
|
return self.get(self.resource_url(resource), params=params)
|
|
1194
1213
|
|
|
@@ -1227,7 +1246,7 @@ class Bamboo(AtlassianRestAPI):
|
|
|
1227
1246
|
"""
|
|
1228
1247
|
params = {"limit": limit, "start": start}
|
|
1229
1248
|
if filter_name:
|
|
1230
|
-
params
|
|
1249
|
+
params["name"] = filter_name
|
|
1231
1250
|
resource = f"permissions/environment/{environment_id}/groups"
|
|
1232
1251
|
return self.get(self.resource_url(resource), params=params)
|
|
1233
1252
|
|
|
@@ -1489,6 +1508,823 @@ class Bamboo(AtlassianRestAPI):
|
|
|
1489
1508
|
response = self.get("rest/supportHealthCheck/1.0/check/")
|
|
1490
1509
|
return response
|
|
1491
1510
|
|
|
1511
|
+
"""Responsibility"""
|
|
1512
|
+
|
|
1513
|
+
def get_broken_builds_by_user(self, username):
|
|
1514
|
+
"""
|
|
1515
|
+
Get broken builds for which a user has taken responsibility.
|
|
1516
|
+
:param username: str - username
|
|
1517
|
+
:return: list of broken builds
|
|
1518
|
+
"""
|
|
1519
|
+
return self.get(f"rest/responsibility/latest/brokenBuild/byUser/{username}")
|
|
1520
|
+
|
|
1521
|
+
def get_my_broken_builds(self):
|
|
1522
|
+
"""Get broken builds for which the current user has taken responsibility."""
|
|
1523
|
+
return self.get("rest/responsibility/latest/brokenBuild/myBrokenBuilds")
|
|
1524
|
+
|
|
1525
|
+
def get_broken_build(self, plan_result_key_or_plan_key):
|
|
1526
|
+
"""
|
|
1527
|
+
Get responsibility information for a broken build or plan.
|
|
1528
|
+
:param plan_result_key_or_plan_key: str - plan result key or plan key
|
|
1529
|
+
:return: responsibility info
|
|
1530
|
+
"""
|
|
1531
|
+
return self.get(f"rest/responsibility/latest/brokenBuild/{plan_result_key_or_plan_key}")
|
|
1532
|
+
|
|
1533
|
+
def take_responsibility(self, plan_result_key_or_plan_key, username):
|
|
1534
|
+
"""
|
|
1535
|
+
Take responsibility for a broken build.
|
|
1536
|
+
:param plan_result_key_or_plan_key: str - plan result key or plan key
|
|
1537
|
+
:param username: str - username taking responsibility
|
|
1538
|
+
:return:
|
|
1539
|
+
"""
|
|
1540
|
+
return self.post(f"rest/responsibility/latest/brokenBuild/{plan_result_key_or_plan_key}/{username}")
|
|
1541
|
+
|
|
1542
|
+
def remove_responsibility(self, plan_result_key_or_plan_key, username):
|
|
1543
|
+
"""
|
|
1544
|
+
Remove responsibility for a broken build.
|
|
1545
|
+
:param plan_result_key_or_plan_key: str - plan result key or plan key
|
|
1546
|
+
:param username: str - username
|
|
1547
|
+
:return:
|
|
1548
|
+
"""
|
|
1549
|
+
return self.delete(f"rest/responsibility/latest/brokenBuild/{plan_result_key_or_plan_key}/{username}")
|
|
1550
|
+
|
|
1551
|
+
"""Triggers"""
|
|
1552
|
+
|
|
1553
|
+
def remote_trigger_change_detection(self):
|
|
1554
|
+
"""Trigger remote repository change detection for all linked repositories."""
|
|
1555
|
+
return self.post("rest/triggers/latest/remote/changeDetection")
|
|
1556
|
+
|
|
1557
|
+
"""Access tokens"""
|
|
1558
|
+
|
|
1559
|
+
def get_access_tokens(self):
|
|
1560
|
+
"""Get all access tokens for the current user."""
|
|
1561
|
+
return self.get(self.resource_url("access-token"))
|
|
1562
|
+
|
|
1563
|
+
def create_access_token(self):
|
|
1564
|
+
"""Create a new access token for the current user."""
|
|
1565
|
+
return self.post(self.resource_url("access-token"))
|
|
1566
|
+
|
|
1567
|
+
def delete_access_token(self, token_id):
|
|
1568
|
+
"""
|
|
1569
|
+
Delete an access token.
|
|
1570
|
+
:param token_id: str - token id
|
|
1571
|
+
:return:
|
|
1572
|
+
"""
|
|
1573
|
+
return self.delete(self.resource_url(f"access-token/{token_id}"))
|
|
1574
|
+
|
|
1575
|
+
"""Deployments"""
|
|
1576
|
+
|
|
1577
|
+
def create_deployment_project(self, data):
|
|
1578
|
+
"""
|
|
1579
|
+
Create a new deployment project.
|
|
1580
|
+
:param data: dict - deployment project representation
|
|
1581
|
+
:return: created deployment project
|
|
1582
|
+
"""
|
|
1583
|
+
return self.post(self.resource_url("deploy/project"), data=data)
|
|
1584
|
+
|
|
1585
|
+
def update_deployment_project(self, project_id, data):
|
|
1586
|
+
"""
|
|
1587
|
+
Update a deployment project.
|
|
1588
|
+
:param project_id: str - deployment project id
|
|
1589
|
+
:param data: dict - deployment project representation
|
|
1590
|
+
:return:
|
|
1591
|
+
"""
|
|
1592
|
+
return self.put(self.resource_url(f"deploy/project/{project_id}"), data=data)
|
|
1593
|
+
|
|
1594
|
+
def create_deployment_environment(self, project_id, data):
|
|
1595
|
+
"""
|
|
1596
|
+
Create a deployment environment in a deployment project.
|
|
1597
|
+
:param project_id: str - deployment project id
|
|
1598
|
+
:param data: dict - environment representation
|
|
1599
|
+
:return: created environment
|
|
1600
|
+
"""
|
|
1601
|
+
return self.post(self.resource_url(f"deploy/project/{project_id}/environment"), data=data)
|
|
1602
|
+
|
|
1603
|
+
def get_deployment_environment(self, environment_id):
|
|
1604
|
+
"""
|
|
1605
|
+
Get a deployment environment.
|
|
1606
|
+
:param environment_id: str - environment id
|
|
1607
|
+
:return: environment
|
|
1608
|
+
"""
|
|
1609
|
+
return self.get(self.resource_url(f"deploy/environment/{environment_id}"))
|
|
1610
|
+
|
|
1611
|
+
def update_deployment_environment(self, environment_id, data):
|
|
1612
|
+
"""
|
|
1613
|
+
Update a deployment environment.
|
|
1614
|
+
:param environment_id: str - environment id
|
|
1615
|
+
:param data: dict - environment representation
|
|
1616
|
+
:return:
|
|
1617
|
+
"""
|
|
1618
|
+
return self.put(self.resource_url(f"deploy/environment/{environment_id}"), data=data)
|
|
1619
|
+
|
|
1620
|
+
def delete_deployment_environment(self, environment_id):
|
|
1621
|
+
"""
|
|
1622
|
+
Delete a deployment environment.
|
|
1623
|
+
:param environment_id: str - environment id
|
|
1624
|
+
:return:
|
|
1625
|
+
"""
|
|
1626
|
+
return self.delete(self.resource_url(f"deploy/environment/{environment_id}"))
|
|
1627
|
+
|
|
1628
|
+
def get_deployment_versions(self, project_id, start=0, limit=25):
|
|
1629
|
+
"""
|
|
1630
|
+
Get versions for a deployment project.
|
|
1631
|
+
:param project_id: str - deployment project id
|
|
1632
|
+
:param start: int - start index for paging
|
|
1633
|
+
:param limit: int - maximum number of results
|
|
1634
|
+
:return: versions
|
|
1635
|
+
"""
|
|
1636
|
+
return self.get(
|
|
1637
|
+
self.resource_url(f"deploy/project/{project_id}/versions"),
|
|
1638
|
+
params={"start": start, "limit": limit},
|
|
1639
|
+
)
|
|
1640
|
+
|
|
1641
|
+
def create_deployment_version(self, project_id, data):
|
|
1642
|
+
"""
|
|
1643
|
+
Create a deployment version.
|
|
1644
|
+
:param project_id: str - deployment project id
|
|
1645
|
+
:param data: dict - version representation
|
|
1646
|
+
:return: created version
|
|
1647
|
+
"""
|
|
1648
|
+
return self.post(self.resource_url(f"deploy/project/{project_id}/version"), data=data)
|
|
1649
|
+
|
|
1650
|
+
def get_deployment_version(self, version_id):
|
|
1651
|
+
"""
|
|
1652
|
+
Get a deployment version.
|
|
1653
|
+
:param version_id: str - version id
|
|
1654
|
+
:return: version
|
|
1655
|
+
"""
|
|
1656
|
+
return self.get(self.resource_url(f"deploy/version/{version_id}"))
|
|
1657
|
+
|
|
1658
|
+
def delete_deployment_version(self, version_id):
|
|
1659
|
+
"""
|
|
1660
|
+
Delete a deployment version.
|
|
1661
|
+
:param version_id: str - version id
|
|
1662
|
+
:return:
|
|
1663
|
+
"""
|
|
1664
|
+
return self.delete(self.resource_url(f"deploy/version/{version_id}"))
|
|
1665
|
+
|
|
1666
|
+
def get_deployment_dashboard_paginate(self, project_id=None, start=0, limit=25):
|
|
1667
|
+
"""
|
|
1668
|
+
Get paginated deployment dashboard.
|
|
1669
|
+
:param project_id: str - optional deployment project id
|
|
1670
|
+
:param start: int - start index
|
|
1671
|
+
:param limit: int - maximum number of results
|
|
1672
|
+
:return: dashboard data
|
|
1673
|
+
"""
|
|
1674
|
+
resource = f"deploy/dashboard/paginate/{project_id}" if project_id else "deploy/dashboard/paginate"
|
|
1675
|
+
return self.get(self.resource_url(resource), params={"start": start, "limit": limit})
|
|
1676
|
+
|
|
1677
|
+
def get_deployment_dashboard_status(self, data):
|
|
1678
|
+
"""
|
|
1679
|
+
Get deployment dashboard status for given environments.
|
|
1680
|
+
:param data: dict - request body with environment ids
|
|
1681
|
+
:return: dashboard status
|
|
1682
|
+
"""
|
|
1683
|
+
return self.post(self.resource_url("deploy/dashboard/status"), data=data)
|
|
1684
|
+
|
|
1685
|
+
"""Admin configuration"""
|
|
1686
|
+
|
|
1687
|
+
def _admin_url(self, resource):
|
|
1688
|
+
return f"rest/admin/latest/{resource}"
|
|
1689
|
+
|
|
1690
|
+
def get_artifact_handler_config(self, handler_name):
|
|
1691
|
+
"""
|
|
1692
|
+
Get configuration for an artifact handler.
|
|
1693
|
+
:param handler_name: str - handler name (agentLocal, bambooRemote, s3, sftp)
|
|
1694
|
+
:return: configuration
|
|
1695
|
+
"""
|
|
1696
|
+
return self.get(self._admin_url(f"artifactHandlers/{handler_name}"))
|
|
1697
|
+
|
|
1698
|
+
def update_artifact_handler_config(self, handler_name, data):
|
|
1699
|
+
"""
|
|
1700
|
+
Update configuration for an artifact handler.
|
|
1701
|
+
:param handler_name: str - handler name
|
|
1702
|
+
:param data: dict - handler configuration
|
|
1703
|
+
:return:
|
|
1704
|
+
"""
|
|
1705
|
+
return self.put(self._admin_url(f"artifactHandlers/{handler_name}"), data=data)
|
|
1706
|
+
|
|
1707
|
+
def get_agent_config(self):
|
|
1708
|
+
"""Get agent configuration list."""
|
|
1709
|
+
return self.get(self._admin_url("config/agents"))
|
|
1710
|
+
|
|
1711
|
+
def get_offline_agent_removal_config(self):
|
|
1712
|
+
"""Get offline agent removal configuration."""
|
|
1713
|
+
return self.get(self._admin_url("config/agents/offlineAgentRemoval"))
|
|
1714
|
+
|
|
1715
|
+
def update_offline_agent_removal_config(self, data):
|
|
1716
|
+
"""
|
|
1717
|
+
Update offline agent removal configuration.
|
|
1718
|
+
:param data: dict - configuration
|
|
1719
|
+
:return:
|
|
1720
|
+
"""
|
|
1721
|
+
return self.put(self._admin_url("config/agents/offlineAgentRemoval"), data=data)
|
|
1722
|
+
|
|
1723
|
+
def get_build_concurrency_config(self):
|
|
1724
|
+
"""Get build concurrency configuration."""
|
|
1725
|
+
return self.get(self._admin_url("config/build/concurrency"))
|
|
1726
|
+
|
|
1727
|
+
def update_build_concurrency_config(self, data):
|
|
1728
|
+
"""
|
|
1729
|
+
Update build concurrency configuration.
|
|
1730
|
+
:param data: dict - configuration
|
|
1731
|
+
:return:
|
|
1732
|
+
"""
|
|
1733
|
+
return self.put(self._admin_url("config/build/concurrency"), data=data)
|
|
1734
|
+
|
|
1735
|
+
def get_build_monitoring_config(self):
|
|
1736
|
+
"""Get build monitoring configuration."""
|
|
1737
|
+
return self.get(self._admin_url("config/build/monitoring"))
|
|
1738
|
+
|
|
1739
|
+
def update_build_monitoring_config(self, data):
|
|
1740
|
+
"""
|
|
1741
|
+
Update build monitoring configuration.
|
|
1742
|
+
:param data: dict - configuration
|
|
1743
|
+
:return:
|
|
1744
|
+
"""
|
|
1745
|
+
return self.put(self._admin_url("config/build/monitoring"), data=data)
|
|
1746
|
+
|
|
1747
|
+
def get_general_config(self):
|
|
1748
|
+
"""Get general configuration."""
|
|
1749
|
+
return self.get(self._admin_url("config/general"))
|
|
1750
|
+
|
|
1751
|
+
def update_general_config(self, data):
|
|
1752
|
+
"""
|
|
1753
|
+
Update general configuration.
|
|
1754
|
+
:param data: dict - configuration
|
|
1755
|
+
:return:
|
|
1756
|
+
"""
|
|
1757
|
+
return self.put(self._admin_url("config/general"), data=data)
|
|
1758
|
+
|
|
1759
|
+
def get_mail_server_config(self):
|
|
1760
|
+
"""Get mail server configuration."""
|
|
1761
|
+
return self.get(self._admin_url("config/mailServer"))
|
|
1762
|
+
|
|
1763
|
+
def update_mail_server_config(self, data):
|
|
1764
|
+
"""
|
|
1765
|
+
Update mail server configuration.
|
|
1766
|
+
:param data: dict - configuration
|
|
1767
|
+
:return:
|
|
1768
|
+
"""
|
|
1769
|
+
return self.put(self._admin_url("config/mailServer"), data=data)
|
|
1770
|
+
|
|
1771
|
+
def delete_mail_server_config(self):
|
|
1772
|
+
"""Delete mail server configuration."""
|
|
1773
|
+
return self.delete(self._admin_url("config/mailServer"))
|
|
1774
|
+
|
|
1775
|
+
def get_im_server_config(self):
|
|
1776
|
+
"""Get instant messaging server configuration."""
|
|
1777
|
+
return self.get(self._admin_url("config/imServer"))
|
|
1778
|
+
|
|
1779
|
+
def update_im_server_config(self, data):
|
|
1780
|
+
"""
|
|
1781
|
+
Update instant messaging server configuration.
|
|
1782
|
+
:param data: dict - configuration
|
|
1783
|
+
:return:
|
|
1784
|
+
"""
|
|
1785
|
+
return self.put(self._admin_url("config/imServer"), data=data)
|
|
1786
|
+
|
|
1787
|
+
def delete_im_server_config(self):
|
|
1788
|
+
"""Delete instant messaging server configuration."""
|
|
1789
|
+
return self.delete(self._admin_url("config/imServer"))
|
|
1790
|
+
|
|
1791
|
+
def get_remote_agent_support_config(self):
|
|
1792
|
+
"""Get remote agent support configuration."""
|
|
1793
|
+
return self.get(self._admin_url("config/remoteAgentSupport"))
|
|
1794
|
+
|
|
1795
|
+
def update_remote_agent_support_config(self, data):
|
|
1796
|
+
"""
|
|
1797
|
+
Update remote agent support configuration.
|
|
1798
|
+
:param data: dict - configuration
|
|
1799
|
+
:return:
|
|
1800
|
+
"""
|
|
1801
|
+
return self.put(self._admin_url("config/remoteAgentSupport"), data=data)
|
|
1802
|
+
|
|
1803
|
+
def get_quarantine_config(self):
|
|
1804
|
+
"""Get quarantine configuration."""
|
|
1805
|
+
return self.get(self._admin_url("config/quarantine"))
|
|
1806
|
+
|
|
1807
|
+
def update_quarantine_config(self, data):
|
|
1808
|
+
"""
|
|
1809
|
+
Update quarantine configuration.
|
|
1810
|
+
:param data: dict - configuration
|
|
1811
|
+
:return:
|
|
1812
|
+
"""
|
|
1813
|
+
return self.put(self._admin_url("config/quarantine"), data=data)
|
|
1814
|
+
|
|
1815
|
+
def get_audit_log_config(self):
|
|
1816
|
+
"""Get audit log configuration."""
|
|
1817
|
+
return self.get(self._admin_url("config/auditLog"))
|
|
1818
|
+
|
|
1819
|
+
def update_audit_log_config(self, data):
|
|
1820
|
+
"""
|
|
1821
|
+
Update audit log configuration.
|
|
1822
|
+
:param data: dict - configuration
|
|
1823
|
+
:return:
|
|
1824
|
+
"""
|
|
1825
|
+
return self.put(self._admin_url("config/auditLog"), data=data)
|
|
1826
|
+
|
|
1827
|
+
def get_dark_features(self):
|
|
1828
|
+
"""Get all dark features."""
|
|
1829
|
+
return self.get(self._admin_url("darkFeatures"))
|
|
1830
|
+
|
|
1831
|
+
def get_dark_feature(self, key):
|
|
1832
|
+
"""
|
|
1833
|
+
Get a dark feature.
|
|
1834
|
+
:param key: str - feature key
|
|
1835
|
+
:return: feature status
|
|
1836
|
+
"""
|
|
1837
|
+
return self.get(self._admin_url(f"darkFeatures/{key}"))
|
|
1838
|
+
|
|
1839
|
+
def update_dark_feature(self, key, enabled):
|
|
1840
|
+
"""
|
|
1841
|
+
Enable or disable a dark feature.
|
|
1842
|
+
:param key: str - feature key
|
|
1843
|
+
:param enabled: bool - enabled status
|
|
1844
|
+
:return:
|
|
1845
|
+
"""
|
|
1846
|
+
return self.put(self._admin_url(f"darkFeatures/{key}"), data={"enabled": enabled})
|
|
1847
|
+
|
|
1848
|
+
def get_dark_feature_user(self, key, username):
|
|
1849
|
+
"""
|
|
1850
|
+
Get dark feature status for a user.
|
|
1851
|
+
:param key: str - feature key
|
|
1852
|
+
:param username: str - username
|
|
1853
|
+
:return: feature status
|
|
1854
|
+
"""
|
|
1855
|
+
return self.get(self._admin_url(f"darkFeatures/{key}/user/{username}"))
|
|
1856
|
+
|
|
1857
|
+
def update_dark_feature_user(self, key, username, enabled):
|
|
1858
|
+
"""
|
|
1859
|
+
Enable or disable a dark feature for a user.
|
|
1860
|
+
:param key: str - feature key
|
|
1861
|
+
:param username: str - username
|
|
1862
|
+
:param enabled: bool - enabled status
|
|
1863
|
+
:return:
|
|
1864
|
+
"""
|
|
1865
|
+
return self.put(self._admin_url(f"darkFeatures/{key}/user/{username}"), data={"enabled": enabled})
|
|
1866
|
+
|
|
1867
|
+
def get_global_variables(self):
|
|
1868
|
+
"""Get all global variables."""
|
|
1869
|
+
return self.get(self._admin_url("globalVariables"))
|
|
1870
|
+
|
|
1871
|
+
def create_global_variable(self, data):
|
|
1872
|
+
"""
|
|
1873
|
+
Create a global variable.
|
|
1874
|
+
:param data: dict - variable representation
|
|
1875
|
+
:return: created variable
|
|
1876
|
+
"""
|
|
1877
|
+
return self.post(self._admin_url("globalVariables"), data=data)
|
|
1878
|
+
|
|
1879
|
+
def get_global_variable(self, variable_id):
|
|
1880
|
+
"""
|
|
1881
|
+
Get a global variable.
|
|
1882
|
+
:param variable_id: str - variable id
|
|
1883
|
+
:return: variable
|
|
1884
|
+
"""
|
|
1885
|
+
return self.get(self._admin_url(f"globalVariables/{variable_id}"))
|
|
1886
|
+
|
|
1887
|
+
def update_global_variable(self, variable_id, data):
|
|
1888
|
+
"""
|
|
1889
|
+
Update a global variable.
|
|
1890
|
+
:param variable_id: str - variable id
|
|
1891
|
+
:param data: dict - variable representation
|
|
1892
|
+
:return:
|
|
1893
|
+
"""
|
|
1894
|
+
return self.put(self._admin_url(f"globalVariables/{variable_id}"), data=data)
|
|
1895
|
+
|
|
1896
|
+
def delete_global_variable(self, variable_id):
|
|
1897
|
+
"""
|
|
1898
|
+
Delete a global variable.
|
|
1899
|
+
:param variable_id: str - variable id
|
|
1900
|
+
:return:
|
|
1901
|
+
"""
|
|
1902
|
+
return self.delete(self._admin_url(f"globalVariables/{variable_id}"))
|
|
1903
|
+
|
|
1904
|
+
def verify_global_variables(self, data):
|
|
1905
|
+
"""
|
|
1906
|
+
Verify global variables.
|
|
1907
|
+
:param data: dict - variables to verify
|
|
1908
|
+
:return: verification result
|
|
1909
|
+
"""
|
|
1910
|
+
return self.put(self._admin_url("globalVariables/verify"), data=data)
|
|
1911
|
+
|
|
1912
|
+
def get_security_settings(self):
|
|
1913
|
+
"""Get security settings."""
|
|
1914
|
+
return self.get(self._admin_url("security/settings"))
|
|
1915
|
+
|
|
1916
|
+
def update_security_settings(self, data):
|
|
1917
|
+
"""
|
|
1918
|
+
Update security settings.
|
|
1919
|
+
:param data: dict - security settings
|
|
1920
|
+
:return:
|
|
1921
|
+
"""
|
|
1922
|
+
return self.put(self._admin_url("security/settings"), data=data)
|
|
1923
|
+
|
|
1924
|
+
def get_security_groups(self):
|
|
1925
|
+
"""Get security groups."""
|
|
1926
|
+
return self.get(self._admin_url("security/groups"))
|
|
1927
|
+
|
|
1928
|
+
def create_security_group(self, data):
|
|
1929
|
+
"""
|
|
1930
|
+
Create a security group.
|
|
1931
|
+
:param data: dict - group representation
|
|
1932
|
+
:return: created group
|
|
1933
|
+
"""
|
|
1934
|
+
return self.post(self._admin_url("security/groups"), data=data)
|
|
1935
|
+
|
|
1936
|
+
def get_trusted_keys(self):
|
|
1937
|
+
"""Get trusted keys."""
|
|
1938
|
+
return self.get(self._admin_url("security/trustedKey"))
|
|
1939
|
+
|
|
1940
|
+
def add_trusted_key(self, data):
|
|
1941
|
+
"""
|
|
1942
|
+
Add a trusted key.
|
|
1943
|
+
:param data: dict - key representation
|
|
1944
|
+
:return: created key
|
|
1945
|
+
"""
|
|
1946
|
+
return self.post(self._admin_url("security/trustedKey"), data=data)
|
|
1947
|
+
|
|
1948
|
+
def delete_trusted_key(self, key_id):
|
|
1949
|
+
"""
|
|
1950
|
+
Delete a trusted key.
|
|
1951
|
+
:param key_id: str - key id
|
|
1952
|
+
:return:
|
|
1953
|
+
"""
|
|
1954
|
+
return self.delete(self._admin_url(f"security/trustedKey/{key_id}"))
|
|
1955
|
+
|
|
1956
|
+
"""Permissions"""
|
|
1957
|
+
|
|
1958
|
+
def _permission_url(self, resource_type, resource_id):
|
|
1959
|
+
return f"permissions/{resource_type}/{resource_id}"
|
|
1960
|
+
|
|
1961
|
+
def get_available_users_for_permission(self, resource_type, resource_id, start=0, limit=25):
|
|
1962
|
+
"""
|
|
1963
|
+
Get users available for granting permission to a resource.
|
|
1964
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
1965
|
+
:param resource_id: str - resource id
|
|
1966
|
+
:param start: int - start index
|
|
1967
|
+
:param limit: int - maximum number of results
|
|
1968
|
+
:return: available users
|
|
1969
|
+
"""
|
|
1970
|
+
return self.get(
|
|
1971
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + "/available-users"),
|
|
1972
|
+
params={"start": start, "limit": limit},
|
|
1973
|
+
)
|
|
1974
|
+
|
|
1975
|
+
def get_available_groups_for_permission(self, resource_type, resource_id, start=0, limit=25):
|
|
1976
|
+
"""
|
|
1977
|
+
Get groups available for granting permission to a resource.
|
|
1978
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
1979
|
+
:param resource_id: str - resource id
|
|
1980
|
+
:param start: int - start index
|
|
1981
|
+
:param limit: int - maximum number of results
|
|
1982
|
+
:return: available groups
|
|
1983
|
+
"""
|
|
1984
|
+
return self.get(
|
|
1985
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + "/available-groups"),
|
|
1986
|
+
params={"start": start, "limit": limit},
|
|
1987
|
+
)
|
|
1988
|
+
|
|
1989
|
+
def get_roles_for_permission(self, resource_type, resource_id):
|
|
1990
|
+
"""
|
|
1991
|
+
Get roles with permissions for a resource.
|
|
1992
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
1993
|
+
:param resource_id: str - resource id
|
|
1994
|
+
:return: roles
|
|
1995
|
+
"""
|
|
1996
|
+
return self.get(self.resource_url(self._permission_url(resource_type, resource_id) + "/roles"))
|
|
1997
|
+
|
|
1998
|
+
def grant_role_permission(self, resource_type, resource_id, role_name, permissions):
|
|
1999
|
+
"""
|
|
2000
|
+
Grant permissions to a role for a resource.
|
|
2001
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
2002
|
+
:param resource_id: str - resource id
|
|
2003
|
+
:param role_name: str - role name
|
|
2004
|
+
:param permissions: list - list of permissions
|
|
2005
|
+
:return:
|
|
2006
|
+
"""
|
|
2007
|
+
return self.put(
|
|
2008
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + f"/roles/{role_name}"),
|
|
2009
|
+
data=permissions,
|
|
2010
|
+
)
|
|
2011
|
+
|
|
2012
|
+
def revoke_role_permission(self, resource_type, resource_id, role_name, permissions):
|
|
2013
|
+
"""
|
|
2014
|
+
Revoke permissions from a role for a resource.
|
|
2015
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
2016
|
+
:param resource_id: str - resource id
|
|
2017
|
+
:param role_name: str - role name
|
|
2018
|
+
:param permissions: list - list of permissions
|
|
2019
|
+
:return:
|
|
2020
|
+
"""
|
|
2021
|
+
return self.delete(
|
|
2022
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + f"/roles/{role_name}"),
|
|
2023
|
+
data=permissions,
|
|
2024
|
+
)
|
|
2025
|
+
|
|
2026
|
+
def get_permission_users(self, resource_type, resource_id, filter_name=None, start=0, limit=25):
|
|
2027
|
+
"""
|
|
2028
|
+
Get users with explicit permissions to a resource.
|
|
2029
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
2030
|
+
:param resource_id: str - resource id
|
|
2031
|
+
:param filter_name: str - optional name filter
|
|
2032
|
+
:param start: int - start index
|
|
2033
|
+
:param limit: int - maximum number of results
|
|
2034
|
+
:return: users
|
|
2035
|
+
"""
|
|
2036
|
+
params = {"start": start, "limit": limit}
|
|
2037
|
+
if filter_name:
|
|
2038
|
+
params["name"] = filter_name
|
|
2039
|
+
return self.get(
|
|
2040
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + "/users"),
|
|
2041
|
+
params=params,
|
|
2042
|
+
)
|
|
2043
|
+
|
|
2044
|
+
def grant_user_permission(self, resource_type, resource_id, user_name, permissions):
|
|
2045
|
+
"""
|
|
2046
|
+
Grant permissions to a user for a resource.
|
|
2047
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
2048
|
+
:param resource_id: str - resource id
|
|
2049
|
+
:param user_name: str - username
|
|
2050
|
+
:param permissions: list - list of permissions
|
|
2051
|
+
:return:
|
|
2052
|
+
"""
|
|
2053
|
+
return self.put(
|
|
2054
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + f"/users/{user_name}"),
|
|
2055
|
+
data=permissions,
|
|
2056
|
+
)
|
|
2057
|
+
|
|
2058
|
+
def revoke_user_permission(self, resource_type, resource_id, user_name, permissions):
|
|
2059
|
+
"""
|
|
2060
|
+
Revoke permissions from a user for a resource.
|
|
2061
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
2062
|
+
:param resource_id: str - resource id
|
|
2063
|
+
:param user_name: str - username
|
|
2064
|
+
:param permissions: list - list of permissions
|
|
2065
|
+
:return:
|
|
2066
|
+
"""
|
|
2067
|
+
return self.delete(
|
|
2068
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + f"/users/{user_name}"),
|
|
2069
|
+
data=permissions,
|
|
2070
|
+
)
|
|
2071
|
+
|
|
2072
|
+
def get_permission_groups(self, resource_type, resource_id, filter_name=None, start=0, limit=25):
|
|
2073
|
+
"""
|
|
2074
|
+
Get groups with explicit permissions to a resource.
|
|
2075
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
2076
|
+
:param resource_id: str - resource id
|
|
2077
|
+
:param filter_name: str - optional name filter
|
|
2078
|
+
:param start: int - start index
|
|
2079
|
+
:param limit: int - maximum number of results
|
|
2080
|
+
:return: groups
|
|
2081
|
+
"""
|
|
2082
|
+
params = {"start": start, "limit": limit}
|
|
2083
|
+
if filter_name:
|
|
2084
|
+
params["name"] = filter_name
|
|
2085
|
+
return self.get(
|
|
2086
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + "/groups"),
|
|
2087
|
+
params=params,
|
|
2088
|
+
)
|
|
2089
|
+
|
|
2090
|
+
def grant_group_permission(self, resource_type, resource_id, group_name, permissions):
|
|
2091
|
+
"""
|
|
2092
|
+
Grant permissions to a group for a resource.
|
|
2093
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
2094
|
+
:param resource_id: str - resource id
|
|
2095
|
+
:param group_name: str - group name
|
|
2096
|
+
:param permissions: list - list of permissions
|
|
2097
|
+
:return:
|
|
2098
|
+
"""
|
|
2099
|
+
return self.put(
|
|
2100
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + f"/groups/{group_name}"),
|
|
2101
|
+
data=permissions,
|
|
2102
|
+
)
|
|
2103
|
+
|
|
2104
|
+
def revoke_group_permission(self, resource_type, resource_id, group_name, permissions):
|
|
2105
|
+
"""
|
|
2106
|
+
Revoke permissions from a group for a resource.
|
|
2107
|
+
:param resource_type: str - deployment, environment, project, plan, repository
|
|
2108
|
+
:param resource_id: str - resource id
|
|
2109
|
+
:param group_name: str - group name
|
|
2110
|
+
:param permissions: list - list of permissions
|
|
2111
|
+
:return:
|
|
2112
|
+
"""
|
|
2113
|
+
return self.delete(
|
|
2114
|
+
self.resource_url(self._permission_url(resource_type, resource_id) + f"/groups/{group_name}"),
|
|
2115
|
+
data=permissions,
|
|
2116
|
+
)
|
|
2117
|
+
|
|
2118
|
+
"""Admin users and groups"""
|
|
2119
|
+
|
|
2120
|
+
def get_users(self, start=0, limit=25):
|
|
2121
|
+
"""
|
|
2122
|
+
Get a paginated list of users.
|
|
2123
|
+
:param start: int - start index
|
|
2124
|
+
:param limit: int - maximum number of results
|
|
2125
|
+
:return: users
|
|
2126
|
+
"""
|
|
2127
|
+
return self.get(self.resource_url("admin/users"), params={"start": start, "limit": limit})
|
|
2128
|
+
|
|
2129
|
+
def create_user(self, data):
|
|
2130
|
+
"""
|
|
2131
|
+
Create a new user.
|
|
2132
|
+
:param data: dict - user representation
|
|
2133
|
+
:return: created user
|
|
2134
|
+
"""
|
|
2135
|
+
return self.post(self.resource_url("admin/users"), data=data)
|
|
2136
|
+
|
|
2137
|
+
def delete_user(self, username):
|
|
2138
|
+
"""
|
|
2139
|
+
Delete a user.
|
|
2140
|
+
:param username: str - username
|
|
2141
|
+
:return:
|
|
2142
|
+
"""
|
|
2143
|
+
return self.delete(self.resource_url(f"admin/users/{username}"))
|
|
2144
|
+
|
|
2145
|
+
def update_user_credentials(self, data):
|
|
2146
|
+
"""
|
|
2147
|
+
Update user credentials.
|
|
2148
|
+
:param data: dict - credentials request
|
|
2149
|
+
:return:
|
|
2150
|
+
"""
|
|
2151
|
+
return self.put(self.resource_url("admin/users/credentials"), data=data)
|
|
2152
|
+
|
|
2153
|
+
def rename_user(self, data):
|
|
2154
|
+
"""
|
|
2155
|
+
Rename a user.
|
|
2156
|
+
:param data: dict - rename request
|
|
2157
|
+
:return:
|
|
2158
|
+
"""
|
|
2159
|
+
return self.put(self.resource_url("admin/users/rename"), data=data)
|
|
2160
|
+
|
|
2161
|
+
def get_user_access_tokens(self, username):
|
|
2162
|
+
"""
|
|
2163
|
+
Get access tokens for a user.
|
|
2164
|
+
:param username: str - username
|
|
2165
|
+
:return: access tokens
|
|
2166
|
+
"""
|
|
2167
|
+
return self.get(self.resource_url(f"admin/users/{username}/access-token"))
|
|
2168
|
+
|
|
2169
|
+
def delete_user_access_token(self, username, token_id):
|
|
2170
|
+
"""
|
|
2171
|
+
Delete an access token for a user.
|
|
2172
|
+
:param username: str - username
|
|
2173
|
+
:param token_id: str - token id
|
|
2174
|
+
:return:
|
|
2175
|
+
"""
|
|
2176
|
+
return self.delete(self.resource_url(f"admin/users/{username}/access-token/{token_id}"))
|
|
2177
|
+
|
|
2178
|
+
def get_user_alias(self, username):
|
|
2179
|
+
"""
|
|
2180
|
+
Get a user's alias.
|
|
2181
|
+
:param username: str - username
|
|
2182
|
+
:return: alias
|
|
2183
|
+
"""
|
|
2184
|
+
return self.get(self.resource_url(f"admin/users/{username}/alias"))
|
|
2185
|
+
|
|
2186
|
+
def set_user_alias(self, username, data):
|
|
2187
|
+
"""
|
|
2188
|
+
Set a user's alias.
|
|
2189
|
+
:param username: str - username
|
|
2190
|
+
:param data: dict - alias request
|
|
2191
|
+
:return:
|
|
2192
|
+
"""
|
|
2193
|
+
return self.post(self.resource_url(f"admin/users/{username}/alias"), data=data)
|
|
2194
|
+
|
|
2195
|
+
def delete_user_alias(self, username):
|
|
2196
|
+
"""
|
|
2197
|
+
Delete a user's alias.
|
|
2198
|
+
:param username: str - username
|
|
2199
|
+
:return:
|
|
2200
|
+
"""
|
|
2201
|
+
return self.delete(self.resource_url(f"admin/users/{username}/alias"))
|
|
2202
|
+
|
|
2203
|
+
"""Server and queue"""
|
|
2204
|
+
|
|
2205
|
+
def get_server(self):
|
|
2206
|
+
"""Get Bamboo server information."""
|
|
2207
|
+
return self.get(self.resource_url("server"))
|
|
2208
|
+
|
|
2209
|
+
def get_server_nodes(self):
|
|
2210
|
+
"""Get Bamboo server nodes."""
|
|
2211
|
+
return self.get(self.resource_url("server/nodes"))
|
|
2212
|
+
|
|
2213
|
+
def pause_server(self):
|
|
2214
|
+
"""Pause the Bamboo server."""
|
|
2215
|
+
return self.post(self.resource_url("server/pause"))
|
|
2216
|
+
|
|
2217
|
+
def resume_server(self):
|
|
2218
|
+
"""Resume the Bamboo server."""
|
|
2219
|
+
return self.post(self.resource_url("server/resume"))
|
|
2220
|
+
|
|
2221
|
+
def prepare_for_restart(self):
|
|
2222
|
+
"""Prepare the Bamboo server for restart."""
|
|
2223
|
+
return self.put(self.resource_url("server/prepareForRestart"))
|
|
2224
|
+
|
|
2225
|
+
def get_current_user(self):
|
|
2226
|
+
"""Get information about the current user."""
|
|
2227
|
+
return self.get(self.resource_url("currentUser"))
|
|
2228
|
+
|
|
2229
|
+
def remove_build_from_queue(self, project_key, build_key, build_number):
|
|
2230
|
+
"""
|
|
2231
|
+
Remove a build from the queue.
|
|
2232
|
+
:param project_key: str - project key
|
|
2233
|
+
:param build_key: str - build key
|
|
2234
|
+
:param build_number: int - build number
|
|
2235
|
+
:return:
|
|
2236
|
+
"""
|
|
2237
|
+
return self.delete(self.resource_url(f"queue/{project_key}-{build_key}-{build_number}"))
|
|
2238
|
+
|
|
2239
|
+
def pause_build_in_queue(self, project_key, build_key, build_number):
|
|
2240
|
+
"""
|
|
2241
|
+
Pause a build in the queue.
|
|
2242
|
+
:param project_key: str - project key
|
|
2243
|
+
:param build_key: str - build key
|
|
2244
|
+
:param build_number: int - build number
|
|
2245
|
+
:return:
|
|
2246
|
+
"""
|
|
2247
|
+
return self.put(self.resource_url(f"queue/{project_key}-{build_key}-{build_number}"))
|
|
2248
|
+
|
|
2249
|
+
def remove_deployment_from_queue(self, deployment_result_id):
|
|
2250
|
+
"""
|
|
2251
|
+
Remove a deployment from the queue.
|
|
2252
|
+
:param deployment_result_id: str - deployment result id
|
|
2253
|
+
:return:
|
|
2254
|
+
"""
|
|
2255
|
+
return self.delete(self.resource_url(f"queue/deployment/{deployment_result_id}"))
|
|
2256
|
+
|
|
2257
|
+
"""Quick filters"""
|
|
2258
|
+
|
|
2259
|
+
def get_quick_filters(self):
|
|
2260
|
+
"""Get all quick filters."""
|
|
2261
|
+
return self.get(self.resource_url("quickFilter"))
|
|
2262
|
+
|
|
2263
|
+
def create_quick_filter(self, data):
|
|
2264
|
+
"""
|
|
2265
|
+
Create a quick filter.
|
|
2266
|
+
:param data: dict - filter representation
|
|
2267
|
+
:return: created filter
|
|
2268
|
+
"""
|
|
2269
|
+
return self.post(self.resource_url("quickFilter"), data=data)
|
|
2270
|
+
|
|
2271
|
+
def get_active_quick_filters(self):
|
|
2272
|
+
"""Get active quick filters."""
|
|
2273
|
+
return self.get(self.resource_url("quickFilter/active"))
|
|
2274
|
+
|
|
2275
|
+
def get_visible_quick_filters(self):
|
|
2276
|
+
"""Get visible quick filters."""
|
|
2277
|
+
return self.get(self.resource_url("quickFilter/visible"))
|
|
2278
|
+
|
|
2279
|
+
def set_visible_quick_filters(self, data):
|
|
2280
|
+
"""
|
|
2281
|
+
Set visible quick filters.
|
|
2282
|
+
:param data: dict - filter ids
|
|
2283
|
+
:return:
|
|
2284
|
+
"""
|
|
2285
|
+
return self.put(self.resource_url("quickFilter/visible"), data=data)
|
|
2286
|
+
|
|
2287
|
+
def deactivate_quick_filters(self, data):
|
|
2288
|
+
"""
|
|
2289
|
+
Deactivate quick filters.
|
|
2290
|
+
:param data: dict - filter ids
|
|
2291
|
+
:return:
|
|
2292
|
+
"""
|
|
2293
|
+
return self.put(self.resource_url("quickFilter/deactivate"), data=data)
|
|
2294
|
+
|
|
2295
|
+
def get_quick_filter(self, filter_id):
|
|
2296
|
+
"""
|
|
2297
|
+
Get a quick filter.
|
|
2298
|
+
:param filter_id: str - filter id
|
|
2299
|
+
:return: filter
|
|
2300
|
+
"""
|
|
2301
|
+
return self.get(self.resource_url(f"quickFilter/{filter_id}"))
|
|
2302
|
+
|
|
2303
|
+
def update_quick_filter(self, filter_id, data):
|
|
2304
|
+
"""
|
|
2305
|
+
Update a quick filter.
|
|
2306
|
+
:param filter_id: str - filter id
|
|
2307
|
+
:param data: dict - filter representation
|
|
2308
|
+
:return:
|
|
2309
|
+
"""
|
|
2310
|
+
return self.put(self.resource_url(f"quickFilter/{filter_id}"), data=data)
|
|
2311
|
+
|
|
2312
|
+
def delete_quick_filter(self, filter_id):
|
|
2313
|
+
"""
|
|
2314
|
+
Delete a quick filter.
|
|
2315
|
+
:param filter_id: str - filter id
|
|
2316
|
+
:return:
|
|
2317
|
+
"""
|
|
2318
|
+
return self.delete(self.resource_url(f"quickFilter/{filter_id}"))
|
|
2319
|
+
|
|
2320
|
+
def activate_quick_filter(self, filter_id):
|
|
2321
|
+
"""
|
|
2322
|
+
Activate a quick filter.
|
|
2323
|
+
:param filter_id: str - filter id
|
|
2324
|
+
:return:
|
|
2325
|
+
"""
|
|
2326
|
+
return self.put(self.resource_url(f"quickFilter/{filter_id}/activate"))
|
|
2327
|
+
|
|
1492
2328
|
"""Elastic Bamboo"""
|
|
1493
2329
|
|
|
1494
2330
|
def get_elastic_instance_logs(self, instance_id):
|