def find_application_resource()

in marketplace/deployer_util/resources.py [0:0]


def find_application_resource(resources):
  """Finds the Application resource from a list of resource manifests."""
  apps = [
      r for r in resources if r["kind"] == "Application" and
      r["apiVersion"].startswith('app.k8s.io/')
  ]
  if len(apps) == 0:
    raise Exception("Set of resources does not include an Application")
  if len(apps) > 1:
    raise Exception("Set of resources includes multiple Applications")
  return apps[0]