def ListVersions(client, messages, pkg, version_view):
  """Lists all versions under a package."""
  list_vers_req = messages.ArtifactregistryProjectsLocationsRepositoriesPackagesVersionsListRequest(
      parent=pkg, view=version_view)
  list_vers_res = client.projects_locations_repositories_packages_versions.List(
      list_vers_req)
  return list_vers_res.versions