Interface CLI de groupes

Notes

  • L’interface CLI des groupes requiert Databricks CLI 0.8.0 ou version ultérieure.
  • Vous devez être administrateur Databricks pour appeler cette API.

Vous exécutez les sous-commandes de l’interface CLI des groupes Databricks en les ajoutant à databricks groups .

databricks groups --help
Usage: databricks groups [OPTIONS] COMMAND [ARGS]...

  Provide utility to interact with Databricks groups.

Options:
  -v, --version   0.8.0
  --debug         Debug Mode. Shows full stack trace on error.
  --profile TEXT  CLI connection profile to use. The default profile is "DEFAULT".
  -h, --help      Show this message and exit.

Commands:
  add-member     Add an existing principal to another existing group.
    Options:
      --parent-name TEXT  Name of the parent group to which the new member will be
                          added. This field is required.  [required]
      --user-name TEXT    The user name which will be added to the parent group.
      --group-name TEXT   If group name which will be added to the parent group.
  create         Create a new group with the given name.
    Options:
      --group-name TEXT  [required]
  delete         Remove a group from this organization.
    Options:
      --group-name TEXT  [required]
  list           Return all of the groups in a workspace.
  list-members   Return all of the members of a particular group.
    Options:
      --group-name TEXT  [required]
  list-parents   Retrieve all groups in which a given user or group is a member.
    Options:
      --user-name TEXT
      --group-name TEXT
  remove-member  Removes a user or group from a group.
    Options:
      --parent-name TEXT  Name of the parent group to which the new member will be
                          removed. This field is required.  [required]
      --user-name TEXT    The user name which will be removed from the parent
                          group.
      --group-name TEXT   If group name which will be removed from the parent
                          group.

Ajouter un membre à un groupe

Pour afficher la documentation sur l’utilisation, exécutez databricks groups add-member --help .

databricks groups add-member \
--parent-name sql-users \
--user-name someone@example.com
databricks groups add-member \
--parent-name sql-power-users \
--group-name sql-users

En cas de réussite, aucune sortie ne s’affiche.

Créer un groupe

Pour afficher la documentation sur l’utilisation, exécutez databricks groups create --help .

databricks groups create --group-name sql-users
{
  "group_name": "sql-users"
}

Supprimer un groupe

Pour afficher la documentation sur l’utilisation, exécutez databricks groups delete --help .

databricks groups delete --group-name sql-users
{}

Répertorier les groupes disponibles

Pour afficher la documentation sur l’utilisation, exécutez databricks groups list --help .

databricks groups list
{
  "group_names": [
    "sql-users",
    "sql-power-users",
    "sql-admins"
  ]
}

Répertorier les membres d’un groupe

Pour afficher la documentation sur l’utilisation, exécutez databricks groups list-members --help .

databricks groups list-members --group-name sql-users
{
  "members": [
    {
      "user_name": "someone@example.com"
    }
  ]
}
databricks groups list-members --group-name sql-power-users
{
  "members": [
    {
      "group_name": "sql-users"
    }
  ]
}

Répertorier les groupes auxquels appartient un utilisateur ou un groupe

Pour afficher la documentation sur l’utilisation, exécutez databricks groups list-parents --help .

databricks groups list-parents --user-name someone@example.com
{
  "group_names": [
    "sql-users"
  ]
}
databricks groups list-parents --group-name sql-users
{
  "group_names": [
    "sql-power-users"
  ]
}

Supprimer un membre d'un groupe

Pour afficher la documentation sur l’utilisation, exécutez databricks groups remove-member --help .

databricks groups remove-member \
--parent-name sql-power-users \
--group-name sql-users
databricks groups remove-member \
--parent-name sql-users \
--user-name someone@example.com

En cas de réussite, aucune sortie ne s’affiche.