(ctx context.Context)
| 61 | } |
| 62 | |
| 63 | func (api *API) fetchRegions(ctx context.Context) (codersdk.RegionsResponse[codersdk.Region], error) { |
| 64 | //nolint:gocritic // this intentionally requests resources that users |
| 65 | // cannot usually access in order to give them a full list of available |
| 66 | // regions. Regions are just a data subset of proxies. |
| 67 | ctx = dbauthz.AsSystemRestricted(ctx) |
| 68 | proxies, err := api.fetchWorkspaceProxies(ctx) |
| 69 | if err != nil { |
| 70 | return codersdk.RegionsResponse[codersdk.Region]{}, err |
| 71 | } |
| 72 | |
| 73 | regions := make([]codersdk.Region, 0, len(proxies.Regions)) |
| 74 | for i := range proxies.Regions { |
| 75 | // Ignore deleted and DERP-only proxies. |
| 76 | if proxies.Regions[i].Deleted || proxies.Regions[i].DerpOnly { |
| 77 | continue |
| 78 | } |
| 79 | // Append the inner region data. |
| 80 | regions = append(regions, proxies.Regions[i].Region) |
| 81 | } |
| 82 | |
| 83 | return codersdk.RegionsResponse[codersdk.Region]{ |
| 84 | Regions: regions, |
| 85 | }, nil |
| 86 | } |
| 87 | |
| 88 | // @Summary Update workspace proxy |
| 89 | // @ID update-workspace-proxy |
no test coverage detected