def GKEEnumerate(args: 'argparse.Namespace') -> None:
  """Enumerate GKE cluster objects.

  Args:
    args (argparse.Namespace): Arguments from ArgumentParser.

  Raises:
    AttributeError: If a namespace is not provided or multiple enumerations
      are provided.
    ResourceNotFoundError: If a workload, node or service is not found.
  """
  AssignProjectID(args)

  cluster = gke.GkeCluster(args.project, args.location, args.cluster)

  enumerations = []  # type: List[k8s_enumerations.base.Enumeration[Any]]

  if args.workload:
    if not args.namespace:
      raise AttributeError(
          'Namespace must be provided for workload enumeration.')
    workload = cluster.FindWorkload(args.workload, args.namespace)
    if not workload:
      raise errors.ResourceNotFoundError('Workload not found.', __name__)
    enumerations.append(k8s_enumerations.base.WorkloadEnumeration(workload))

  if args.node:
    node = cluster.FindNode(args.node)
    if not node:
      raise errors.ResourceNotFoundError('Node not found.', __name__)
    enumerations.append(k8s_enumerations.base.NodeEnumeration(node))

  if args.service:
    if not args.namespace:
      raise AttributeError(
          'Namespace must be provided for service enumeration.')
    service = cluster.FindService(args.service, args.namespace)
    if not service:
      raise errors.ResourceNotFoundError('Service not found.', __name__)
    enumerations.append(k8s_enumerations.base.ServiceEnumeration(service))

  if len(enumerations) == 1:
    enumeration = enumerations[0]
  elif len(enumerations) == 0:
    enumeration = k8s_enumerations.gcp.GkeClusterEnumeration(cluster)
  else:
    raise AttributeError('At most one enumeration point can be specified.')

  if args.as_json:
    json.dump(
        enumeration.ToJson(namespace=args.namespace), sys.stdout, indent=2)
  else:
    enumeration.Enumerate(namespace=args.namespace)
Enumerate GKE cluster objects.

Args:
args (argparse.Namespace): Arguments from ArgumentParser.

Raises:
AttributeError: If a namespace is not provided or multiple enumerations
are provided.
ResourceNotFoundError: If a workload, node or service is not found.
tools/gcp_cli.py