more SKU renames.

This commit is contained in:
Alan Donovan 2021-08-27 15:36:45 -04:00
parent da34d12abb
commit d8f1baa519
2 changed files with 6 additions and 6 deletions

View file

@ -292,7 +292,7 @@ type SKU struct {
DisplayName string `json:"display_name"`
}
func (a *API) GetCodespacesSkus(ctx context.Context, user *User, repository *Repository, location string) ([]*SKU, error) {
func (a *API) GetCodespacesSKUs(ctx context.Context, user *User, repository *Repository, location string) ([]*SKU, error) {
req, err := http.NewRequest(http.MethodGet, githubAPI+"/vscs_internal/user/"+user.Login+"/skus", nil)
if err != nil {
return nil, fmt.Errorf("err creating request: %v", err)

View file

@ -151,9 +151,9 @@ func getBranchName() (string, error) {
}
func getMachineName(ctx context.Context, user *api.User, repo *api.Repository, location string, apiClient *api.API) (string, error) {
skus, err := apiClient.GetCodespacesSkus(ctx, user, repo, location)
skus, err := apiClient.GetCodespacesSKUs(ctx, user, repo, location)
if err != nil {
return "", fmt.Errorf("error getting codespace skus: %v", err)
return "", fmt.Errorf("error getting codespace SKUs: %v", err)
}
// if user supplied a machine type, it must be valid
@ -165,12 +165,12 @@ func getMachineName(ctx context.Context, user *api.User, repo *api.Repository, l
}
}
availableSkus := make([]string, len(skus))
availableSKUs := make([]string, len(skus))
for i := 0; i < len(skus); i++ {
availableSkus[i] = skus[i].Name
availableSKUs[i] = skus[i].Name
}
return "", fmt.Errorf("there are is no such machine for the repository: %s\nAvailable machines: %v", machine, availableSkus)
return "", fmt.Errorf("there is no such machine for the repository: %s\nAvailable machines: %v", machine, availableSKUs)
} else if len(skus) == 0 {
return "", nil
}