@@ -18,7 +18,7 @@ import (
18
18
)
19
19
20
20
const (
21
- satelliteKeyPath = "/api/private/satellites/key"
21
+ satelliteKeyPath = "/api/private/satellites/key"
22
22
)
23
23
24
24
type satelliteKeyResponse struct {
@@ -28,10 +28,9 @@ type satelliteKeyResponse struct {
28
28
29
29
func satellitesCmd () * cobra.Command {
30
30
cmd := & cobra.Command {
31
- Use : "satellites" ,
32
- Short : "Interact with Coder satellite deployments" ,
33
- Long : "Perform operations on the Coder satellites for the platform." ,
34
- Hidden : true ,
31
+ Use : "satellites" ,
32
+ Short : "Interact with Coder satellite deployments" ,
33
+ Long : "Perform operations on the Coder satellites for the platform." ,
35
34
}
36
35
37
36
cmd .AddCommand (
@@ -53,19 +52,19 @@ func createSatelliteCmd() *cobra.Command {
53
52
coder satellites create eu-west https://eu-west-coder.com` ,
54
53
RunE : func (cmd * cobra.Command , args []string ) error {
55
54
var (
56
- ctx = cmd .Context ()
57
- name = args [0 ]
55
+ ctx = cmd .Context ()
56
+ name = args [0 ]
58
57
accessURL = args [1 ]
59
58
)
60
59
61
60
client , err := newClient (ctx , true )
62
61
if err != nil {
63
- return xerrors .Errorf ("making coder client" , err )
62
+ return xerrors .Errorf ("making coder client: %w " , err )
64
63
}
65
64
66
65
sURL , err := url .Parse (accessURL )
67
66
if err != nil {
68
- return xerrors .Errorf ("parsing satellite access url" , err )
67
+ return xerrors .Errorf ("parsing satellite access url: %w " , err )
69
68
}
70
69
sURL .Path = satelliteKeyPath
71
70
@@ -90,10 +89,10 @@ coder satellites create eu-west https://eu-west-coder.com`,
90
89
}
91
90
92
91
if keyRes .Key == "" {
93
- return xerrors .Errorf ("key field empty in response" )
92
+ return xerrors .New ("key field empty in response" )
94
93
}
95
94
if keyRes .Fingerprint == "" {
96
- return xerrors .Errorf ("fingerprint field empty in response" )
95
+ return xerrors .New ("fingerprint field empty in response" )
97
96
}
98
97
99
98
fmt .Printf (`The following satellite will be created:
@@ -156,12 +155,12 @@ coder satellites ls`,
156
155
157
156
client , err := newClient (ctx , true )
158
157
if err != nil {
159
- return xerrors .Errorf ("making coder client" , err )
158
+ return xerrors .Errorf ("making coder client: %w " , err )
160
159
}
161
160
162
161
sats , err := client .Satellites (ctx )
163
162
if err != nil {
164
- return xerrors .Errorf ("get satellites request" , err )
163
+ return xerrors .Errorf ("get satellites request: %w " , err )
165
164
}
166
165
167
166
err = tablewriter .WriteTable (cmd .OutOrStdout (), len (sats .Data ), func (i int ) interface {} {
@@ -196,14 +195,14 @@ coder satellites rm my-satellite`,
196
195
197
196
sats , err := client .Satellites (ctx )
198
197
if err != nil {
199
- return xerrors .Errorf ("get satellites request" , err )
198
+ return xerrors .Errorf ("get satellites request: %w " , err )
200
199
}
201
200
202
201
for _ , sat := range sats .Data {
203
202
if sat .Name == name {
204
203
err = client .DeleteSatelliteByID (ctx , sat .ID )
205
204
if err != nil {
206
- return xerrors .Errorf ("delete satellites request" , err )
205
+ return xerrors .Errorf ("delete satellites request: %w " , err )
207
206
}
208
207
clog .LogSuccess (fmt .Sprintf ("satellite %s successfully deleted" , name ))
209
208
@@ -216,5 +215,3 @@ coder satellites rm my-satellite`,
216
215
}
217
216
return cmd
218
217
}
219
-
220
-
0 commit comments