-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Panos Vagenas <[email protected]>
- Loading branch information
Showing
7 changed files
with
81 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,31 +6,26 @@ After registering with [Deep Search](https://ds4sd.github.io/), you can obtain y | |
|
||
|
||
--- | ||
### Configure a profile | ||
### Set up a profile | ||
|
||
=== "CLI" | ||
Configure a profile using [`deepsearch profile config`](../cli-reference.md#profile). | ||
Set up a [profile][profiles] using `deepsearch profile config`. | ||
In its basic form it looks like this: | ||
<div class="termy"> | ||
|
||
```console | ||
$ deepsearch profile config | ||
|
||
Host: # (1) | ||
Username: # (2) | ||
Api key: # (3) | ||
Host: https://ds.example.com # the Deep Search instance you are using | ||
Username: [email protected] # your username | ||
Api key: (hidden) # your API key | ||
``` | ||
|
||
</div> | ||
|
||
1. Input the Deep Search deployment host to use. | ||
2. Enter your `User name`. | ||
3. Enter your `API key`. | ||
|
||
By providing a profile name (via option `--profile-name`) you can configure multiple | ||
different profiles, which you can then easily switch between and manage. | ||
|
||
For details, check [Profiles](../guide/configuration.md#profiles). | ||
For details, check [Profiles][profiles]. | ||
|
||
### Validate the setup | ||
|
||
|
@@ -89,3 +84,6 @@ Here, we show a simple way to convert documents using [Deep Search](https://ds4s | |
``` | ||
|
||
--- | ||
|
||
|
||
[profiles]: ../guide/configuration.md#profiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ Besides *global* settings, the Toolkit also allows the configuration of multiple | |
|
||
## Profiles | ||
|
||
The Toolkit provides the capability of easily interacting with different Deep Search | ||
instances through the use of *profiles*. A user may define multiple profiles, identified | ||
by profile name, and can easily switch between them. | ||
|
||
### Overview | ||
|
||
For an overview of the profile management commands check `deepsearch profile --help`: | ||
|
@@ -32,8 +36,8 @@ $ deepsearch profile --help | |
|
||
### Profile setup | ||
|
||
To setup a profile use [`deepsearch profile config`](../cli-reference.md#profile), | ||
providing options as needed (for a full reference run with `--help`). | ||
To set up a profile use `deepsearch profile config`, providing options as needed (for a | ||
full reference check `deepsearch profile config --help`). | ||
|
||
Here is a basic invocation example: | ||
|
||
|
@@ -44,59 +48,60 @@ Username: [email protected] | |
Api key: | ||
``` | ||
|
||
> NOTE: If you had used the meanwhile deprecated `deepsearch login` command to set up a | ||
config file in the default location, that will automatically be migrated to a profile. | ||
> NOTE: If you used the meanwhile deprecated `deepsearch login` command to set up a config | ||
file in the default location, that will automatically be migrated to a profile. | ||
|
||
### Usage | ||
|
||
Here some usage examples: | ||
|
||
=== "CLI" | ||
|
||
```console | ||
$ # configure a profile | ||
$ deepsearch profile config --profile-name foo --host ds-1.example.com ... | ||
$ # -> "foo" now available and selected as the active profile | ||
$ | ||
$ deepsearch cps projects list | ||
$ # -> outputs projects corresponding to "foo" | ||
$ | ||
$ # configure another profile | ||
$ deepsearch profile config --profile-name bar --host ds-2.example.com ... | ||
$ # -> "bar" now available and selected as the active profile | ||
$ | ||
$ deepsearch profile list | ||
$ # -> displays all profiles, with "bar" marked as the active one | ||
$ | ||
$ deepsearch cps projects list | ||
$ # -> outputs projects corresponding to "bar" | ||
$ | ||
$ # switch to previous profile | ||
$ deepsearch profile use foo | ||
$ # -> "foo" now selected as the active profile | ||
$ | ||
$ deepsearch cps projects list | ||
$ # -> outputs projects corresponding to "foo" | ||
``` | ||
|
||
=== "Python" | ||
|
||
```python | ||
from deepsearch.cps.client.api import CpsApi | ||
|
||
# using the active profile; let's assume that is "foo" | ||
api = CpsApi.from_env() | ||
print([p.name for p in api.projects.list()]) | ||
# -> outputs projects corresponding to "foo" | ||
|
||
# using a profile by name | ||
api = CpsApi.from_env(profile_name="bar") | ||
print([p.name for p in api.projects.list()]) | ||
# -> outputs projects corresponding to "bar" | ||
``` | ||
|
||
--- | ||
#### Usage in CLI | ||
|
||
```console | ||
$ # configure a profile | ||
$ deepsearch profile config --profile-name foo --host ds-1.example.com ... | ||
$ # -> "foo" now available and selected as the active profile | ||
$ | ||
$ deepsearch cps projects list | ||
$ # -> outputs projects corresponding to "foo" | ||
$ | ||
$ # configure another profile | ||
$ deepsearch profile config --profile-name bar --host ds-2.example.com ... | ||
$ # -> "bar" now available and selected as the active profile | ||
$ | ||
$ deepsearch profile list | ||
$ # -> displays all profiles, with "bar" marked as the active one | ||
$ | ||
$ deepsearch cps projects list | ||
$ # -> outputs projects corresponding to "bar" | ||
$ | ||
$ # switch to previous profile | ||
$ deepsearch profile use foo | ||
$ # -> "foo" now selected as the active profile | ||
$ | ||
$ deepsearch cps projects list | ||
$ # -> outputs projects corresponding to "foo" | ||
``` | ||
|
||
#### Usage in Python | ||
|
||
To use the active profile (recommended usage pattern): | ||
```python | ||
from deepsearch.cps.client.api import CpsApi | ||
|
||
api = CpsApi.from_env() | ||
|
||
print([p.name for p in api.projects.list()]) | ||
# -> outputs projects corresponding to active profile | ||
``` | ||
|
||
To use a specific profile: | ||
```python | ||
from deepsearch.cps.client.api import CpsApi | ||
|
||
api = CpsApi.from_env(profile_name="foo") | ||
|
||
print([p.name for p in api.projects.list()]) | ||
# -> outputs projects corresponding to "foo" | ||
``` | ||
|
||
## Environment variables | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters