update go.mod and imports

This commit is contained in:
2023-03-17 12:54:34 +03:00
parent f3a1a4c83f
commit 437841c8dd
268 changed files with 4019 additions and 2045 deletions

View File

@@ -2,31 +2,26 @@ package compute
import (
"context"
"errors"
"net/http"
"strings"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for get console URL
type GetConsoleURLRequest struct {
// ID of compute instance to get console for
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId"`
}
func (crq GetConsoleURLRequest) validate() error {
if crq.ComputeID == 0 {
return errors.New("validation-error: field ComputeID can not be empty or equal to 0")
}
return nil
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
}
// GetConsoleURL gets computes console URL
func (c Compute) GetConsoleURL(ctx context.Context, req GetConsoleURLRequest) (string, error) {
err := req.validate()
err := validators.ValidateRequest(req)
if err != nil {
return "", err
for _, validationError := range validators.GetErrors(err) {
return "", validators.ValidationError(validationError)
}
}
url := "/cloudapi/compute/getConsoleUrl"