aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralextarazanov <alextarazanov@yandex-team.com>2022-11-01 11:09:35 +0300
committeralextarazanov <alextarazanov@yandex-team.com>2022-11-01 11:09:35 +0300
commit1da614bd236ace1d9cd22b47a6cdba1ce5f7fcd3 (patch)
tree5fd61600af5dd8921ef64a5bccc7a7de32e5be06
parent297bbcf21769ea69237a7f4eb5c7b5d61202f583 (diff)
downloadydb-1da614bd236ace1d9cd22b47a6cdba1ce5f7fcd3.tar.gz
[review] [YDB] Check translate ydb cli profile update/replace
-rw-r--r--ydb/docs/en/core/reference/ydb-cli/_includes/auth/options_cloud.md7
-rw-r--r--ydb/docs/en/core/reference/ydb-cli/profile/_includes/create.md151
-rw-r--r--ydb/docs/en/core/reference/ydb-cli/profile/_includes/use.md21
-rw-r--r--ydb/docs/en/core/reference/ydb-cli/profile/toc_i.yaml4
-rw-r--r--ydb/docs/ru/core/reference/ydb-cli/profile/_includes/use.md2
-rw-r--r--ydb/docs/ru/core/reference/ydb-cli/profile/toc_i.yaml3
6 files changed, 144 insertions, 44 deletions
diff --git a/ydb/docs/en/core/reference/ydb-cli/_includes/auth/options_cloud.md b/ydb/docs/en/core/reference/ydb-cli/_includes/auth/options_cloud.md
index 837fdae7786..08b99644806 100644
--- a/ydb/docs/en/core/reference/ydb-cli/_includes/auth/options_cloud.md
+++ b/ydb/docs/en/core/reference/ydb-cli/_includes/auth/options_cloud.md
@@ -1,5 +1,4 @@
-- `--iam-token-file <filepath>` : The **Access Token** authentication mode is used based on the contents of the file specified in this option value.
-- `--yc-token-file <filepath>` : The **Refresh Token** authentication mode is used based on the contents of the file specified in this option value.
+- `--token-file <filepath>`: Enables the **Access Token** authentication mode using the contents of the file specified in this option
+- `--yc-token-file <filepath>`: Enables the **Refresh Token** authentication mode using the contents of the file specified in this option
- `--use-metadata-credentials` : The **Metadata** authentication mode is used.
-- `--sa-key-file <filepath>` : The **Service Account Key** authentication mode is used with the key and other parameters taken from the JSON file specified in this option value.
-
+- `--sa-key-file <filepath>`: Enables the **Service Account Key** authentication mode, where the key and other parameters are taken from the JSON file specified in this option \ No newline at end of file
diff --git a/ydb/docs/en/core/reference/ydb-cli/profile/_includes/create.md b/ydb/docs/en/core/reference/ydb-cli/profile/_includes/create.md
index bb17c67e05e..bb546c0b608 100644
--- a/ydb/docs/en/core/reference/ydb-cli/profile/_includes/create.md
+++ b/ydb/docs/en/core/reference/ydb-cli/profile/_includes/create.md
@@ -1,6 +1,106 @@
# Creating and updating profiles
-Currently you can only create and update profiles interactively using the following commands:
+You can set connection parameter values for the profile being created or updated through the [command line](#cmdline) or request them [in interactive mode](#interactive) in the console.
+
+## Command line {#cmdline}
+
+To create or update a profile, the command line uses the `profile create`, `profile update`, and `profile replace` commands.
+
+They only use the values entered directly on the command line without accessing environment variables or the activated profile.
+
+### Profile create {#create}
+
+`Profile create` creates a new profile with the specified parameter values:
+
+```bash
+{{ ydb-cli }} config profile create <profile_name> <connection_options>
+```
+
+Where:
+- `<profile_name>` is the required profile name.
+- `<connection options>` are [connection parameters](../../connect.md#command-line-pars) to be written to the profile. You need to specify at least one connection parameter; otherwise the command will run [in interactive mode](#interactive).
+
+If a profile with the specified name exists, the command will return an error.
+
+### Profile replace {#replace}
+
+`Profile replace` creates or replaces a profile with the specified parameter values:
+
+```bash
+{{ ydb-cli }} config profile replace <profile_name> [connection_options]
+```
+
+Where:
+- `<profile_name>` is the required profile name.
+- `<connection options>` are optional [connection parameters](../../connect.md#command-line-pars) to be written to the profile.
+
+If a profile with the specified name already exists, it will be overwritten with a new one with the passed-in parameters. If you specify no connection parameters, the profile will be empty once the command completes.
+
+### Profile update {#update}
+
+`Profile update` modifies the properties of an existing profile:
+
+```bash
+{{ ydb-cli }} config profile update <profile_name> [connection_options] [reset-options]
+```
+
+Where:
+- `<profile_name>` is the required profile name.
+- `<connection options>` are optional [connection parameters](../../connect.md#command-line-pars) to be written to the profile.
+- `<reset options>` are optional settings for deleting parameters from an existing profile. Possible values:
+
+ `--no-endpoint`: Delete an endpoint from the profile
+ `--no-database`: Delete the database path from the profile
+ `--no-auth`: Delete authentication information from the profile
+ `--no-iam-endpoint`: Delete the IAM server URL
+
+The profile will update with the parameters entered on the command line. Any properties not listed on the command line will remain unchanged.
+
+### Examples {#create-cmdline-examples}
+
+#### Creating a profile from previous connection settings {#cmdline-example-from-explicit}
+
+Any command with explicit connection settings performing a YDB database transaction can be converted to a profile create command by moving connection properties from global options to options specific to the `config profile create` command.
+
+For instance, if you successfully ran the `scheme Is` command with the following properties:
+
+```bash
+{{ydb-cli}} \
+ -e grpcs://example.com:2135 -d /Root/somedatabase --sa-key-file ~/sa_key.json \
+ scheme ls
+```
+
+You can create a profile to connect to the accessed database using the following command:
+
+```bash
+{{ydb-cli}} \
+ config profile create db1 \
+ -e grpcs://example.com:2135 -d /Root/somedatabase --sa-key-file ~/sa_key.json
+```
+
+You can now use much shorter syntax to re-write the original command:
+
+```bash
+{{ydb-cli}} -p db1 scheme ls
+```
+
+#### Profile to connect to a local database {#cmdline-example-local}
+
+Creating/replacing a `local` profile to connect to a local YDB database deployed using rapid-deployment scripts from a [binary file](../../../../getting_started/self_hosted/ydb_local.md) or [in Docker](../../../../getting_started/self_hosted/ydb_docker.md):
+
+```bash
+{{ydb-cli}} config profile replace local --endpoint grpc://localhost:2136 --database /Root/test
+```
+
+Defining the login and password authentication method in the `local` profile:
+
+```bash
+{{ydb-cli}} config profile update local --user user1 --password-file ~/pwd.txt
+```
+
+## Interactive mode {#interactive}
+
+You can use the commands below to create and update profiles in interactive mode:
```bash
{{ ydb-cli }} init
@@ -9,38 +109,41 @@ Currently you can only create and update profiles interactively using the follow
or
```bash
-{{ ydb-cli }} config profile create [profile_name]
+{{ ydb-cli }} config profile create [profile_name] [connection_options]
```
-where `[profile_name]` is an optional name of the profile being created or updated.
+Where:
+- `[profile_name]` is an optional name of the profile to create or update.
+- `[connection_options]` are optional [connection settings](../../connect.md#command-line-pars) to write to the profile.
+The `init` command always runs in interactive mode while `config profile create` launches in interactive mode unless you specify a profile name or none of the connection settings on the command line.
-The first step of the interactive scenario is different in the `init` and `profile create` commands:
+The interactive scenario starts differently for the `init` and the `profile create` commands:
{% list tabs %}
- Init
- Prints a list of existing profiles (if any) and prompts you to make a choice: Create a new or update the configuration of an existing profile:
+ 1. Prints a list of existing profiles (if any) and prompts you to make a choice: Create a new or update the configuration of an existing profile:
- ```text
- Please choose profile to configure:
- [1] Create a new profile
- [2] test
- [3] local
- ```
+ ```text
+ Please choose profile to configure:
+ [1] Create a new profile
+ [2] test
+ [3] local
+ ```
- If no profiles exist or you select option `1` in the previous step, the name of a profile to create is requested:
+ 2. If no profiles exist or you select option `1` in the previous step, the name of a profile to create is requested:
- ```text
- Please enter name for a new profile:
- ```
+ ```text
+ Please enter name for a new profile:
+ ```
- If you enter the name of an existing profile at this point, the {{ ydb-short-name }} CLI proceeds to updating its parameters as if an option with the name of this profile was selected at once.
+ 3. If you enter the name of an existing profile at this point, the {{ ydb-short-name }} CLI proceeds to updating its parameters as if an option with the name of this profile was selected at once.
- Profile Create
- If no profile name is specified in the command line, it is requested:
+ If no profile name is specified on the command line, it is requested:
```text
Please enter configuration profile name to create or re-configure:
```
@@ -53,7 +156,7 @@ Next, you'll be prompted to sequentially perform the following actions with each
- Set a new value or Use <value>
- Use current value (this option is available when updating an existing profile)
-## Example
+### Example {#interactive-example}
Creating a new `mydb1` profile:
@@ -85,11 +188,13 @@ Creating a new `mydb1` profile:
```text
Pick desired action to configure authentication method:
- [1] Use IAM token (iam-token) cloud.yandex.com/docs/iam/concepts/authorization/iam-token
- [2] Use OAuth token of a Yandex Passport user (yc-token) cloud.yandex.com/docs/iam/concepts/authorization/oauth-token
- [3] Use metadata service on a virtual machine (use-metadata-credentials) cloud.yandex.com/docs/compute/operations/vm-connect/auth-inside-vm
- [4] Use security account key file (sa-key-file) cloud.yandex.com/docs/iam/operations/iam-token/create-for-sa
- [5] Don't save authentication data for profile "mydb1"
+ [1] Use static credentials (user & password)
+ [2] Use IAM token (iam-token) cloud.yandex.com/docs/iam/concepts/authorization/iam-token
+ [3] Use OAuth token of a Yandex Passport user (yc-token). Doesn't work with federative accounts. cloud.yandex.com/docs/iam/concepts/authorization/oauth-token
+ [4] Use metadata service on a virtual machine (use-metadata-credentials) cloud.yandex.com/docs/compute/operations/vm-connect/auth-inside-vm
+ [5] Use service account key file (sa-key-file) cloud.yandex.com/docs/iam/operations/iam-token/create-for-sa
+ [6] Set new OAuth token (ydb-token)
+ [7] Don't save authentication data for profile "mydb1"
Please enter your numeric choice:
```
diff --git a/ydb/docs/en/core/reference/ydb-cli/profile/_includes/use.md b/ydb/docs/en/core/reference/ydb-cli/profile/_includes/use.md
index cda6440a88f..4f184b63b72 100644
--- a/ydb/docs/en/core/reference/ydb-cli/profile/_includes/use.md
+++ b/ydb/docs/en/core/reference/ydb-cli/profile/_includes/use.md
@@ -2,37 +2,36 @@
## Connection based on a selected profile {#explicit}
-A profile can be applied when running a {{ ydb-short-name }} CLI command with the `--profile <profile_name>` option specified:
+A profile can be applied when running a {{ ydb-short-name }} CLI command with the `--profile` or the `-p` option:
```bash
-{{ ydb-cli }} --profile <profile_name> <command and command options>
+{{ ydb-cli }} -p <profile_name> <command and command options>
```
For example:
```bash
-{{ ydb-cli }} --profile mydb1 scheme ls -l
+{{ ydb-cli }} -p mydb1 scheme ls -l
```
-In this case, all DB connection parameters are taken from the profile. At the same time, if the authentication parameters are not specified in the profile, the {{ ydb-short-name }} CLI will try to define them based on environment variables, as described in [Connecting to and authenticating with a database - Environment variable](../../connect.md#env).
+In this case, all DB connection parameters are taken from the profile. At the same time, if the authentication parameters are not specified in the profile, the {{ ydb-short-name }} CLI will try to define them based on environment variables, as described in [Connecting to and authenticating with a database — Environment variable](../../connect.md#env).
## Connection based on a selected profile and specified command line parameters {#explicit-and-pars}
-Apart from the `--profile` option, there may be other connection parameters specified in the command line. For example:
+The `--profile` (`-p`) option doesn't need to be the only connection setting specified on the command line. For example:
```bash
-{{ ydb-cli }} --profile mydb1 -d /local2 scheme ls -l
+{{ ydb-cli }} -p mydb1 -d /local2 scheme ls -l
```
```bash
-{{ ydb-cli }} --profile mydb1 --user alex scheme ls -l
+{{ ydb-cli }} -p mydb1 --user alex scheme ls -l
```
-In this case, the connection parameters specified in the command line have priority over those stored in the profile. This format lets you reuse profiles to connect to different databases or under different accounts. In addition, specifying the authentication parameter in the command line (such as `--user alex` in the example above) disables environment variable checks regardless of their presence in the profile.
+In this case, the connection parameters specified on the command line have priority over those stored in the profile. This format lets you reuse profiles to connect to different databases or under different accounts. In addition, specifying the authentication parameter on the command line (such as `--user alex` in the example above) disables environment variable checks regardless of their presence in the profile.
## Connection based on an activated profile {#implicit}
-If the `--profile` option is not specified in the command line, the {{ ydb-short-name }} CLI will try to take from the currently activated profile all the connection parameters that it couldn't define in other ways (from command-line options or environment variables, as described in [Connecting to and authenticating with a database](../../connect.md)).
-
-Implicit use of the activated profile may cause errors, so we recommend that you read the [Activated profile](../activate.md) article before using this mode.
+If the `--profile` (`-p`) option is not specified on the command line, the {{ ydb-short-name }} CLI will attempt to take all the connection parameters that it couldn't otherwise determine (from the command-line options or environment variables, as described in [Connecting to and authenticating with a database](../../connect.md)) from the currently activated profile.
+Implicit use of the activated profile may cause errors, so we recommend that you read the [Activated profile](../activate.md) article before using this mode. \ No newline at end of file
diff --git a/ydb/docs/en/core/reference/ydb-cli/profile/toc_i.yaml b/ydb/docs/en/core/reference/ydb-cli/profile/toc_i.yaml
index a0c3071712d..11ca39b6d40 100644
--- a/ydb/docs/en/core/reference/ydb-cli/profile/toc_i.yaml
+++ b/ydb/docs/en/core/reference/ydb-cli/profile/toc_i.yaml
@@ -1,5 +1,5 @@
items:
-- name: Creating a profile
+- name: Creating and updating profile
href: create.md
- name: Using a profile in requests
href: use.md
@@ -8,4 +8,4 @@ items:
- name: Deleting a profile
href: delete.md
- name: Activated profile
- href: activate.md \ No newline at end of file
+ href: activate.md
diff --git a/ydb/docs/ru/core/reference/ydb-cli/profile/_includes/use.md b/ydb/docs/ru/core/reference/ydb-cli/profile/_includes/use.md
index 4efb3bb90fa..745f1b7a572 100644
--- a/ydb/docs/ru/core/reference/ydb-cli/profile/_includes/use.md
+++ b/ydb/docs/ru/core/reference/ydb-cli/profile/_includes/use.md
@@ -14,7 +14,7 @@
{{ ydb-cli }} -p mydb1 scheme ls -l
```
-В таком случае все параметры соединения с БД будут взяты из профиля. При этом, если в профиле не указано параметров аутентификации, то {{ ydb-short-name }} CLI попробует их определить по переменным окружения, как описано в статье [Соединение с БД и аутентификация - Переменные окружения](../../connect.md#env).
+В таком случае все параметры соединения с БД будут взяты из профиля. При этом, если в профиле не указано параметров аутентификации, то {{ ydb-short-name }} CLI попробует их определить по переменным окружения, как описано в статье [Соединение с БД и аутентификация — Переменные окружения](../../connect.md#env).
## Соединение по выбранному профилю и параметрам командной строки {#explicit-and-pars}
diff --git a/ydb/docs/ru/core/reference/ydb-cli/profile/toc_i.yaml b/ydb/docs/ru/core/reference/ydb-cli/profile/toc_i.yaml
index 27b03360e71..def044a1c60 100644
--- a/ydb/docs/ru/core/reference/ydb-cli/profile/toc_i.yaml
+++ b/ydb/docs/ru/core/reference/ydb-cli/profile/toc_i.yaml
@@ -9,6 +9,3 @@ items:
href: delete.md
- name: Активированный профиль
href: activate.md
-
-
-