This commit is contained in:
2023-10-25 17:37:18 +03:00
parent b666789c7d
commit 4120cd2b1a
639 changed files with 2010 additions and 3224 deletions

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for create image
// CreateRequest struct to create image
type CreateRequest struct {
// Name of the rescue disk
// Required: true
@@ -83,9 +83,7 @@ type CreateRequest struct {
func (i Image) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return 0, validators.ValidationError(validationError)
}
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/image/create"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for create virtual image
// CreateVirtualRequest struct to create virtual image
type CreateVirtualRequest struct {
// Name of the virtual image to create
// Required: true
@@ -23,9 +23,7 @@ type CreateVirtualRequest struct {
func (i Image) CreateVirtual(ctx context.Context, req CreateVirtualRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return 0, validators.ValidationError(validationError)
}
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/image/createVirtual"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for delete image
// DeleteRequest struct to delete image
type DeleteRequest struct {
// ID of the image to delete
// Required: true
@@ -23,9 +23,7 @@ type DeleteRequest struct {
func (i Image) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/image/delete"

View File

@@ -42,9 +42,7 @@ func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error) {
func (i Image) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return nil, validators.ValidationError(validationError)
}
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/image/get"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for link virtual image to another image
// LinkRequest struct to link virtual image to another image
type LinkRequest struct {
// ID of the virtual image
// Required: true
@@ -23,9 +23,7 @@ type LinkRequest struct {
func (i Image) Link(ctx context.Context, req LinkRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/image/link"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for rename image
// RenameRequest struct to rename image
type RenameRequest struct {
// ID of the virtual image to rename
// Required: true
@@ -23,9 +23,7 @@ type RenameRequest struct {
func (i Image) Rename(ctx context.Context, req RenameRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/image/rename"