def get_all_service_attributes(cluster_name, service_name):
"""
Get all information for a service
:param cluster_name: str. name of the cluster that the service is in
:param service_name: str. name of service to look up
:return: json
"""
service = {"service_name": service_name,
"cluster_name": cluster_name,
"tasks": []}
try:
for task in ecs_api.get_task_ids_from_service(service_name, cluster_name):
try:
task_json = get_all_container_attributes_by_task_id(task, json=False)
service['tasks'].append(task_json)
except NotFound as e:
logger.warn('ECS API told us about task {} but unable to find in our database'.
format(task))
return jsonify(service)
except:
abort(404, 'ECS service not found')
评论列表
文章目录