updates from review
This commit is contained in:
parent
86feaff6a9
commit
edfaac23da
2 changed files with 3 additions and 14 deletions
|
|
@ -701,23 +701,13 @@ func (a *API) DeleteCodespace(ctx context.Context, codespaceName string) error {
|
|||
}
|
||||
|
||||
type EditCodespaceParams struct {
|
||||
DisplayName string
|
||||
IdleTimeoutMinutes int
|
||||
Machine string
|
||||
}
|
||||
|
||||
type editRequest struct {
|
||||
DisplayName string `json:"display_name,omitempty"`
|
||||
IdleTimeoutMinutes int `json:"idle_timeout_minutes,omitempty"`
|
||||
Machine string `json:"machine,omitempty"`
|
||||
}
|
||||
|
||||
func (a *API) EditCodespace(ctx context.Context, codespaceName string, params *EditCodespaceParams) (*Codespace, error) {
|
||||
requestBody, err := json.Marshal(editRequest{
|
||||
DisplayName: params.DisplayName,
|
||||
IdleTimeoutMinutes: params.IdleTimeoutMinutes,
|
||||
Machine: params.Machine,
|
||||
})
|
||||
requestBody, err := json.Marshal(params)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error marshaling request: %w", err)
|
||||
|
|
@ -735,7 +725,7 @@ func (a *API) EditCodespace(ctx context.Context, codespaceName string, params *E
|
|||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, api.HandleHTTPError(resp)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ func (a *App) Edit(ctx context.Context, opts editOptions) error {
|
|||
SKU: opts.machine,
|
||||
}
|
||||
a.StartProgressIndicatorWithLabel("Editing codespace")
|
||||
codespace, err := a.apiClient.EditCodespace(ctx, userInputs.CodespaceName, &api.EditCodespaceParams{
|
||||
_, err := a.apiClient.EditCodespace(ctx, userInputs.CodespaceName, &api.EditCodespaceParams{
|
||||
DisplayName: userInputs.DisplayName,
|
||||
IdleTimeoutMinutes: int(userInputs.IdleTimeout.Minutes()),
|
||||
Machine: userInputs.SKU,
|
||||
|
|
@ -60,6 +60,5 @@ func (a *App) Edit(ctx context.Context, opts editOptions) error {
|
|||
return fmt.Errorf("error editing codespace: %w", err)
|
||||
}
|
||||
|
||||
fmt.Fprintln(a.io.Out, codespace.DisplayName)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue