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

@@ -7,7 +7,7 @@ import (
"strconv"
)
// Request struct for creating PCI device
// CreateRequest struct to creating PCI device
type CreateRequest struct {
// StackID
// Required: true
@@ -35,9 +35,7 @@ type CreateRequest struct {
func (p PCIDevice) 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 := "/cloudbroker/pcidevice/create"

View File

@@ -7,7 +7,7 @@ import (
"strconv"
)
// Request struct for deleting PCI device
// DeleteRequest struct to deleting PCI device
type DeleteRequest struct {
// PCI device ID
// Required: true
@@ -18,13 +18,11 @@ type DeleteRequest struct {
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
// Delete PCI device
// Delete deletes PCI device
func (p PCIDevice) 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 := "/cloudbroker/pcidevice/delete"

View File

@@ -7,7 +7,7 @@ import (
"strconv"
)
// Request struct for disabling PCI device
// DisableRequest struct for disabling PCI device
type DisableRequest struct {
// PCI device ID
// Required: true
@@ -18,13 +18,11 @@ type DisableRequest struct {
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
// Disable PCI device
// Disable disables PCI device
func (p PCIDevice) Disable(ctx context.Context, req DisableRequest) (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 := "/cloudbroker/pcidevice/disable"

View File

@@ -7,20 +7,18 @@ import (
"strconv"
)
// Request struct for enabling PCI device
// EnableRequest struct for enabling PCI device
type EnableRequest struct {
// PCI device ID
// Required: true
DeviceID uint64 `url:"deviceId" json:"deviceId" validate:"required"`
}
// Enable PCI device
// Enable enables PCI device
func (p PCIDevice) Enable(ctx context.Context, req EnableRequest) (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 := "/cloudbroker/pcidevice/enable"