Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commitdd00acd

Browse files
authored
Add satellite commands (#387)
* Add satellite commands* lint and docs* docs* better yes check* better domain* more docs* add not found error* fix types
1 parent0b4b4fa commitdd00acd

File tree

9 files changed

+417
-0
lines changed

9 files changed

+417
-0
lines changed

‎coder-sdk/interface.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,13 @@ type Client interface {
241241

242242
// SetPolicyTemplate sets the workspace policy template
243243
SetPolicyTemplate(ctx context.Context,templateIDstring,templateScopeTemplateScope,dryRunbool) (*SetPolicyTemplateResponse,error)
244+
245+
// satellites fetches all satellitess known to the Coder control plane.
246+
Satellites(ctx context.Context) ([]Satellite,error)
247+
248+
// CreateSatellite creates a new satellite entity.
249+
CreateSatellite(ctx context.Context,reqCreateSatelliteReq) (*Satellite,error)
250+
251+
// DeleteSatelliteByID deletes a satellite entity from the Coder control plane.
252+
DeleteSatelliteByID(ctx context.Context,idstring)error
244253
}

‎coder-sdk/satellite.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package coder
2+
3+
import (
4+
"context"
5+
"net/http"
6+
)
7+
8+
typeSatellitestruct {
9+
IDstring`json:"id"`
10+
Namestring`json:"name"`
11+
Fingerprintstring`json:"fingerprint"`
12+
}
13+
14+
typesatellitesstruct {
15+
Data []Satellite`json:"data"`
16+
}
17+
18+
typecreateSatelliteResponsestruct {
19+
DataSatellite`json:"data"`
20+
}
21+
22+
// Satellites fetches all satellitess known to the Coder control plane.
23+
func (c*DefaultClient)Satellites(ctx context.Context) ([]Satellite,error) {
24+
varressatellites
25+
err:=c.requestBody(ctx,http.MethodGet,"/api/private/satellites",nil,&res)
26+
iferr!=nil {
27+
returnnil,err
28+
}
29+
returnres.Data,nil
30+
}
31+
32+
// CreateSatelliteReq defines the request parameters for creating a new satellite entity.
33+
typeCreateSatelliteReqstruct {
34+
Namestring`json:"name"`
35+
PublicKeystring`json:"public_key"`
36+
}
37+
38+
// CreateSatellite creates a new satellite entity.
39+
func (c*DefaultClient)CreateSatellite(ctx context.Context,reqCreateSatelliteReq) (*Satellite,error) {
40+
varrescreateSatelliteResponse
41+
err:=c.requestBody(ctx,http.MethodPost,"/api/private/satellites",req,&res)
42+
iferr!=nil {
43+
returnnil,err
44+
}
45+
return&res.Data,nil
46+
}
47+
48+
// DeleteSatelliteByID deletes a satellite entity from the Coder control plane.
49+
func (c*DefaultClient)DeleteSatelliteByID(ctx context.Context,idstring)error {
50+
returnc.requestBody(ctx,http.MethodDelete,"/api/private/satellites/"+id,nil,nil)
51+
}

‎docs/coder.md

Lines changed: 1 addition & 0 deletions
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

‎docs/coder_satellites.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
##coder satellites
2+
3+
Interact with Coder satellite deployments
4+
5+
###Synopsis
6+
7+
Perform operations on the Coder satellites for the platform.
8+
9+
###Options
10+
11+
```
12+
-h, --help help for satellites
13+
```
14+
15+
###Options inherited from parent commands
16+
17+
```
18+
-v, --verbose show verbose output
19+
```
20+
21+
###SEE ALSO
22+
23+
*[coder](coder.md) - coder provides a CLI for working with an existing Coder installation
24+
*[coder satellites create](coder_satellites_create.md) - create a new satellite.
25+
*[coder satellites ls](coder_satellites_ls.md) - list satellites.
26+
*[coder satellites rm](coder_satellites_rm.md) - remove a satellite.
27+

‎docs/coder_satellites_create.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
##coder satellites create
2+
3+
create a new satellite.
4+
5+
###Synopsis
6+
7+
Create a new Coder satellite.
8+
9+
```
10+
coder satellites create [name] [satellite_access_url] [flags]
11+
```
12+
13+
###Examples
14+
15+
```
16+
# create a new satellite
17+
18+
coder satellites create eu-west https://eu-west.coder.com
19+
```
20+
21+
###Options
22+
23+
```
24+
-h, --help help for create
25+
```
26+
27+
###Options inherited from parent commands
28+
29+
```
30+
-v, --verbose show verbose output
31+
```
32+
33+
###SEE ALSO
34+
35+
*[coder satellites](coder_satellites.md) - Interact with Coder satellite deployments
36+

‎docs/coder_satellites_ls.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
##coder satellites ls
2+
3+
list satellites.
4+
5+
###Synopsis
6+
7+
List all Coder workspace satellites.
8+
9+
```
10+
coder satellites ls [flags]
11+
```
12+
13+
###Examples
14+
15+
```
16+
# list satellites
17+
coder satellites ls
18+
```
19+
20+
###Options
21+
22+
```
23+
-h, --help help for ls
24+
```
25+
26+
###Options inherited from parent commands
27+
28+
```
29+
-v, --verbose show verbose output
30+
```
31+
32+
###SEE ALSO
33+
34+
*[coder satellites](coder_satellites.md) - Interact with Coder satellite deployments
35+

‎docs/coder_satellites_rm.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
##coder satellites rm
2+
3+
remove a satellite.
4+
5+
###Synopsis
6+
7+
Remove an existing Coder satellite by name.
8+
9+
```
10+
coder satellites rm [satellite_name] [flags]
11+
```
12+
13+
###Examples
14+
15+
```
16+
# remove an existing satellite by name
17+
coder satellites rm my-satellite
18+
```
19+
20+
###Options
21+
22+
```
23+
-h, --help help for rm
24+
```
25+
26+
###Options inherited from parent commands
27+
28+
```
29+
-v, --verbose show verbose output
30+
```
31+
32+
###SEE ALSO
33+
34+
*[coder satellites](coder_satellites.md) - Interact with Coder satellite deployments
35+

‎internal/cmd/cmd.go

Lines changed: 1 addition & 0 deletions
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
returnapp

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp