Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions internal/cmd/login/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/confluentinc/cli/internal/pkg/log"
"github.com/confluentinc/cli/internal/pkg/netrc"
"github.com/confluentinc/cli/internal/pkg/utils"
"github.com/confluentinc/cli/internal/pkg/examples"
)

type command struct {
Expand All @@ -42,6 +43,24 @@ func New(cfg *v1.Config, prerunner pcmd.PreRunner, ccloudClientFactory pauth.CCl
Long: fmt.Sprintf("Confluent Cloud:\n\nLog in to Confluent Cloud using your email and password, or using single sign-on (SSO) credentials.\n\nEmail and password login can be accomplished non-interactively using the `%s` and `%s` environment variables.\n\nEmail and password can also be stored locally for non-interactive re-authentication with the `--save` flag.\n\nSSO login can be accomplished headlessly using the `--no-browser` flag, but non-interactive login is not natively supported. Authentication tokens last 8 hours and are automatically refreshed with CLI client usage. If the client is not used for more than 8 hours, you have to log in again.\n\nLog in to a specific Confluent Cloud organization using the `--organization-id` flag, or by setting the environment variable `%s`.\n\n", pauth.ConfluentCloudEmail, pauth.ConfluentCloudPassword, pauth.ConfluentCloudOrganizationId) +
fmt.Sprintf("Confluent Platform:\n\nLog in to Confluent Platform with your username and password, the `--url` flag to identify the location of your Metadata Service (MDS), and the `--ca-cert-path` flag to identify your self-signed certificate chain.\n\nLogin can be accomplished non-interactively using the `%s`, `%s`, `%s`, and `%s` environment variables.\n\nIn a non-interactive login, `%s` replaces the `--url` flag, and `%s` replaces the `--ca-cert-path` flag.\n\nEven with the environment variables set, you can force an interactive login using the `--prompt` flag.", pauth.ConfluentPlatformUsername, pauth.ConfluentPlatformPassword, pauth.ConfluentPlatformMDSURL, pauth.ConfluentPlatformCACertPath, pauth.ConfluentPlatformMDSURL, pauth.ConfluentPlatformCACertPath),
Args: cobra.NoArgs,
Example: examples.BuildExampleString(
examples.Example{
Text: "Log in to Confluent Cloud.",
Code: "confluent login",
},
examples.Example{
Text: "Log in to a specific organization in Confluent Cloud.",
Code: "confluent login --organization-id 00000000-0000-0000-0000-000000000000",
},
examples.Example{
Text: "Log in to Confluent Platform with a MDS URL.",
Code: "confluent login --url http://localhost:8090",
},
examples.Example{
Text: "Log in to Confluent Platform with a MDS URL and CA certificate.",
Code: "confluent login --url http://localhost:8090 --ca-cert-path certs/my-cert.crt",
},
),
}

cmd.Flags().String("url", "", "Metadata Service (MDS) URL, for on-prem deployments.")
Expand Down
17 changes: 17 additions & 0 deletions test/fixtures/output/login/help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ Even with the environment variables set, you can force an interactive login usin
Usage:
confluent login [flags]

Examples:
Log in to Confluent Cloud.

$ confluent login

Log in to a specific organization in Confluent Cloud.

$ confluent login --organization-id 00000000-0000-0000-0000-000000000000

Log in to Confluent Platform with a MDS URL.

$ confluent login --url http://localhost:8090

Log in to Confluent Platform with a MDS URL and CA certificate.

$ confluent login --url http://localhost:8090 --ca-cert-path certs/my-cert.crt

Flags:
--url string Metadata Service (MDS) URL, for on-prem deployments.
--ca-cert-path string Self-signed certificate chain in PEM format, for on-prem deployments.
Expand Down