Skip to content

Commit

Permalink
Add arlas_cli login documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliGautier committed Nov 18, 2024
1 parent 0a6cbe9 commit 05b33b5
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 102 deletions.
2 changes: 1 addition & 1 deletion arlas/cli/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
121 changes: 24 additions & 97 deletions docs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -103,51 +100,16 @@ First, set the environment variables provided by Gisaïa and change appropriatel
export ELASTIC_PWD=<SET_THIS_VALUE>
```

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"
```
Expand All @@ -159,53 +121,18 @@ First, set the environment variables provided by Gisaïa and change appropriatel
$env:ELASTIC_PWD = "<SET_THIS_VALUE>"
```

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
Expand All @@ -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
```
22 changes: 20 additions & 2 deletions docs/docs/confs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<!-- termynal -->
```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

Expand Down
22 changes: 20 additions & 2 deletions docs/docs/confs.md.template
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<!-- termynal -->
```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

Expand Down
1 change: 1 addition & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 05b33b5

Please sign in to comment.