Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 84c7231

Browse files
committedJul 16, 2021
lint and docs
1 parent 10ab022 commit 84c7231

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed
 

‎coder-sdk/satellite.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
)
77

88
type Satellite struct {
9-
ID string `json:"id"`
10-
Name string `json:"name"`
11-
Fingerprint string `json:"fingerprint"`
9+
ID string `json:"id"`
10+
Name string `json:"name"`
11+
Fingerprint string `json:"fingerprint"`
1212
}
1313

1414
type Satellites struct {

‎docs/coder.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ coder provides a CLI for working with an existing Coder installation
1616
* [coder images](coder_images.md) - Manage Coder images
1717
* [coder login](coder_login.md) - Authenticate this client for future operations
1818
* [coder logout](coder_logout.md) - Remove local authentication credentials if any exist
19+
* [coder satellites](coder_satellites.md) - Interact with Coder satellite deployments
1920
* [coder ssh](coder_ssh.md) - Enter a shell of execute a command over SSH into a Coder workspace
2021
* [coder sync](coder_sync.md) - Establish a one way directory sync to a Coder workspace
2122
* [coder tokens](coder_tokens.md) - manage Coder API tokens for the active user

‎internal/cmd/cmd.go

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func Make() *cobra.Command {
4040
genDocsCmd(app),
4141
agentCmd(),
4242
tunnelCmd(),
43+
satellitesCmd(),
4344
)
4445
app.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "show verbose output")
4546
return app

‎internal/cmd/satellites.go

+14-17
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
)
1919

2020
const (
21-
satelliteKeyPath = "/api/private/satellites/key"
21+
satelliteKeyPath = "/api/private/satellites/key"
2222
)
2323

2424
type satelliteKeyResponse struct {
@@ -28,10 +28,9 @@ type satelliteKeyResponse struct {
2828

2929
func satellitesCmd() *cobra.Command {
3030
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.",
3534
}
3635

3736
cmd.AddCommand(
@@ -53,19 +52,19 @@ func createSatelliteCmd() *cobra.Command {
5352
coder satellites create eu-west https://eu-west-coder.com`,
5453
RunE: func(cmd *cobra.Command, args []string) error {
5554
var (
56-
ctx = cmd.Context()
57-
name = args[0]
55+
ctx = cmd.Context()
56+
name = args[0]
5857
accessURL = args[1]
5958
)
6059

6160
client, err := newClient(ctx, true)
6261
if err != nil {
63-
return xerrors.Errorf("making coder client", err)
62+
return xerrors.Errorf("making coder client: %w", err)
6463
}
6564

6665
sURL, err := url.Parse(accessURL)
6766
if err != nil {
68-
return xerrors.Errorf("parsing satellite access url", err)
67+
return xerrors.Errorf("parsing satellite access url: %w", err)
6968
}
7069
sURL.Path = satelliteKeyPath
7170

@@ -90,10 +89,10 @@ coder satellites create eu-west https://eu-west-coder.com`,
9089
}
9190

9291
if keyRes.Key == "" {
93-
return xerrors.Errorf("key field empty in response")
92+
return xerrors.New("key field empty in response")
9493
}
9594
if keyRes.Fingerprint == "" {
96-
return xerrors.Errorf("fingerprint field empty in response")
95+
return xerrors.New("fingerprint field empty in response")
9796
}
9897

9998
fmt.Printf(`The following satellite will be created:
@@ -156,12 +155,12 @@ coder satellites ls`,
156155

157156
client, err := newClient(ctx, true)
158157
if err != nil {
159-
return xerrors.Errorf("making coder client", err)
158+
return xerrors.Errorf("making coder client: %w", err)
160159
}
161160

162161
sats, err := client.Satellites(ctx)
163162
if err != nil {
164-
return xerrors.Errorf("get satellites request", err)
163+
return xerrors.Errorf("get satellites request: %w", err)
165164
}
166165

167166
err = tablewriter.WriteTable(cmd.OutOrStdout(), len(sats.Data), func(i int) interface{} {
@@ -196,14 +195,14 @@ coder satellites rm my-satellite`,
196195

197196
sats, err := client.Satellites(ctx)
198197
if err != nil {
199-
return xerrors.Errorf("get satellites request", err)
198+
return xerrors.Errorf("get satellites request: %w", err)
200199
}
201200

202201
for _, sat := range sats.Data {
203202
if sat.Name == name {
204203
err = client.DeleteSatelliteByID(ctx, sat.ID)
205204
if err != nil {
206-
return xerrors.Errorf("delete satellites request", err)
205+
return xerrors.Errorf("delete satellites request: %w", err)
207206
}
208207
clog.LogSuccess(fmt.Sprintf("satellite %s successfully deleted", name))
209208

@@ -216,5 +215,3 @@ coder satellites rm my-satellite`,
216215
}
217216
return cmd
218217
}
219-
220-

0 commit comments

Comments
 (0)
Failed to load comments.