Skip to content

Commit cf59a55

Browse files
authored
init: Add an ESS API Key creation link (#506)
Adds a link in the `ecctl init` workflow when the Elasticsearch Service option has been selected to the ESS API Key feature page. Additionally, updates the configuration precedence documentation to use a different set of flags rather than `--user` and `--pass`, since these are only relevant for ECE users. Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
1 parent 7e00608 commit cf59a55

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

docs/ecctl-getting-started.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ variables, or at runtime using the CLI’s global flags.
108108
=== Before you begin
109109
The hierarchy for configuration parameters is as follows, from higher precedence to lower:
110110

111-
. Command line flags `--host`, `--user`, `--pass`
111+
. Command line flags `--api-key`, `--region`, `--verbose`
112112
. Environment variables
113113
. Shared configuration file
114114
`$HOME/.ecctl/config.<json|toml|yaml|hcl>`
@@ -173,6 +173,7 @@ Select a region you would like to have as default:
173173
174174
Please enter your choice: 1
175175
176+
Create a new Elasticsearch Service API key (https://cloud.elastic.co/deployment-features/keys) and/or
176177
Paste your API Key and press enter: xxxxx
177178
178179
What default output format would you like?

pkg/ecctl/init.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ const (
103103
esspHostMsg = "Enter the URL of your ESSP installation: "
104104
essChoiceMsg = "Using \"%s\" as the API endpoint.\n"
105105

106-
apiKeyMsg = "Paste your API Key and press enter: "
107-
userMsg = "Type in your username: "
106+
essAPIKeyCreateMsg = "Create a new Elasticsearch Service API key (https://cloud.elastic.co/deployment-features/keys) and/or"
107+
apiKeyMsg = "Paste your API Key and press enter: "
108+
userMsg = "Type in your username: "
108109
//nolint
109110
passMsg = "Type in your password: "
110111

@@ -386,6 +387,7 @@ func askInfraSelection(cfg *Config, scanner *input.Scanner, writer, errWriter io
386387
if err := askRegionSelection(cfg, scanner, writer, essRegions); err != nil {
387388
return err
388389
}
390+
fmt.Fprintln(writer, essAPIKeyCreateMsg)
389391
if err := askAPIKey(cfg, writer, passFunc); err != nil {
390392
return err
391393
}

pkg/ecctl/init_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ func TestInitConfig(t *testing.T) {
264264
},
265265
wantOutput: disclaimer + missingConfigMsg + hostChoiceMsg + "\n" +
266266
fmt.Sprintf(essChoiceMsg, essHostAddress) + regionChoiceMsg + "\n" +
267+
essAPIKeyCreateMsg + "\n" +
267268
apiKeyMsg + "\n" + formatChoiceMsg + "\n" + "\n" +
268269
fmt.Sprintf(validCredentialsMsg, "anacleto") + finalMsg + "\n",
269270
},

0 commit comments

Comments
 (0)