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 disk
// CreateRequest struct to create disk
type CreateRequest struct {
// ID of the account
// Required: true
@@ -58,9 +58,7 @@ type CreateRequest struct {
func (d Disks) 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/disks/create"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request for delete disk
// DeleteRequest struct to delete disk
type DeleteRequest struct {
// ID of disk to delete
// Required: true
@@ -31,9 +31,7 @@ type DeleteRequest struct {
func (d Disks) 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/disks/delete"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for multiple disks
// DeleteDisksRequest struct for multiple disks
type DeleteDisksRequest struct {
// List of disk ids to delete
// Required: true
@@ -27,9 +27,7 @@ type DeleteDisksRequest struct {
func (d Disks) DeleteDisks(ctx context.Context, req DeleteDisksRequest) (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/disks/deleteDisks"

View File

@@ -38,9 +38,7 @@ func (d Disks) Get(ctx context.Context, req GetRequest) (*RecordDisk, error) {
func (d Disks) 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 := "/cloudbroker/disks/get"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for limit IO
// LimitIORequest struct for limit IO
type LimitIORequest struct {
// ID of the disk to limit
// Required: true
@@ -71,15 +71,13 @@ type LimitIORequest struct {
SizeIOPSSec uint64 `url:"size_iops_sec,omitempty" json:"size_iops_sec,omitempty"`
}
// LimitIO limit IO for a certain disk
// LimitIO limits IO for a certain disk
// total and read/write options are not allowed to be combined
// see http://libvirt.org/formatdomain.html#elementsDisks iotune section for more details
func (d Disks) LimitIO(ctx context.Context, req LimitIORequest) (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/disks/limitIO"

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// Request struct for get list deleted disks
// ListDeletedRequest struct to get list of deleted disks
type ListDeletedRequest struct {
// Find by id
// Required: false
@@ -45,7 +45,7 @@ type ListDeletedRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListDeleted gets list the deleted disks based on filter
// ListDeleted gets list of the deleted disks based on filter
func (d Disks) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListDisks, error) {
url := "/cloudbroker/disks/listDeleted"

View File

@@ -4,11 +4,9 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for get list types of disks
// ListTypesRequest struct to get list of types of disks
type ListTypesRequest struct {
// Show detailed disk types by seps
// Required: false
@@ -23,15 +21,8 @@ type ListTypesRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListTypes gets list defined disk types
// ListTypes gets list of defined disk types
func (d Disks) ListTypes(ctx context.Context, req ListTypesRequest) (*ListTypes, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return nil, validators.ValidationError(validationError)
}
}
url := "/cloudbroker/disks/listTypes"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// Request struct for get list unattached disk
// ListUnattachedRequest struct to get list of unattached disk
type ListUnattachedRequest struct {
// Find by id
// Required: false

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for rename disk
// RenameRequest struct to rename disk
type RenameRequest struct {
// ID of the disk to rename
// Required: true
@@ -19,13 +19,11 @@ type RenameRequest struct {
Name string `url:"name" json:"name" validate:"required"`
}
// Rename rename disk
// Rename renames disk
func (d Disks) 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 := "/cloudbroker/disks/rename"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for resize disk
// ResizeRequest struct to resize disk
type ResizeRequest struct {
// ID of the disk to resize
// Required: true
@@ -19,16 +19,14 @@ type ResizeRequest struct {
Size uint64 `url:"size" json:"size" validate:"required"`
}
// Resize resize disk
// Resize resizes disk
// Returns 200 if disk is resized online, else will return 202,
// in that case please stop and start your machine after changing the disk size, for your changes to be reflected.
// This method will not be used for disks, assigned to computes. Only unassigned disks and disks, assigned with "old" virtual machines.
func (d Disks) Resize(ctx context.Context, req ResizeRequest) (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/disks/resize"
@@ -53,9 +51,7 @@ func (d Disks) Resize(ctx context.Context, req ResizeRequest) (bool, error) {
func (d Disks) Resize2(ctx context.Context, req ResizeRequest) (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/disks/resize2"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for restore a deleted unattached disk
// RestoreRequest struct to restore a deleted unattached disk
type RestoreRequest struct {
// ID of the disk to restore
// Required: true
@@ -19,13 +19,11 @@ type RestoreRequest struct {
Reason string `url:"reason" json:"reason" validate:"required"`
}
// Restore restore a deleted unattached disk from recycle bin
// Restore restores a deleted unattached disk from recycle bin
func (d Disks) Restore(ctx context.Context, req RestoreRequest) (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/disks/restore"

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// Request struct for search
// SearchRequest struct for search
type SearchRequest struct {
// ID of the account to search for the Disk
// Required: false
@@ -28,7 +28,7 @@ type SearchRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// Search search disks
// Search searches disks
func (d Disks) Search(ctx context.Context, req SearchRequest) (SearchListDisks, error) {
url := "/cloudbroker/disks/search"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for share data disk
// ShareRequest struct to share data disk
type ShareRequest struct {
// ID of the disk to share
// Required: true
@@ -19,9 +19,7 @@ type ShareRequest struct {
func (d Disks) Share(ctx context.Context, req ShareRequest) (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/disks/share"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for delete snapshot
// SnapshotDeleteRequest struct to delete snapshot
type SnapshotDeleteRequest struct {
// ID of disk to delete
// Required: true
@@ -23,9 +23,7 @@ type SnapshotDeleteRequest struct {
func (d Disks) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (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/disks/snapshotDelete"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for rollback snapshot
// SnapshotRollbackRequest struct to rollback snapshot
type SnapshotRollbackRequest struct {
// ID of the disk
// Required: true
@@ -23,13 +23,11 @@ type SnapshotRollbackRequest struct {
TimeStamp uint64 `url:"timestamp,omitempty" json:"timestamp,omitempty"`
}
// SnapshotRollback rollback an individual disk snapshot
// SnapshotRollback rollbacks an individual disk snapshot
func (d Disks) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (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/disks/snapshotRollback"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for unshare data disk
// UnshareRequest struct to unshare data disk
type UnshareRequest struct {
// ID of the disk to unshare
// Required: true
@@ -19,9 +19,7 @@ type UnshareRequest struct {
func (d Disks) Unshare(ctx context.Context, req UnshareRequest) (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/disks/unshare"