Skip to content

Commit

Permalink
feat: added support to handle empty object names
Browse files Browse the repository at this point in the history
  • Loading branch information
anaik91 committed Feb 13, 2025
1 parent 3bee1fa commit 5e78b9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def get_org_object(self, org_object, org_object_name):
Returns:
dict: A dictionary containing the object details.
"""
if len(org_object_name) == 0:
return { 'name': 'EMPTY_OBJECT_NAME'}
if org_object == "resourcefiles":
resource_type = org_object_name["type"]
name = org_object_name["name"]
Expand Down Expand Up @@ -185,6 +187,8 @@ def get_env_object(self, env, env_object, env_object_name):
Returns:
dict: A dictionary containing the object details.
"""
if len(env_object_name) == 0:
return { 'name': 'EMPTY_OBJECT_NAME'}
if env_object == "resourcefiles":
resource_type = env_object_name["type"]
name = env_object_name["name"]
Expand Down
4 changes: 4 additions & 0 deletions nextgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ def get_org_object(self, org_object, org_object_name):
Returns:
dict: A dictionary containing the object details.
"""
if len(org_object_name) == 0:
return { 'name': 'EMPTY_OBJECT_NAME'}
if org_object == "resourcefiles":
return {}
org_object_name = urlencode(org_object_name)
Expand Down Expand Up @@ -204,6 +206,8 @@ def get_env_object(self, env, env_object, env_object_name):
Returns:
dict: The environment object details.
"""
if len(env_object_name) == 0:
return { 'name': 'EMPTY_OBJECT_NAME'}
if env_object == 'resourcefiles':
url = f"{self.baseurl}/organizations/{self.project_id}/environments/{env}/{env_object}/{env_object_name['type']}/{env_object_name['name']}" # noqa pylint: disable=C0301
env_object = self.client.get(url)
Expand Down

0 comments on commit 5e78b9b

Please sign in to comment.