atlassian-python-api 5.0.2__py3-none-any.whl → 5.0.4__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 +7 -1
- atlassian/assets/__init__.py +6 -0
- atlassian/{assets.py → assets/assets_cloud.py} +264 -6
- atlassian/assets/assets_server.py +24 -0
- atlassian/bamboo.py +819 -2
- atlassian/bitbucket/__init__.py +149 -0
- atlassian/bitbucket/cloud/repositories/commits.py +13 -3
- atlassian/bitbucket/cloud/repositories/repositoryVariables.py +23 -0
- atlassian/bitbucket/cloud/workspaces/__init__.py +6 -1
- atlassian/company_calendar.py +215 -0
- atlassian/compass/__init__.py +109 -0
- atlassian/confluence/base.py +12 -1
- atlassian/confluence/cloud/__init__.py +17 -0
- atlassian/confluence/cloud/admin_management.py +125 -0
- atlassian/confluence/cloud/cloud.py +7 -21
- atlassian/confluence/server/__init__.py +140 -16
- atlassian/confluence_base.py +24 -13
- atlassian/crowd.py +1204 -6
- atlassian/jira/jira_cloud.py +83 -0
- atlassian/jira/jira_server.py +165 -31
- atlassian/service_desk.py +71 -11
- atlassian/{xray.py → xray/__init__.py} +136 -9
- {atlassian_python_api-5.0.2.dist-info → atlassian_python_api-5.0.4.dist-info}/METADATA +2 -5
- {atlassian_python_api-5.0.2.dist-info → atlassian_python_api-5.0.4.dist-info}/RECORD +28 -23
- {atlassian_python_api-5.0.2.dist-info → atlassian_python_api-5.0.4.dist-info}/WHEEL +0 -0
- {atlassian_python_api-5.0.2.dist-info → atlassian_python_api-5.0.4.dist-info}/licenses/LICENSE +0 -0
- {atlassian_python_api-5.0.2.dist-info → atlassian_python_api-5.0.4.dist-info}/top_level.txt +0 -0
atlassian/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.0.
|
|
1
|
+
5.0.4
|
atlassian/__init__.py
CHANGED
|
@@ -6,12 +6,14 @@ from .bamboo import Bamboo
|
|
|
6
6
|
from .bitbucket import Bitbucket
|
|
7
7
|
from .bitbucket import Bitbucket as Stash
|
|
8
8
|
from .cloud_admin import CloudAdmin, CloudAdminOrgs, CloudAdminUsers
|
|
9
|
+
from .company_calendar import CompanyCalendar
|
|
10
|
+
from .compass import Compass
|
|
9
11
|
from .confluence import Confluence, ConfluenceBase, ConfluenceCloud, ConfluenceServer
|
|
10
12
|
from .confluence.cloud.cloud import ConfluenceCloud as ConfluenceV2
|
|
11
13
|
from .crowd import Crowd
|
|
12
14
|
from .insight import Insight
|
|
13
15
|
from .insight import Insight as Assets # used for Insight on-premise
|
|
14
|
-
from .assets import AssetsCloud #
|
|
16
|
+
from .assets import AssetsCloud, AssetsDataCenter, AssetsServer # Assets Cloud and Data Center
|
|
15
17
|
from .jira import Jira, JiraCloud, JiraServer, JiraServiceManagement, JiraSoftware, create_jira_cloud
|
|
16
18
|
from .marketplace import MarketPlace
|
|
17
19
|
from .portfolio import Portfolio
|
|
@@ -46,6 +48,8 @@ __all__ = [
|
|
|
46
48
|
"CloudAdminOrgs",
|
|
47
49
|
"CloudAdminUsers",
|
|
48
50
|
"CloudAdmin",
|
|
51
|
+
"CompanyCalendar",
|
|
52
|
+
"Compass",
|
|
49
53
|
"Portfolio",
|
|
50
54
|
"Bamboo",
|
|
51
55
|
"Stash",
|
|
@@ -57,6 +61,8 @@ __all__ = [
|
|
|
57
61
|
"Insight",
|
|
58
62
|
"Assets",
|
|
59
63
|
"AssetsCloud",
|
|
64
|
+
"AssetsDataCenter",
|
|
65
|
+
"AssetsServer",
|
|
60
66
|
"TempoCloud",
|
|
61
67
|
"TempoServer",
|
|
62
68
|
"YogiJiraCloud",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
import logging
|
|
3
3
|
|
|
4
|
-
from
|
|
4
|
+
from ..rest_client import AtlassianRestAPI
|
|
5
5
|
|
|
6
6
|
# from deprecated import deprecated
|
|
7
7
|
|
|
@@ -72,6 +72,11 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
72
72
|
"""
|
|
73
73
|
return next(iter(self._get_assets_workspace_ids()))
|
|
74
74
|
|
|
75
|
+
@staticmethod
|
|
76
|
+
def _params(**kwargs):
|
|
77
|
+
"""Drop unset query parameters while preserving false/zero values."""
|
|
78
|
+
return {key: value for key, value in kwargs.items() if value is not None}
|
|
79
|
+
|
|
75
80
|
# Attachments
|
|
76
81
|
def get_attachments_of_objects(self, object_id):
|
|
77
82
|
"""
|
|
@@ -215,6 +220,11 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
215
220
|
url = self.url_joiner(self.api_root, "icon/global")
|
|
216
221
|
return self.get(url)
|
|
217
222
|
|
|
223
|
+
def get_icon_image(self, icon_id, not_json_response=True):
|
|
224
|
+
"""Return the binary image for an Assets icon."""
|
|
225
|
+
url = self.url_joiner(self.api_root, f"icon/{icon_id}/icon.png")
|
|
226
|
+
return self.get(url, not_json_response=not_json_response)
|
|
227
|
+
|
|
218
228
|
# Import
|
|
219
229
|
# Start configured imports. To see an ongoing import see the Progress resource
|
|
220
230
|
def start_import_configuration(self, import_id):
|
|
@@ -230,6 +240,62 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
230
240
|
)
|
|
231
241
|
return self.post(url)
|
|
232
242
|
|
|
243
|
+
def get_import_source(self, import_source_id):
|
|
244
|
+
return self.get(self.url_joiner(self.api_root, f"importsource/{import_source_id}"))
|
|
245
|
+
|
|
246
|
+
def update_import_source_mapping(self, import_source_id, data, partial=False):
|
|
247
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/mapping")
|
|
248
|
+
if partial:
|
|
249
|
+
return self.patch(url, data=data)
|
|
250
|
+
return self.put(url, data=data)
|
|
251
|
+
|
|
252
|
+
def get_import_mapping_progress(self, import_source_id, resource_id):
|
|
253
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/mapping/progress/{resource_id}")
|
|
254
|
+
return self.get(url)
|
|
255
|
+
|
|
256
|
+
def get_import_config_status(self, import_source_id):
|
|
257
|
+
return self.get(self.url_joiner(self.api_root, f"importsource/{import_source_id}/configstatus"))
|
|
258
|
+
|
|
259
|
+
def get_import_schema_and_mapping(self, import_source_id):
|
|
260
|
+
return self.get(self.url_joiner(self.api_root, f"importsource/{import_source_id}/schema-and-mapping"))
|
|
261
|
+
|
|
262
|
+
def create_import_execution(self, import_source_id, data=None):
|
|
263
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/executions")
|
|
264
|
+
return self.post(url, data=data)
|
|
265
|
+
|
|
266
|
+
def delete_import_execution(self, import_source_id, import_execution_id):
|
|
267
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/executions/{import_execution_id}")
|
|
268
|
+
return self.delete(url)
|
|
269
|
+
|
|
270
|
+
def update_import_execution_progress(self, import_source_id, import_execution_id, data=None):
|
|
271
|
+
url = self.url_joiner(
|
|
272
|
+
self.api_root, f"importsource/{import_source_id}/executions/{import_execution_id}/progress"
|
|
273
|
+
)
|
|
274
|
+
return self.put(url, data=data)
|
|
275
|
+
|
|
276
|
+
def add_import_execution_data(self, import_source_id, import_execution_id, data=None):
|
|
277
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/executions/{import_execution_id}/data")
|
|
278
|
+
return self.post(url, data=data)
|
|
279
|
+
|
|
280
|
+
def get_import_execution_status(self, import_source_id, import_execution_id):
|
|
281
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/executions/{import_execution_id}/status")
|
|
282
|
+
return self.get(url)
|
|
283
|
+
|
|
284
|
+
def get_import_executions_status(self, import_source_id):
|
|
285
|
+
return self.get(self.url_joiner(self.api_root, f"importsource/{import_source_id}/executions/status"))
|
|
286
|
+
|
|
287
|
+
def add_failed_import_execution_history(self, import_source_id, execution_id, data=None):
|
|
288
|
+
url = self.url_joiner(
|
|
289
|
+
self.api_root, f"importsource/{import_source_id}/executions/{execution_id}/history/failed"
|
|
290
|
+
)
|
|
291
|
+
return self.post(url, data=data)
|
|
292
|
+
|
|
293
|
+
def create_import_token(self, import_source_id, data=None):
|
|
294
|
+
return self.post(self.url_joiner(self.api_root, f"importsource/{import_source_id}/token"), data=data)
|
|
295
|
+
|
|
296
|
+
def get_import_schedule(self, import_source_id):
|
|
297
|
+
return self.get(self.url_joiner(self.api_root, f"importsource/{import_source_id}/schedule"))
|
|
298
|
+
|
|
233
299
|
# Index
|
|
234
300
|
# Handle the indexing of Assets
|
|
235
301
|
def reindex_assets(self):
|
|
@@ -275,6 +341,55 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
275
341
|
url = self.url_joiner(self.api_root, "object/aql")
|
|
276
342
|
return self.post(url, params=params, data=data)
|
|
277
343
|
|
|
344
|
+
def get_aql_objects(
|
|
345
|
+
self,
|
|
346
|
+
query=None,
|
|
347
|
+
page=None,
|
|
348
|
+
result_per_page=None,
|
|
349
|
+
include_attributes=None,
|
|
350
|
+
include_attributes_deep=None,
|
|
351
|
+
include_type_attributes=None,
|
|
352
|
+
include_extended_info=None,
|
|
353
|
+
):
|
|
354
|
+
"""Retrieve objects through the legacy AQL collection endpoint."""
|
|
355
|
+
params = self._params(
|
|
356
|
+
qlQuery=query,
|
|
357
|
+
page=page,
|
|
358
|
+
resultPerPage=result_per_page,
|
|
359
|
+
includeAttributes=include_attributes,
|
|
360
|
+
includeAttributesDeep=include_attributes_deep,
|
|
361
|
+
includeTypeAttributes=include_type_attributes,
|
|
362
|
+
includeExtendedInfo=include_extended_info,
|
|
363
|
+
)
|
|
364
|
+
return self.get(self.url_joiner(self.api_root, "aql/objects"), params=params or None)
|
|
365
|
+
|
|
366
|
+
def get_iql_objects(
|
|
367
|
+
self,
|
|
368
|
+
query=None,
|
|
369
|
+
page=None,
|
|
370
|
+
result_per_page=None,
|
|
371
|
+
include_attributes=None,
|
|
372
|
+
include_attributes_deep=None,
|
|
373
|
+
include_type_attributes=None,
|
|
374
|
+
include_extended_info=None,
|
|
375
|
+
):
|
|
376
|
+
"""Retrieve objects through the IQL collection endpoint."""
|
|
377
|
+
params = self._params(
|
|
378
|
+
iql=query,
|
|
379
|
+
page=page,
|
|
380
|
+
resultPerPage=result_per_page,
|
|
381
|
+
includeAttributes=include_attributes,
|
|
382
|
+
includeAttributesDeep=include_attributes_deep,
|
|
383
|
+
includeTypeAttributes=include_type_attributes,
|
|
384
|
+
includeExtendedInfo=include_extended_info,
|
|
385
|
+
)
|
|
386
|
+
return self.get(self.url_joiner(self.api_root, "iql/objects"), params=params or None)
|
|
387
|
+
|
|
388
|
+
def iql(self, query, start=0, max_results=25, include_attributes=True):
|
|
389
|
+
"""Find Assets objects using the IQL-compatible Cloud endpoint."""
|
|
390
|
+
params = self._params(startAt=start, maxResults=max_results, includeAttributes=include_attributes)
|
|
391
|
+
return self.post(self.url_joiner(self.api_root, "object/aql"), params=params, data={"qlQuery": query})
|
|
392
|
+
|
|
278
393
|
# Navlist AQL
|
|
279
394
|
# Retrieve a list of objects based on an AQL query
|
|
280
395
|
# Server-only. Cloud use aql()
|
|
@@ -387,6 +502,44 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
387
502
|
url = self.url_joiner(self.api_root, f"object/{object_id}/attributes")
|
|
388
503
|
return self.get(url)
|
|
389
504
|
|
|
505
|
+
def get_object_attribute_value(self, object_id, attribute_id, default=None):
|
|
506
|
+
"""Return the first value for an object type attribute.
|
|
507
|
+
|
|
508
|
+
Assets exposes object attributes as a collection rather than a
|
|
509
|
+
dedicated value endpoint. This helper fetches that collection and
|
|
510
|
+
selects the entry whose ``objectTypeAttributeId`` matches
|
|
511
|
+
``attribute_id``. ``None`` (or ``default``) is returned when the
|
|
512
|
+
attribute is absent or has no values.
|
|
513
|
+
|
|
514
|
+
:param object_id: Assets object ID
|
|
515
|
+
:param attribute_id: object type attribute ID
|
|
516
|
+
:param default: value returned when no matching value exists
|
|
517
|
+
"""
|
|
518
|
+
attributes = self.get_object_attributes(object_id)
|
|
519
|
+
if isinstance(attributes, dict):
|
|
520
|
+
attributes = attributes.get("objectAttributeBeans", attributes.get("values", []))
|
|
521
|
+
if not isinstance(attributes, list):
|
|
522
|
+
return default
|
|
523
|
+
|
|
524
|
+
for attribute in attributes:
|
|
525
|
+
if not isinstance(attribute, dict):
|
|
526
|
+
continue
|
|
527
|
+
object_type_attribute = attribute.get("objectTypeAttribute") or {}
|
|
528
|
+
current_id = attribute.get("objectTypeAttributeId", object_type_attribute.get("id"))
|
|
529
|
+
if str(current_id) != str(attribute_id):
|
|
530
|
+
continue
|
|
531
|
+
|
|
532
|
+
values = attribute.get("objectAttributeValues")
|
|
533
|
+
if values is None:
|
|
534
|
+
values = attribute.get("values")
|
|
535
|
+
if values:
|
|
536
|
+
value = values[0]
|
|
537
|
+
return value.get("value") if isinstance(value, dict) else value
|
|
538
|
+
if "value" in attribute:
|
|
539
|
+
return attribute["value"]
|
|
540
|
+
return default
|
|
541
|
+
return default
|
|
542
|
+
|
|
390
543
|
def get_object_history(self, object_id, asc=False, abbreviate=True):
|
|
391
544
|
"""
|
|
392
545
|
Retrieve the history entries for this object
|
|
@@ -410,6 +563,21 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
410
563
|
url = self.url_joiner(self.api_root, f"object/{object_id}/referenceinfo")
|
|
411
564
|
return self.get(url)
|
|
412
565
|
|
|
566
|
+
def search_objects_aql(self, query, start=0, max_results=25, include_attributes=True):
|
|
567
|
+
return self.aql(query, start=start, max_results=max_results, include_attributes=include_attributes)
|
|
568
|
+
|
|
569
|
+
def search_objects_iql(self, query, start=0, max_results=25, include_attributes=True):
|
|
570
|
+
return self.iql(query, start=start, max_results=max_results, include_attributes=include_attributes)
|
|
571
|
+
|
|
572
|
+
def search_objects_aql_navigation(self, data=None):
|
|
573
|
+
return self.post(self.url_joiner(self.api_root, "object/navlist/aql"), data=data)
|
|
574
|
+
|
|
575
|
+
def search_objects_iql_navigation(self, data=None):
|
|
576
|
+
return self.post(self.url_joiner(self.api_root, "object/navlist/iql"), data=data)
|
|
577
|
+
|
|
578
|
+
def get_object_aql_total_count(self, query):
|
|
579
|
+
return self.post(self.url_joiner(self.api_root, "object/aql/totalcount"), data={"qlQuery": query})
|
|
580
|
+
|
|
413
581
|
def create_object(self, object_type_id, attributes, has_avatar=False, avatar_uuid=""):
|
|
414
582
|
"""
|
|
415
583
|
Create a new object in Assets
|
|
@@ -467,7 +635,8 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
467
635
|
return self.get(url)
|
|
468
636
|
|
|
469
637
|
def create_object_schema(self, object_schema_key, description):
|
|
470
|
-
|
|
638
|
+
data = {"objectSchemaKey": object_schema_key, "description": description}
|
|
639
|
+
return self.post(self.url_joiner(self.api_root, "objectschema/create"), data=data)
|
|
471
640
|
|
|
472
641
|
def get_object_schema(self, schema_id):
|
|
473
642
|
"""
|
|
@@ -477,23 +646,26 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
477
646
|
url = self.url_joiner(self.api_root, f"objectschema/{schema_id}")
|
|
478
647
|
return self.get(url)
|
|
479
648
|
|
|
480
|
-
def update_object_schema(self, schema_id):
|
|
649
|
+
def update_object_schema(self, schema_id, data=None):
|
|
481
650
|
"""
|
|
482
651
|
Update an object schema
|
|
483
652
|
"""
|
|
484
|
-
|
|
653
|
+
return self.put(self.url_joiner(self.api_root, f"objectschema/{schema_id}"), data=data)
|
|
485
654
|
|
|
486
655
|
def delete_object_schema(self, schema_id):
|
|
487
656
|
"""
|
|
488
657
|
Delete a schema
|
|
489
658
|
"""
|
|
490
|
-
|
|
659
|
+
return self.delete(self.url_joiner(self.api_root, f"objectschema/{schema_id}"))
|
|
491
660
|
|
|
492
661
|
def get_object_schema_attributes(self, schema_id):
|
|
493
662
|
"""
|
|
494
663
|
Find all object type attributes for this object schema
|
|
495
664
|
"""
|
|
496
|
-
|
|
665
|
+
return self.get(self.url_joiner(self.api_root, f"objectschema/{schema_id}/attributes"))
|
|
666
|
+
|
|
667
|
+
def get_object_schema_object_types(self, schema_id):
|
|
668
|
+
return self.get(self.url_joiner(self.api_root, f"objectschema/{schema_id}/objecttypes"))
|
|
497
669
|
|
|
498
670
|
def get_object_schema_object_types_flat(self, schema_id, query=None, exclude=None, includeObjectCounts=None):
|
|
499
671
|
"""
|
|
@@ -596,6 +768,10 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
596
768
|
url = self.url_joiner(self.api_root, f"progress/category/imports/{import_id}")
|
|
597
769
|
return self.get(url)
|
|
598
770
|
|
|
771
|
+
def get_import_progress(self, import_id):
|
|
772
|
+
"""Return progress for a Cloud import."""
|
|
773
|
+
return self.get(self.url_joiner(self.api_root, f"progress/category/imports/{import_id}"))
|
|
774
|
+
|
|
599
775
|
# Assets Config API
|
|
600
776
|
# TODO: Get config statustype:
|
|
601
777
|
# https://developer.atlassian.com/cloud/assets/rest/api-group-config/#api-config-statustype-get
|
|
@@ -631,3 +807,85 @@ class AssetsCloud(AtlassianRestAPI):
|
|
|
631
807
|
}
|
|
632
808
|
data = {"fields": {field_id: [{"key": i} for i in assets_keys]}}
|
|
633
809
|
return self.put(f"{base_url}/{key}", data=data)
|
|
810
|
+
|
|
811
|
+
# Object type and configuration resources
|
|
812
|
+
def get_object_type(self, object_type_id):
|
|
813
|
+
return self.get(self.url_joiner(self.api_root, f"objecttype/{object_type_id}"))
|
|
814
|
+
|
|
815
|
+
def update_object_type(self, object_type_id, data=None):
|
|
816
|
+
return self.put(self.url_joiner(self.api_root, f"objecttype/{object_type_id}"), data=data)
|
|
817
|
+
|
|
818
|
+
def delete_object_type(self, object_type_id):
|
|
819
|
+
return self.delete(self.url_joiner(self.api_root, f"objecttype/{object_type_id}"))
|
|
820
|
+
|
|
821
|
+
def create_object_type(self, data=None):
|
|
822
|
+
return self.post(self.url_joiner(self.api_root, "objecttype/create"), data=data)
|
|
823
|
+
|
|
824
|
+
def move_object_type(self, object_type_id, data=None):
|
|
825
|
+
return self.post(self.url_joiner(self.api_root, f"objecttype/{object_type_id}/position"), data=data)
|
|
826
|
+
|
|
827
|
+
def create_object_type_attribute(self, object_type_id, data=None):
|
|
828
|
+
return self.post(self.url_joiner(self.api_root, f"objecttypeattribute/{object_type_id}"), data=data)
|
|
829
|
+
|
|
830
|
+
def update_object_type_attribute(self, object_type_id, attribute_id, data=None):
|
|
831
|
+
url = self.url_joiner(self.api_root, f"objecttypeattribute/{object_type_id}/{attribute_id}")
|
|
832
|
+
return self.put(url, data=data)
|
|
833
|
+
|
|
834
|
+
def delete_object_type_attribute(self, attribute_id):
|
|
835
|
+
return self.delete(self.url_joiner(self.api_root, f"objecttypeattribute/{attribute_id}"))
|
|
836
|
+
|
|
837
|
+
def get_status_types(self):
|
|
838
|
+
return self.get(self.url_joiner(self.api_root, "config/statustype"))
|
|
839
|
+
|
|
840
|
+
def create_status_type(self, data=None):
|
|
841
|
+
return self.post(self.url_joiner(self.api_root, "config/statustype"), data=data)
|
|
842
|
+
|
|
843
|
+
def get_status_type(self, status_type_id):
|
|
844
|
+
return self.get(self.url_joiner(self.api_root, f"config/statustype/{status_type_id}"))
|
|
845
|
+
|
|
846
|
+
def update_status_type(self, status_type_id, data=None):
|
|
847
|
+
return self.put(self.url_joiner(self.api_root, f"config/statustype/{status_type_id}"), data=data)
|
|
848
|
+
|
|
849
|
+
def delete_status_type(self, status_type_id):
|
|
850
|
+
return self.delete(self.url_joiner(self.api_root, f"config/statustype/{status_type_id}"))
|
|
851
|
+
|
|
852
|
+
def get_reference_types(self):
|
|
853
|
+
return self.get(self.url_joiner(self.api_root, "config/referencetype"))
|
|
854
|
+
|
|
855
|
+
def create_reference_type(self, data=None):
|
|
856
|
+
return self.post(self.url_joiner(self.api_root, "config/referencetype"), data=data)
|
|
857
|
+
|
|
858
|
+
def set_object_schema_property(self, schema_id, data=None):
|
|
859
|
+
url = self.url_joiner(self.api_root, f"global/config/objectschema/{schema_id}/property")
|
|
860
|
+
return self.post(url, data=data)
|
|
861
|
+
|
|
862
|
+
def create_import_schedule(self, import_source_id, data=None):
|
|
863
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/importschedule")
|
|
864
|
+
return self.post(url, data=data)
|
|
865
|
+
|
|
866
|
+
def get_import_schedule_by_id(self, import_source_id, import_schedule_id):
|
|
867
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/importschedule/{import_schedule_id}")
|
|
868
|
+
return self.get(url)
|
|
869
|
+
|
|
870
|
+
def update_import_schedule(self, import_source_id, import_schedule_id, data=None):
|
|
871
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/importschedule/{import_schedule_id}")
|
|
872
|
+
return self.put(url, data=data)
|
|
873
|
+
|
|
874
|
+
def delete_import_schedule(self, import_source_id, import_schedule_id):
|
|
875
|
+
url = self.url_joiner(self.api_root, f"importsource/{import_source_id}/importschedule/{import_schedule_id}")
|
|
876
|
+
return self.delete(url)
|
|
877
|
+
|
|
878
|
+
def get_usage(self):
|
|
879
|
+
return self.get(self.url_joiner(self.api_root, "usage"))
|
|
880
|
+
|
|
881
|
+
def export_dataset(self, **filters):
|
|
882
|
+
"""Export dataset information as CSV."""
|
|
883
|
+
allowed = {"testIssueId", "testIssueKey", "testVersion", "contextIssueId", "contextIssueKey", "resolved"}
|
|
884
|
+
params = self._params(**{key: value for key, value in filters.items() if key in allowed})
|
|
885
|
+
return self.get(self.url_joiner(self.api_root, "dataset/export"), params=params or None, not_json_response=True)
|
|
886
|
+
|
|
887
|
+
def import_dataset(self, files=None, **filters):
|
|
888
|
+
"""Import a dataset CSV using optional entity context filters."""
|
|
889
|
+
allowed = {"testIssueId", "testIssueKey", "testVersion", "contextIssueId", "contextIssueKey"}
|
|
890
|
+
params = self._params(**{key: value for key, value in filters.items() if key in allowed})
|
|
891
|
+
return self.post(self.url_joiner(self.api_root, "dataset/import"), params=params or None, files=files)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Jira Service Management Assets Server/Data Center client."""
|
|
2
|
+
|
|
3
|
+
from .assets_cloud import AssetsCloud
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AssetsServer(AssetsCloud):
|
|
7
|
+
"""Assets REST client for Jira Server/Data Center installations.
|
|
8
|
+
|
|
9
|
+
Assets Data Center 10.x exposes the REST resources below
|
|
10
|
+
``/rest/assets/1.0``. The implementation shares the resource methods
|
|
11
|
+
with :class:`~atlassian.assets.assets_cloud.AssetsCloud`; only workspace
|
|
12
|
+
discovery and the Cloud gateway are skipped.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, *args, **kwargs):
|
|
16
|
+
# Explicitly force the server path even if a caller reuses a config
|
|
17
|
+
# dictionary that contains ``cloud=True``.
|
|
18
|
+
kwargs["cloud"] = False
|
|
19
|
+
super().__init__(*args, **kwargs)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Data Center is the current product name; retain this descriptive alias for
|
|
23
|
+
# callers that used the previous class name.
|
|
24
|
+
AssetsDataCenter = AssetsServer
|