|
1 | 1 | # ------------------------------------------------------------------------------- |
2 | | -# (c) 2019-2021 Siemens AG |
| 2 | +# (c) 2019-2022 Siemens AG |
3 | 3 | # All Rights Reserved. |
4 | 4 | # Authors: thomas.graf@siemens.com, gernot.hillier@siemens.com |
5 | 5 | # |
@@ -360,7 +360,7 @@ def get_projects_by_tag(self, tag): |
360 | 360 | :rtype: list of JSON project objects |
361 | 361 | :raises SW360Error: if there is a negative HTTP response |
362 | 362 | """ |
363 | | - full_url = self.url + "resource/api/projects?tag=" + tag |
| 363 | + full_url = self.url + "resource/api/projects?tag=" + tag + "&luceneSearch=true" |
364 | 364 | resp = self.api_get(full_url) |
365 | 365 | if not resp: |
366 | 366 | return None |
@@ -608,6 +608,45 @@ def duplicate_project(self, project_id: str, new_version: str): |
608 | 608 |
|
609 | 609 | raise SW360Error(response, url) |
610 | 610 |
|
| 611 | + def update_project_release_relationship(self, project_id: str, release_id: str, new_state: str, |
| 612 | + new_relation: str, comment: str): |
| 613 | + """Update the relationship for a specific release of a project |
| 614 | +
|
| 615 | + API endpoint PATCH /projects/{pid}/release{rid} |
| 616 | +
|
| 617 | + :param project_id: the id of the exisiting project |
| 618 | + :type project_id: string |
| 619 | + :param release_id: the id of the release to be requested |
| 620 | + :type release_id: string |
| 621 | + :param new_state: the new mainline state of the release, one of |
| 622 | + (OPEN, MAINLINE, SPECIFIC, PHASEOUT, DENIED) |
| 623 | + :type new_state: string |
| 624 | + :param new_relation: the new relation of the release, one of |
| 625 | + (CONTAINED, REFERRED, UNKNOWN, DYNAMICALLY_LINKED, STATICALLY_LINKED, SIDE_BY_SIDE, STANDALONE, |
| 626 | + INTERNAL_USE, OPTIONAL, TO_BE_REPLACED, CODE_SNIPPET) |
| 627 | + :type new_relation: string |
| 628 | + :param comment: a comment |
| 629 | + :type comment: string |
| 630 | + """ |
| 631 | + if not project_id: |
| 632 | + raise SW360Error(message="No project id provided!") |
| 633 | + |
| 634 | + if not release_id: |
| 635 | + raise SW360Error(message="No release id provided!") |
| 636 | + |
| 637 | + relation = {} |
| 638 | + relation["releaseRelation"] = new_relation |
| 639 | + relation["mainlineState"] = new_state |
| 640 | + relation["comment"] = comment |
| 641 | + |
| 642 | + url = self.url + "resource/api/projects/" + project_id + "/release/" + release_id |
| 643 | + response = requests.patch(url, json=relation, headers=self.api_headers) |
| 644 | + |
| 645 | + if response.ok: |
| 646 | + return response.json() |
| 647 | + |
| 648 | + raise SW360Error(response, url) |
| 649 | + |
611 | 650 | # ----- Releases --------------------------------------------------------- |
612 | 651 |
|
613 | 652 | def get_release(self, release_id): |
|
0 commit comments