Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
List catalogs & Delete catalog

See merge request cpes/european-projects/enershare/tsg-client!62
  • Loading branch information
carolinacatorze committed May 16, 2024
1 parent f92164d commit 0217393
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tsg_client/controllers/TSGController.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,3 +560,36 @@ def delete_administrative_user(self, id):
return f"Administrative User with ID {id} deleted with success"
elif rsp.status_code == 400:
return f"Error: Administrative User with ID {id} not found."

def get_catalog(self):
"""
Get catalogs from the connector.
"""

rsp = self.controller.get(
endpoint=self.endpoints.RESOURCES, expected_status_code=200
)
catalogs_artifacts = []

try:
rsp_json = rsp.json()

for catalogs_artifacts in rsp_json:
catalogs_artifacts.append({'@type': catalogs_artifacts['@type'], '@id': catalogs_artifacts['@id']})

except ValueError as ve:
logger.exception(f"Error creating SelfDescription: {ve}")

return catalogs_artifacts

def delete_catalog(self, catalog_id):
"""
Delete catalog from the connector.
"""

endpoint = f"{self.endpoints.RESOURCES}/{catalog_id}"

self.controller.delete(
endpoint=endpoint, expected_status_code=200
)

0 comments on commit 0217393

Please sign in to comment.