Skip to content

Commit

Permalink
Merge pull request #44 from uc-cdis/feat/add-merge-option-to-update-r…
Browse files Browse the repository at this point in the history
…esource

(PXP-9480): Support merge param for update_resource
  • Loading branch information
johnfrancismccann authored Feb 15, 2022
2 parents 43153fc + f07a119 commit 1897064
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gen3authz"
version = "1.4.2"
version = "1.5.0"
description = "Gen3 authz client"
authors = ["CTDS UChicago <cdis@uchicago.edu>"]
license = "Apache-2.0"
Expand Down
12 changes: 10 additions & 2 deletions python/src/gen3authz/client/arborist/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,18 @@ async def get_resource(self, path):
return response.json

@maybe_sync
async def update_resource(self, path, resource_json, create_parents=False):
async def update_resource(
self, path, resource_json, create_parents=False, merge=False
):
url = self._resource_url + quote(path)
parameters = []
if create_parents:
url = url + "?p"
parameters.append("p")
if merge:
parameters.append("merge")
if parameters:
url = url + "?" + "&".join(parameters)

response = await self.put(url, json=resource_json)
if not response.successful:
msg = "could not update resource `{}` in arborist: {}".format(
Expand Down

0 comments on commit 1897064

Please sign in to comment.