def list_instances(self, project_id, service_id, version_id):
"""Lists instances of a given service and version.
Args:
project_id (str): The id of the project.
service_id (str): The id of the service to query.
version_id (str): The id of the version to query.
Returns:
list: A list of Instance resource dicts for a given Version.
"""
try:
paged_results = self.repository.version_instances.list(
project_id, services_id=service_id, versions_id=version_id)
return api_helpers.flatten_list_results(paged_results, 'instances')
except (errors.HttpError, HttpLib2Error) as e:
if isinstance(e, errors.HttpError) and e.resp.status == 404:
return []
raise api_errors.ApiExecutionError(project_id, e)
评论列表
文章目录