This repository was archived by the owner on Aug 30, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork18
Add satellite commands#387
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
8 commits Select commitHold shift + click to select a range
10ab022
Add satellite commands
f0ssel84c7231
lint and docs
f0ssel20ab2c4
docs
f0ssel56ed80e
better yes check
f0ssel33c5ef3
better domain
f0ssel573ba59
more docs
f0ssela6fc089
add not found error
f0ssel963b1a5
fix types
f0sselFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletionscoder-sdk/interface.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletionscoder-sdk/satellite.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package coder | ||
import ( | ||
"context" | ||
"net/http" | ||
) | ||
type Satellite struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Fingerprint string `json:"fingerprint"` | ||
} | ||
type satellites struct { | ||
Data []Satellite `json:"data"` | ||
} | ||
type createSatelliteResponse struct { | ||
Data Satellite `json:"data"` | ||
} | ||
// Satellites fetches all satellitess known to the Coder control plane. | ||
func (c *DefaultClient) Satellites(ctx context.Context) ([]Satellite, error) { | ||
var res satellites | ||
err := c.requestBody(ctx, http.MethodGet, "/api/private/satellites", nil, &res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return res.Data, nil | ||
} | ||
// CreateSatelliteReq defines the request parameters for creating a new satellite entity. | ||
type CreateSatelliteReq struct { | ||
Name string `json:"name"` | ||
PublicKey string `json:"public_key"` | ||
} | ||
// CreateSatellite creates a new satellite entity. | ||
func (c *DefaultClient) CreateSatellite(ctx context.Context, req CreateSatelliteReq) (*Satellite, error) { | ||
var res createSatelliteResponse | ||
err := c.requestBody(ctx, http.MethodPost, "/api/private/satellites", req, &res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &res.Data, nil | ||
} | ||
// DeleteSatelliteByID deletes a satellite entity from the Coder control plane. | ||
func (c *DefaultClient) DeleteSatelliteByID(ctx context.Context, id string) error { | ||
return c.requestBody(ctx, http.MethodDelete, "/api/private/satellites/"+id, nil, nil) | ||
} |
1 change: 1 addition & 0 deletionsdocs/coder.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletionsdocs/coder_satellites.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## coder satellites | ||
Interact with Coder satellite deployments | ||
### Synopsis | ||
Perform operations on the Coder satellites for the platform. | ||
### Options | ||
``` | ||
-h, --help help for satellites | ||
``` | ||
### Options inherited from parent commands | ||
``` | ||
-v, --verbose show verbose output | ||
``` | ||
### SEE ALSO | ||
* [coder](coder.md) - coder provides a CLI for working with an existing Coder installation | ||
* [coder satellites create](coder_satellites_create.md) - create a new satellite. | ||
* [coder satellites ls](coder_satellites_ls.md) - list satellites. | ||
* [coder satellites rm](coder_satellites_rm.md) - remove a satellite. | ||
36 changes: 36 additions & 0 deletionsdocs/coder_satellites_create.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## coder satellites create | ||
create a new satellite. | ||
### Synopsis | ||
Create a new Coder satellite. | ||
``` | ||
coder satellites create [name] [satellite_access_url] [flags] | ||
``` | ||
### Examples | ||
``` | ||
# create a new satellite | ||
coder satellites create eu-west https://eu-west.coder.com | ||
``` | ||
### Options | ||
``` | ||
-h, --help help for create | ||
``` | ||
### Options inherited from parent commands | ||
``` | ||
-v, --verbose show verbose output | ||
``` | ||
### SEE ALSO | ||
* [coder satellites](coder_satellites.md) - Interact with Coder satellite deployments | ||
35 changes: 35 additions & 0 deletionsdocs/coder_satellites_ls.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## coder satellites ls | ||
list satellites. | ||
### Synopsis | ||
List all Coder workspace satellites. | ||
``` | ||
coder satellites ls [flags] | ||
``` | ||
### Examples | ||
``` | ||
# list satellites | ||
coder satellites ls | ||
``` | ||
### Options | ||
``` | ||
-h, --help help for ls | ||
``` | ||
### Options inherited from parent commands | ||
``` | ||
-v, --verbose show verbose output | ||
``` | ||
### SEE ALSO | ||
* [coder satellites](coder_satellites.md) - Interact with Coder satellite deployments | ||
35 changes: 35 additions & 0 deletionsdocs/coder_satellites_rm.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## coder satellites rm | ||
remove a satellite. | ||
### Synopsis | ||
Remove an existing Coder satellite by name. | ||
``` | ||
coder satellites rm [satellite_name] [flags] | ||
``` | ||
### Examples | ||
``` | ||
# remove an existing satellite by name | ||
coder satellites rm my-satellite | ||
``` | ||
### Options | ||
``` | ||
-h, --help help for rm | ||
``` | ||
### Options inherited from parent commands | ||
``` | ||
-v, --verbose show verbose output | ||
``` | ||
### SEE ALSO | ||
* [coder satellites](coder_satellites.md) - Interact with Coder satellite deployments | ||
1 change: 1 addition & 0 deletionsinternal/cmd/cmd.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.