Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Anuj Chaudhari <[email protected]>
  • Loading branch information
anujc25 committed Oct 7, 2024
1 parent 328a84c commit f718d5d
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/cli/commands/tanzu.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Tanzu CLI

### SEE ALSO

* [tanzu api-token](tanzu_api-token.md) - API Token Generation for Tanzu Platform
* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform
* [tanzu completion](tanzu_completion.md) - Output shell completion code
* [tanzu config](tanzu_config.md) - Configuration for the CLI
* [tanzu context](tanzu_context.md) - Configure and manage contexts for the Tanzu CLI
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/commands/tanzu_api-token.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## tanzu api-token

API Token Generation for Tanzu Platform
Manage API Tokens for Tanzu Platform

### Options

Expand All @@ -11,5 +11,5 @@ API Token Generation for Tanzu Platform
### SEE ALSO

* [tanzu](tanzu.md) - The Tanzu CLI
* [tanzu api-token create](tanzu_api-token_create.md) - Create new API Token
* [tanzu api-token create](tanzu_api-token_create.md) - Create a new API Token for Tanzu Platform

16 changes: 14 additions & 2 deletions docs/cli/commands/tanzu_api-token_create.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
## tanzu api-token create

Create new API Token
Create a new API Token for Tanzu Platform

```
tanzu api-token create [flags]
```

### Examples

```
# Create an API Token for the Tanzu Platform
tanzu api-token create
# Note: The retrieved token can be used as the value of TANZU_API_TOKEN
# when running 'tanzu login'. For example:
TANZU_API_TOKEN=<token> tanzu login
```

### Options

```
Expand All @@ -14,5 +26,5 @@ tanzu api-token create [flags]

### SEE ALSO

* [tanzu api-token](tanzu_api-token.md) - API Token Generation for Tanzu Platform
* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform

22 changes: 20 additions & 2 deletions docs/quickstart/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,27 @@ Notes:

##### API Token

To authenticate with the Tanzu Platform Endpoint for non-interactive login, you must first generate an API token.

###### Generating an API Token

* For public endpoints, generate the API token via the CSP UI at https://console.tanzu.broadcom.com.
* For Self-Managed use cases that rely on UAA, create the API token using the `tanzu api-token create` command.

###### Logging in with an API Token

Example command to log in using an API token:

```console
TANZU_API_TOKEN=<APIToken> tanzu login
TANZU_API_TOKEN=<APIToken> tanzu login [--endpoint <tanzu-platform-endpoint>]
```

Users can persist the environment variable in the CLI configuration file, which will be used for each CLI command
invocation:

```console
tanzu config set env.TANZU_API_TOKEN <api_token>
tanzu login
tanzu login [--endpoint <tanzu-platform-endpoint>]
```

### Creating and connecting to a new context
Expand Down Expand Up @@ -298,6 +307,15 @@ Notes:

##### API Token

To authenticate with the Tanzu Platform Endpoint for non-interactive login, you must first generate an API token.

###### Generating an API Token

* For public endpoints, generate the API token via the CSP UI at https://console.tanzu.broadcom.com.
* For Self-Managed use cases that rely on UAA, create the API token using the `tanzu api-token create` command.

###### Logging in with an API Token

Example command for creating a tanzu context using an API token:

```console
Expand Down
13 changes: 10 additions & 3 deletions pkg/command/apitoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
func newAPITokenCmd() *cobra.Command {
apiTokenCmd := &cobra.Command{
Use: "api-token",
Short: "API Token Generation for Tanzu Platform",
Short: "Manage API Tokens for Tanzu Platform",
Aliases: []string{"apitoken"},
Annotations: map[string]string{
"group": string(plugin.SystemCmdGroup),
Expand All @@ -41,9 +41,16 @@ func newAPITokenCmd() *cobra.Command {
func newAPITokenCreateCmd() *cobra.Command {
createCmd := &cobra.Command{
Use: "create",
Short: "Create new API Token",
Short: "Create a new API Token for Tanzu Platform",
Aliases: []string{},
RunE: createAPIToken,
Example: `
# Create an API Token for the Tanzu Platform
tanzu api-token create
# Note: The retrieved token can be used as the value of TANZU_API_TOKEN
# when running 'tanzu login'. For example:
TANZU_API_TOKEN=<token> tanzu login`,
RunE: createAPIToken,
}

return createCmd
Expand Down

0 comments on commit f718d5d

Please sign in to comment.