From 05b33b596d8b6fa9081eaadf8259082f0d570a30 Mon Sep 17 00:00:00 2001 From: Willi Date: Mon, 18 Nov 2024 12:18:27 +0100 Subject: [PATCH] Add arlas_cli login documentation --- arlas/cli/configurations.py | 2 +- docs/docs/configuration.md | 121 +++++++----------------------------- docs/docs/confs.md | 22 ++++++- docs/docs/confs.md.template | 22 ++++++- docs/docs/index.md | 1 + 5 files changed, 66 insertions(+), 102 deletions(-) diff --git a/arlas/cli/configurations.py b/arlas/cli/configurations.py index ab5ab2c..64f3245 100644 --- a/arlas/cli/configurations.py +++ b/arlas/cli/configurations.py @@ -78,7 +78,7 @@ def create_configuration( @configurations.command(help="Add a configuration for ARLAS Cloud", name="login") def login( - auth_login: str = typer.Argument(help="login"), + auth_login: str = typer.Argument(help="ARLAS login"), elastic_login: str = typer.Argument(help="Elasticsearch login"), elastic: str = typer.Argument(help="Elasticsearch url"), auth_org: str = typer.Option(default=None, help="ARLAS IAM Organization, default is your email domain name"), diff --git a/docs/docs/configuration.md b/docs/docs/configuration.md index 3f6d74a..defd451 100644 --- a/docs/docs/configuration.md +++ b/docs/docs/configuration.md @@ -86,10 +86,7 @@ All the arlas_cli commands can then be run on this configuration file, for examp ## ARLAS Cloud configuration -If you have an ARLAS cloud account, you can configure `cloud.arlas.io` and `cloud.arlas.io-admin` configurations to access your space with `arlas_cli`. - -!!! note - You can name your configuration as you want, but it is advised to create an "admin" configuration which is the only one to have the right to delete data. +If you have an ARLAS cloud account, you can directly create the configurations to access your space with `arlas_cli login`. First, set the environment variables provided by Gisaïa and change appropriately `SET_THIS_VALUE` with your own ARLAS user login/password: @@ -103,51 +100,16 @@ First, set the environment variables provided by Gisaïa and change appropriatel export ELASTIC_PWD= ``` - Then run the command `arlas_cli confs create` with all the parameters to create the `cloud.arlas.io` and `cloud.arlas.io-admin` configurations: - - === "cloud.arlas.io" - ```shell - arlas_cli confs \ - create cloud.arlas.io \ - --server "https://cloud.arlas.io/arlas/server" \ - --headers "arlas-org-filter:${MY_ORGANIZATION}" \ - --headers "Content-Type:application/json" \ - --auth-token-url https://cloud.arlas.io/arlas/iam/session \ - --auth-login "${ARLAS_USER}" \ - --auth-password "${ARLAS_PWD}" \ - --auth-headers "Content-Type:application/json;charset=utf-8" \ - --auth-org "${MY_ORGANIZATION}" \ - --elastic "${ELASTIC_ENDPOINT}" \ - --elastic-headers "Content-Type:application/json" \ - --elastic-login "${ELASTIC_USER}" \ - --elastic-password "${ELASTIC_PWD}" \ - --persistence "https://cloud.arlas.io/arlas/persistence" \ - --persistence-headers "Content-Type:application/json" \ - --auth-arlas-iam \ - --no-allow-delete - ``` - - === "cloud.arlas.io-admin" - ```shell - arlas_cli confs \ - create cloud.arlas.io \ - --server "https://cloud.arlas.io/arlas/server" \ - --headers "arlas-org-filter:${MY_ORGANIZATION}" \ - --headers "Content-Type:application/json" \ - --auth-token-url https://cloud.arlas.io/arlas/iam/session \ - --auth-login "${ARLAS_USER}" \ - --auth-password "${ARLAS_PWD}" \ - --auth-headers "Content-Type:application/json;charset=utf-8" \ - --auth-org "${MY_ORGANIZATION}" \ - --elastic "${ELASTIC_ENDPOINT}" \ - --elastic-headers "Content-Type:application/json" \ - --elastic-login "${ELASTIC_USER}" \ - --elastic-password "${ELASTIC_PWD}" \ - --persistence "https://cloud.arlas.io/arlas/persistence" \ - --persistence-headers "Content-Type:application/json" \ - --auth-arlas-iam \ - --allow-delete - ``` + Then run the command `arlas_cli confs create` with all the parameters to create the `cloud.arlas.io.{USER_NAME}` configuration: + + ```shell + arlas_cli confs \ + login ${ARLAS_USER} ${ELASTIC_USER} ${ELASTIC_ENDPOINT} \ + --auth-password "${ARLAS_PWD}" \ + --auth-org "${MY_ORGANIZATION}" \ + --elastic-password "${ELASTIC_PWD}" \ + --allow-delete + ``` === "Windows PowerShell" ``` @@ -159,53 +121,18 @@ First, set the environment variables provided by Gisaïa and change appropriatel $env:ELASTIC_PWD = "" ``` - Then run the command `arlas_cli confs create` with all the parameters to create the `cloud.arlas.io` and `cloud.arlas.io-admin` configurations: - - === "cloud.arlas.io" - ```shell - arlas_cli confs ` - create cloud.arlas.io ` - --server "https://cloud.arlas.io/arlas/server" ` - --headers "arlas-org-filter:$env:MY_ORGANIZATION" ` - --headers "Content-Type:application/json" ` - --auth-token-url https://cloud.arlas.io/arlas/iam/session ` - --auth-login "$env:ARLAS_USER" ` - --auth-password "$env:ARLAS_PWD" ` - --auth-headers "Content-Type:application/json;charset=utf-8" ` - --auth-org "$env:MY_ORGANIZATION" ` - --elastic "$env:ELASTIC_ENDPOINT" ` - --elastic-headers "Content-Type:application/json" ` - --elastic-login "$env:ELASTIC_USER" ` - --elastic-password "$env:ELASTIC_PWD" ` - --persistence "https://cloud.arlas.io/arlas/persistence" ` - --persistence-headers "Content-Type:application/json" ` - --auth-arlas-iam ` - --no-allow-delete - ``` - - === "cloud.arlas.io-admin" - ```shell - arlas_cli confs ` - create cloud.arlas.io ` - --server "https://cloud.arlas.io/arlas/server" ` - --headers "arlas-org-filter:$env:MY_ORGANIZATION" ` - --headers "Content-Type:application/json" ` - --auth-token-url https://cloud.arlas.io/arlas/iam/session ` - --auth-login "$env:ARLAS_USER" ` - --auth-password "$env:ARLAS_PWD" ` - --auth-headers "Content-Type:application/json;charset=utf-8" ` - --auth-org "$env:MY_ORGANIZATION" ` - --elastic "$env:ELASTIC_ENDPOINT" ` - --elastic-headers "Content-Type:application/json" ` - --elastic-login "$env:ELASTIC_USER" ` - --elastic-password "$env:ELASTIC_PWD" ` - --persistence "https://cloud.arlas.io/arlas/persistence" ` - --persistence-headers "Content-Type:application/json" ` - --auth-arlas-iam ` - --allow-delete - ``` - -Check that the configurations exist: + Then run the command `arlas_cli confs create` with all the parameters to create the `cloud.arlas.io.{USER_NAME}` configuration: + + ```shell + arlas_cli confs ` + login $env:ARLAS_USER $env:ELASTIC_USER $env:ELASTIC_ENDPOINT ` + --auth-password "$env:ARLAS_PWD" ` + --auth-org "$env:MY_ORGANIZATION" ` + --elastic-password "$env:ELASTIC_PWD" ` + --allow-delete + ``` + +Check that the configuration exist: ```shell arlas_cli confs list @@ -214,5 +141,5 @@ arlas_cli confs list You can now, for example, list the available collections: ```shell -arlas_cli collections --config cloud.arlas.io list +arlas_cli collections list ``` \ No newline at end of file diff --git a/docs/docs/confs.md b/docs/docs/confs.md index 40dced3..75189c1 100644 --- a/docs/docs/confs.md +++ b/docs/docs/confs.md @@ -167,9 +167,27 @@ This is to prevent accidental data loss. !!! warning "--allow-delete" In order to allow to delete on a configuration, use the `--allow-delete` option. -### ARLAS Cloud +## login -If you want to connect `arlas_cli` to an existing ARLAS Cloud account, follow the [ARLAS Cloud configuration guide](configuration.md#arlas-cloud-configuration). +### Create configuration for ARLAS Cloud + +The `confs longin` allows to create a configuration linked to an ARLAS Cloud account: + + +```shell +> !!!execute arlas_cli confs login --help +``` + +Only your own ES and ARLAS credentials have to be set, the configuration is directly linked to the ARLAS Cloud instance. + +It creates a configuration based on your username (extracted from your ARLAS login) : `cloud.arlas.io.{USER_NAME}` + +!!! note + This created configuration is used as default. + + You no longer need to declare the `--config` in the arlas_cli commands + +See the [ARLAS Cloud configuration guide](configuration.md#arlas-cloud-configuration). ## delete diff --git a/docs/docs/confs.md.template b/docs/docs/confs.md.template index c91b54b..1b0957f 100644 --- a/docs/docs/confs.md.template +++ b/docs/docs/confs.md.template @@ -96,9 +96,27 @@ This is to prevent accidental data loss. !!! warning "--allow-delete" In order to allow to delete on a configuration, use the `--allow-delete` option. -### ARLAS Cloud +## login -If you want to connect `arlas_cli` to an existing ARLAS Cloud account, follow the [ARLAS Cloud configuration guide](configuration.md#arlas-cloud-configuration). +### Create configuration for ARLAS Cloud + +The `confs longin` allows to create a configuration linked to an ARLAS Cloud account: + + +```shell +> !!!execute arlas_cli confs login --help +``` + +Only your own ES and ARLAS credentials have to be set, the configuration is directly linked to the ARLAS Cloud instance. + +It creates a configuration based on your username (extracted from your ARLAS login) : `cloud.arlas.io.{USER_NAME}` + +!!! note + This created configuration is used as default. + + You no longer need to declare the `--config` in the arlas_cli commands + +See the [ARLAS Cloud configuration guide](configuration.md#arlas-cloud-configuration). ## delete diff --git a/docs/docs/index.md b/docs/docs/index.md index d8861ad..b7afe3f 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -22,6 +22,7 @@ __ARLAS Command Line__ (`arlas_cli`) is a tool to manage data and configurations - Delete a collection - Managing [arlas_cli configurations](concepts.md#configuration) - Register an ARLAS/Elasticsearch configuration, with headers and authentication parameters + - Login to your ARLAS Cloud account - List your configurations - Delete a configuration - Managing [ARLAS Dashboards](concepts.md#arlas-dashboards) persistence