Skip to content

Commit

Permalink
Bitbucket Cloud: Fixes for repository deployment environments. (#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
djgoku authored Jun 28, 2023
1 parent 1ef624a commit 6180955
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,25 @@ def __get_object(self, data):
**self._new_session_args,
)

def each(self, q=None, sort=None):
def each(self):
"""
Returns the list of environments in this repository.
:param q: string: Query string to narrow down the response.
See https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering for details.
:param sort: string: Name of a response property to sort results.
See https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering for details.
:return: A generator for the DeploymentEnvironment objects
:return: A list of the DeploymentEnvironment objects
API docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/environments/#get
"""
params = {}
if sort is not None:
params["sort"] = sort
if q is not None:
params["q"] = q
for deployment_environment in self._get_paged(
None,
params=params,
):
yield self.__get_object(deployment_environment)

return
# workaround for this issue
# https://jira.atlassian.com/browse/BCLOUD-20796
response = super(BitbucketCloudBase, self).get(None)

deployment_environments = []

for value in response.get("values", []):
deployment_environments.append(self.__get_object(value))

return deployment_environments

def get(self, uuid):
"""
Expand Down

0 comments on commit 6180955

Please sign in to comment.