Skip to content

Commit 816bd48

Browse files
committed
Add list_resources method for charmhub module
1 parent bd01785 commit 816bd48

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

juju/charmhub.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ async def is_subordinate(self, charm_name):
4141
# TODO (caner) : we should be able to recreate the channel-map through the
4242
# api call without needing the CharmHub facade
4343

44+
async def list_resources(self, charm_name):
45+
conn, headers, path_prefix = self.model.connection().https_connection()
46+
47+
model_conf = await self.model.get_config()
48+
charmhub_url = model_conf['charmhub-url']
49+
url = "{}/v2/charms/info/{}?fields=default-release.resources".format(charmhub_url.value, charm_name)
50+
_response = self.request_charmhub_with_retry(url, 5)
51+
response = json.loads(_response.text)
52+
return response['default-release']['resources']
53+
4454
async def info(self, name, channel=None):
4555
"""info displays detailed information about a CharmHub charm. The charm
4656
can be specified by the exact name.

0 commit comments

Comments
 (0)