v12.0.0
This commit is contained in:
57
pkg/cloudbroker/compute/stop_migration_in.go
Normal file
57
pkg/cloudbroker/compute/stop_migration_in.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
||||
)
|
||||
|
||||
// OSUsers struct contains OS user data for Guest OS.
|
||||
// Must be provided if NewVMUUID is provided.
|
||||
type OSUser struct {
|
||||
// Login of a user
|
||||
Login string `url:"login,omitempty" json:"login,omitempty"`
|
||||
|
||||
// Password of a user
|
||||
Password string `url:"password,omitempty" json:"password,omitempty"`
|
||||
|
||||
// GUID
|
||||
GUID string `url:"guid,omitempty" json:"guid,omitempty"`
|
||||
|
||||
// Pubkey
|
||||
Pubkey string `url:"pubkey,omitempty" json:"pubkey,omitempty"`
|
||||
}
|
||||
|
||||
// StopMigrationINRequest struct to stop compute for external migration in
|
||||
type StopMigrationINRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// If provided, indicates the UUID of the VM on the target host and that migration completed.
|
||||
// Required: false
|
||||
NewVMUUID string `url:"new_vm_uuid,omitempty" json:"new_vm_uuid,omitempty"`
|
||||
|
||||
// OS user data for Guest OS
|
||||
// Required: false
|
||||
OSUsers []OSUser `url:"os_users,omitempty" json:"os_users,omitempty"`
|
||||
}
|
||||
|
||||
// StopMigrationIN stops compute for external migration in
|
||||
func (c Compute) StopMigrationIN(ctx context.Context, req StopMigrationINRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/stop_migration_in"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
Reference in New Issue
Block a user