Skip to content

Commit 0312d28

Browse files
authored
Onboard keypair commands (#532)
* onboard key-pair commands: - create - delete - describe - list - update
1 parent 36548b5 commit 0312d28

21 files changed

+1987
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Below you can find a list of the STACKIT services already available in the CLI (
6868
| Service | CLI Commands | Status |
6969
| ---------------------------------- |----------------------------------------------------------------------------------------------------------------------| ------------------------- |
7070
| Observability | `observability` | :white_check_mark: |
71-
| Infrastructure as a Service (IaaS) | `beta network-area` <br/> `beta network` <br/> `beta volume` <br/> `beta network-interface` <br/> `beta public-ip` | :white_check_mark: (beta) |
71+
| Infrastructure as a Service (IaaS) | `beta network-area` <br/> `beta network` <br/> `beta volume` <br/> `beta network-interface` <br/> `beta public-ip` <br/> `beta key-pair` | :white_check_mark: (beta) |
7272
| Authorization | `project`, `organization` | :white_check_mark: |
7373
| DNS | `dns` | :white_check_mark: |
7474
| Kubernetes Engine (SKE) | `ske` | :white_check_mark: |

docs/stackit_beta.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ stackit beta [flags]
4040
### SEE ALSO
4141

4242
* [stackit](./stackit.md) - Manage STACKIT resources using the command line
43+
* [stackit beta key-pair](./stackit_beta_key-pair.md) - Provides functionality for SSH key pairs
4344
* [stackit beta network](./stackit_beta_network.md) - Provides functionality for networks
4445
* [stackit beta network-area](./stackit_beta_network-area.md) - Provides functionality for STACKIT Network Area (SNA)
4546
* [stackit beta network-interface](./stackit_beta_network-interface.md) - Provides functionality for network interfaces

docs/stackit_beta_key-pair.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## stackit beta key-pair
2+
3+
Provides functionality for SSH key pairs
4+
5+
### Synopsis
6+
7+
Provides functionality for SSH key pairs
8+
9+
```
10+
stackit beta key-pair [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help Help for "stackit beta key-pair"
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
-y, --assume-yes If set, skips all confirmation prompts
23+
--async If set, runs the command asynchronously
24+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
25+
-p, --project-id string Project ID
26+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
27+
```
28+
29+
### SEE ALSO
30+
31+
* [stackit beta](./stackit_beta.md) - Contains beta STACKIT CLI commands
32+
* [stackit beta key-pair create](./stackit_beta_key-pair_create.md) - Creates a key pair
33+
* [stackit beta key-pair delete](./stackit_beta_key-pair_delete.md) - Deletes a key pair
34+
* [stackit beta key-pair describe](./stackit_beta_key-pair_describe.md) - Describes a key pair
35+
* [stackit beta key-pair list](./stackit_beta_key-pair_list.md) - Lists all key pairs
36+
* [stackit beta key-pair update](./stackit_beta_key-pair_update.md) - Updates a key pair
37+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## stackit beta key-pair create
2+
3+
Creates a key pair
4+
5+
### Synopsis
6+
7+
Creates a key pair.
8+
9+
```
10+
stackit beta key-pair create [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Create a new key pair with public-key "ssh-rsa xxx"
17+
$ stackit beta key-pair create --public-key `ssh-rsa xxx`
18+
19+
Create a new key pair with public-key from file "/Users/username/.ssh/id_rsa.pub"
20+
$ stackit beta key-pair create --public-key `@/Users/username/.ssh/id_rsa.pub`
21+
22+
Create a new key pair with name "KEY_PAIR_NAME" and public-key "ssh-rsa yyy"
23+
$ stackit beta key-pair create --name KEY_PAIR_NAME --public-key `ssh-rsa yyy`
24+
25+
Create a new key pair with public-key "ssh-rsa xxx" and labels "key=value,key1=value1"
26+
$ stackit beta key-pair create --public-key `ssh-rsa xxx` --labels key=value,key1=value1
27+
```
28+
29+
### Options
30+
31+
```
32+
-h, --help Help for "stackit beta key-pair create"
33+
--labels stringToString Labels are key-value string pairs which can be attached to a key pair. E.g. '--labels key1=value1,key2=value2,...' (default [])
34+
--name string Key pair name
35+
--public-key string Public key to be imported (format: ssh-rsa|ssh-ed25519)
36+
```
37+
38+
### Options inherited from parent commands
39+
40+
```
41+
-y, --assume-yes If set, skips all confirmation prompts
42+
--async If set, runs the command asynchronously
43+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
44+
-p, --project-id string Project ID
45+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
46+
```
47+
48+
### SEE ALSO
49+
50+
* [stackit beta key-pair](./stackit_beta_key-pair.md) - Provides functionality for SSH key pairs
51+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## stackit beta key-pair delete
2+
3+
Deletes a key pair
4+
5+
### Synopsis
6+
7+
Deletes a key pair.
8+
9+
```
10+
stackit beta key-pair delete [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Delete key pair with name "KEY_PAIR_NAME"
17+
$ stackit beta key-pair delete KEY_PAIR_NAME
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta key-pair delete"
24+
```
25+
26+
### Options inherited from parent commands
27+
28+
```
29+
-y, --assume-yes If set, skips all confirmation prompts
30+
--async If set, runs the command asynchronously
31+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
32+
-p, --project-id string Project ID
33+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
34+
```
35+
36+
### SEE ALSO
37+
38+
* [stackit beta key-pair](./stackit_beta_key-pair.md) - Provides functionality for SSH key pairs
39+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## stackit beta key-pair describe
2+
3+
Describes a key pair
4+
5+
### Synopsis
6+
7+
Describes a key pair.
8+
9+
```
10+
stackit beta key-pair describe [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Get details about a key pair with name "KEY_PAIR_NAME"
17+
$ stackit beta key-pair describe KEY_PAIR_NAME
18+
19+
Get only the SSH public key of a key pair with name "KEY_PAIR_NAME"
20+
$ stackit beta key-pair describe KEY_PAIR_NAME --public-key
21+
```
22+
23+
### Options
24+
25+
```
26+
-h, --help Help for "stackit beta key-pair describe"
27+
--public-key Show only the public key
28+
```
29+
30+
### Options inherited from parent commands
31+
32+
```
33+
-y, --assume-yes If set, skips all confirmation prompts
34+
--async If set, runs the command asynchronously
35+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
36+
-p, --project-id string Project ID
37+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
38+
```
39+
40+
### SEE ALSO
41+
42+
* [stackit beta key-pair](./stackit_beta_key-pair.md) - Provides functionality for SSH key pairs
43+

docs/stackit_beta_key-pair_list.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## stackit beta key-pair list
2+
3+
Lists all key pairs
4+
5+
### Synopsis
6+
7+
Lists all key pairs.
8+
9+
```
10+
stackit beta key-pair list [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Lists all key pairs
17+
$ stackit beta key-pair list
18+
19+
Lists all key pairs which contains the label xxx
20+
$ stackit beta key-pair list --label-selector xxx
21+
22+
Lists all key pairs in JSON format
23+
$ stackit beta key-pair list --output-format json
24+
25+
Lists up to 10 key pairs
26+
$ stackit beta key-pair list --limit 10
27+
```
28+
29+
### Options
30+
31+
```
32+
-h, --help Help for "stackit beta key-pair list"
33+
--label-selector string Filter by label
34+
--limit int Number of key pairs to list
35+
```
36+
37+
### Options inherited from parent commands
38+
39+
```
40+
-y, --assume-yes If set, skips all confirmation prompts
41+
--async If set, runs the command asynchronously
42+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
43+
-p, --project-id string Project ID
44+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
45+
```
46+
47+
### SEE ALSO
48+
49+
* [stackit beta key-pair](./stackit_beta_key-pair.md) - Provides functionality for SSH key pairs
50+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## stackit beta key-pair update
2+
3+
Updates a key pair
4+
5+
### Synopsis
6+
7+
Updates a key pair.
8+
9+
```
10+
stackit beta key-pair update [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Update the labels of a key pair with name "KEY_PAIR_NAME" with "key=value,key1=value1"
17+
$ stackit beta key-pair update KEY_PAIR_NAME --labels key=value,key1=value1
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta key-pair update"
24+
--labels stringToString Labels are key-value string pairs which can be attached to a server. E.g. '--labels key1=value1,key2=value2,...' (default [])
25+
```
26+
27+
### Options inherited from parent commands
28+
29+
```
30+
-y, --assume-yes If set, skips all confirmation prompts
31+
--async If set, runs the command asynchronously
32+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
33+
-p, --project-id string Project ID
34+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
35+
```
36+
37+
### SEE ALSO
38+
39+
* [stackit beta key-pair](./stackit_beta_key-pair.md) - Provides functionality for SSH key pairs
40+

internal/cmd/beta/beta.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package beta
33
import (
44
"fmt"
55

6+
keypair "github.com/stackitcloud/stackit-cli/internal/cmd/beta/key-pair"
67
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/network"
78
networkArea "github.com/stackitcloud/stackit-cli/internal/cmd/beta/network-area"
89
networkinterface "github.com/stackitcloud/stackit-cli/internal/cmd/beta/network-interface"
@@ -48,4 +49,5 @@ func addSubcommands(cmd *cobra.Command, p *print.Printer) {
4849
cmd.AddCommand(volume.NewCmd(p))
4950
cmd.AddCommand(networkinterface.NewCmd(p))
5051
cmd.AddCommand(publicip.NewCmd(p))
52+
cmd.AddCommand(keypair.NewCmd(p))
5153
}

0 commit comments

Comments
 (0)