Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8ba599d
fix(deps): update module github.com/jedib0t/go-pretty/v6 to v6.5.8 (#…
stackit-pipeline Apr 29, 2024
258565e
Postgresflex backup command improvements (#259)
GokceGK Apr 29, 2024
6a802b8
Update changelog generation implementation (#263)
joaopalet Apr 29, 2024
9a2670d
change recovery date format (#266)
GokceGK Apr 30, 2024
de64cdf
update description and generate docs (#267)
GokceGK Apr 30, 2024
e081d07
Add debug logs to the CLI (#258)
DiogoFerrao Apr 30, 2024
97c9ec9
Re-add redirect after login (#274)
vicentepinto98 May 3, 2024
05a040f
add debug logs to the authentication flow (#272)
DiogoFerrao May 3, 2024
485c714
Add HTTP Request and Response to debug logs (#271)
DiogoFerrao May 3, 2024
08e9910
Add tint package for colors in slog debug logs (#276)
DiogoFerrao May 6, 2024
11d4090
fix(deps): update module github.com/stackitcloud/stackit-sdk-go/servi…
stackit-pipeline May 6, 2024
6dc1783
fix(deps): update module golang.org/x/text to v0.15.0 (#279)
stackit-pipeline May 6, 2024
54abe14
Move config file to correct folder (#282)
DiogoFerrao May 6, 2024
fd2aabe
Document config file location in command (#284)
DiogoFerrao May 6, 2024
2ca765d
flip hide-password to show-password (#285)
DiogoFerrao May 6, 2024
0b621e4
Test fix for login successfull page on Windows (#286)
joaopalet May 6, 2024
c6a776a
hide password in JSON output by default (#287)
DiogoFerrao May 6, 2024
3add51b
add shorthand for show-password flag (#288)
DiogoFerrao May 6, 2024
7f0388e
Default to output directly to terminal if pager output fails (#290)
joaopalet May 6, 2024
758acb2
Make "pretty" the default output format for describe commands (#289)
DiogoFerrao May 6, 2024
64d9a74
fix(deps): update module golang.org/x/oauth2 to v0.20.0 (#278)
stackit-pipeline May 7, 2024
c5e6f42
fix(deps): update module github.com/jedib0t/go-pretty/v6 to v6.5.9 (#…
stackit-pipeline May 7, 2024
502e8bb
edit docs (#293)
GokceGK May 7, 2024
735b36a
Merge branch 'main' into jp/merge-main-updates-lb
May 8, 2024
f71a2c3
Tidy go.mod
May 8, 2024
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
10 changes: 5 additions & 5 deletions AUTHENTICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This document describes how you can configure authentication for the STACKIT CLI
## Service account

You can use a [service account](https://docs.stackit.cloud/stackit/en/service-accounts-134415819.html) to authenticate to the STACKIT CLI.
The CLI will search for service account credentials similarly to the [STACKIT SDK](https://github.com/stackitcloud/stackit-sdk-go) and [Terraform Provider](https://github.com/stackitcloud/terraform-provider-stackit), so if you have setup you environment previously for those tools, you can just run:
The CLI will search for service account credentials similarly to the [STACKIT SDK](https://github.com/stackitcloud/stackit-sdk-go) and [STACKIT Terraform Provider](https://github.com/stackitcloud/terraform-provider-stackit), so if you have already set up your environment for those tools, you can just run:

```bash
$ stackit auth activate-service-account
Expand All @@ -15,7 +15,7 @@ You can also configure the service account credentials directly in the CLI. To g

### Overview

If you dont have a service account, create one in the STACKIT Portal an assign it the necessary permissions, e.g. `owner`. There are two ways to authenticate:
If you don't have a service account, create one in the [STACKIT Portal](https://portal.stackit.cloud/) and assign the necessary permissions to it, e.g. `owner`. There are two ways to authenticate:

- Key flow (recommended)
- Token flow
Expand All @@ -39,20 +39,20 @@ When setting up authentication, the CLI will always try to use the key flow firs

### Key flow

The following instructions assume that you have created a service account and assigned it the necessary permissions, e.g. `owner`.
The following instructions assume that you have created a service account and assigned the necessary permissions to it, e.g. `owner`.

To use the key flow, you need to have a service account key, which must have an RSA key-pair attached to it.

When creating the service account key, a new RSA key-pair can be created automatically, which will be included in the service account key. This will make it much easier to configure the key flow authentication in the CLI, by just providing the service account key.

**Optionally**, you can provide your own private key when creating the service account key, which will then require you to also provide it explicitly to the CLI, additionaly to the service account key. Check the STACKIT Knowledge Base for an [example of how to create your own key-pair](https://docs.stackit.cloud/stackit/en/usage-of-the-service-account-keys-in-stackit-175112464.html#UsageoftheserviceaccountkeysinSTACKIT-CreatinganRSAkey-pair).
**Optionally**, you can provide your own private key when creating the service account key, which will then require you to also provide it explicitly to the CLI, additionally to the service account key. Check the STACKIT Knowledge Base for an [example of how to create your own key-pair](https://docs.stackit.cloud/stackit/en/usage-of-the-service-account-keys-in-stackit-175112464.html#UsageoftheserviceaccountkeysinSTACKIT-CreatinganRSAkey-pair).

To configure the key flow, follow this steps:

1. Create a service account key:

- In the CLI, run `stackit service-account key create --email <SERVICE_ACCOUNT_EMAIL>`
- As an alternative, use the STACKIT Portal: go to the `Service Accounts` tab, choose a `Service Account` and go to `Service Account Keys` to create a key. For more details, see [Create a service account key](https://docs.stackit.cloud/stackit/en/create-a-service-account-key-175112456.html)
- As an alternative, use the [STACKIT Portal](https://portal.stackit.cloud/): go to the `Service Accounts` tab, choose a `Service Account` and go to `Service Account Keys` to create a key. For more details, see [Create a service account key](https://docs.stackit.cloud/stackit/en/create-a-service-account-key-175112456.html)

2. Save the content of the service account key by copying it and saving it in a JSON file.

Expand Down
2 changes: 1 addition & 1 deletion AUTOCOMPLETION.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ stackit completion zsh > "${fpath[1]}/_stackit"
stackit completion zsh > $(brew --prefix)/share/zsh/site-functions/_stackit
```

Additionaly, you might also need to run:
Additionally, you might also need to run:

```shell
source $(brew --prefix)/share/zsh/site-functions/_stackit >> ~/.zshrc
Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ The CLI commands are located under `internal/cmd`, where each folder includes th

### Implementing a new command

Let's suppose you want to want to implement a new command `bar`, that would be the direct child of an existing command `stackit foo` (meaning it would be invoked as `stackit foo bar`):
Let's suppose you want to implement a new command `bar`, that would be the direct child of an existing command `stackit foo` (meaning it would be invoked as `stackit foo bar`):

1. You would start by creating a new folder `bar/` inside `internal/cmd/foo/`
2. Following with the creation of a file `bar.go` inside your new folder `internal/cmd/foo/bar/`
1. The Go package should be similar to the command usage, in this case `package bar` would be an adequate name
2. Please refer to the [Command file structure](./CONTRIBUTION.md/#command-file-structure) section for details on the strcutre of the file itself
2. Please refer to the [Command file structure](./CONTRIBUTION.md/#command-file-structure) section for details on the structure of the file itself
3. To register the command `bar` as a child of the existing command `foo`, add `cmd.AddCommand(bar.NewCmd(p))` to the `addSubcommands` method of the constructor of the `foo` command
1. In this case, `p` is the `printer` that is passed from the root command to all subcommands of the tree (refer to the [Outputs, prints and debug logs](./CONTRIBUTION.md/#outputs-prints-and-debug-logs) section for more details regarding the `printer`)

Please remeber to run `make generate-docs` after your changes to keep the commands' documentation updated.
Please remember to run `make generate-docs` after your changes to keep the commands' documentation updated.

#### Command file structure

Expand Down Expand Up @@ -212,7 +212,7 @@ If you want to add a command that uses a STACKIT service `foo` that was not yet

1. Add a `FooCustomEndpointKey` key in `internal/pkg/config/config.go` (and add it to `ConfigKeys` and set the to default to `""` using `viper.SetDefault`)
2. Update the `stackit config unset` and `stackit config unset` commands by adding flags to set and unset a custom endpoint for the `foo` service API, respectively, and update their unit tests
3. Setup the SDK client configuration, using the authentication method configured in the CLI
3. Set up the SDK client configuration, using the authentication method configured in the CLI

1. This is done in `internal/pkg/services/foo/client/client.go`
2. Below is an example of a typical `client.go` file structure:
Expand Down Expand Up @@ -291,6 +291,6 @@ If you would like to report a bug, please open a [GitHub issue](https://github.c
To ensure we can provide the best support to your issue, follow these guidelines:

1. Go through the existing issues to check if your issue has already been reported.
2. Make sure you are using the latest version of the provider, we will not provide bug fixes for older versions. Also, latest versions may have the fix for your bug.
3. Please provide as much information as you can about your environment, e.g. your version of Go, your version of the provider, which operating system you are using and the corresponding version.
2. Make sure you are using the latest version of the STACKIT CLI, we will not provide bug fixes for older versions. Also, latest versions may have the fix for your bug.
3. Please provide as much information as you can about your environment, e.g. your version of Go, your version of the CLI, which operating system you are using and the corresponding version.
4. Include in your issue the steps to reproduce it, along with code snippets and/or information about your specific use case. This will make the support process much easier and efficient.
34 changes: 25 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Examples:
- `stackit mongodbflex instance create --name my-instance --cpu 1 --ram 4 --acl 0.0.0.0/0 --assume-yes`
- `stackit dns zone delete my-zone`

Some commands are implemented at the root, group or sub-group level:
Some commands are implemented at the root, group or subgroup level:

- `stackit config` to define variables to be used in future commands.
- `stackit ske enable` to enable the SKE engine on your project.
Expand Down Expand Up @@ -71,9 +71,9 @@ Below you can find a list of the STACKIT services already available in the CLI (

## Authentication

Most of the commands will require you to be authenticated. Currently it's possible to authenticate with your personal user or with a service account.
Most of the commands will require you to be authenticated. Currently, it's possible to authenticate with your personal user or with a service account.

After successful authentication, the CLI stores credentials in your OS keychain. You won't need to login again for the duration of your session, which is 2h by default but configurable by providing the `--session-time-limit` flag on the `config set` command (see [Configuration](#configuration)).
After successful authentication, the CLI stores credentials in your OS keychain. You won't need to log in again for the duration of your session, which is 2h by default but configurable by providing the `--session-time-limit` flag on the `config set` command (see [Configuration](#configuration)).

### Login with a personal user account

Expand All @@ -91,7 +91,7 @@ To authenticate using a service account, run:
stackit auth activate-service-account
```

For more details on how to setup authentication using a service account, check our [authentication guide](./AUTHENTICATION.md).
For more details on how to set up authentication using a service account, check our [authentication guide](./AUTHENTICATION.md).

## Configuration

Expand All @@ -101,7 +101,13 @@ You can configure the CLI using the command:
stackit config
```

The configurations are stored in `~/stackit/cli-config.json` and are valid for all commands. For example, you can set a default `project-id` by running:
The configuration is saved in a file. The file's location varies depending on the operating system:

- Unix - `$XDG_CONFIG_HOME/stackit/cli-config.json`
- MacOS - `$HOME/Library/Application Support/stackit/cli-config.json`
- Windows - `%AppData%\stackit\cli-config.json`

The configuration options apply to all commands and can be set using the `stackit config set` command. For example, you can set a default `project-id` by running:

```bash
stackit config set --project-id xxxx-xxxx-xxxxx
Expand All @@ -113,9 +119,9 @@ To remove it, you can run:
stackit config unset --project-id
```

Run the `config set` command with the flag `--help` to get a list of all of the available configuration options.
Run the `config set` command with the flag `--help` to get a list of all the available configuration options.

You can lookup your current configuration by checking the configuration file or by running:
You can look up your current configuration by checking the configuration file or by running:

```bash
stackit config list
Expand All @@ -125,11 +131,11 @@ You can also edit the configuration file manually.

## Autocompletion

If you wish to setup command autocompletion in your shell for the STACKIT CLI, please refer to our [autocompletion guide](./AUTOCOMPLETION.md).
If you wish to set up command autocompletion in your shell for the STACKIT CLI, please refer to our [autocompletion guide](./AUTOCOMPLETION.md).

## Reporting issues

If you encounter any issues or have suggestions for improvements, please reach out to the Developer Tools team or open a ticket through the [STACKIT Help Center](https://support.stackit.cloud/).
If you encounter any issues or have suggestions for improvements, please open an issue in the [repository](https://github.com/stackitcloud/stackit-cli/issues).

## Contribute

Expand All @@ -138,3 +144,13 @@ Your contribution is welcome! For more details on how to contribute, refer to ou
## License

Apache 2.0


## Useful Links
- [STACKIT Portal](https://portal.stackit.cloud/)

- [STACKIT](https://www.stackit.de/en/)

- [STACKIT Knowledge Base](https://docs.stackit.cloud/stackit/en/knowledge-base-85301704.html)

- [STACKIT Terraform Provider](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs)
12 changes: 6 additions & 6 deletions docs/stackit_argus_grafana_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Shows details of the Grafana configuration of an Argus instance

Shows details of the Grafana configuration of an Argus instance.
The Grafana dashboard URL and initial credentials (admin user and password) will be shown in the "pretty" output format. These credentials are only valid for first login. Please change the password after first login. After changing, the initial password is no longer valid.
The initial password is shown by default, if you want to hide it use the "--hide-password" flag.
The initial password is hidden by default, if you want to show it use the "--show-password" flag.

```
stackit argus grafana describe INSTANCE_ID [flags]
Expand All @@ -18,18 +18,18 @@ stackit argus grafana describe INSTANCE_ID [flags]
Get details of the Grafana configuration of an Argus instance with ID "xxx"
$ stackit argus credentials describe xxx

Get details of the Grafana configuration of an Argus instance with ID "xxx" in a table format
$ stackit argus credentials describe xxx --output-format pretty
Get details of the Grafana configuration of an Argus instance with ID "xxx" and show the initial admin password
$ stackit argus credentials describe xxx --show-password

Get details of the Grafana configuration of an Argus instance with ID "xxx" and hide the initial admin password
$ stackit argus credentials describe xxx --output-format pretty --hide-password
Get details of the Grafana configuration of an Argus instance with ID "xxx" in JSON format
$ stackit argus credentials describe xxx --output-format json
```

### Options

```
-h, --help Help for "stackit argus grafana describe"
--hide-password Show the initial admin password in the "pretty" output format
-s, --show-password Show password in output
```

### Options inherited from parent commands
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_argus_instance_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ stackit argus instance describe INSTANCE_ID [flags]
Get details of an Argus instance with ID "xxx"
$ stackit argus instance describe xxx

Get details of an Argus instance with ID "xxx" in a table format
$ stackit argus instance describe xxx --output-format pretty
Get details of an Argus instance with ID "xxx" in JSON format
$ stackit argus instance describe xxx --output-format json
```

### Options
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_argus_scrape-config_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ stackit argus scrape-config describe JOB_NAME [flags]
Get details of a scrape configuration with name "my-config" from Argus instance "xxx"
$ stackit argus scrape-config describe my-config --instance-id xxx

Get details of a scrape configuration with name "my-config" from Argus instance "xxx" in a table format
$ stackit argus scrape-config describe my-config --output-format pretty
Get details of a scrape configuration with name "my-config" from Argus instance "xxx" in JSON format
$ stackit argus scrape-config describe my-config --output-format json
```

### Options
Expand Down
7 changes: 6 additions & 1 deletion docs/stackit_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ Provides functionality for CLI configuration options

### Synopsis

Provides functionality for CLI configuration options.
Provides functionality for CLI configuration options
The configuration is stored in a file in the user's config directory, which is OS dependent.
Windows: %APPDATA%\stackit
Linux: $XDG_CONFIG_HOME/stackit
macOS: $HOME/Library/Application Support/stackit
The configuration file is named `cli-config.json` and is created automatically in your first CLI run.

```
stackit config [flags]
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_dns_record-set_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ stackit dns record-set describe RECORD_SET_ID [flags]
Get details of DNS record set with ID "xxx" in zone with ID "yyy"
$ stackit dns record-set describe xxx --zone-id yyy

Get details of DNS record set with ID "xxx" in zone with ID "yyy" in a table format
$ stackit dns record-set describe xxx --zone-id yyy --output-format pretty
Get details of DNS record set with ID "xxx" in zone with ID "yyy" in JSON format
$ stackit dns record-set describe xxx --zone-id yyy --output-format json
```

### Options
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_dns_zone_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ stackit dns zone describe ZONE_ID [flags]
Get details of a DNS zone with ID "xxx"
$ stackit dns zone describe xxx

Get details of a DNS zone with ID "xxx" in a table format
$ stackit dns zone describe xxx --output-format pretty
Get details of a DNS zone with ID "xxx" in JSON format
$ stackit dns zone describe xxx --output-format json
```

### Options
Expand Down
6 changes: 3 additions & 3 deletions docs/stackit_logme_credentials_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ stackit logme credentials create [flags]
Create credentials for a LogMe instance
$ stackit logme credentials create --instance-id xxx

Create credentials for a LogMe instance and hide the password in the output
$ stackit logme credentials create --instance-id xxx --hide-password
Create credentials for a LogMe instance and show the password in the output
$ stackit logme credentials create --instance-id xxx --show-password
```

### Options

```
-h, --help Help for "stackit logme credentials create"
--hide-password Hide password in output
--instance-id string Instance ID
-s, --show-password Show password in output
```

### Options inherited from parent commands
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_logme_credentials_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ stackit logme credentials describe CREDENTIALS_ID [flags]
Get details of credentials with ID "xxx" from instance with ID "yyy"
$ stackit logme credentials describe xxx --instance-id yyy

Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format
$ stackit logme credentials describe xxx --instance-id yyy --output-format pretty
Get details of credentials with ID "xxx" from instance with ID "yyy" in JSON format
$ stackit logme credentials describe xxx --instance-id yyy --output-format json
```

### Options
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_logme_instance_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ stackit logme instance describe INSTANCE_ID [flags]
Get details of a LogMe instance with ID "xxx"
$ stackit logme instance describe xxx

Get details of a LogMe instance with ID "xxx" in a table format
$ stackit logme instance describe xxx --output-format pretty
Get details of a LogMe instance with ID "xxx" in JSON format
$ stackit logme instance describe xxx --output-format json
```

### Options
Expand Down
6 changes: 3 additions & 3 deletions docs/stackit_mariadb_credentials_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ stackit mariadb credentials create [flags]
Create credentials for a MariaDB instance
$ stackit mariadb credentials create --instance-id xxx

Create credentials for a MariaDB instance and hide the password in the output
$ stackit mariadb credentials create --instance-id xxx --hide-password
Create credentials for a MariaDB instance and show the password in the output
$ stackit mariadb credentials create --instance-id xxx --show-password
```

### Options

```
-h, --help Help for "stackit mariadb credentials create"
--hide-password Hide password in output
--instance-id string Instance ID
-s, --show-password Show password in output
```

### Options inherited from parent commands
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_mariadb_credentials_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ stackit mariadb credentials describe CREDENTIALS_ID [flags]
Get details of credentials with ID "xxx" from instance with ID "yyy"
$ stackit mariadb credentials describe xxx --instance-id yyy

Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format
$ stackit mariadb credentials describe xxx --instance-id yyy --output-format pretty
Get details of credentials with ID "xxx" from instance with ID "yyy" in JSON format
$ stackit mariadb credentials describe xxx --instance-id yyy --output-format json
```

### Options
Expand Down
Loading