mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-30 12:01:15 +02:00
Simplify state reconciliation and support changing Softnet settings (#364)
* Simplify state reconciliation and support changing Softnet settings * Remove unused "updateFunc" parameter from syncOnDiskVMs() * Don't take an address of a loop variable * ensure → ensures * updateVMState(): don't forget to update VMState * Introduce TestSpecUpdateSoftnet integration test * Update OpenAPI specification to include generation/observedGeneration
This commit is contained in:
+13
-1
@@ -3,11 +3,12 @@ package client
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/cirruslabs/orchard/pkg/resource/v1"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/cirruslabs/orchard/pkg/resource/v1"
|
||||
)
|
||||
|
||||
type VMsService struct {
|
||||
@@ -78,6 +79,17 @@ func (service *VMsService) Update(ctx context.Context, vm v1.VM) (*v1.VM, error)
|
||||
return &updatedVM, nil
|
||||
}
|
||||
|
||||
func (service *VMsService) UpdateState(ctx context.Context, vm v1.VM) (*v1.VM, error) {
|
||||
var updatedVM v1.VM
|
||||
err := service.client.request(ctx, http.MethodPut, fmt.Sprintf("vms/%s/state", url.PathEscape(vm.Name)),
|
||||
vm, &updatedVM, nil)
|
||||
if err != nil {
|
||||
return &updatedVM, err
|
||||
}
|
||||
|
||||
return &updatedVM, nil
|
||||
}
|
||||
|
||||
func (service *VMsService) Delete(ctx context.Context, name string) error {
|
||||
err := service.client.request(ctx, http.MethodDelete, fmt.Sprintf("vms/%s", url.PathEscape(name)),
|
||||
nil, nil, nil)
|
||||
|
||||
Reference in New Issue
Block a user