(config *tui.ModifyConfig, currentInstance *api.Instance)
| 319 | } |
| 320 | |
| 321 | func buildModifyRequestFromConfig(config *tui.ModifyConfig, currentInstance *api.Instance) (api.InstanceModifyRequest, error) { |
| 322 | req := api.InstanceModifyRequest{} |
| 323 | |
| 324 | if config.GPUChanged { |
| 325 | req.GPUType = &config.GPUType |
| 326 | } |
| 327 | |
| 328 | if config.ComputeChanged { |
| 329 | currentNumGPUs, _ := strconv.Atoi(currentInstance.NumGPUs) |
| 330 | currentVCPUs, _ := strconv.Atoi(currentInstance.CPUCores) |
| 331 | |
| 332 | if config.NumGPUs > 0 && config.NumGPUs != currentNumGPUs { |
| 333 | req.NumGPUs = &config.NumGPUs |
| 334 | } |
| 335 | if config.VCPUs > 0 && config.VCPUs != currentVCPUs { |
| 336 | req.CPUCores = &config.VCPUs |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | if config.DiskChanged { |
| 341 | req.DiskSizeGB = &config.DiskSizeGB |
| 342 | } |
| 343 | |
| 344 | // Check if any changes were made |
| 345 | if req.GPUType == nil && req.CPUCores == nil && req.NumGPUs == nil && req.DiskSizeGB == nil { |
| 346 | return req, fmt.Errorf("no changes specified") |
| 347 | } |
| 348 | |
| 349 | return req, nil |
| 350 | } |
| 351 | |
| 352 | func buildModifyRequestFromFlags(cmd *cobra.Command, currentInstance *api.Instance, specs *utils.SpecStore) (api.InstanceModifyRequest, error) { |
| 353 | presets := buildModifyPresets(cmd) |
no outgoing calls